/*!
 * html2canvas 1.0.0-rc.5 <https://html2canvas.hertzen.com>
 * Copyright (c) 2020 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */var A,e;(function(){var A;(A=class extends this.OS.application.BaseApplication{constructor(A){super("Clipper",A)}main(){var A;if(this.scene=this.find("scene"),this.wrapper=this.find("wrapper"),this.cropwin=this.find("cropwin"),this.dirty=!1,this.currfile="Untitled".asFileHandle(),$(this.cropwin).css("position","absolute").hide(),this.find("btnCptScreen").onbtclick=()=>this.capture(document.body,!0),this.find("btnCptWindow").onbtclick=()=>{var A,e,t,r,n,B,s;for(e in s=[],n=OS.PM.processes)for(A=0,t=(B=n[e]).length;A<t;A++)r=B[A],0===OS.application[r.name].type&&s.push({text:r.scheme.apptitle,el:r.scheme,icon:r.meta().icon,iconclass:r.meta().iconclass});return this.openDialog("SelectionDialog",{title:"Select a window",data:s}).then(A=>{if(A)return this.capture(A.el)})},A=this.find("btnCrop"),this.cropselect=A=>{var e,t,r;return t=$(this.cropwin).offset(),r=A.clientX-t.left,e=A.clientY-t.top,$(this.cropwin).css("width",r+"px").css("height",e+"px")},this.cropup=e=>($(window).off("mousemove",this.cropselect),$(window).off("mouseup",this.cropup),this.ask({text:__("Crop the selected zone ?")}).then(e=>{var t,r,n,B,s,o,i,a;if(A.enable=!0,A.selected=!1,t=$(this.cropwin).offset(),s=$(this.scene).offset(),i=t.left-s.left,a=t.top-s.top,o=$(this.cropwin).width(),B=$(this.cropwin).height(),$(this.cropwin).hide(),$(this.cropwin).css("width","0px").css("height","0px"),e)return n=(r=this.scene.getContext("2d")).getImageData(i,a,o,B),this.scene.width=o,this.scene.height=B,r.putImageData(n,0,0),this.dirty=!0})),this.cropdown=e=>{var t;return A.enable=!1,t=$(this.scheme).offset(),$(this.cropwin).css("left",e.clientX-t.left+"px").css("top",e.clientY-t.top+"px").show(),$(window).off("mousedown",this.cropdown),$(window).mousemove(this.cropselect),$(window).mouseup(this.cropup)},A.onbtclick=()=>A.selected?$(window).mousedown(this.cropdown):$(window).off("mousedown",this.cropdown),this.bindKey("CTRL-S",()=>this.actionFile(this.name+"-Save")),this.bindKey("ALT-W",()=>this.actionFile(this.name+"-Saveas")),this.notify(__("User ALT-S global shortcut to capture the entire VDE")),this._gui.bindKey("ALT-S",()=>{if(html2canvas)return html2canvas(document.body).then(A=>this._gui.launch("Clipper",[A]))}),this.args&&1===this.args.length)return this.copycanvas(this.args[0])}copycanvas(A){return this.scene.height=A.height,this.scene.width=A.width,this.scene.getContext("2d").drawImage(A,0,0),this.dirty=!0}capture(A,e){return e&&this.hide(),this.load(new Promise((t,r)=>html2canvas(A).then(A=>(this.copycanvas(A),e&&this.show(),t())).catch((function(A){return r(__e(A))})))).then(()=>this.notify(__("Screen captured"))).catch(A=>this.error(A.toString(),A))}menu(){return[{text:"__(File)",nodes:[{text:"__(Save)",dataid:this.name+"-Save",shortcut:"C-S"},{text:"__(Save as)",dataid:this.name+"-Saveas",shortcut:"A-W"}],onchildselect:A=>this.actionFile(A.data.item.data.dataid)}]}save(){return this.currfile.cache=this.scene.toDataURL("image/png"),this.currfile.write("base64").then(A=>(this.notify(__("File saved")),this.dirty=!1)).catch(A=>this.error(__("Cannot save to file: {0}",A.toString()),A))}actionFile(A){var e;switch(e=()=>this.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(A=>{var e;return e=A.file.path.asFileHandle(),"file"===A.file.type&&(e=e.parent()),this.currfile.setPath(`${e.path}/${A.name}`),this.save(this.currfile)}),A){case this.name+"-Save":return this.currfile.basename?this.save():e();case this.name+"-Saveas":return e()}}cleanup(A){if(this.dirty)return A.preventDefault(),this.ask({title:__("Quit"),text:__("Quit without saving ?")}).then(A=>{if(A)return this.dirty=!1,this.quit()})}}).singleton=!0,this.OS.register("Clipper",A)}).call(this),A=this,e=function(){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */var A=function(e,t){return(A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)e.hasOwnProperty(t)&&(A[t]=e[t])})(e,t)};function e(e,t){function r(){this.constructor=e}A(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var t=function(){return(t=Object.assign||function(A){for(var e,t=1,r=arguments.length;t<r;t++)for(var n in e=arguments[t])Object.prototype.hasOwnProperty.call(e,n)&&(A[n]=e[n]);return A}).apply(this,arguments)};function r(A,e,t,r){return new(t||(t=Promise))((function(n,B){function s(A){try{i(r.next(A))}catch(A){B(A)}}function o(A){try{i(r.throw(A))}catch(A){B(A)}}function i(A){A.done?n(A.value):new t((function(e){e(A.value)})).then(s,o)}i((r=r.apply(A,e||[])).next())}))}function n(A,e){var t,r,n,B,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return B={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(B[Symbol.iterator]=function(){return this}),B;function o(B){return function(o){return function(B){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(n=2&B[0]?r.return:B[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,B[1])).done)return n;switch(r=0,n&&(B=[2&B[0],n.value]),B[0]){case 0:case 1:n=B;break;case 4:return s.label++,{value:B[1],done:!1};case 5:s.label++,r=B[1],B=[0];continue;case 7:B=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==B[0]&&2!==B[0])){s=0;continue}if(3===B[0]&&(!n||B[1]>n[0]&&B[1]<n[3])){s.label=B[1];break}if(6===B[0]&&s.label<n[1]){s.label=n[1],n=B;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(B);break}n[2]&&s.ops.pop(),s.trys.pop();continue}B=e.call(A,s)}catch(A){B=[6,A],r=0}finally{t=n=0}if(5&B[0])throw B[1];return{value:B[0]?B[1]:void 0,done:!0}}([B,o])}}}for(var B=function(){function A(A,e,t,r){this.left=A,this.top=e,this.width=t,this.height=r}return A.prototype.add=function(e,t,r,n){return new A(this.left+e,this.top+t,this.width+r,this.height+n)},A.fromClientRect=function(e){return new A(e.left,e.top,e.width,e.height)},A}(),s=function(A){return B.fromClientRect(A.getBoundingClientRect())},o=function(A){for(var e=[],t=0,r=A.length;t<r;){var n=A.charCodeAt(t++);if(n>=55296&&n<=56319&&t<r){var B=A.charCodeAt(t++);56320==(64512&B)?e.push(((1023&n)<<10)+(1023&B)+65536):(e.push(n),t--)}else e.push(n)}return e},i=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var r=[],n=-1,B="";++n<t;){var s=A[n];s<=65535?r.push(s):(s-=65536,r.push(55296+(s>>10),s%1024+56320)),(n+1===t||r.length>16384)&&(B+=String.fromCharCode.apply(String,r),r.length=0)}return B},a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Q=0;Q<a.length;Q++)c[a.charCodeAt(Q)]=Q;var u,w,U,l,C,g,E,h,F=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},d=function(){function A(A,e,t,r,n,B){this.initialValue=A,this.errorValue=e,this.highStart=t,this.highValueIndex=r,this.index=n,this.data=B}return A.prototype.get=function(A){var e;if(A>=0){if(A<55296||A>56319&&A<=65535)return e=((e=this.index[A>>5])<<2)+(31&A),this.data[e];if(A<=65535)return e=((e=this.index[2048+(A-55296>>5)])<<2)+(31&A),this.data[e];if(A<this.highStart)return e=2080+(A>>11),e=this.index[e],e+=A>>5&63,e=((e=this.index[e])<<2)+(31&A),this.data[e];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),H=10,f=13,p=15,N=17,K=18,I=19,m=20,T=21,R=22,L=24,v=25,O=26,D=27,b=28,S=30,y=32,M=33,_=34,P=35,x=37,V=38,z=39,X=40,J=42,G=(l=function(A){var e,t,r,n,B,s=.75*A.length,o=A.length,i=0;"="===A[A.length-1]&&(s--,"="===A[A.length-2]&&s--);var a="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(s):new Array(s),Q=Array.isArray(a)?a:new Uint8Array(a);for(e=0;e<o;e+=4)t=c[A.charCodeAt(e)],r=c[A.charCodeAt(e+1)],n=c[A.charCodeAt(e+2)],B=c[A.charCodeAt(e+3)],Q[i++]=t<<2|r>>4,Q[i++]=(15&r)<<4|n>>2,Q[i++]=(3&n)<<6|63&B;return a}(" "),C=Array.isArray(l)?function(A){for(var e=A.length,t=[],r=0;r<e;r+=4)t.push(A[r+3]<<24|A[r+2]<<16|A[r+1]<<8|A[r]);return t}(l):new Uint32Array(l),E=F(g=Array.isArray(l)?function(A){for(var e=A.length,t=[],r=0;r<e;r+=2)t.push(A[r+1]<<8|A[r]);return t}(l):new Uint16Array(l),12,C[4]/2),h=2===C[5]?F(g,(24+C[4])/2):(w=C,U=Math.ceil((24+C[4])/4),w.slice?w.slice(U,void 0):new Uint32Array(Array.prototype.slice.call(w,U,void 0))),new d(C[0],C[1],C[2],C[3],E,h)),k=[S,36],W=[1,2,3,5],Y=[H,8],q=[D,O],Z=W.concat(Y),j=[V,z,X,_,P],$=[p,f],AA=function(A,e,t,r){var n=r[t];if(Array.isArray(A)?-1!==A.indexOf(n):A===n)for(var B=t;B<=r.length;){if((i=r[++B])===e)return!0;if(i!==H)break}if(n===H)for(B=t;B>0;){var s=r[--B];if(Array.isArray(A)?-1!==A.indexOf(s):A===s)for(var o=t;o<=r.length;){var i;if((i=r[++o])===e)return!0;if(i!==H)break}if(s!==H)break}return!1},eA=function(A,e){for(var t=A;t>=0;){var r=e[t];if(r!==H)return r;t--}return 0},tA=function(A,e,t,r,n){if(0===t[r])return"×";var B=r-1;if(Array.isArray(n)&&!0===n[B])return"×";var s=B-1,o=B+1,i=e[B],a=s>=0?e[s]:0,c=e[o];if(2===i&&3===c)return"×";if(-1!==W.indexOf(i))return"!";if(-1!==W.indexOf(c))return"×";if(-1!==Y.indexOf(c))return"×";if(8===eA(B,e))return"÷";if(11===G.get(A[B])&&(c===x||c===y||c===M))return"×";if(7===i||7===c)return"×";if(9===i)return"×";if(-1===[H,f,p].indexOf(i)&&9===c)return"×";if(-1!==[N,K,I,L,b].indexOf(c))return"×";if(eA(B,e)===R)return"×";if(AA(23,R,B,e))return"×";if(AA([N,K],T,B,e))return"×";if(AA(12,12,B,e))return"×";if(i===H)return"÷";if(23===i||23===c)return"×";if(16===c||16===i)return"÷";if(-1!==[f,p,T].indexOf(c)||14===i)return"×";if(36===a&&-1!==$.indexOf(i))return"×";if(i===b&&36===c)return"×";if(c===m&&-1!==k.concat(m,I,v,x,y,M).indexOf(i))return"×";if(-1!==k.indexOf(c)&&i===v||-1!==k.indexOf(i)&&c===v)return"×";if(i===D&&-1!==[x,y,M].indexOf(c)||-1!==[x,y,M].indexOf(i)&&c===O)return"×";if(-1!==k.indexOf(i)&&-1!==q.indexOf(c)||-1!==q.indexOf(i)&&-1!==k.indexOf(c))return"×";if(-1!==[D,O].indexOf(i)&&(c===v||-1!==[R,p].indexOf(c)&&e[o+1]===v)||-1!==[R,p].indexOf(i)&&c===v||i===v&&-1!==[v,b,L].indexOf(c))return"×";if(-1!==[v,b,L,N,K].indexOf(c))for(var Q=B;Q>=0;){if((u=e[Q])===v)return"×";if(-1===[b,L].indexOf(u))break;Q--}if(-1!==[D,O].indexOf(c))for(Q=-1!==[N,K].indexOf(i)?s:B;Q>=0;){var u;if((u=e[Q])===v)return"×";if(-1===[b,L].indexOf(u))break;Q--}if(V===i&&-1!==[V,z,_,P].indexOf(c)||-1!==[z,_].indexOf(i)&&-1!==[z,X].indexOf(c)||-1!==[X,P].indexOf(i)&&c===X)return"×";if(-1!==j.indexOf(i)&&-1!==[m,O].indexOf(c)||-1!==j.indexOf(c)&&i===D)return"×";if(-1!==k.indexOf(i)&&-1!==k.indexOf(c))return"×";if(i===L&&-1!==k.indexOf(c))return"×";if(-1!==k.concat(v).indexOf(i)&&c===R||-1!==k.concat(v).indexOf(c)&&i===K)return"×";if(41===i&&41===c){for(var w=t[B],U=1;w>0&&41===e[--w];)U++;if(U%2!=0)return"×"}return i===y&&c===M?"×":"÷"},rA=function(){function A(A,e,t,r){this.codePoints=A,this.required="!"===e,this.start=t,this.end=r}return A.prototype.slice=function(){return i.apply(void 0,this.codePoints.slice(this.start,this.end))},A}();!function(A){A[A.STRING_TOKEN=0]="STRING_TOKEN",A[A.BAD_STRING_TOKEN=1]="BAD_STRING_TOKEN",A[A.LEFT_PARENTHESIS_TOKEN=2]="LEFT_PARENTHESIS_TOKEN",A[A.RIGHT_PARENTHESIS_TOKEN=3]="RIGHT_PARENTHESIS_TOKEN",A[A.COMMA_TOKEN=4]="COMMA_TOKEN",A[A.HASH_TOKEN=5]="HASH_TOKEN",A[A.DELIM_TOKEN=6]="DELIM_TOKEN",A[A.AT_KEYWORD_TOKEN=7]="AT_KEYWORD_TOKEN",A[A.PREFIX_MATCH_TOKEN=8]="PREFIX_MATCH_TOKEN",A[A.DASH_MATCH_TOKEN=9]="DASH_MATCH_TOKEN",A[A.INCLUDE_MATCH_TOKEN=10]="INCLUDE_MATCH_TOKEN",A[A.LEFT_CURLY_BRACKET_TOKEN=11]="LEFT_CURLY_BRACKET_TOKEN",A[A.RIGHT_CURLY_BRACKET_TOKEN=12]="RIGHT_CURLY_BRACKET_TOKEN",A[A.SUFFIX_MATCH_TOKEN=13]="SUFFIX_MATCH_TOKEN",A[A.SUBSTRING_MATCH_TOKEN=14]="SUBSTRING_MATCH_TOKEN",A[A.DIMENSION_TOKEN=15]="DIMENSION_TOKEN",A[A.PERCENTAGE_TOKEN=16]="PERCENTAGE_TOKEN",A[A.NUMBER_TOKEN=17]="NUMBER_TOKEN",A[A.FUNCTION=18]="FUNCTION",A[A.FUNCTION_TOKEN=19]="FUNCTION_TOKEN",A[A.IDENT_TOKEN=20]="IDENT_TOKEN",A[A.COLUMN_TOKEN=21]="COLUMN_TOKEN",A[A.URL_TOKEN=22]="URL_TOKEN",A[A.BAD_URL_TOKEN=23]="BAD_URL_TOKEN",A[A.CDC_TOKEN=24]="CDC_TOKEN",A[A.CDO_TOKEN=25]="CDO_TOKEN",A[A.COLON_TOKEN=26]="COLON_TOKEN",A[A.SEMICOLON_TOKEN=27]="SEMICOLON_TOKEN",A[A.LEFT_SQUARE_BRACKET_TOKEN=28]="LEFT_SQUARE_BRACKET_TOKEN",A[A.RIGHT_SQUARE_BRACKET_TOKEN=29]="RIGHT_SQUARE_BRACKET_TOKEN",A[A.UNICODE_RANGE_TOKEN=30]="UNICODE_RANGE_TOKEN",A[A.WHITESPACE_TOKEN=31]="WHITESPACE_TOKEN",A[A.EOF_TOKEN=32]="EOF_TOKEN"}(u||(u={}));var nA=function(A){return A>=48&&A<=57},BA=function(A){return nA(A)||A>=65&&A<=70||A>=97&&A<=102},sA=function(A){return 10===A||9===A||32===A},oA=function(A){return function(A){return function(A){return A>=97&&A<=122}(A)||function(A){return A>=65&&A<=90}(A)}(A)||function(A){return A>=128}(A)||95===A},iA=function(A){return oA(A)||nA(A)||45===A},aA=function(A){return A>=0&&A<=8||11===A||A>=14&&A<=31||127===A},cA=function(A,e){return 92===A&&10!==e},QA=function(A,e,t){return 45===A?oA(e)||cA(e,t):!!oA(A)||!(92!==A||!cA(A,e))},uA=function(A,e,t){return 43===A||45===A?!!nA(e)||46===e&&nA(t):nA(46===A?e:A)},wA=function(A){var e=0,t=1;43!==A[e]&&45!==A[e]||(45===A[e]&&(t=-1),e++);for(var r=[];nA(A[e]);)r.push(A[e++]);var n=r.length?parseInt(i.apply(void 0,r),10):0;46===A[e]&&e++;for(var B=[];nA(A[e]);)B.push(A[e++]);var s=B.length,o=s?parseInt(i.apply(void 0,B),10):0;69!==A[e]&&101!==A[e]||e++;var a=1;43!==A[e]&&45!==A[e]||(45===A[e]&&(a=-1),e++);for(var c=[];nA(A[e]);)c.push(A[e++]);var Q=c.length?parseInt(i.apply(void 0,c),10):0;return t*(n+o*Math.pow(10,-s))*Math.pow(10,a*Q)},UA={type:u.LEFT_PARENTHESIS_TOKEN},lA={type:u.RIGHT_PARENTHESIS_TOKEN},CA={type:u.COMMA_TOKEN},gA={type:u.SUFFIX_MATCH_TOKEN},EA={type:u.PREFIX_MATCH_TOKEN},hA={type:u.COLUMN_TOKEN},FA={type:u.DASH_MATCH_TOKEN},dA={type:u.INCLUDE_MATCH_TOKEN},HA={type:u.LEFT_CURLY_BRACKET_TOKEN},fA={type:u.RIGHT_CURLY_BRACKET_TOKEN},pA={type:u.SUBSTRING_MATCH_TOKEN},NA={type:u.BAD_URL_TOKEN},KA={type:u.BAD_STRING_TOKEN},IA={type:u.CDO_TOKEN},mA={type:u.CDC_TOKEN},TA={type:u.COLON_TOKEN},RA={type:u.SEMICOLON_TOKEN},LA={type:u.LEFT_SQUARE_BRACKET_TOKEN},vA={type:u.RIGHT_SQUARE_BRACKET_TOKEN},OA={type:u.WHITESPACE_TOKEN},DA={type:u.EOF_TOKEN},bA=function(){function A(){this._value=[]}return A.prototype.write=function(A){this._value=this._value.concat(o(A))},A.prototype.read=function(){for(var A=[],e=this.consumeToken();e!==DA;)A.push(e),e=this.consumeToken();return A},A.prototype.consumeToken=function(){var A=this.consumeCodePoint();switch(A){case 34:return this.consumeStringToken(34);case 35:var e=this.peekCodePoint(0),t=this.peekCodePoint(1),r=this.peekCodePoint(2);if(iA(e)||cA(t,r)){var n=QA(e,t,r)?2:1,B=this.consumeName();return{type:u.HASH_TOKEN,value:B,flags:n}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),gA;break;case 39:return this.consumeStringToken(39);case 40:return UA;case 41:return lA;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),pA;break;case 43:if(uA(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case 44:return CA;case 45:var s=A,o=this.peekCodePoint(0),a=this.peekCodePoint(1);if(uA(s,o,a))return this.reconsumeCodePoint(A),this.consumeNumericToken();if(QA(s,o,a))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();if(45===o&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),mA;break;case 46:if(uA(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(42===c&&47===(c=this.consumeCodePoint()))return this.consumeToken();if(-1===c)return this.consumeToken()}break;case 58:return TA;case 59:return RA;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),IA;break;case 64:var Q=this.peekCodePoint(0),w=this.peekCodePoint(1),U=this.peekCodePoint(2);if(QA(Q,w,U))return B=this.consumeName(),{type:u.AT_KEYWORD_TOKEN,value:B};break;case 91:return LA;case 92:if(cA(A,this.peekCodePoint(0)))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();break;case 93:return vA;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),EA;break;case 123:return HA;case 125:return fA;case 117:case 85:var l=this.peekCodePoint(0),C=this.peekCodePoint(1);return 43!==l||!BA(C)&&63!==C||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(A),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),FA;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),hA;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),dA;break;case-1:return DA}return sA(A)?(this.consumeWhiteSpace(),OA):nA(A)?(this.reconsumeCodePoint(A),this.consumeNumericToken()):oA(A)?(this.reconsumeCodePoint(A),this.consumeIdentLikeToken()):{type:u.DELIM_TOKEN,value:i(A)}},A.prototype.consumeCodePoint=function(){var A=this._value.shift();return void 0===A?-1:A},A.prototype.reconsumeCodePoint=function(A){this._value.unshift(A)},A.prototype.peekCodePoint=function(A){return A>=this._value.length?-1:this._value[A]},A.prototype.consumeUnicodeRangeToken=function(){for(var A=[],e=this.consumeCodePoint();BA(e)&&A.length<6;)A.push(e),e=this.consumeCodePoint();for(var t=!1;63===e&&A.length<6;)A.push(e),e=this.consumeCodePoint(),t=!0;if(t){var r=parseInt(i.apply(void 0,A.map((function(A){return 63===A?48:A}))),16),n=parseInt(i.apply(void 0,A.map((function(A){return 63===A?70:A}))),16);return{type:u.UNICODE_RANGE_TOKEN,start:r,end:n}}var B=parseInt(i.apply(void 0,A),16);if(45===this.peekCodePoint(0)&&BA(this.peekCodePoint(1))){this.consumeCodePoint(),e=this.consumeCodePoint();for(var s=[];BA(e)&&s.length<6;)s.push(e),e=this.consumeCodePoint();return n=parseInt(i.apply(void 0,s),16),{type:u.UNICODE_RANGE_TOKEN,start:B,end:n}}return{type:u.UNICODE_RANGE_TOKEN,start:B,end:B}},A.prototype.consumeIdentLikeToken=function(){var A=this.consumeName();return"url"===A.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:u.FUNCTION_TOKEN,value:A}):{type:u.IDENT_TOKEN,value:A}},A.prototype.consumeUrlToken=function(){var A=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:u.URL_TOKEN,value:""};var e=this.peekCodePoint(0);if(39===e||34===e){var t=this.consumeStringToken(this.consumeCodePoint());return t.type===u.STRING_TOKEN&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:u.URL_TOKEN,value:t.value}):(this.consumeBadUrlRemnants(),NA)}for(;;){var r=this.consumeCodePoint();if(-1===r||41===r)return{type:u.URL_TOKEN,value:i.apply(void 0,A)};if(sA(r))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:u.URL_TOKEN,value:i.apply(void 0,A)}):(this.consumeBadUrlRemnants(),NA);if(34===r||39===r||40===r||aA(r))return this.consumeBadUrlRemnants(),NA;if(92===r){if(!cA(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),NA;A.push(this.consumeEscapedCodePoint())}else A.push(r)}},A.prototype.consumeWhiteSpace=function(){for(;sA(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var A=this.consumeCodePoint();if(41===A||-1===A)return;cA(A,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(A){for(var e="";A>0;){var t=Math.min(6e4,A);e+=i.apply(void 0,this._value.splice(0,t)),A-=t}return this._value.shift(),e},A.prototype.consumeStringToken=function(A){for(var e="",t=0;;){var r=this._value[t];if(-1===r||void 0===r||r===A)return e+=this.consumeStringSlice(t),{type:u.STRING_TOKEN,value:e};if(10===r)return this._value.splice(0,t),KA;if(92===r){var n=this._value[t+1];-1!==n&&void 0!==n&&(10===n?(e+=this.consumeStringSlice(t),t=-1,this._value.shift()):cA(r,n)&&(e+=this.consumeStringSlice(t),e+=i(this.consumeEscapedCodePoint()),t=-1))}t++}},A.prototype.consumeNumber=function(){var A=[],e=4,t=this.peekCodePoint(0);for(43!==t&&45!==t||A.push(this.consumeCodePoint());nA(this.peekCodePoint(0));)A.push(this.consumeCodePoint());t=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(46===t&&nA(r))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),e=8;nA(this.peekCodePoint(0));)A.push(this.consumeCodePoint());t=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((69===t||101===t)&&((43===r||45===r)&&nA(n)||nA(r)))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),e=8;nA(this.peekCodePoint(0));)A.push(this.consumeCodePoint());return[wA(A),e]},A.prototype.consumeNumericToken=function(){var A=this.consumeNumber(),e=A[0],t=A[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),B=this.peekCodePoint(2);if(QA(r,n,B)){var s=this.consumeName();return{type:u.DIMENSION_TOKEN,number:e,flags:t,unit:s}}return 37===r?(this.consumeCodePoint(),{type:u.PERCENTAGE_TOKEN,number:e,flags:t}):{type:u.NUMBER_TOKEN,number:e,flags:t}},A.prototype.consumeEscapedCodePoint=function(){var A=this.consumeCodePoint();if(BA(A)){for(var e=i(A);BA(this.peekCodePoint(0))&&e.length<6;)e+=i(this.consumeCodePoint());sA(this.peekCodePoint(0))&&this.consumeCodePoint();var t=parseInt(e,16);return 0===t||function(A){return A>=55296&&A<=57343}(t)||t>1114111?65533:t}return-1===A?65533:A},A.prototype.consumeName=function(){for(var A="";;){var e=this.consumeCodePoint();if(iA(e))A+=i(e);else{if(!cA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),A;A+=i(this.consumeEscapedCodePoint())}}},A}(),SA=function(){function A(A){this._tokens=A}return A.create=function(e){var t=new bA;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var A=this.consumeToken();A.type===u.WHITESPACE_TOKEN;)A=this.consumeToken();if(A.type===u.EOF_TOKEN)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(A);var e=this.consumeComponentValue();do{A=this.consumeToken()}while(A.type===u.WHITESPACE_TOKEN);if(A.type===u.EOF_TOKEN)return e;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var A=[];;){var e=this.consumeComponentValue();if(e.type===u.EOF_TOKEN)return A;A.push(e),A.push()}},A.prototype.consumeComponentValue=function(){var A=this.consumeToken();switch(A.type){case u.LEFT_CURLY_BRACKET_TOKEN:case u.LEFT_SQUARE_BRACKET_TOKEN:case u.LEFT_PARENTHESIS_TOKEN:return this.consumeSimpleBlock(A.type);case u.FUNCTION_TOKEN:return this.consumeFunction(A)}return A},A.prototype.consumeSimpleBlock=function(A){for(var e={type:A,values:[]},t=this.consumeToken();;){if(t.type===u.EOF_TOKEN||JA(t,A))return e;this.reconsumeToken(t),e.values.push(this.consumeComponentValue()),t=this.consumeToken()}},A.prototype.consumeFunction=function(A){for(var e={name:A.value,values:[],type:u.FUNCTION};;){var t=this.consumeToken();if(t.type===u.EOF_TOKEN||t.type===u.RIGHT_PARENTHESIS_TOKEN)return e;this.reconsumeToken(t),e.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var A=this._tokens.shift();return void 0===A?DA:A},A.prototype.reconsumeToken=function(A){this._tokens.unshift(A)},A}(),yA=function(A){return A.type===u.DIMENSION_TOKEN},MA=function(A){return A.type===u.NUMBER_TOKEN},_A=function(A){return A.type===u.IDENT_TOKEN},PA=function(A){return A.type===u.STRING_TOKEN},xA=function(A,e){return _A(A)&&A.value===e},VA=function(A){return A.type!==u.WHITESPACE_TOKEN},zA=function(A){return A.type!==u.WHITESPACE_TOKEN&&A.type!==u.COMMA_TOKEN},XA=function(A){var e=[],t=[];return A.forEach((function(A){if(A.type===u.COMMA_TOKEN){if(0===t.length)throw new Error("Error parsing function args, zero tokens for arg");return e.push(t),void(t=[])}A.type!==u.WHITESPACE_TOKEN&&t.push(A)})),t.length&&e.push(t),e},JA=function(A,e){return e===u.LEFT_CURLY_BRACKET_TOKEN&&A.type===u.RIGHT_CURLY_BRACKET_TOKEN||e===u.LEFT_SQUARE_BRACKET_TOKEN&&A.type===u.RIGHT_SQUARE_BRACKET_TOKEN||e===u.LEFT_PARENTHESIS_TOKEN&&A.type===u.RIGHT_PARENTHESIS_TOKEN},GA=function(A){return A.type===u.NUMBER_TOKEN||A.type===u.DIMENSION_TOKEN},kA=function(A){return A.type===u.PERCENTAGE_TOKEN||GA(A)},WA=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},YA={type:u.NUMBER_TOKEN,number:0,flags:4},qA={type:u.PERCENTAGE_TOKEN,number:50,flags:4},ZA={type:u.PERCENTAGE_TOKEN,number:100,flags:4},jA=function(A,e,t){var r=A[0],n=A[1];return[$A(r,e),$A(void 0!==n?n:r,t)]},$A=function(A,e){if(A.type===u.PERCENTAGE_TOKEN)return A.number/100*e;if(yA(A))switch(A.unit){case"rem":case"em":return 16*A.number;case"px":default:return A.number}return A.number},Ae=function(A){if(A.type===u.DIMENSION_TOKEN)switch(A.unit){case"deg":return Math.PI*A.number/180;case"grad":return Math.PI/200*A.number;case"rad":return A.number;case"turn":return 2*Math.PI*A.number}throw new Error("Unsupported angle type")},ee=function(A){return A.type===u.DIMENSION_TOKEN&&("deg"===A.unit||"grad"===A.unit||"rad"===A.unit||"turn"===A.unit)},te=function(A){switch(A.filter(_A).map((function(A){return A.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[YA,YA];case"to top":case"bottom":return re(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[YA,ZA];case"to right":case"left":return re(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ZA,ZA];case"to bottom":case"top":return re(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ZA,YA];case"to left":case"right":return re(270)}return 0},re=function(A){return Math.PI*A/180},ne=function(A){if(A.type===u.FUNCTION){var e=Ue[A.name];if(void 0===e)throw new Error('Attempting to parse an unsupported color function "'+A.name+'"');return e(A.values)}if(A.type===u.HASH_TOKEN){if(3===A.value.length){var t=A.value.substring(0,1),r=A.value.substring(1,2),n=A.value.substring(2,3);return oe(parseInt(t+t,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(4===A.value.length){t=A.value.substring(0,1),r=A.value.substring(1,2),n=A.value.substring(2,3);var B=A.value.substring(3,4);return oe(parseInt(t+t,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(B+B,16)/255)}if(6===A.value.length)return t=A.value.substring(0,2),r=A.value.substring(2,4),n=A.value.substring(4,6),oe(parseInt(t,16),parseInt(r,16),parseInt(n,16),1);if(8===A.value.length)return t=A.value.substring(0,2),r=A.value.substring(2,4),n=A.value.substring(4,6),B=A.value.substring(6,8),oe(parseInt(t,16),parseInt(r,16),parseInt(n,16),parseInt(B,16)/255)}if(A.type===u.IDENT_TOKEN){var s=le[A.value.toUpperCase()];if(void 0!==s)return s}return le.TRANSPARENT},Be=function(A){return 0==(255&A)},se=function(A){var e=255&A,t=255&A>>8,r=255&A>>16,n=255&A>>24;return e<255?"rgba("+n+","+r+","+t+","+e/255+")":"rgb("+n+","+r+","+t+")"},oe=function(A,e,t,r){return(A<<24|e<<16|t<<8|Math.round(255*r)<<0)>>>0},ie=function(A,e){if(A.type===u.NUMBER_TOKEN)return A.number;if(A.type===u.PERCENTAGE_TOKEN){var t=3===e?1:255;return 3===e?A.number/100*t:Math.round(A.number/100*t)}return 0},ae=function(A){var e=A.filter(zA);if(3===e.length){var t=e.map(ie),r=t[0],n=t[1],B=t[2];return oe(r,n,B,1)}if(4===e.length){var s=e.map(ie),o=(r=s[0],n=s[1],B=s[2],s[3]);return oe(r,n,B,o)}return 0};function ce(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<.5?e:t<2/3?6*(e-A)*(2/3-t)+A:A}var Qe,ue,we=function(A){var e=A.filter(zA),t=e[0],r=e[1],n=e[2],B=e[3],s=(t.type===u.NUMBER_TOKEN?re(t.number):Ae(t))/(2*Math.PI),o=kA(r)?r.number/100:0,i=kA(n)?n.number/100:0,a=void 0!==B&&kA(B)?$A(B,1):1;if(0===o)return oe(255*i,255*i,255*i,1);var c=i<=.5?i*(o+1):i+o-i*o,Q=2*i-c,w=ce(Q,c,s+1/3),U=ce(Q,c,s),l=ce(Q,c,s-1/3);return oe(255*w,255*U,255*l,a)},Ue={hsl:we,hsla:we,rgb:ae,rgba:ae},le={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199};!function(A){A[A.VALUE=0]="VALUE",A[A.LIST=1]="LIST",A[A.IDENT_VALUE=2]="IDENT_VALUE",A[A.TYPE_VALUE=3]="TYPE_VALUE",A[A.TOKEN_VALUE=4]="TOKEN_VALUE"}(Qe||(Qe={})),function(A){A[A.BORDER_BOX=0]="BORDER_BOX",A[A.PADDING_BOX=1]="PADDING_BOX",A[A.CONTENT_BOX=2]="CONTENT_BOX"}(ue||(ue={}));var Ce,ge,Ee,he={name:"background-clip",initialValue:"border-box",prefix:!1,type:Qe.LIST,parse:function(A){return A.map((function(A){if(_A(A))switch(A.value){case"padding-box":return ue.PADDING_BOX;case"content-box":return ue.CONTENT_BOX}return ue.BORDER_BOX}))}},Fe={name:"background-color",initialValue:"transparent",prefix:!1,type:Qe.TYPE_VALUE,format:"color"},de=function(A){var e=ne(A[0]),t=A[1];return t&&kA(t)?{color:e,stop:t}:{color:e,stop:null}},He=function(A,e){var t=A[0],r=A[A.length-1];null===t.stop&&(t.stop=YA),null===r.stop&&(r.stop=ZA);for(var n=[],B=0,s=0;s<A.length;s++){var o=A[s].stop;if(null!==o){var i=$A(o,e);i>B?n.push(i):n.push(B),B=i}else n.push(null)}var a=null;for(s=0;s<n.length;s++){var c=n[s];if(null===c)null===a&&(a=s);else if(null!==a){for(var Q=s-a,u=(c-n[a-1])/(Q+1),w=1;w<=Q;w++)n[a+w-1]=u*w;a=null}}return A.map((function(A,t){return{color:A.color,stop:Math.max(Math.min(1,n[t]/e),0)}}))},fe=function(A,e){return Math.sqrt(A*A+e*e)},pe=function(A,e,t,r,n){return[[0,0],[0,e],[A,0],[A,e]].reduce((function(A,e){var B=e[0],s=e[1],o=fe(t-B,r-s);return(n?o<A.optimumDistance:o>A.optimumDistance)?{optimumCorner:e,optimumDistance:o}:A}),{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},Ne=function(A){var e=re(180),t=[];return XA(A).forEach((function(A,r){if(0===r){var n=A[0];if(n.type===u.IDENT_TOKEN&&-1!==["top","left","right","bottom"].indexOf(n.value))return void(e=te(A));if(ee(n))return void(e=(Ae(n)+re(270))%re(360))}var B=de(A);t.push(B)})),{angle:e,stops:t,type:Ce.LINEAR_GRADIENT}},Ke=function(A){return 0===A[0]&&255===A[1]&&0===A[2]&&255===A[3]},Ie=function(A,e,t,r,n){var B="http://www.w3.org/2000/svg",s=document.createElementNS(B,"svg"),o=document.createElementNS(B,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",r.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(n),s},me=function(A){return new Promise((function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(A))}))},Te={get SUPPORT_RANGE_BOUNDS(){var A=function(A){if(A.createRange){var e=A.createRange();if(e.getBoundingClientRect){var t=A.createElement("boundtest");t.style.height="123px",t.style.display="block",A.body.appendChild(t),e.selectNode(t);var r=e.getBoundingClientRect(),n=Math.round(r.height);if(A.body.removeChild(t),123===n)return!0}}return!1}(document);return Object.defineProperty(Te,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=function(A){var e=new Image,t=A.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{r.drawImage(e,0,0),t.toDataURL()}catch(A){return!1}return!0}(document);return Object.defineProperty(Te,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A="function"==typeof Array.from&&"function"==typeof window.fetch?function(A){var e=A.createElement("canvas");e.width=100,e.height=100;var t=e.getContext("2d");if(!t)return Promise.reject(!1);t.fillStyle="rgb(0, 255, 0)",t.fillRect(0,0,100,100);var r=new Image,n=e.toDataURL();r.src=n;var B=Ie(100,100,0,0,r);return t.fillStyle="red",t.fillRect(0,0,100,100),me(B).then((function(e){t.drawImage(e,0,0);var r=t.getImageData(0,0,100,100).data;t.fillStyle="red",t.fillRect(0,0,100,100);var B=A.createElement("div");return B.style.backgroundImage="url("+n+")",B.style.height="100px",Ke(r)?me(Ie(100,100,0,0,B)):Promise.reject(!1)})).then((function(A){return t.drawImage(A,0,0),Ke(t.getImageData(0,0,100,100).data)})).catch((function(){return!1}))}(document):Promise.resolve(!1);return Object.defineProperty(Te,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=void 0!==(new Image).crossOrigin;return Object.defineProperty(Te,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(Te,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Te,"SUPPORT_CORS_XHR",{value:A}),A}},Re=function(){function A(A){var e=A.id,t=A.enabled;this.id=e,this.enabled=t,this.start=Date.now()}return A.prototype.debug=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.debug?console.debug.apply(console,[this.id,this.getTime()+"ms"].concat(A)):this.info.apply(this,A))},A.prototype.getTime=function(){return Date.now()-this.start},A.create=function(e){A.instances[e.id]=new A(e)},A.destroy=function(e){delete A.instances[e]},A.getInstance=function(e){var t=A.instances[e];if(void 0===t)throw new Error("No logger instance found with id "+e);return t},A.prototype.info=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&"undefined"!=typeof window&&window.console&&"function"==typeof console.info&&console.info.apply(console,[this.id,this.getTime()+"ms"].concat(A))},A.prototype.error=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&("undefined"!=typeof window&&window.console&&"function"==typeof console.error?console.error.apply(console,[this.id,this.getTime()+"ms"].concat(A)):this.info.apply(this,A))},A.instances={},A}(),Le=function(){function A(){}return A.create=function(e,t){return A._caches[e]=new ve(e,t)},A.destroy=function(e){delete A._caches[e]},A.open=function(e){var t=A._caches[e];if(void 0!==t)return t;throw new Error('Cache with key "'+e+'" not found')},A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A.getInstance=function(){var e=A._current;if(null===e)throw new Error("No cache instance attached");return e},A.attachInstance=function(e){A._current=e},A.detachInstance=function(){A._current=null},A._caches={},A._origin="about:blank",A._current=null,A}(),ve=function(){function A(A,e){this.id=A,this._options=e,this._cache={}}return A.prototype.addImage=function(A){var e=Promise.resolve();return this.has(A)?e:_e(A)||Se(A)?(this._cache[A]=this.loadImage(A),e):e},A.prototype.match=function(A){return this._cache[A]},A.prototype.loadImage=function(A){return r(this,void 0,void 0,(function(){var e,t,r,B,s=this;return n(this,(function(n){switch(n.label){case 0:return e=Le.isSameOrigin(A),t=!ye(A)&&!0===this._options.useCORS&&Te.SUPPORT_CORS_IMAGES&&!e,r=!ye(A)&&!e&&"string"==typeof this._options.proxy&&Te.SUPPORT_CORS_XHR&&!t,e||!1!==this._options.allowTaint||ye(A)||r||t?(B=A,r?[4,this.proxy(B)]:[3,2]):[2];case 1:B=n.sent(),n.label=2;case 2:return Re.getInstance(this.id).debug("Added image "+A.substring(0,256)),[4,new Promise((function(A,e){var r=new Image;r.onload=function(){return A(r)},r.onerror=e,(Me(B)||t)&&(r.crossOrigin="anonymous"),r.src=B,!0===r.complete&&setTimeout((function(){return A(r)}),500),s._options.imageTimeout>0&&setTimeout((function(){return e("Timed out ("+s._options.imageTimeout+"ms) loading image")}),s._options.imageTimeout)}))];case 3:return[2,n.sent()]}}))}))},A.prototype.has=function(A){return void 0!==this._cache[A]},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(A){var e=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var r=A.substring(0,256);return new Promise((function(n,B){var s=Te.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;if(o.onload=function(){if(200===o.status)if("text"===s)n(o.response);else{var A=new FileReader;A.addEventListener("load",(function(){return n(A.result)}),!1),A.addEventListener("error",(function(A){return B(A)}),!1),A.readAsDataURL(o.response)}else B("Failed to proxy resource "+r+" with status code "+o.status)},o.onerror=B,o.open("GET",t+"?url="+encodeURIComponent(A)+"&responseType="+s),"text"!==s&&o instanceof XMLHttpRequest&&(o.responseType=s),e._options.imageTimeout){var i=e._options.imageTimeout;o.timeout=i,o.ontimeout=function(){return B("Timed out ("+i+"ms) proxying "+r)}}o.send()}))},A}(),Oe=/^data:image\/svg\+xml/i,De=/^data:image\/.*;base64,/i,be=/^data:image\/.*/i,Se=function(A){return Te.SUPPORT_SVG_DRAWING||!Pe(A)},ye=function(A){return be.test(A)},Me=function(A){return De.test(A)},_e=function(A){return"blob"===A.substr(0,4)},Pe=function(A){return"svg"===A.substr(-3).toLowerCase()||Oe.test(A)},xe=function(A){var e=ge.CIRCLE,t=Ee.FARTHEST_CORNER,r=[],n=[];return XA(A).forEach((function(A,B){var s=!0;if(0===B?s=A.reduce((function(A,e){if(_A(e))switch(e.value){case"center":return n.push(qA),!1;case"top":case"left":return n.push(YA),!1;case"right":case"bottom":return n.push(ZA),!1}else if(kA(e)||GA(e))return n.push(e),!1;return A}),s):1===B&&(s=A.reduce((function(A,r){if(_A(r))switch(r.value){case"circle":return e=ge.CIRCLE,!1;case"ellipse":return e=ge.ELLIPSE,!1;case"contain":case"closest-side":return t=Ee.CLOSEST_SIDE,!1;case"farthest-side":return t=Ee.FARTHEST_SIDE,!1;case"closest-corner":return t=Ee.CLOSEST_CORNER,!1;case"cover":case"farthest-corner":return t=Ee.FARTHEST_CORNER,!1}else if(GA(r)||kA(r))return Array.isArray(t)||(t=[]),t.push(r),!1;return A}),s)),s){var o=de(A);r.push(o)}})),{size:t,shape:e,stops:r,position:n,type:Ce.RADIAL_GRADIENT}};!function(A){A[A.URL=0]="URL",A[A.LINEAR_GRADIENT=1]="LINEAR_GRADIENT",A[A.RADIAL_GRADIENT=2]="RADIAL_GRADIENT"}(Ce||(Ce={})),function(A){A[A.CIRCLE=0]="CIRCLE",A[A.ELLIPSE=1]="ELLIPSE"}(ge||(ge={})),function(A){A[A.CLOSEST_SIDE=0]="CLOSEST_SIDE",A[A.FARTHEST_SIDE=1]="FARTHEST_SIDE",A[A.CLOSEST_CORNER=2]="CLOSEST_CORNER",A[A.FARTHEST_CORNER=3]="FARTHEST_CORNER"}(Ee||(Ee={}));var Ve,ze=function(A){if(A.type===u.URL_TOKEN){var e={url:A.value,type:Ce.URL};return Le.getInstance().addImage(A.value),e}if(A.type===u.FUNCTION){var t=Xe[A.name];if(void 0===t)throw new Error('Attempting to parse an unsupported image function "'+A.name+'"');return t(A.values)}throw new Error("Unsupported image type")},Xe={"linear-gradient":function(A){var e=re(180),t=[];return XA(A).forEach((function(A,r){if(0===r){var n=A[0];if(n.type===u.IDENT_TOKEN&&"to"===n.value)return void(e=te(A));if(ee(n))return void(e=Ae(n))}var B=de(A);t.push(B)})),{angle:e,stops:t,type:Ce.LINEAR_GRADIENT}},"-moz-linear-gradient":Ne,"-ms-linear-gradient":Ne,"-o-linear-gradient":Ne,"-webkit-linear-gradient":Ne,"radial-gradient":function(A){var e=ge.CIRCLE,t=Ee.FARTHEST_CORNER,r=[],n=[];return XA(A).forEach((function(A,B){var s=!0;if(0===B){var o=!1;s=A.reduce((function(A,r){if(o)if(_A(r))switch(r.value){case"center":return n.push(qA),A;case"top":case"left":return n.push(YA),A;case"right":case"bottom":return n.push(ZA),A}else(kA(r)||GA(r))&&n.push(r);else if(_A(r))switch(r.value){case"circle":return e=ge.CIRCLE,!1;case"ellipse":return e=ge.ELLIPSE,!1;case"at":return o=!0,!1;case"closest-side":return t=Ee.CLOSEST_SIDE,!1;case"cover":case"farthest-side":return t=Ee.FARTHEST_SIDE,!1;case"contain":case"closest-corner":return t=Ee.CLOSEST_CORNER,!1;case"farthest-corner":return t=Ee.FARTHEST_CORNER,!1}else if(GA(r)||kA(r))return Array.isArray(t)||(t=[]),t.push(r),!1;return A}),s)}if(s){var i=de(A);r.push(i)}})),{size:t,shape:e,stops:r,position:n,type:Ce.RADIAL_GRADIENT}},"-moz-radial-gradient":xe,"-ms-radial-gradient":xe,"-o-radial-gradient":xe,"-webkit-radial-gradient":xe,"-webkit-gradient":function(A){var e=re(180),t=[],r=Ce.LINEAR_GRADIENT,n=ge.CIRCLE,B=Ee.FARTHEST_CORNER;return XA(A).forEach((function(A,e){var n=A[0];if(0===e){if(_A(n)&&"linear"===n.value)return void(r=Ce.LINEAR_GRADIENT);if(_A(n)&&"radial"===n.value)return void(r=Ce.RADIAL_GRADIENT)}if(n.type===u.FUNCTION)if("from"===n.name){var B=ne(n.values[0]);t.push({stop:YA,color:B})}else if("to"===n.name)B=ne(n.values[0]),t.push({stop:ZA,color:B});else if("color-stop"===n.name){var s=n.values.filter(zA);if(2===s.length){B=ne(s[1]);var o=s[0];MA(o)&&t.push({stop:{type:u.PERCENTAGE_TOKEN,number:100*o.number,flags:o.flags},color:B})}}})),r===Ce.LINEAR_GRADIENT?{angle:(e+re(180))%re(360),stops:t,type:r}:{size:B,shape:n,stops:t,position:[],type:r}}},Je={name:"background-image",initialValue:"none",type:Qe.LIST,prefix:!1,parse:function(A){if(0===A.length)return[];var e=A[0];return e.type===u.IDENT_TOKEN&&"none"===e.value?[]:A.filter((function(A){return zA(A)&&function(A){return A.type!==u.FUNCTION||Xe[A.name]}(A)})).map(ze)}},Ge={name:"background-origin",initialValue:"border-box",prefix:!1,type:Qe.LIST,parse:function(A){return A.map((function(A){if(_A(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},ke={name:"background-position",initialValue:"0% 0%",type:Qe.LIST,prefix:!1,parse:function(A){return XA(A).map((function(A){return A.filter(kA)})).map(WA)}};!function(A){A[A.REPEAT=0]="REPEAT",A[A.NO_REPEAT=1]="NO_REPEAT",A[A.REPEAT_X=2]="REPEAT_X",A[A.REPEAT_Y=3]="REPEAT_Y"}(Ve||(Ve={}));var We,Ye={name:"background-repeat",initialValue:"repeat",prefix:!1,type:Qe.LIST,parse:function(A){return XA(A).map((function(A){return A.filter(_A).map((function(A){return A.value})).join(" ")})).map(qe)}},qe=function(A){switch(A){case"no-repeat":return Ve.NO_REPEAT;case"repeat-x":case"repeat no-repeat":return Ve.REPEAT_X;case"repeat-y":case"no-repeat repeat":return Ve.REPEAT_Y;case"repeat":default:return Ve.REPEAT}};!function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"}(We||(We={}));var Ze,je={name:"background-size",initialValue:"0",prefix:!1,type:Qe.LIST,parse:function(A){return XA(A).map((function(A){return A.filter($e)}))}},$e=function(A){return _A(A)||kA(A)},At=function(A){return{name:"border-"+A+"-color",initialValue:"transparent",prefix:!1,type:Qe.TYPE_VALUE,format:"color"}},et=At("top"),tt=At("right"),rt=At("bottom"),nt=At("left"),Bt=function(A){return{name:"border-radius-"+A,initialValue:"0 0",prefix:!1,type:Qe.LIST,parse:function(A){return WA(A.filter(kA))}}},st=Bt("top-left"),ot=Bt("top-right"),it=Bt("bottom-right"),at=Bt("bottom-left");!function(A){A[A.NONE=0]="NONE",A[A.SOLID=1]="SOLID"}(Ze||(Ze={}));var ct,Qt=function(A){return{name:"border-"+A+"-style",initialValue:"solid",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"none":return Ze.NONE}return Ze.SOLID}}},ut=Qt("top"),wt=Qt("right"),Ut=Qt("bottom"),lt=Qt("left"),Ct=function(A){return{name:"border-"+A+"-width",initialValue:"0",type:Qe.VALUE,prefix:!1,parse:function(A){return yA(A)?A.number:0}}},gt=Ct("top"),Et=Ct("right"),ht=Ct("bottom"),Ft=Ct("left"),dt={name:"color",initialValue:"transparent",prefix:!1,type:Qe.TYPE_VALUE,format:"color"},Ht={name:"display",initialValue:"inline-block",prefix:!1,type:Qe.LIST,parse:function(A){return A.filter(_A).reduce((function(A,e){return A|ft(e.value)}),0)}},ft=function(A){switch(A){case"block":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0};!function(A){A[A.NONE=0]="NONE",A[A.LEFT=1]="LEFT",A[A.RIGHT=2]="RIGHT",A[A.INLINE_START=3]="INLINE_START",A[A.INLINE_END=4]="INLINE_END"}(ct||(ct={}));var pt,Nt={name:"float",initialValue:"none",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"left":return ct.LEFT;case"right":return ct.RIGHT;case"inline-start":return ct.INLINE_START;case"inline-end":return ct.INLINE_END}return ct.NONE}},Kt={name:"letter-spacing",initialValue:"0",prefix:!1,type:Qe.VALUE,parse:function(A){return A.type===u.IDENT_TOKEN&&"normal"===A.value?0:A.type===u.NUMBER_TOKEN||A.type===u.DIMENSION_TOKEN?A.number:0}};!function(A){A.NORMAL="normal",A.STRICT="strict"}(pt||(pt={}));var It,mt={name:"line-break",initialValue:"normal",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"strict":return pt.STRICT;case"normal":default:return pt.NORMAL}}},Tt={name:"line-height",initialValue:"normal",prefix:!1,type:Qe.TOKEN_VALUE},Rt={name:"list-style-image",initialValue:"none",type:Qe.VALUE,prefix:!1,parse:function(A){return A.type===u.IDENT_TOKEN&&"none"===A.value?null:ze(A)}};!function(A){A[A.INSIDE=0]="INSIDE",A[A.OUTSIDE=1]="OUTSIDE"}(It||(It={}));var Lt,vt={name:"list-style-position",initialValue:"outside",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"inside":return It.INSIDE;case"outside":default:return It.OUTSIDE}}};!function(A){A[A.NONE=-1]="NONE",A[A.DISC=0]="DISC",A[A.CIRCLE=1]="CIRCLE",A[A.SQUARE=2]="SQUARE",A[A.DECIMAL=3]="DECIMAL",A[A.CJK_DECIMAL=4]="CJK_DECIMAL",A[A.DECIMAL_LEADING_ZERO=5]="DECIMAL_LEADING_ZERO",A[A.LOWER_ROMAN=6]="LOWER_ROMAN",A[A.UPPER_ROMAN=7]="UPPER_ROMAN",A[A.LOWER_GREEK=8]="LOWER_GREEK",A[A.LOWER_ALPHA=9]="LOWER_ALPHA",A[A.UPPER_ALPHA=10]="UPPER_ALPHA",A[A.ARABIC_INDIC=11]="ARABIC_INDIC",A[A.ARMENIAN=12]="ARMENIAN",A[A.BENGALI=13]="BENGALI",A[A.CAMBODIAN=14]="CAMBODIAN",A[A.CJK_EARTHLY_BRANCH=15]="CJK_EARTHLY_BRANCH",A[A.CJK_HEAVENLY_STEM=16]="CJK_HEAVENLY_STEM",A[A.CJK_IDEOGRAPHIC=17]="CJK_IDEOGRAPHIC",A[A.DEVANAGARI=18]="DEVANAGARI",A[A.ETHIOPIC_NUMERIC=19]="ETHIOPIC_NUMERIC",A[A.GEORGIAN=20]="GEORGIAN",A[A.GUJARATI=21]="GUJARATI",A[A.GURMUKHI=22]="GURMUKHI",A[A.HEBREW=22]="HEBREW",A[A.HIRAGANA=23]="HIRAGANA",A[A.HIRAGANA_IROHA=24]="HIRAGANA_IROHA",A[A.JAPANESE_FORMAL=25]="JAPANESE_FORMAL",A[A.JAPANESE_INFORMAL=26]="JAPANESE_INFORMAL",A[A.KANNADA=27]="KANNADA",A[A.KATAKANA=28]="KATAKANA",A[A.KATAKANA_IROHA=29]="KATAKANA_IROHA",A[A.KHMER=30]="KHMER",A[A.KOREAN_HANGUL_FORMAL=31]="KOREAN_HANGUL_FORMAL",A[A.KOREAN_HANJA_FORMAL=32]="KOREAN_HANJA_FORMAL",A[A.KOREAN_HANJA_INFORMAL=33]="KOREAN_HANJA_INFORMAL",A[A.LAO=34]="LAO",A[A.LOWER_ARMENIAN=35]="LOWER_ARMENIAN",A[A.MALAYALAM=36]="MALAYALAM",A[A.MONGOLIAN=37]="MONGOLIAN",A[A.MYANMAR=38]="MYANMAR",A[A.ORIYA=39]="ORIYA",A[A.PERSIAN=40]="PERSIAN",A[A.SIMP_CHINESE_FORMAL=41]="SIMP_CHINESE_FORMAL",A[A.SIMP_CHINESE_INFORMAL=42]="SIMP_CHINESE_INFORMAL",A[A.TAMIL=43]="TAMIL",A[A.TELUGU=44]="TELUGU",A[A.THAI=45]="THAI",A[A.TIBETAN=46]="TIBETAN",A[A.TRAD_CHINESE_FORMAL=47]="TRAD_CHINESE_FORMAL",A[A.TRAD_CHINESE_INFORMAL=48]="TRAD_CHINESE_INFORMAL",A[A.UPPER_ARMENIAN=49]="UPPER_ARMENIAN",A[A.DISCLOSURE_OPEN=50]="DISCLOSURE_OPEN",A[A.DISCLOSURE_CLOSED=51]="DISCLOSURE_CLOSED"}(Lt||(Lt={}));var Ot,Dt={name:"list-style-type",initialValue:"none",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"disc":return Lt.DISC;case"circle":return Lt.CIRCLE;case"square":return Lt.SQUARE;case"decimal":return Lt.DECIMAL;case"cjk-decimal":return Lt.CJK_DECIMAL;case"decimal-leading-zero":return Lt.DECIMAL_LEADING_ZERO;case"lower-roman":return Lt.LOWER_ROMAN;case"upper-roman":return Lt.UPPER_ROMAN;case"lower-greek":return Lt.LOWER_GREEK;case"lower-alpha":return Lt.LOWER_ALPHA;case"upper-alpha":return Lt.UPPER_ALPHA;case"arabic-indic":return Lt.ARABIC_INDIC;case"armenian":return Lt.ARMENIAN;case"bengali":return Lt.BENGALI;case"cambodian":return Lt.CAMBODIAN;case"cjk-earthly-branch":return Lt.CJK_EARTHLY_BRANCH;case"cjk-heavenly-stem":return Lt.CJK_HEAVENLY_STEM;case"cjk-ideographic":return Lt.CJK_IDEOGRAPHIC;case"devanagari":return Lt.DEVANAGARI;case"ethiopic-numeric":return Lt.ETHIOPIC_NUMERIC;case"georgian":return Lt.GEORGIAN;case"gujarati":return Lt.GUJARATI;case"gurmukhi":return Lt.GURMUKHI;case"hebrew":return Lt.HEBREW;case"hiragana":return Lt.HIRAGANA;case"hiragana-iroha":return Lt.HIRAGANA_IROHA;case"japanese-formal":return Lt.JAPANESE_FORMAL;case"japanese-informal":return Lt.JAPANESE_INFORMAL;case"kannada":return Lt.KANNADA;case"katakana":return Lt.KATAKANA;case"katakana-iroha":return Lt.KATAKANA_IROHA;case"khmer":return Lt.KHMER;case"korean-hangul-formal":return Lt.KOREAN_HANGUL_FORMAL;case"korean-hanja-formal":return Lt.KOREAN_HANJA_FORMAL;case"korean-hanja-informal":return Lt.KOREAN_HANJA_INFORMAL;case"lao":return Lt.LAO;case"lower-armenian":return Lt.LOWER_ARMENIAN;case"malayalam":return Lt.MALAYALAM;case"mongolian":return Lt.MONGOLIAN;case"myanmar":return Lt.MYANMAR;case"oriya":return Lt.ORIYA;case"persian":return Lt.PERSIAN;case"simp-chinese-formal":return Lt.SIMP_CHINESE_FORMAL;case"simp-chinese-informal":return Lt.SIMP_CHINESE_INFORMAL;case"tamil":return Lt.TAMIL;case"telugu":return Lt.TELUGU;case"thai":return Lt.THAI;case"tibetan":return Lt.TIBETAN;case"trad-chinese-formal":return Lt.TRAD_CHINESE_FORMAL;case"trad-chinese-informal":return Lt.TRAD_CHINESE_INFORMAL;case"upper-armenian":return Lt.UPPER_ARMENIAN;case"disclosure-open":return Lt.DISCLOSURE_OPEN;case"disclosure-closed":return Lt.DISCLOSURE_CLOSED;case"none":default:return Lt.NONE}}},bt=function(A){return{name:"margin-"+A,initialValue:"0",prefix:!1,type:Qe.TOKEN_VALUE}},St=bt("top"),yt=bt("right"),Mt=bt("bottom"),_t=bt("left");!function(A){A[A.VISIBLE=0]="VISIBLE",A[A.HIDDEN=1]="HIDDEN",A[A.SCROLL=2]="SCROLL",A[A.AUTO=3]="AUTO"}(Ot||(Ot={}));var Pt,xt={name:"overflow",initialValue:"visible",prefix:!1,type:Qe.LIST,parse:function(A){return A.filter(_A).map((function(A){switch(A.value){case"hidden":return Ot.HIDDEN;case"scroll":return Ot.SCROLL;case"auto":return Ot.AUTO;case"visible":default:return Ot.VISIBLE}}))}};!function(A){A.NORMAL="normal",A.BREAK_WORD="break-word"}(Pt||(Pt={}));var Vt,zt={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"break-word":return Pt.BREAK_WORD;case"normal":default:return Pt.NORMAL}}},Xt=function(A){return{name:"padding-"+A,initialValue:"0",prefix:!1,type:Qe.TYPE_VALUE,format:"length-percentage"}},Jt=Xt("top"),Gt=Xt("right"),kt=Xt("bottom"),Wt=Xt("left");!function(A){A[A.LEFT=0]="LEFT",A[A.CENTER=1]="CENTER",A[A.RIGHT=2]="RIGHT"}(Vt||(Vt={}));var Yt,qt={name:"text-align",initialValue:"left",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"right":return Vt.RIGHT;case"center":case"justify":return Vt.CENTER;case"left":default:return Vt.LEFT}}};!function(A){A[A.STATIC=0]="STATIC",A[A.RELATIVE=1]="RELATIVE",A[A.ABSOLUTE=2]="ABSOLUTE",A[A.FIXED=3]="FIXED",A[A.STICKY=4]="STICKY"}(Yt||(Yt={}));var Zt,jt={name:"position",initialValue:"static",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"relative":return Yt.RELATIVE;case"absolute":return Yt.ABSOLUTE;case"fixed":return Yt.FIXED;case"sticky":return Yt.STICKY}return Yt.STATIC}},$t={name:"text-shadow",initialValue:"none",type:Qe.LIST,prefix:!1,parse:function(A){return 1===A.length&&xA(A[0],"none")?[]:XA(A).map((function(A){for(var e={color:le.TRANSPARENT,offsetX:YA,offsetY:YA,blur:YA},t=0,r=0;r<A.length;r++){var n=A[r];GA(n)?(0===t?e.offsetX=n:1===t?e.offsetY=n:e.blur=n,t++):e.color=ne(n)}return e}))}};!function(A){A[A.NONE=0]="NONE",A[A.LOWERCASE=1]="LOWERCASE",A[A.UPPERCASE=2]="UPPERCASE",A[A.CAPITALIZE=3]="CAPITALIZE"}(Zt||(Zt={}));var Ar,er={name:"text-transform",initialValue:"none",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"uppercase":return Zt.UPPERCASE;case"lowercase":return Zt.LOWERCASE;case"capitalize":return Zt.CAPITALIZE}return Zt.NONE}},tr={name:"transform",initialValue:"none",prefix:!0,type:Qe.VALUE,parse:function(A){if(A.type===u.IDENT_TOKEN&&"none"===A.value)return null;if(A.type===u.FUNCTION){var e=rr[A.name];if(void 0===e)throw new Error('Attempting to parse an unsupported transform function "'+A.name+'"');return e(A.values)}return null}},rr={matrix:function(A){var e=A.filter((function(A){return A.type===u.NUMBER_TOKEN})).map((function(A){return A.number}));return 6===e.length?e:null},matrix3d:function(A){var e=A.filter((function(A){return A.type===u.NUMBER_TOKEN})).map((function(A){return A.number})),t=e[0],r=e[1],n=(e[2],e[3],e[4]),B=e[5],s=(e[6],e[7],e[8],e[9],e[10],e[11],e[12]),o=e[13];return e[14],e[15],16===e.length?[t,r,n,B,s,o]:null}},nr={type:u.PERCENTAGE_TOKEN,number:50,flags:4},Br=[nr,nr],sr={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:Qe.LIST,parse:function(A){var e=A.filter(kA);return 2!==e.length?Br:[e[0],e[1]]}};!function(A){A[A.VISIBLE=0]="VISIBLE",A[A.HIDDEN=1]="HIDDEN",A[A.COLLAPSE=2]="COLLAPSE"}(Ar||(Ar={}));var or,ir={name:"visible",initialValue:"none",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"hidden":return Ar.HIDDEN;case"collapse":return Ar.COLLAPSE;case"visible":default:return Ar.VISIBLE}}};!function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"}(or||(or={}));var ar,cr={name:"word-break",initialValue:"normal",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"break-all":return or.BREAK_ALL;case"keep-all":return or.KEEP_ALL;case"normal":default:return or.NORMAL}}},Qr={name:"z-index",initialValue:"auto",prefix:!1,type:Qe.VALUE,parse:function(A){if(A.type===u.IDENT_TOKEN)return{auto:!0,order:0};if(MA(A))return{auto:!1,order:A.number};throw new Error("Invalid z-index number parsed")}},ur={name:"opacity",initialValue:"1",type:Qe.VALUE,prefix:!1,parse:function(A){return MA(A)?A.number:1}},wr={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:Qe.TYPE_VALUE,format:"color"},Ur={name:"text-decoration-line",initialValue:"none",prefix:!1,type:Qe.LIST,parse:function(A){return A.filter(_A).map((function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0})).filter((function(A){return 0!==A}))}},lr={name:"font-family",initialValue:"",prefix:!1,type:Qe.LIST,parse:function(A){return A.filter(Cr).map((function(A){return A.value}))}},Cr=function(A){return A.type===u.STRING_TOKEN||A.type===u.IDENT_TOKEN},gr={name:"font-size",initialValue:"0",prefix:!1,type:Qe.TYPE_VALUE,format:"length"},Er={name:"font-weight",initialValue:"normal",type:Qe.VALUE,prefix:!1,parse:function(A){if(MA(A))return A.number;if(_A(A))switch(A.value){case"bold":return 700;case"normal":default:return 400}return 400}},hr={name:"font-variant",initialValue:"none",type:Qe.LIST,prefix:!1,parse:function(A){return A.filter(_A).map((function(A){return A.value}))}};!function(A){A.NORMAL="normal",A.ITALIC="italic",A.OBLIQUE="oblique"}(ar||(ar={}));var Fr,dr={name:"font-style",initialValue:"normal",prefix:!1,type:Qe.IDENT_VALUE,parse:function(A){switch(A){case"oblique":return ar.OBLIQUE;case"italic":return ar.ITALIC;case"normal":default:return ar.NORMAL}}},Hr=function(A,e){return 0!=(A&e)},fr={name:"content",initialValue:"none",type:Qe.LIST,prefix:!1,parse:function(A){if(0===A.length)return[];var e=A[0];return e.type===u.IDENT_TOKEN&&"none"===e.value?[]:A}},pr={name:"counter-increment",initialValue:"none",prefix:!0,type:Qe.LIST,parse:function(A){if(0===A.length)return null;var e=A[0];if(e.type===u.IDENT_TOKEN&&"none"===e.value)return null;for(var t=[],r=A.filter(VA),n=0;n<r.length;n++){var B=r[n],s=r[n+1];if(B.type===u.IDENT_TOKEN){var o=s&&MA(s)?s.number:1;t.push({counter:B.value,increment:o})}}return t}},Nr={name:"counter-reset",initialValue:"none",prefix:!0,type:Qe.LIST,parse:function(A){if(0===A.length)return[];for(var e=[],t=A.filter(VA),r=0;r<t.length;r++){var n=t[r],B=t[r+1];if(_A(n)&&"none"!==n.value){var s=B&&MA(B)?B.number:0;e.push({counter:n.value,reset:s})}}return e}},Kr={name:"quotes",initialValue:"none",prefix:!0,type:Qe.LIST,parse:function(A){if(0===A.length)return null;var e=A[0];if(e.type===u.IDENT_TOKEN&&"none"===e.value)return null;var t=[],r=A.filter(PA);if(r.length%2!=0)return null;for(var n=0;n<r.length;n+=2){var B=r[n].value,s=r[n+1].value;t.push({open:B,close:s})}return t}},Ir=function(A,e,t){if(!A)return"";var r=A[Math.min(e,A.length-1)];return r?t?r.open:r.close:""},mr={name:"box-shadow",initialValue:"none",type:Qe.LIST,prefix:!1,parse:function(A){return 1===A.length&&xA(A[0],"none")?[]:XA(A).map((function(A){for(var e={color:255,offsetX:YA,offsetY:YA,blur:YA,spread:YA,inset:!1},t=0,r=0;r<A.length;r++){var n=A[r];xA(n,"inset")?e.inset=!0:GA(n)?(0===t?e.offsetX=n:1===t?e.offsetY=n:2===t?e.blur=n:e.spread=n,t++):e.color=ne(n)}return e}))}},Tr=function(){function A(A){this.backgroundClip=vr(he,A.backgroundClip),this.backgroundColor=vr(Fe,A.backgroundColor),this.backgroundImage=vr(Je,A.backgroundImage),this.backgroundOrigin=vr(Ge,A.backgroundOrigin),this.backgroundPosition=vr(ke,A.backgroundPosition),this.backgroundRepeat=vr(Ye,A.backgroundRepeat),this.backgroundSize=vr(je,A.backgroundSize),this.borderTopColor=vr(et,A.borderTopColor),this.borderRightColor=vr(tt,A.borderRightColor),this.borderBottomColor=vr(rt,A.borderBottomColor),this.borderLeftColor=vr(nt,A.borderLeftColor),this.borderTopLeftRadius=vr(st,A.borderTopLeftRadius),this.borderTopRightRadius=vr(ot,A.borderTopRightRadius),this.borderBottomRightRadius=vr(it,A.borderBottomRightRadius),this.borderBottomLeftRadius=vr(at,A.borderBottomLeftRadius),this.borderTopStyle=vr(ut,A.borderTopStyle),this.borderRightStyle=vr(wt,A.borderRightStyle),this.borderBottomStyle=vr(Ut,A.borderBottomStyle),this.borderLeftStyle=vr(lt,A.borderLeftStyle),this.borderTopWidth=vr(gt,A.borderTopWidth),this.borderRightWidth=vr(Et,A.borderRightWidth),this.borderBottomWidth=vr(ht,A.borderBottomWidth),this.borderLeftWidth=vr(Ft,A.borderLeftWidth),this.boxShadow=vr(mr,A.boxShadow),this.color=vr(dt,A.color),this.display=vr(Ht,A.display),this.float=vr(Nt,A.cssFloat),this.fontFamily=vr(lr,A.fontFamily),this.fontSize=vr(gr,A.fontSize),this.fontStyle=vr(dr,A.fontStyle),this.fontVariant=vr(hr,A.fontVariant),this.fontWeight=vr(Er,A.fontWeight),this.letterSpacing=vr(Kt,A.letterSpacing),this.lineBreak=vr(mt,A.lineBreak),this.lineHeight=vr(Tt,A.lineHeight),this.listStyleImage=vr(Rt,A.listStyleImage),this.listStylePosition=vr(vt,A.listStylePosition),this.listStyleType=vr(Dt,A.listStyleType),this.marginTop=vr(St,A.marginTop),this.marginRight=vr(yt,A.marginRight),this.marginBottom=vr(Mt,A.marginBottom),this.marginLeft=vr(_t,A.marginLeft),this.opacity=vr(ur,A.opacity);var e=vr(xt,A.overflow);this.overflowX=e[0],this.overflowY=e[e.length>1?1:0],this.overflowWrap=vr(zt,A.overflowWrap),this.paddingTop=vr(Jt,A.paddingTop),this.paddingRight=vr(Gt,A.paddingRight),this.paddingBottom=vr(kt,A.paddingBottom),this.paddingLeft=vr(Wt,A.paddingLeft),this.position=vr(jt,A.position),this.textAlign=vr(qt,A.textAlign),this.textDecorationColor=vr(wr,A.textDecorationColor||A.color),this.textDecorationLine=vr(Ur,A.textDecorationLine),this.textShadow=vr($t,A.textShadow),this.textTransform=vr(er,A.textTransform),this.transform=vr(tr,A.transform),this.transformOrigin=vr(sr,A.transformOrigin),this.visibility=vr(ir,A.visibility),this.wordBreak=vr(cr,A.wordBreak),this.zIndex=vr(Qr,A.zIndex)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===Ar.VISIBLE},A.prototype.isTransparent=function(){return Be(this.backgroundColor)},A.prototype.isTransformed=function(){return null!==this.transform},A.prototype.isPositioned=function(){return this.position!==Yt.STATIC},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==ct.NONE},A.prototype.isInlineLevel=function(){return Hr(this.display,4)||Hr(this.display,33554432)||Hr(this.display,268435456)||Hr(this.display,536870912)||Hr(this.display,67108864)||Hr(this.display,134217728)},A}(),Rr=function(A){this.content=vr(fr,A.content),this.quotes=vr(Kr,A.quotes)},Lr=function(A){this.counterIncrement=vr(pr,A.counterIncrement),this.counterReset=vr(Nr,A.counterReset)},vr=function(A,e){var t=new bA,r=null!=e?e.toString():A.initialValue;t.write(r);var n=new SA(t.read());switch(A.type){case Qe.IDENT_VALUE:var B=n.parseComponentValue();return A.parse(_A(B)?B.value:A.initialValue);case Qe.VALUE:return A.parse(n.parseComponentValue());case Qe.LIST:return A.parse(n.parseComponentValues());case Qe.TOKEN_VALUE:return n.parseComponentValue();case Qe.TYPE_VALUE:switch(A.format){case"angle":return Ae(n.parseComponentValue());case"color":return ne(n.parseComponentValue());case"image":return ze(n.parseComponentValue());case"length":var s=n.parseComponentValue();return GA(s)?s:YA;case"length-percentage":var o=n.parseComponentValue();return kA(o)?o:YA}}throw new Error("Attempting to parse unsupported css format type "+A.format)},Or=function(A){this.styles=new Tr(window.getComputedStyle(A,null)),this.textNodes=[],this.elements=[],null!==this.styles.transform&&Bn(A)&&(A.style.transform="none"),this.bounds=s(A),this.flags=0},Dr=function(A,e){this.text=A,this.bounds=e},br=function(A,e){this.text=Sr(A.data,e.textTransform),this.textBounds=function(A,e,t){var r=function(A,e){return 0!==e.letterSpacing?o(A).map((function(A){return i(A)})):function(A,e){for(var t,r=function(A,e){var t=o(A),r=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=function(A,e){void 0===e&&(e="strict");var t=[],r=[],n=[];return A.forEach((function(A,B){var s=G.get(A);if(s>50?(n.push(!0),s-=50):n.push(!1),-1!==["normal","auto","loose"].indexOf(e)&&-1!==[8208,8211,12316,12448].indexOf(A))return r.push(B),t.push(16);if(4===s||11===s){if(0===B)return r.push(B),t.push(S);var o=t[B-1];return-1===Z.indexOf(o)?(r.push(r[B-1]),t.push(o)):(r.push(B),t.push(S))}return r.push(B),31===s?t.push("strict"===e?T:x):s===J||29===s?t.push(S):43===s?A>=131072&&A<=196605||A>=196608&&A<=262141?t.push(x):t.push(S):void t.push(s)})),[r,t,n]}(A,e.lineBreak),r=t[0],n=t[1],B=t[2];return"break-all"!==e.wordBreak&&"break-word"!==e.wordBreak||(n=n.map((function(A){return-1!==[v,S,J].indexOf(A)?x:A}))),[r,n,"keep-all"===e.wordBreak?B.map((function(e,t){return e&&A[t]>=19968&&A[t]<=40959})):void 0]}(t,e),n=r[0],B=r[1],s=r[2],i=t.length,a=0,c=0;return{next:function(){if(c>=i)return{done:!0,value:null};for(var A="×";c<i&&"×"===(A=tA(t,B,n,++c,s)););if("×"!==A||c===i){var e=new rA(t,A,a,c);return a=c,{value:e,done:!1}}return{done:!0,value:null}}}}(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap===Pt.BREAK_WORD?"break-word":e.wordBreak}),n=[];!(t=r.next()).done;)t.value&&n.push(t.value.slice());return n}(A,e)}(A,e),n=[],a=0;return r.forEach((function(A){if(e.textDecorationLine.length||A.trim().length>0)if(Te.SUPPORT_RANGE_BOUNDS)n.push(new Dr(A,function(A,e,t){var r=A.ownerDocument;if(!r)throw new Error("Node has no owner document");var n=r.createRange();return n.setStart(A,e),n.setEnd(A,e+t),B.fromClientRect(n.getBoundingClientRect())}(t,a,A.length)));else{var r=t.splitText(A.length);n.push(new Dr(A,function(A){var e=A.ownerDocument;if(e){var t=e.createElement("html2canvaswrapper");t.appendChild(A.cloneNode(!0));var r=A.parentNode;if(r){r.replaceChild(t,A);var n=s(t);return t.firstChild&&r.replaceChild(t.firstChild,t),n}}return new B(0,0,0,0)}(t))),t=r}else Te.SUPPORT_RANGE_BOUNDS||(t=t.splitText(A.length));a+=A.length})),n}(this.text,e,A)},Sr=function(A,e){switch(e){case Zt.LOWERCASE:return A.toLowerCase();case Zt.CAPITALIZE:return A.replace(yr,Mr);case Zt.UPPERCASE:return A.toUpperCase();default:return A}},yr=/(^|\s|:|-|\(|\))([a-z])/g,Mr=function(A,e,t){return A.length>0?e+t.toUpperCase():A},_r=function(A){function t(e){var t=A.call(this,e)||this;return t.src=e.currentSrc||e.src,t.intrinsicWidth=e.naturalWidth,t.intrinsicHeight=e.naturalHeight,Le.getInstance().addImage(t.src),t}return e(t,A),t}(Or),Pr=function(A){function t(e){var t=A.call(this,e)||this;return t.canvas=e,t.intrinsicWidth=e.width,t.intrinsicHeight=e.height,t}return e(t,A),t}(Or),xr=function(A){function t(e){var t=A.call(this,e)||this,r=new XMLSerializer;return t.svg="data:image/svg+xml,"+encodeURIComponent(r.serializeToString(e)),t.intrinsicWidth=e.width.baseVal.value,t.intrinsicHeight=e.height.baseVal.value,Le.getInstance().addImage(t.svg),t}return e(t,A),t}(Or),Vr=function(A){function t(e){var t=A.call(this,e)||this;return t.value=e.value,t}return e(t,A),t}(Or),zr=function(A){function t(e){var t=A.call(this,e)||this;return t.start=e.start,t.reversed="boolean"==typeof e.reversed&&!0===e.reversed,t}return e(t,A),t}(Or),Xr=[{type:u.DIMENSION_TOKEN,flags:0,unit:"px",number:3}],Jr=[{type:u.PERCENTAGE_TOKEN,flags:0,number:50}],Gr=function(A){function t(e){var t,r,n,s=A.call(this,e)||this;switch(s.type=e.type.toLowerCase(),s.checked=e.checked,s.value=0===(r="password"===(t=e).type?new Array(t.value.length+1).join("•"):t.value).length?t.placeholder||"":r,"checkbox"!==s.type&&"radio"!==s.type||(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=Ze.SOLID,s.styles.backgroundClip=[ue.BORDER_BOX],s.styles.backgroundOrigin=[0],s.bounds=(n=s.bounds).width>n.height?new B(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width<n.height?new B(n.left,n.top+(n.height-n.width)/2,n.width,n.width):n),s.type){case"checkbox":s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=Xr;break;case"radio":s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=Jr}return s}return e(t,A),t}(Or),kr=function(A){function t(e){var t=A.call(this,e)||this,r=e.options[e.selectedIndex||0];return t.value=r&&r.text||"",t}return e(t,A),t}(Or),Wr=function(A){function t(e){var t=A.call(this,e)||this;return t.value=e.value,t}return e(t,A),t}(Or),Yr=function(A){return ne(SA.create(A).parseComponentValue())},qr=function(A){function t(e){var t=A.call(this,e)||this;t.src=e.src,t.width=parseInt(e.width,10)||0,t.height=parseInt(e.height,10)||0,t.backgroundColor=t.styles.backgroundColor;try{if(e.contentWindow&&e.contentWindow.document&&e.contentWindow.document.documentElement){t.tree=An(e.contentWindow.document.documentElement);var r=e.contentWindow.document.documentElement?Yr(getComputedStyle(e.contentWindow.document.documentElement).backgroundColor):le.TRANSPARENT,n=e.contentWindow.document.body?Yr(getComputedStyle(e.contentWindow.document.body).backgroundColor):le.TRANSPARENT;t.backgroundColor=Be(r)?Be(n)?t.styles.backgroundColor:n:r}}catch(A){}return t}return e(t,A),t}(Or),Zr=["OL","UL","MENU"],jr=function(A,e,t){for(var r=A.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,rn(r)&&r.data.trim().length>0)e.textNodes.push(new br(r,e.styles));else if(nn(r)){var B=$r(r);B.styles.isVisible()&&(en(r,B,t)?B.flags|=4:tn(B.styles)&&(B.flags|=2),-1!==Zr.indexOf(r.tagName)&&(B.flags|=8),e.elements.push(B),gn(r)||cn(r)||En(r)||jr(r,B,t))}},$r=function(A){return wn(A)?new _r(A):un(A)?new Pr(A):cn(A)?new xr(A):sn(A)?new Vr(A):on(A)?new zr(A):an(A)?new Gr(A):En(A)?new kr(A):gn(A)?new Wr(A):Un(A)?new qr(A):new Or(A)},An=function(A){var e=$r(A);return e.flags|=4,jr(A,e,e),e},en=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Qn(A)&&t.styles.isTransparent()},tn=function(A){return A.isPositioned()||A.isFloating()},rn=function(A){return A.nodeType===Node.TEXT_NODE},nn=function(A){return A.nodeType===Node.ELEMENT_NODE},Bn=function(A){return void 0!==A.style},sn=function(A){return"LI"===A.tagName},on=function(A){return"OL"===A.tagName},an=function(A){return"INPUT"===A.tagName},cn=function(A){return"svg"===A.tagName},Qn=function(A){return"BODY"===A.tagName},un=function(A){return"CANVAS"===A.tagName},wn=function(A){return"IMG"===A.tagName},Un=function(A){return"IFRAME"===A.tagName},ln=function(A){return"STYLE"===A.tagName},Cn=function(A){return"SCRIPT"===A.tagName},gn=function(A){return"TEXTAREA"===A.tagName},En=function(A){return"SELECT"===A.tagName},hn=function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(A){var e=this.counters[A];return e&&e.length?e[e.length-1]:1},A.prototype.getCounterValues=function(A){return this.counters[A]||[]},A.prototype.pop=function(A){var e=this;A.forEach((function(A){return e.counters[A].pop()}))},A.prototype.parse=function(A){var e=this,t=A.counterIncrement,r=A.counterReset,n=!0;null!==t&&t.forEach((function(A){var t=e.counters[A.counter];t&&0!==A.increment&&(n=!1,t[Math.max(0,t.length-1)]+=A.increment)}));var B=[];return n&&r.forEach((function(A){var t=e.counters[A.counter];B.push(A.counter),t||(t=e.counters[A.counter]=[]),t.push(A.reset)})),B},A}(),Fn={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},dn={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Hn={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},fn={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},pn=function(A,e,t,r,n,B){return A<e||A>t?Tn(A,n,B.length>0):r.integers.reduce((function(e,t,n){for(;A>=t;)A-=t,e+=r.values[n];return e}),"")+B},Nn=function(A,e,t,r){var n="";do{t||A--,n=r(A)+n,A/=e}while(A*e>=e);return n},Kn=function(A,e,t,r,n){var B=t-e+1;return(A<0?"-":"")+(Nn(Math.abs(A),B,r,(function(A){return i(Math.floor(A%B)+e)}))+n)},In=function(A,e,t){void 0===t&&(t=". ");var r=e.length;return Nn(Math.abs(A),r,!1,(function(A){return e[Math.floor(A%r)]}))+t},mn=function(A,e,t,r,n,B){if(A<-9999||A>9999)return Tn(A,Lt.CJK_DECIMAL,n.length>0);var s=Math.abs(A),o=n;if(0===s)return e[0]+o;for(var i=0;s>0&&i<=4;i++){var a=s%10;0===a&&Hr(B,1)&&""!==o?o=e[a]+o:a>1||1===a&&0===i||1===a&&1===i&&Hr(B,2)||1===a&&1===i&&Hr(B,4)&&A>100||1===a&&i>1&&Hr(B,8)?o=e[a]+(i>0?t[i-1]:"")+o:1===a&&i>0&&(o=t[i-1]+o),s=Math.floor(s/10)}return(A<0?r:"")+o},Tn=function(A,e,t){var r=t?". ":"",n=t?"、":"",B=t?", ":"",s=t?" ":"";switch(e){case Lt.DISC:return"•"+s;case Lt.CIRCLE:return"◦"+s;case Lt.SQUARE:return"◾"+s;case Lt.DECIMAL_LEADING_ZERO:var o=Kn(A,48,57,!0,r);return o.length<4?"0"+o:o;case Lt.CJK_DECIMAL:return In(A,"〇一二三四五六七八九",n);case Lt.LOWER_ROMAN:return pn(A,1,3999,Fn,Lt.DECIMAL,r).toLowerCase();case Lt.UPPER_ROMAN:return pn(A,1,3999,Fn,Lt.DECIMAL,r);case Lt.LOWER_GREEK:return Kn(A,945,969,!1,r);case Lt.LOWER_ALPHA:return Kn(A,97,122,!1,r);case Lt.UPPER_ALPHA:return Kn(A,65,90,!1,r);case Lt.ARABIC_INDIC:return Kn(A,1632,1641,!0,r);case Lt.ARMENIAN:case Lt.UPPER_ARMENIAN:return pn(A,1,9999,dn,Lt.DECIMAL,r);case Lt.LOWER_ARMENIAN:return pn(A,1,9999,dn,Lt.DECIMAL,r).toLowerCase();case Lt.BENGALI:return Kn(A,2534,2543,!0,r);case Lt.CAMBODIAN:case Lt.KHMER:return Kn(A,6112,6121,!0,r);case Lt.CJK_EARTHLY_BRANCH:return In(A,"子丑寅卯辰巳午未申酉戌亥",n);case Lt.CJK_HEAVENLY_STEM:return In(A,"甲乙丙丁戊己庚辛壬癸",n);case Lt.CJK_IDEOGRAPHIC:case Lt.TRAD_CHINESE_INFORMAL:return mn(A,"零一二三四五六七八九","十百千萬","負",n,14);case Lt.TRAD_CHINESE_FORMAL:return mn(A,"零壹貳參肆伍陸柒捌玖","拾佰仟萬","負",n,15);case Lt.SIMP_CHINESE_INFORMAL:return mn(A,"零一二三四五六七八九","十百千萬","负",n,14);case Lt.SIMP_CHINESE_FORMAL:return mn(A,"零壹贰叁肆伍陆柒捌玖","拾佰仟萬","负",n,15);case Lt.JAPANESE_INFORMAL:return mn(A,"〇一二三四五六七八九","十百千万","マイナス",n,0);case Lt.JAPANESE_FORMAL:return mn(A,"零壱弐参四伍六七八九","拾百千万","マイナス",n,7);case Lt.KOREAN_HANGUL_FORMAL:return mn(A,"영일이삼사오육칠팔구","십백천만","마이너스",B,7);case Lt.KOREAN_HANJA_INFORMAL:return mn(A,"零一二三四五六七八九","十百千萬","마이너스",B,0);case Lt.KOREAN_HANJA_FORMAL:return mn(A,"零壹貳參四五六七八九","拾百千","마이너스",B,7);case Lt.DEVANAGARI:return Kn(A,2406,2415,!0,r);case Lt.GEORGIAN:return pn(A,1,19999,fn,Lt.DECIMAL,r);case Lt.GUJARATI:return Kn(A,2790,2799,!0,r);case Lt.GURMUKHI:return Kn(A,2662,2671,!0,r);case Lt.HEBREW:return pn(A,1,10999,Hn,Lt.DECIMAL,r);case Lt.HIRAGANA:return In(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case Lt.HIRAGANA_IROHA:return In(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case Lt.KANNADA:return Kn(A,3302,3311,!0,r);case Lt.KATAKANA:return In(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case Lt.KATAKANA_IROHA:return In(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case Lt.LAO:return Kn(A,3792,3801,!0,r);case Lt.MONGOLIAN:return Kn(A,6160,6169,!0,r);case Lt.MYANMAR:return Kn(A,4160,4169,!0,r);case Lt.ORIYA:return Kn(A,2918,2927,!0,r);case Lt.PERSIAN:return Kn(A,1776,1785,!0,r);case Lt.TAMIL:return Kn(A,3046,3055,!0,r);case Lt.TELUGU:return Kn(A,3174,3183,!0,r);case Lt.THAI:return Kn(A,3664,3673,!0,r);case Lt.TIBETAN:return Kn(A,3872,3881,!0,r);case Lt.DECIMAL:default:return Kn(A,48,57,!0,r)}},Rn=function(){function A(A,e){if(this.options=e,this.scrolledElements=[],this.referenceElement=A,this.counters=new hn,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement)}return A.prototype.toIFrame=function(A,e){var t=this,B=vn(A,e);if(!B.contentWindow)return Promise.reject("Unable to find iframe window");var s=A.defaultView.pageXOffset,o=A.defaultView.pageYOffset,i=B.contentWindow,a=i.document,c=On(B).then((function(){return r(t,void 0,void 0,(function(){var A;return n(this,(function(t){switch(t.label){case 0:return this.scrolledElements.forEach(yn),i&&(i.scrollTo(e.left,e.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||i.scrollY===e.top&&i.scrollX===e.left||(a.documentElement.style.top=-e.top+"px",a.documentElement.style.left=-e.left+"px",a.documentElement.style.position="absolute")),A=this.options.onclone,void 0===this.clonedReferenceElement?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:t.sent(),t.label=2;case 2:return"function"==typeof A?[2,Promise.resolve().then((function(){return A(a)})).then((function(){return B}))]:[2,B]}}))}))}));return a.open(),a.write(bn(document.doctype)+"<html></html>"),Sn(this.referenceElement.ownerDocument,s,o),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),c},A.prototype.createElementClone=function(A){return un(A)?this.createCanvasClone(A):ln(A)?this.createStyleClone(A):A.cloneNode(!1)},A.prototype.createStyleClone=function(A){try{var e=A.sheet;if(e&&e.cssRules){var t=[].slice.call(e.cssRules,0).reduce((function(A,e){return e&&"string"==typeof e.cssText?A+e.cssText:A}),""),r=A.cloneNode(!1);return r.textContent=t,r}}catch(A){if(Re.getInstance(this.options.id).error("Unable to access cssRules property",A),"SecurityError"!==A.name)throw A}return A.cloneNode(!1)},A.prototype.createCanvasClone=function(A){if(this.options.inlineImages&&A.ownerDocument){var e=A.ownerDocument.createElement("img");try{return e.src=A.toDataURL(),e}catch(A){Re.getInstance(this.options.id).info("Unable to clone canvas contents, canvas is tainted")}}var t=A.cloneNode(!1);try{t.width=A.width,t.height=A.height;var r=A.getContext("2d"),n=t.getContext("2d");return n&&(r?n.putImageData(r.getImageData(0,0,A.width,A.height),0,0):n.drawImage(A,0,0)),t}catch(A){}return t},A.prototype.cloneNode=function(A){if(rn(A))return document.createTextNode(A.data);if(!A.ownerDocument)return A.cloneNode(!1);var e=A.ownerDocument.defaultView;if(Bn(A)&&e){var t=this.createElementClone(A),r=e.getComputedStyle(A),n=e.getComputedStyle(A,":before"),B=e.getComputedStyle(A,":after");this.referenceElement===A&&(this.clonedReferenceElement=t),Qn(t)&&Pn(t);for(var s=this.counters.parse(new Lr(r)),o=this.resolvePseudoContent(A,t,n,Fr.BEFORE),i=A.firstChild;i;i=i.nextSibling)nn(i)&&(Cn(i)||i.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(i))||this.options.copyStyles&&nn(i)&&ln(i)||t.appendChild(this.cloneNode(i));o&&t.insertBefore(o,t.firstChild);var a=this.resolvePseudoContent(A,t,B,Fr.AFTER);return a&&t.appendChild(a),this.counters.pop(s),r&&this.options.copyStyles&&!Un(A)&&Dn(r,t),0===A.scrollTop&&0===A.scrollLeft||this.scrolledElements.push([t,A.scrollLeft,A.scrollTop]),(gn(A)||En(A))&&(gn(t)||En(t))&&(t.value=A.value),t}return A.cloneNode(!1)},A.prototype.resolvePseudoContent=function(A,e,t,r){var n=this;if(t){var B=t.content,s=e.ownerDocument;if(s&&B&&"none"!==B&&"-moz-alt-content"!==B&&"none"!==t.display){this.counters.parse(new Lr(t));var o=new Rr(t),i=s.createElement("html2canvaspseudoelement");Dn(t,i),o.content.forEach((function(e){if(e.type===u.STRING_TOKEN)i.appendChild(s.createTextNode(e.value));else if(e.type===u.URL_TOKEN){var t=s.createElement("img");t.src=e.value,t.style.opacity="1",i.appendChild(t)}else if(e.type===u.FUNCTION){if("attr"===e.name){var r=e.values.filter(_A);r.length&&i.appendChild(s.createTextNode(A.getAttribute(r[0].value)||""))}else if("counter"===e.name){var B=e.values.filter(zA),a=B[0],c=B[1];if(a&&_A(a)){var Q=n.counters.getCounterValue(a.value),w=c&&_A(c)?Dt.parse(c.value):Lt.DECIMAL;i.appendChild(s.createTextNode(Tn(Q,w,!1)))}}else if("counters"===e.name){var U=e.values.filter(zA),l=(a=U[0],U[1]);if(c=U[2],a&&_A(a)){var C=n.counters.getCounterValues(a.value),g=c&&_A(c)?Dt.parse(c.value):Lt.DECIMAL,E=l&&l.type===u.STRING_TOKEN?l.value:"",h=C.map((function(A){return Tn(A,g,!1)})).join(E);i.appendChild(s.createTextNode(h))}}}else if(e.type===u.IDENT_TOKEN)switch(e.value){case"open-quote":i.appendChild(s.createTextNode(Ir(o.quotes,n.quoteDepth++,!0)));break;case"close-quote":i.appendChild(s.createTextNode(Ir(o.quotes,--n.quoteDepth,!1)));break;default:i.appendChild(s.createTextNode(e.value))}})),i.className=Mn+" "+_n;var a=r===Fr.BEFORE?" "+Mn:" "+_n;return"object"==typeof e.className?e.className.baseValue+=a:e.className+=a,i}}},A.destroy=function(A){return!!A.parentNode&&(A.parentNode.removeChild(A),!0)},A}();!function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"}(Fr||(Fr={}));var Ln,vn=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute("data-html2canvas-ignore","true"),A.body.appendChild(t),t},On=function(A){return new Promise((function(e,t){var r=A.contentWindow;if(!r)return t("No window assigned for iframe");var n=r.document;r.onload=A.onload=n.onreadystatechange=function(){r.onload=A.onload=n.onreadystatechange=null;var t=setInterval((function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(t),e(A))}),50)}}))},Dn=function(A,e){for(var t=A.length-1;t>=0;t--){var r=A.item(t);"content"!==r&&e.style.setProperty(r,A.getPropertyValue(r))}return e},bn=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'+A.publicId+'"'),A.systemId&&(e+='"'+A.systemId+'"'),e+=">"),e},Sn=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},yn=function(A){var e=A[0],t=A[1],r=A[2];e.scrollLeft=t,e.scrollTop=r},Mn="___html2canvas___pseudoelement_before",_n="___html2canvas___pseudoelement_after",Pn=function(A){xn(A,"."+Mn+':before{\n    content: "" !important;\n    display: none !important;\n}\n         .'+_n+':after{\n    content: "" !important;\n    display: none !important;\n}')},xn=function(A,e){var t=A.ownerDocument;if(t){var r=t.createElement("style");r.textContent=e,A.appendChild(r)}};!function(A){A[A.VECTOR=0]="VECTOR",A[A.BEZIER_CURVE=1]="BEZIER_CURVE"}(Ln||(Ln={}));var Vn,zn=function(A,e){return A.length===e.length&&A.some((function(A,t){return A===e[t]}))},Xn=function(){function A(A,e){this.type=Ln.VECTOR,this.x=A,this.y=e}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Jn=function(A,e,t){return new Xn(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},Gn=function(){function A(A,e,t,r){this.type=Ln.BEZIER_CURVE,this.start=A,this.startControl=e,this.endControl=t,this.end=r}return A.prototype.subdivide=function(e,t){var r=Jn(this.start,this.startControl,e),n=Jn(this.startControl,this.endControl,e),B=Jn(this.endControl,this.end,e),s=Jn(r,n,e),o=Jn(n,B,e),i=Jn(s,o,e);return t?new A(this.start,r,s,i):new A(i,o,B,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),kn=function(A){return A.type===Ln.BEZIER_CURVE},Wn=function(A){var e=A.styles,t=A.bounds,r=jA(e.borderTopLeftRadius,t.width,t.height),n=r[0],B=r[1],s=jA(e.borderTopRightRadius,t.width,t.height),o=s[0],i=s[1],a=jA(e.borderBottomRightRadius,t.width,t.height),c=a[0],Q=a[1],u=jA(e.borderBottomLeftRadius,t.width,t.height),w=u[0],U=u[1],l=[];l.push((n+o)/t.width),l.push((w+c)/t.width),l.push((B+U)/t.height),l.push((i+Q)/t.height);var C=Math.max.apply(Math,l);C>1&&(n/=C,B/=C,o/=C,i/=C,c/=C,Q/=C,w/=C,U/=C);var g=t.width-o,E=t.height-Q,h=t.width-c,F=t.height-U,d=e.borderTopWidth,H=e.borderRightWidth,f=e.borderBottomWidth,p=e.borderLeftWidth,N=$A(e.paddingTop,A.bounds.width),K=$A(e.paddingRight,A.bounds.width),I=$A(e.paddingBottom,A.bounds.width),m=$A(e.paddingLeft,A.bounds.width);this.topLeftBorderBox=n>0||B>0?Yn(t.left,t.top,n,B,Vn.TOP_LEFT):new Xn(t.left,t.top),this.topRightBorderBox=o>0||i>0?Yn(t.left+g,t.top,o,i,Vn.TOP_RIGHT):new Xn(t.left+t.width,t.top),this.bottomRightBorderBox=c>0||Q>0?Yn(t.left+h,t.top+E,c,Q,Vn.BOTTOM_RIGHT):new Xn(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=w>0||U>0?Yn(t.left,t.top+F,w,U,Vn.BOTTOM_LEFT):new Xn(t.left,t.top+t.height),this.topLeftPaddingBox=n>0||B>0?Yn(t.left+p,t.top+d,Math.max(0,n-p),Math.max(0,B-d),Vn.TOP_LEFT):new Xn(t.left+p,t.top+d),this.topRightPaddingBox=o>0||i>0?Yn(t.left+Math.min(g,t.width+p),t.top+d,g>t.width+p?0:o-p,i-d,Vn.TOP_RIGHT):new Xn(t.left+t.width-H,t.top+d),this.bottomRightPaddingBox=c>0||Q>0?Yn(t.left+Math.min(h,t.width-p),t.top+Math.min(E,t.height+d),Math.max(0,c-H),Q-f,Vn.BOTTOM_RIGHT):new Xn(t.left+t.width-H,t.top+t.height-f),this.bottomLeftPaddingBox=w>0||U>0?Yn(t.left+p,t.top+F,Math.max(0,w-p),U-f,Vn.BOTTOM_LEFT):new Xn(t.left+p,t.top+t.height-f),this.topLeftContentBox=n>0||B>0?Yn(t.left+p+m,t.top+d+N,Math.max(0,n-(p+m)),Math.max(0,B-(d+N)),Vn.TOP_LEFT):new Xn(t.left+p+m,t.top+d+N),this.topRightContentBox=o>0||i>0?Yn(t.left+Math.min(g,t.width+p+m),t.top+d+N,g>t.width+p+m?0:o-p+m,i-(d+N),Vn.TOP_RIGHT):new Xn(t.left+t.width-(H+K),t.top+d+N),this.bottomRightContentBox=c>0||Q>0?Yn(t.left+Math.min(h,t.width-(p+m)),t.top+Math.min(E,t.height+d+N),Math.max(0,c-(H+K)),Q-(f+I),Vn.BOTTOM_RIGHT):new Xn(t.left+t.width-(H+K),t.top+t.height-(f+I)),this.bottomLeftContentBox=w>0||U>0?Yn(t.left+p+m,t.top+F,Math.max(0,w-(p+m)),U-(f+I),Vn.BOTTOM_LEFT):new Xn(t.left+p+m,t.top+t.height-(f+I))};!function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(Vn||(Vn={}));var Yn=function(A,e,t,r,n){var B=(Math.sqrt(2)-1)/3*4,s=t*B,o=r*B,i=A+t,a=e+r;switch(n){case Vn.TOP_LEFT:return new Gn(new Xn(A,a),new Xn(A,a-o),new Xn(i-s,e),new Xn(i,e));case Vn.TOP_RIGHT:return new Gn(new Xn(A,e),new Xn(A+s,e),new Xn(i,a-o),new Xn(i,a));case Vn.BOTTOM_RIGHT:return new Gn(new Xn(i,e),new Xn(i,e+o),new Xn(A+s,a),new Xn(A,a));case Vn.BOTTOM_LEFT:default:return new Gn(new Xn(i,a),new Xn(i-s,a),new Xn(A,e+o),new Xn(A,e))}},qn=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},Zn=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},jn=function(A,e,t){this.type=0,this.offsetX=A,this.offsetY=e,this.matrix=t,this.target=6},$n=function(A,e){this.type=1,this.target=e,this.path=A},AB=function(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},eB=function(){function A(A,e){if(this.container=A,this.effects=e.slice(0),this.curves=new Wn(A),null!==A.styles.transform){var t=A.bounds.left+A.styles.transformOrigin[0].number,r=A.bounds.top+A.styles.transformOrigin[1].number,n=A.styles.transform;this.effects.push(new jn(t,r,n))}if(A.styles.overflowX!==Ot.VISIBLE){var B=qn(this.curves),s=Zn(this.curves);zn(B,s)?this.effects.push(new $n(B,6)):(this.effects.push(new $n(B,2)),this.effects.push(new $n(s,4)))}}return A.prototype.getParentEffects=function(){var A=this.effects.slice(0);if(this.container.styles.overflowX!==Ot.VISIBLE){var e=qn(this.curves),t=Zn(this.curves);zn(e,t)||A.push(new $n(t,6))}return A},A}(),tB=function(A,e,t,r){A.container.elements.forEach((function(n){var B=Hr(n.flags,4),s=Hr(n.flags,2),o=new eB(n,A.getParentEffects());Hr(n.styles.display,2048)&&r.push(o);var i=Hr(n.flags,8)?[]:r;if(B||s){var a=B||n.styles.isPositioned()?t:e,c=new AB(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var Q=n.styles.zIndex.order;if(Q<0){var u=0;a.negativeZIndex.some((function(A,e){return Q>A.element.container.styles.zIndex.order?(u=e,!1):u>0})),a.negativeZIndex.splice(u,0,c)}else if(Q>0){var w=0;a.positiveZIndex.some((function(A,e){return Q>A.element.container.styles.zIndex.order?(w=e+1,!1):w>0})),a.positiveZIndex.splice(w,0,c)}else a.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?a.nonPositionedFloats.push(c):a.nonPositionedInlineLevel.push(c);tB(o,c,B?c:t,i)}else n.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),tB(o,e,t,i);Hr(n.flags,8)&&rB(n,i)}))},rB=function(A,e){for(var t=A instanceof zr?A.start:1,r=A instanceof zr&&A.reversed,n=0;n<e.length;n++){var B=e[n];B.container instanceof Vr&&"number"==typeof B.container.value&&0!==B.container.value&&(t=B.container.value),B.listValue=Tn(t,B.container.styles.listStyleType,!0),t+=r?-1:1}},nB=function(A,e,t,r){var n=[];return kn(A)?n.push(A.subdivide(.5,!1)):n.push(A),kn(t)?n.push(t.subdivide(.5,!0)):n.push(t),kn(r)?n.push(r.subdivide(.5,!0).reverse()):n.push(r),kn(e)?n.push(e.subdivide(.5,!1).reverse()):n.push(e),n},BB=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},sB=function(A){var e=A.styles,t=A.bounds,r=$A(e.paddingLeft,t.width),n=$A(e.paddingRight,t.width),B=$A(e.paddingTop,t.width),s=$A(e.paddingBottom,t.width);return t.add(r+e.borderLeftWidth,B+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+n),-(e.borderTopWidth+e.borderBottomWidth+B+s))},oB=function(A,e,t){var r=function(A,e){return 0===A?e.bounds:2===A?sB(e):BB(e)}(QB(A.styles.backgroundOrigin,e),A),n=function(A,e){return A===ue.BORDER_BOX?e.bounds:A===ue.CONTENT_BOX?sB(e):BB(e)}(QB(A.styles.backgroundClip,e),A),B=cB(QB(A.styles.backgroundSize,e),t,r),s=B[0],o=B[1],i=jA(QB(A.styles.backgroundPosition,e),r.width-s,r.height-o);return[uB(QB(A.styles.backgroundRepeat,e),i,B,r,n),Math.round(r.left+i[0]),Math.round(r.top+i[1]),s,o]},iB=function(A){return _A(A)&&A.value===We.AUTO},aB=function(A){return"number"==typeof A},cB=function(A,e,t){var r=e[0],n=e[1],B=e[2],s=A[0],o=A[1];if(kA(s)&&o&&kA(o))return[$A(s,t.width),$A(o,t.height)];var i=aB(B);if(_A(s)&&(s.value===We.CONTAIN||s.value===We.COVER))return aB(B)?t.width/t.height<B!=(s.value===We.COVER)?[t.width,t.width/B]:[t.height*B,t.height]:[t.width,t.height];var a=aB(r),c=aB(n),Q=a||c;if(iB(s)&&(!o||iB(o)))return a&&c?[r,n]:i||Q?Q&&i?[a?r:n*B,c?n:r/B]:[a?r:t.width,c?n:t.height]:[t.width,t.height];if(i){var u=0,w=0;return kA(s)?u=$A(s,t.width):kA(o)&&(w=$A(o,t.height)),iB(s)?u=w*B:o&&!iB(o)||(w=u/B),[u,w]}var U=null,l=null;if(kA(s)?U=$A(s,t.width):o&&kA(o)&&(l=$A(o,t.height)),null===U||o&&!iB(o)||(l=a&&c?U/r*n:t.height),null!==l&&iB(s)&&(U=a&&c?l/n*r:t.width),null!==U&&null!==l)return[U,l];throw new Error("Unable to calculate background-size for element")},QB=function(A,e){var t=A[e];return void 0===t?A[0]:t},uB=function(A,e,t,r,n){var B=e[0],s=e[1],o=t[0],i=t[1];switch(A){case Ve.REPEAT_X:return[new Xn(Math.round(r.left),Math.round(r.top+s)),new Xn(Math.round(r.left+r.width),Math.round(r.top+s)),new Xn(Math.round(r.left+r.width),Math.round(i+r.top+s)),new Xn(Math.round(r.left),Math.round(i+r.top+s))];case Ve.REPEAT_Y:return[new Xn(Math.round(r.left+B),Math.round(r.top)),new Xn(Math.round(r.left+B+o),Math.round(r.top)),new Xn(Math.round(r.left+B+o),Math.round(r.height+r.top)),new Xn(Math.round(r.left+B),Math.round(r.height+r.top))];case Ve.NO_REPEAT:return[new Xn(Math.round(r.left+B),Math.round(r.top+s)),new Xn(Math.round(r.left+B+o),Math.round(r.top+s)),new Xn(Math.round(r.left+B+o),Math.round(r.top+s+i)),new Xn(Math.round(r.left+B),Math.round(r.top+s+i))];default:return[new Xn(Math.round(n.left),Math.round(n.top)),new Xn(Math.round(n.left+n.width),Math.round(n.top)),new Xn(Math.round(n.left+n.width),Math.round(n.height+n.top)),new Xn(Math.round(n.left),Math.round(n.height+n.top))]}},wB=function(){function A(A){this._data={},this._document=A}return A.prototype.parseMetrics=function(A,e){var t=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),B=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=e,t.style.margin="0",t.style.padding="0",B.appendChild(t),r.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=A,n.style.fontSize=e,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode("Hidden Text")),t.appendChild(n),t.appendChild(r);var s=r.offsetTop-n.offsetTop+2;t.removeChild(n),t.appendChild(this._document.createTextNode("Hidden Text")),t.style.lineHeight="normal",r.style.verticalAlign="super";var o=r.offsetTop-t.offsetTop+2;return B.removeChild(t),{baseline:s,middle:o}},A.prototype.getMetrics=function(A,e){var t=A+" "+e;return void 0===this._data[t]&&(this._data[t]=this.parseMetrics(A,e)),this._data[t]},A}(),UB=function(){function A(A){this._activeEffects=[],this.canvas=A.canvas?A.canvas:document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),this.options=A,A.canvas||(this.canvas.width=Math.floor(A.width*A.scale),this.canvas.height=Math.floor(A.height*A.scale),this.canvas.style.width=A.width+"px",this.canvas.style.height=A.height+"px"),this.fontMetrics=new wB(document),this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-A.x+A.scrollX,-A.y+A.scrollY),this.ctx.textBaseline="bottom",this._activeEffects=[],Re.getInstance(A.id).debug("Canvas renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale)}return A.prototype.applyEffects=function(A,e){for(var t=this;this._activeEffects.length;)this.popEffect();A.filter((function(A){return Hr(A.target,e)})).forEach((function(A){return t.applyEffect(A)}))},A.prototype.applyEffect=function(A){this.ctx.save(),function(A){return 0===A.type}(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),function(A){return 1===A.type}(A)&&(this.path(A.path),this.ctx.clip()),this._activeEffects.push(A)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(A){return r(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return(e=A.element.container.styles).isVisible()?(this.ctx.globalAlpha=e.opacity,[4,this.renderStackContent(A)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},A.prototype.renderNode=function(A){return r(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return e.sent(),[4,this.renderNodeContent(A)];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},A.prototype.renderTextWithLetterSpacing=function(A,e){var t=this;0===e?this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+A.bounds.height):o(A.text).map((function(A){return i(A)})).reduce((function(e,r){return t.ctx.fillText(r,e,A.bounds.top+A.bounds.height),e+t.ctx.measureText(r).width}),A.bounds.left)},A.prototype.createFontStyle=function(A){var e=A.fontVariant.filter((function(A){return"normal"===A||"small-caps"===A})).join(""),t=A.fontFamily.join(", "),r=yA(A.fontSize)?""+A.fontSize.number+A.fontSize.unit:A.fontSize.number+"px";return[[A.fontStyle,e,A.fontWeight,r,t].join(" "),t,r]},A.prototype.renderTextNode=function(A,e){return r(this,void 0,void 0,(function(){var t,r,B,s,o=this;return n(this,(function(n){return t=this.createFontStyle(e),r=t[0],B=t[1],s=t[2],this.ctx.font=r,A.textBounds.forEach((function(A){o.ctx.fillStyle=se(e.color),o.renderTextWithLetterSpacing(A,e.letterSpacing);var t=e.textShadow;t.length&&A.text.trim().length&&(t.slice(0).reverse().forEach((function(e){o.ctx.shadowColor=se(e.color),o.ctx.shadowOffsetX=e.offsetX.number*o.options.scale,o.ctx.shadowOffsetY=e.offsetY.number*o.options.scale,o.ctx.shadowBlur=e.blur.number,o.ctx.fillText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)})),o.ctx.shadowColor="",o.ctx.shadowOffsetX=0,o.ctx.shadowOffsetY=0,o.ctx.shadowBlur=0),e.textDecorationLine.length&&(o.ctx.fillStyle=se(e.textDecorationColor||e.color),e.textDecorationLine.forEach((function(e){switch(e){case 1:var t=o.fontMetrics.getMetrics(B,s).baseline;o.ctx.fillRect(A.bounds.left,Math.round(A.bounds.top+t),A.bounds.width,1);break;case 2:o.ctx.fillRect(A.bounds.left,Math.round(A.bounds.top),A.bounds.width,1);break;case 3:var r=o.fontMetrics.getMetrics(B,s).middle;o.ctx.fillRect(A.bounds.left,Math.ceil(A.bounds.top+r),A.bounds.width,1)}})))})),[2]}))}))},A.prototype.renderReplacedElement=function(A,e,t){if(t&&A.intrinsicWidth>0&&A.intrinsicHeight>0){var r=sB(A),n=Zn(e);this.path(n),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(t,0,0,A.intrinsicWidth,A.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return r(this,void 0,void 0,(function(){var t,r,s,o,i,a,c,Q,w,U,l,C,g,E;return n(this,(function(n){switch(n.label){case 0:this.applyEffects(e.effects,4),t=e.container,r=e.curves,s=t.styles,o=0,i=t.textNodes,n.label=1;case 1:return o<i.length?(a=i[o],[4,this.renderTextNode(a,s)]):[3,4];case 2:n.sent(),n.label=3;case 3:return o++,[3,1];case 4:if(!(t instanceof _r))return[3,8];n.label=5;case 5:return n.trys.push([5,7,,8]),[4,this.options.cache.match(t.src)];case 6:return C=n.sent(),this.renderReplacedElement(t,r,C),[3,8];case 7:return n.sent(),Re.getInstance(this.options.id).error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Pr&&this.renderReplacedElement(t,r,t.canvas),!(t instanceof xr))return[3,12];n.label=9;case 9:return n.trys.push([9,11,,12]),[4,this.options.cache.match(t.svg)];case 10:return C=n.sent(),this.renderReplacedElement(t,r,C),[3,12];case 11:return n.sent(),Re.getInstance(this.options.id).error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof qr&&t.tree?[4,new A({id:this.options.id,scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,scrollX:0,scrollY:0,width:t.width,height:t.height,cache:this.options.cache,windowWidth:t.width,windowHeight:t.height}).render(t.tree)]:[3,14];case 13:c=n.sent(),t.width&&t.height&&this.ctx.drawImage(c,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),n.label=14;case 14:if(t instanceof Gr&&(Q=Math.min(t.bounds.width,t.bounds.height),"checkbox"===t.type?t.checked&&(this.ctx.save(),this.path([new Xn(t.bounds.left+.39363*Q,t.bounds.top+.79*Q),new Xn(t.bounds.left+.16*Q,t.bounds.top+.5549*Q),new Xn(t.bounds.left+.27347*Q,t.bounds.top+.44071*Q),new Xn(t.bounds.left+.39694*Q,t.bounds.top+.5649*Q),new Xn(t.bounds.left+.72983*Q,t.bounds.top+.23*Q),new Xn(t.bounds.left+.84*Q,t.bounds.top+.34085*Q),new Xn(t.bounds.left+.39363*Q,t.bounds.top+.79*Q)]),this.ctx.fillStyle=se(707406591),this.ctx.fill(),this.ctx.restore()):"radio"===t.type&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+Q/2,t.bounds.top+Q/2,Q/4,0,2*Math.PI,!0),this.ctx.fillStyle=se(707406591),this.ctx.fill(),this.ctx.restore())),lB(t)&&t.value.length){switch(this.ctx.font=this.createFontStyle(s)[0],this.ctx.fillStyle=se(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign=gB(t.styles.textAlign),E=sB(t),w=0,t.styles.textAlign){case Vt.CENTER:w+=E.width/2;break;case Vt.RIGHT:w+=E.width}U=E.add(w,0,0,-E.height/2+1),this.ctx.save(),this.path([new Xn(E.left,E.top),new Xn(E.left+E.width,E.top),new Xn(E.left+E.width,E.top+E.height),new Xn(E.left,E.top+E.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Dr(t.value,U),s.letterSpacing),this.ctx.restore(),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"}if(!Hr(t.styles.display,2048))return[3,20];if(null===t.styles.listStyleImage)return[3,19];if((l=t.styles.listStyleImage).type!==Ce.URL)return[3,18];C=void 0,g=l.url,n.label=15;case 15:return n.trys.push([15,17,,18]),[4,this.options.cache.match(g)];case 16:return C=n.sent(),this.ctx.drawImage(C,t.bounds.left-(C.width+10),t.bounds.top),[3,18];case 17:return n.sent(),Re.getInstance(this.options.id).error("Error loading list-style-image "+g),[3,18];case 18:return[3,20];case 19:e.listValue&&t.styles.listStyleType!==Lt.NONE&&(this.ctx.font=this.createFontStyle(s)[0],this.ctx.fillStyle=se(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",E=new B(t.bounds.left,t.bounds.top+$A(t.styles.paddingTop,t.bounds.width),t.bounds.width,function(A,e){return _A(A)&&"normal"===A.value?1.2*e:A.type===u.NUMBER_TOKEN?e*A.number:kA(A)?$A(A,e):e}(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Dr(e.listValue,E),s.letterSpacing),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),n.label=20;case 20:return[2]}}))}))},A.prototype.renderStackContent=function(A){return r(this,void 0,void 0,(function(){var e,t,r,B,s,o,i,a,c,Q,u,w,U,l,C;return n(this,(function(n){switch(n.label){case 0:return[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:n.sent(),e=0,t=A.negativeZIndex,n.label=2;case 2:return e<t.length?(C=t[e],[4,this.renderStack(C)]):[3,5];case 3:n.sent(),n.label=4;case 4:return e++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:n.sent(),r=0,B=A.nonInlineLevel,n.label=7;case 7:return r<B.length?(C=B[r],[4,this.renderNode(C)]):[3,10];case 8:n.sent(),n.label=9;case 9:return r++,[3,7];case 10:s=0,o=A.nonPositionedFloats,n.label=11;case 11:return s<o.length?(C=o[s],[4,this.renderStack(C)]):[3,14];case 12:n.sent(),n.label=13;case 13:return s++,[3,11];case 14:i=0,a=A.nonPositionedInlineLevel,n.label=15;case 15:return i<a.length?(C=a[i],[4,this.renderStack(C)]):[3,18];case 16:n.sent(),n.label=17;case 17:return i++,[3,15];case 18:c=0,Q=A.inlineLevel,n.label=19;case 19:return c<Q.length?(C=Q[c],[4,this.renderNode(C)]):[3,22];case 20:n.sent(),n.label=21;case 21:return c++,[3,19];case 22:u=0,w=A.zeroOrAutoZIndexOrTransformedOrOpacity,n.label=23;case 23:return u<w.length?(C=w[u],[4,this.renderStack(C)]):[3,26];case 24:n.sent(),n.label=25;case 25:return u++,[3,23];case 26:U=0,l=A.positiveZIndex,n.label=27;case 27:return U<l.length?(C=l[U],[4,this.renderStack(C)]):[3,30];case 28:n.sent(),n.label=29;case 29:return U++,[3,27];case 30:return[2]}}))}))},A.prototype.mask=function(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},A.prototype.formatPath=function(A){var e=this;A.forEach((function(A,t){var r=kn(A)?A.start:A;0===t?e.ctx.moveTo(r.x,r.y):e.ctx.lineTo(r.x,r.y),kn(A)&&e.ctx.bezierCurveTo(A.startControl.x,A.startControl.y,A.endControl.x,A.endControl.y,A.end.x,A.end.y)}))},A.prototype.renderRepeat=function(A,e,t,r){this.path(A),this.ctx.fillStyle=e,this.ctx.translate(t,r),this.ctx.fill(),this.ctx.translate(-t,-r)},A.prototype.resizeImage=function(A,e,t){if(A.width===e&&A.height===t)return A;var r=this.canvas.ownerDocument.createElement("canvas");return r.width=e,r.height=t,r.getContext("2d").drawImage(A,0,0,A.width,A.height,0,0,e,t),r},A.prototype.renderBackgroundImage=function(A){return r(this,void 0,void 0,(function(){var e,t,r,B,s,o;return n(this,(function(i){switch(i.label){case 0:e=A.styles.backgroundImage.length-1,t=function(t){var B,s,o,i,a,c,Q,u,w,U,l,C,g,E,h,F,d,H,f,p,N,K,I,m,T,R,L,v,O,D,b;return n(this,(function(n){switch(n.label){case 0:if(t.type!==Ce.URL)return[3,5];B=void 0,s=t.url,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.options.cache.match(s)];case 2:return B=n.sent(),[3,4];case 3:return n.sent(),Re.getInstance(r.options.id).error("Error loading background-image "+s),[3,4];case 4:return B&&(o=oB(A,e,[B.width,B.height,B.width/B.height]),F=o[0],K=o[1],I=o[2],f=o[3],p=o[4],E=r.ctx.createPattern(r.resizeImage(B,f,p),"repeat"),r.renderRepeat(F,E,K,I)),[3,6];case 5:t.type===Ce.LINEAR_GRADIENT?(i=oB(A,e,[null,null,null]),F=i[0],K=i[1],I=i[2],f=i[3],p=i[4],a=function(A,e,t){var r="number"==typeof A?A:function(A,e,t){var r=e/2,n=t/2,B=$A(A[0],e)-r,s=n-$A(A[1],t);return(Math.atan2(s,B)+2*Math.PI)%(2*Math.PI)}(A,e,t),n=Math.abs(e*Math.sin(r))+Math.abs(t*Math.cos(r)),B=e/2,s=t/2,o=n/2,i=Math.sin(r-Math.PI/2)*o,a=Math.cos(r-Math.PI/2)*o;return[n,B-a,B+a,s-i,s+i]}(t.angle,f,p),c=a[0],Q=a[1],u=a[2],w=a[3],U=a[4],(l=document.createElement("canvas")).width=f,l.height=p,C=l.getContext("2d"),g=C.createLinearGradient(Q,w,u,U),He(t.stops,c).forEach((function(A){return g.addColorStop(A.stop,se(A.color))})),C.fillStyle=g,C.fillRect(0,0,f,p),f>0&&p>0&&(E=r.ctx.createPattern(l,"repeat"),r.renderRepeat(F,E,K,I))):t.type===Ce.RADIAL_GRADIENT&&(h=oB(A,e,[null,null,null]),F=h[0],d=h[1],H=h[2],f=h[3],p=h[4],N=0===t.position.length?[qA]:t.position,K=$A(N[0],f),I=$A(N[N.length-1],p),m=function(A,e,t,r,n){var B=0,s=0;switch(A.size){case Ee.CLOSEST_SIDE:A.shape===ge.CIRCLE?B=s=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-n)):A.shape===ge.ELLIPSE&&(B=Math.min(Math.abs(e),Math.abs(e-r)),s=Math.min(Math.abs(t),Math.abs(t-n)));break;case Ee.CLOSEST_CORNER:if(A.shape===ge.CIRCLE)B=s=Math.min(fe(e,t),fe(e,t-n),fe(e-r,t),fe(e-r,t-n));else if(A.shape===ge.ELLIPSE){var o=Math.min(Math.abs(t),Math.abs(t-n))/Math.min(Math.abs(e),Math.abs(e-r)),i=pe(r,n,e,t,!0),a=i[0],c=i[1];s=o*(B=fe(a-e,(c-t)/o))}break;case Ee.FARTHEST_SIDE:A.shape===ge.CIRCLE?B=s=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-n)):A.shape===ge.ELLIPSE&&(B=Math.max(Math.abs(e),Math.abs(e-r)),s=Math.max(Math.abs(t),Math.abs(t-n)));break;case Ee.FARTHEST_CORNER:if(A.shape===ge.CIRCLE)B=s=Math.max(fe(e,t),fe(e,t-n),fe(e-r,t),fe(e-r,t-n));else if(A.shape===ge.ELLIPSE){o=Math.max(Math.abs(t),Math.abs(t-n))/Math.max(Math.abs(e),Math.abs(e-r));var Q=pe(r,n,e,t,!1);a=Q[0],c=Q[1],s=o*(B=fe(a-e,(c-t)/o))}}return Array.isArray(A.size)&&(B=$A(A.size[0],r),s=2===A.size.length?$A(A.size[1],n):B),[B,s]}(t,K,I,f,p),T=m[0],R=m[1],T>0&&T>0&&(L=r.ctx.createRadialGradient(d+K,H+I,0,d+K,H+I,T),He(t.stops,2*T).forEach((function(A){return L.addColorStop(A.stop,se(A.color))})),r.path(F),r.ctx.fillStyle=L,T!==R?(v=A.bounds.left+.5*A.bounds.width,O=A.bounds.top+.5*A.bounds.height,b=1/(D=R/T),r.ctx.save(),r.ctx.translate(v,O),r.ctx.transform(1,0,0,D,0,0),r.ctx.translate(-v,-O),r.ctx.fillRect(d,b*(H-O)+O,f,p*b),r.ctx.restore()):r.ctx.fill())),n.label=6;case 6:return e--,[2]}}))},r=this,B=0,s=A.styles.backgroundImage.slice(0).reverse(),i.label=1;case 1:return B<s.length?(o=s[B],[5,t(o)]):[3,4];case 2:i.sent(),i.label=3;case 3:return B++,[3,1];case 4:return[2]}}))}))},A.prototype.renderBorder=function(A,e,t){return r(this,void 0,void 0,(function(){return n(this,(function(r){return this.path(function(A,e){switch(e){case 0:return nB(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return nB(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return nB(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return nB(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}}(t,e)),this.ctx.fillStyle=se(A),this.ctx.fill(),[2]}))}))},A.prototype.renderNodeBackgroundAndBorders=function(A){return r(this,void 0,void 0,(function(){var e,t,r,B,s,o,i,a,c=this;return n(this,(function(n){switch(n.label){case 0:return this.applyEffects(A.effects,2),e=A.container.styles,t=!Be(e.backgroundColor)||e.backgroundImage.length,r=[{style:e.borderTopStyle,color:e.borderTopColor},{style:e.borderRightStyle,color:e.borderRightColor},{style:e.borderBottomStyle,color:e.borderBottomColor},{style:e.borderLeftStyle,color:e.borderLeftColor}],B=CB(QB(e.backgroundClip,0),A.curves),t||e.boxShadow.length?(this.ctx.save(),this.path(B),this.ctx.clip(),Be(e.backgroundColor)||(this.ctx.fillStyle=se(e.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:n.sent(),this.ctx.restore(),e.boxShadow.slice(0).reverse().forEach((function(e){c.ctx.save();var t,r,n,B,s,o=qn(A.curves),i=e.inset?0:1e4,a=(t=o,r=-i+(e.inset?1:-1)*e.spread.number,n=(e.inset?1:-1)*e.spread.number,B=e.spread.number*(e.inset?-2:2),s=e.spread.number*(e.inset?-2:2),t.map((function(A,e){switch(e){case 0:return A.add(r,n);case 1:return A.add(r+B,n);case 2:return A.add(r+B,n+s);case 3:return A.add(r,n+s)}return A})));e.inset?(c.path(o),c.ctx.clip(),c.mask(a)):(c.mask(o),c.ctx.clip(),c.path(a)),c.ctx.shadowOffsetX=e.offsetX.number+i,c.ctx.shadowOffsetY=e.offsetY.number,c.ctx.shadowColor=se(e.color),c.ctx.shadowBlur=e.blur.number,c.ctx.fillStyle=e.inset?se(e.color):"rgba(0,0,0,1)",c.ctx.fill(),c.ctx.restore()})),n.label=2;case 2:s=0,o=0,i=r,n.label=3;case 3:return o<i.length?(a=i[o]).style===Ze.NONE||Be(a.color)?[3,5]:[4,this.renderBorder(a.color,s,A.curves)]:[3,7];case 4:n.sent(),n.label=5;case 5:s++,n.label=6;case 6:return o++,[3,3];case 7:return[2]}}))}))},A.prototype.render=function(A){return r(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=se(this.options.backgroundColor),this.ctx.fillRect(this.options.x-this.options.scrollX,this.options.y-this.options.scrollY,this.options.width,this.options.height)),r=new eB(A,[]),n=new AB(r),tB(r,n,n,B=[]),rB(r.container,B),e=n,[4,this.renderStack(e)];case 1:return t.sent(),this.applyEffects([],2),[2,this.canvas]}var r,n,B}))}))},A}(),lB=function(A){return A instanceof Wr||A instanceof kr||A instanceof Gr&&"radio"!==A.type&&"checkbox"!==A.type},CB=function(A,e){switch(A){case ue.BORDER_BOX:return qn(e);case ue.CONTENT_BOX:return function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]}(e);case ue.PADDING_BOX:default:return Zn(e)}},gB=function(A){switch(A){case Vt.CENTER:return"center";case Vt.RIGHT:return"right";case Vt.LEFT:default:return"left"}},EB=function(){function A(A){this.canvas=A.canvas?A.canvas:document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),this.options=A,this.canvas.width=Math.floor(A.width*A.scale),this.canvas.height=Math.floor(A.height*A.scale),this.canvas.style.width=A.width+"px",this.canvas.style.height=A.height+"px",this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-A.x+A.scrollX,-A.y+A.scrollY),Re.getInstance(A.id).debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale)}return A.prototype.render=function(A){return r(this,void 0,void 0,(function(){var e,t;return n(this,(function(r){switch(r.label){case 0:return e=Ie(Math.max(this.options.windowWidth,this.options.width)*this.options.scale,Math.max(this.options.windowHeight,this.options.height)*this.options.scale,this.options.scrollX*this.options.scale,this.options.scrollY*this.options.scale,A),[4,hB(e)];case 1:return t=r.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=se(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(t,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}}))}))},A}(),hB=function(A){return new Promise((function(e,t){var r=new Image;r.onload=function(){e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(A))}))},FB=function(A){return ne(SA.create(A).parseComponentValue())};return"undefined"!=typeof window&&Le.setContext(window),function(A,e){return void 0===e&&(e={}),function(A,e){return r(void 0,void 0,void 0,(function(){var r,o,i,a,c,Q,u,w,U,l,C,g,E,h,F,d,H,f,p,N,K,I,m;return n(this,(function(n){switch(n.label){case 0:if(!(r=A.ownerDocument))throw new Error("Element is not attached to a Document");if(!(o=r.defaultView))throw new Error("Document is not attached to a Window");return i=(Math.round(1e3*Math.random())+Date.now()).toString(16),a=Qn(A)||"HTML"===A.tagName?function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var r=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),n=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new B(0,0,r,n)}(r):s(A),c=a.width,Q=a.height,u=a.left,w=a.top,U=t({},{allowTaint:!1,imageTimeout:15e3,proxy:void 0,useCORS:!1},e),l={backgroundColor:"#ffffff",cache:e.cache?e.cache:Le.create(i,U),logging:!0,removeContainer:!0,foreignObjectRendering:!1,scale:o.devicePixelRatio||1,windowWidth:o.innerWidth,windowHeight:o.innerHeight,scrollX:o.pageXOffset,scrollY:o.pageYOffset,x:u,y:w,width:Math.ceil(c),height:Math.ceil(Q),id:i},C=t({},l,U,e),g=new B(C.scrollX,C.scrollY,C.windowWidth,C.windowHeight),Re.create({id:i,enabled:C.logging}),Re.getInstance(i).debug("Starting document clone"),E=new Rn(A,{id:i,onclone:C.onclone,ignoreElements:C.ignoreElements,inlineImages:C.foreignObjectRendering,copyStyles:C.foreignObjectRendering}),(h=E.clonedReferenceElement)?[4,E.toIFrame(r,g)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return F=n.sent(),d=r.documentElement?FB(getComputedStyle(r.documentElement).backgroundColor):le.TRANSPARENT,H=r.body?FB(getComputedStyle(r.body).backgroundColor):le.TRANSPARENT,f=e.backgroundColor,p="string"==typeof f?FB(f):null===f?le.TRANSPARENT:4294967295,N=A===r.documentElement?Be(d)?Be(H)?p:H:d:p,K={id:i,cache:C.cache,canvas:C.canvas,backgroundColor:N,scale:C.scale,x:C.x,y:C.y,scrollX:C.scrollX,scrollY:C.scrollY,width:C.width,height:C.height,windowWidth:C.windowWidth,windowHeight:C.windowHeight},C.foreignObjectRendering?(Re.getInstance(i).debug("Document cloned, using foreign object rendering"),[4,new EB(K).render(h)]):[3,3];case 2:return I=n.sent(),[3,5];case 3:return Re.getInstance(i).debug("Document cloned, using computed rendering"),Le.attachInstance(C.cache),Re.getInstance(i).debug("Starting DOM parsing"),m=An(h),Le.detachInstance(),N===m.styles.backgroundColor&&(m.styles.backgroundColor=le.TRANSPARENT),Re.getInstance(i).debug("Starting renderer"),[4,new UB(K).render(m)];case 4:I=n.sent(),n.label=5;case 5:return!0===C.removeContainer&&(Rn.destroy(F)||Re.getInstance(i).error("Cannot detach cloned iframe as it is not in the DOM anymore")),Re.getInstance(i).debug("Finished rendering"),Re.destroy(i),Le.destroy(i),[2,I]}}))}))}(A,e)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(A=A||self).html2canvas=e();