!function(){function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function e(e){for(var i=1;i=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function n(){return n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var i=a(t,e);if(i){var n=Object.getOwnPropertyDescriptor(i,e);return n.get?n.get.call(arguments.length<3?t:r):n.value}},n.apply(this,arguments)}function a(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}function o(t){return function(t){if(Array.isArray(t))return m(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,i=f(t);if(e){var n=f(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return h(this,r)}}function h(t,e){if(e&&("object"===w(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),r=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==r.length&&(r="0"+r),"#"+t+e+r},this.getHelpXML=function(){for(var t=new Array,i=0;i "+l.toRGB()+" -> "+l.toHex());u.appendChild(h),u.appendChild(c),s.appendChild(u)}catch(f){}return s}},V=function(t,e){return(V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function _(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}V(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function R(t,e){var r=t[0],i=t[1];return[r*Math.cos(e)-i*Math.sin(e),r*Math.sin(e)+i*Math.cos(e)]}function I(){for(var t=[],e=0;et.phi1&&(t.phi2-=2*L),1===t.sweepFlag&&t.phi2i)return[];if(0===i)return[[t*r/(t*t+e*e),e*r/(t*t+e*e)]];var n=Math.sqrt(i);return[[(t*r+e*n)/(t*t+e*e),(e*r-t*n)/(t*t+e*e)],[(t*r-e*n)/(t*t+e*e),(e*r+t*n)/(t*t+e*e)]]}var H,z=Math.PI/180;function F(t,e,r){return(1-r)*t+r*e}function U(t,e,r,i){return t+Math.cos(i/180*L)*e+Math.sin(i/180*L)*r}function X(t,e,r,i){var n=1e-6,a=e-t,o=r-e,s=3*a+3*(i-r)-6*o,u=6*(o-a),l=3*a;return Math.abs(s)d&&(n.sweepFlag=+!n.sweepFlag),n}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),I(t),function(t){return void 0!==t.x1&&(t.x1=e(t.x1)),void 0!==t.y1&&(t.y1=e(t.y1)),void 0!==t.x2&&(t.x2=e(t.x2)),void 0!==t.y2&&(t.y2=e(t.y2)),void 0!==t.x&&(t.x=e(t.x)),void 0!==t.y&&(t.y=e(t.y)),void 0!==t.rX&&(t.rX=e(t.rX)),void 0!==t.rY&&(t.rY=e(t.rY)),t}},t.TO_ABS=e,t.TO_REL=function(){return n((function(t,e,r){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=r),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=r),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=r),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,r){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===r&&(r=!0),n((function(i,n,a,o,s){if(isNaN(o)&&!(i.type&$.MOVE_TO))throw new Error("path must start with moveto");return e&&i.type&$.HORIZ_LINE_TO&&(i.type=$.LINE_TO,i.y=i.relative?0:a),r&&i.type&$.VERT_LINE_TO&&(i.type=$.LINE_TO,i.x=i.relative?0:n),t&&i.type&$.CLOSE_PATH&&(i.type=$.LINE_TO,i.x=i.relative?o-n:o,i.y=i.relative?s-a:s),i.type&$.ARC&&(0===i.rX||0===i.rY)&&(i.type=$.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),i}))},t.NORMALIZE_ST=r,t.QT_TO_C=i,t.INFO=n,t.SANITIZE=function(t){void 0===t&&(t=0),I(t);var e=NaN,r=NaN,i=NaN,a=NaN;return n((function(n,o,s,u,l){var h=Math.abs,c=!1,f=0,g=0;if(n.type&$.SMOOTH_CURVE_TO&&(f=isNaN(e)?0:o-e,g=isNaN(r)?0:s-r),n.type&($.CURVE_TO|$.SMOOTH_CURVE_TO)?(e=n.relative?o+n.x2:n.x2,r=n.relative?s+n.y2:n.y2):(e=NaN,r=NaN),n.type&$.SMOOTH_QUAD_TO?(i=isNaN(i)?o:2*o-i,a=isNaN(a)?s:2*s-a):n.type&$.QUAD_TO?(i=n.relative?o+n.x1:n.x1,a=n.relative?s+n.y1:n.y2):(i=NaN,a=NaN),n.type&$.LINE_COMMANDS||n.type&$.ARC&&(0===n.rX||0===n.rY||!n.lArcFlag)||n.type&$.CURVE_TO||n.type&$.SMOOTH_CURVE_TO||n.type&$.QUAD_TO||n.type&$.SMOOTH_QUAD_TO){var v=void 0===n.x?0:n.relative?n.x:n.x-o,y=void 0===n.y?0:n.relative?n.y:n.y-s;f=isNaN(i)?void 0===n.x1?f:n.relative?n.x:n.x1-o:i-o,g=isNaN(a)?void 0===n.y1?g:n.relative?n.y:n.y1-s:a-s;var d=void 0===n.x2?0:n.relative?n.x:n.x2-o,p=void 0===n.y2?0:n.relative?n.y:n.y2-s;h(v)<=t&&h(y)<=t&&h(f)<=t&&h(g)<=t&&h(d)<=t&&h(p)<=t&&(c=!0)}return n.type&$.CLOSE_PATH&&h(o-u)<=t&&h(s-l)<=t&&(c=!0),c?[]:n}))},t.MATRIX=a,t.ROTATE=function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=0),I(t,e,r);var i=Math.sin(t),n=Math.cos(t);return a(n,i,-i,n,e-e*n+r*i,r-e*i-r*n)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),I(t,e),a(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),I(t,e),a(t,0,0,e,0,0)},t.SKEW_X=function(t){return I(t),a(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return I(t),a(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),I(t),a(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),I(t),a(1,0,0,-1,0,t)},t.A_TO_C=function(){return n((function(t,e,r){return $.ARC===t.type?function(t,e,r){var i,n,a,o;t.cX||B(t,e,r);for(var s=Math.min(t.phi1,t.phi2),u=Math.max(t.phi1,t.phi2)-s,l=Math.ceil(u/90),h=new Array(l),c=e,f=r,g=0;gs.maxX&&(s.maxX=t),ts.maxY&&(s.maxY=t),tO&&u(Y(r,n.x1,n.x2,n.x,O));for(var f=0,g=X(i,n.y1,n.y2,n.y);fO&&l(Y(i,n.y1,n.y2,n.y,O))}if(n.type&$.ARC){u(n.x),l(n.y),B(n,r,i);for(var v=n.xRot/180*Math.PI,y=Math.cos(v)*n.rX,d=Math.sin(v)*n.rX,p=-Math.sin(v)*n.rY,m=Math.cos(v)*n.rY,x=n.phi1n.phi2?[n.phi2+360,n.phi1+360]:[n.phi2,n.phi1],b=x[0],w=x[1],S=function(t){var e=t[0],r=t[1],i=180*Math.atan2(r,e)/Math.PI;return ib&&Ob&&Ou)throw new SyntaxError('Expected positive number, got "'+u+'" at index "'+n+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+n+'"');this.curArgs.push(u),this.curArgs.length===Z[this.curCommandType]&&($.HORIZ_LINE_TO===this.curCommandType?i({type:$.HORIZ_LINE_TO,relative:this.curCommandRelative,x:u}):$.VERT_LINE_TO===this.curCommandType?i({type:$.VERT_LINE_TO,relative:this.curCommandRelative,y:u}):this.curCommandType===$.MOVE_TO||this.curCommandType===$.LINE_TO||this.curCommandType===$.SMOOTH_QUAD_TO?(i({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),$.MOVE_TO===this.curCommandType&&(this.curCommandType=$.LINE_TO)):this.curCommandType===$.CURVE_TO?i({type:$.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===$.SMOOTH_CURVE_TO?i({type:$.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.QUAD_TO?i({type:$.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.ARC&&i({type:$.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!W(a))if(","===a&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==a&&"-"!==a&&"."!==a)if(s)this.curNumber=a,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+n+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+a+'" at index '+n+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==a&&"Z"!==a)if("h"===a||"H"===a)this.curCommandType=$.HORIZ_LINE_TO,this.curCommandRelative="h"===a;else if("v"===a||"V"===a)this.curCommandType=$.VERT_LINE_TO,this.curCommandRelative="v"===a;else if("m"===a||"M"===a)this.curCommandType=$.MOVE_TO,this.curCommandRelative="m"===a;else if("l"===a||"L"===a)this.curCommandType=$.LINE_TO,this.curCommandRelative="l"===a;else if("c"===a||"C"===a)this.curCommandType=$.CURVE_TO,this.curCommandRelative="c"===a;else if("s"===a||"S"===a)this.curCommandType=$.SMOOTH_CURVE_TO,this.curCommandRelative="s"===a;else if("q"===a||"Q"===a)this.curCommandType=$.QUAD_TO,this.curCommandRelative="q"===a;else if("t"===a||"T"===a)this.curCommandType=$.SMOOTH_QUAD_TO,this.curCommandRelative="t"===a;else{if("a"!==a&&"A"!==a)throw new SyntaxError('Unexpected character "'+a+'" at index '+n+".");this.curCommandType=$.ARC,this.curCommandRelative="a"===a}else e.push({type:$.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=a,this.curNumberHasDecimal="."===a}else this.curNumber+=a,this.curNumberHasDecimal=!0;else this.curNumber+=a;else this.curNumber+=a,this.curNumberHasExp=!0;else this.curNumber+=a,this.curNumberHasExpDigits=this.curNumberHasExp}return e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,r){void 0===r&&(r=[]);for(var i=0,n=Object.getPrototypeOf(this).parse.call(this,e);i>w;if(s[x+3]=Q,0!==Q){var G=255/Q;s[x]=(L*b>>w)*G,s[x+1]=(B*b>>w)*G,s[x+2]=(D*b>>w)*G}else s[x]=s[x+1]=s[x+2]=0;L-=V,B-=_,D-=R,H-=I,V-=d.r,_-=d.g,R-=d.b,I-=d.a;var $=W+a+1;$=m+($>w,lt>0?(lt=255/lt,s[Ot]=(vt*b>>w)*lt,s[Ot+1]=(yt*b>>w)*lt,s[Ot+2]=(dt*b>>w)*lt):s[Ot]=s[Ot+1]=s[Ot+2]=0,vt-=ht,yt-=ct,dt-=ft,pt-=gt,ht-=d.r,ct-=d.g,ft-=d.b,gt-=d.a,Ot=at+((Ot=Ct+c)0&&void 0!==arguments[0]?arguments[0]:{},e=t.DOMParser,r={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,createCanvas:function(t,e){return new OffscreenCanvas(t,e)},createImage:function(t){return b(regeneratorRuntime.mark((function e(){var r,i,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return r=e.sent,e.next=5,r.blob();case 5:return i=e.sent,e.next=8,createImageBitmap(i);case 8:return n=e.sent,e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})))()}};return void 0===globalThis.DOMParser&&void 0!==e||Reflect.deleteProperty(r,"DOMParser"),r},node:function(t){var e=t.DOMParser,r=t.canvas;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,fetch:t.fetch,createCanvas:r.createCanvas,createImage:r.loadImage}}});function nt(t){return t.replace(/(?!\u3000)\s+/gm," ")}function at(t){var e=t.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return e?e.map(parseFloat):[]}var ot=/^[A-Z-]+$/;function st(t){return ot.test(t)?t.toLowerCase():t}function ut(t){var e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t);return e&&(e[2]||e[3]||e[4])||""}var lt=/(\[[^\]]+\])/g,ht=/(#[^\s+>~.[:]+)/g,ct=/(\.[^\s+>~.[:]+)/g,ft=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,gt=/(:[\w-]+\([^)]*\))/gi,vt=/(:[^\s+>~.[:]+)/g,yt=/([^\s+>~.[:]+)/g;function dt(t,e){var r=e.exec(t);return r?[t.replace(e," "),r.length]:[t,0]}var pt=1e-8;function mt(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function xt(t,e){return(t[0]*e[0]+t[1]*e[1])/(mt(t)*mt(e))}function bt(t,e){return(t[0]*e[1]0&&void 0!==arguments[0]?arguments[0]:" ",r=this.document,i=this.name;return nt(this.getString()).trim().split(e).map((function(e){return new t(r,i,e)}))}},{key:"hasValue",value:function(t){var e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}},{key:"isString",value:function(t){var e=this.value,r="string"==typeof e;return r&&t?t.test(e):r}},{key:"isUrlDefinition",value:function(){return this.isString(/^url\(/)}},{key:"isPixels",value:function(){if(!this.hasValue())return!1;var t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"getValue",value:function(t){return void 0===t||this.hasValue()?this.value:t}},{key:"getNumber",value:function(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);var e=this.value,r=parseFloat(e);return this.isString(/%$/)&&(r/=100),r}},{key:"getString",value:function(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}},{key:"getColor",value:function(t){var e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=function(t){if(!t.startsWith("rgb"))return t;var e=3;return t.replace(/\d+(\.\d+)?/g,(function(t,r){return e--&&r?String(Math.round(parseFloat(t))):t}))}(e),this.value=e),e}},{key:"getDpi",value:function(){return 96}},{key:"getRem",value:function(){return this.document.rootEmSize}},{key:"getEm",value:function(){return this.document.emSize}},{key:"getUnits",value:function(){return this.getString().replace(/[0-9.-]/g,"")}},{key:"getPixels",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var r="boolean"==typeof t?[void 0,t]:[t],i=d(r,2),n=i[0],a=i[1],o=this.document.screen.viewPort;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(o.computeSize("x"),o.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(o.computeSize("x"),o.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*o.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*o.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&a:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*o.computeSize(n);default:var s=this.getNumber();return e&&s<1?s*o.computeSize(n):s}}},{key:"getMilliseconds",value:function(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}},{key:"getRadians",value:function(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}},{key:"getDefinition",value:function(){var t=this.getString(),e=/#([^)'"]+)/.exec(t),r=(null==e?void 0:e[1])||t;return this.document.definitions[r]}},{key:"getFillStyleDefinition",value:function(t,e){var r=this.getDefinition();if(!r)return null;if("function"==typeof r.createGradient&&"getBoundingBox"in t)return r.createGradient(this.document.ctx,t,e);if("function"==typeof r.createPattern){if(r.getHrefAttribute().hasValue()){var i=r.getAttribute("patternTransform");(r=r.getHrefAttribute().getDefinition())&&i.hasValue()&&r.getAttribute("patternTransform",!0).setValue(i.value)}if(r)return r.createPattern(this.document.ctx,t,e)}return null}},{key:"getTextBaseline",value:function(){if(!this.hasValue())return null;var e=this.getString();return t.textBaselineMapping[e]||null}},{key:"addOpacity",value:function(e){for(var r=this.getColor(),i=r.length,n=0,a=0;a1&&void 0!==arguments[1]?arguments[1]:0,i=at(e),n=d(i,2),a=n[0],o=void 0===a?r:a,s=n[1],u=void 0===s?r:s;return new t(o,u)}},{key:"parseScale",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=at(e),n=d(i,2),a=n[0],o=void 0===a?r:a,s=n[1],u=void 0===s?o:s;return new t(o,u)}},{key:"parsePath",value:function(e){for(var r=at(e),i=r.length,n=[],a=0;a0}},{key:"runEvents",value:function(){if(this.working){var t,e=this.screen,r=this.events,i=this.eventElements,n=e.ctx.canvas.style;n&&(n.cursor=""),r.forEach((function(e,r){var n=e.run;for(t=i[r];t;)n(t),t=t.parent})),this.events=[],this.eventElements=[]}}},{key:"checkPath",value:function(t,e){if(this.working&&e){var r=this.events,i=this.eventElements;r.forEach((function(r,n){var a=r.x,o=r.y;!i[n]&&e.isPointInPath&&e.isPointInPath(a,o)&&(i[n]=t)}))}}},{key:"checkBoundingBox",value:function(t,e){if(this.working&&e){var r=this.events,i=this.eventElements;r.forEach((function(r,n){var a=r.x,o=r.y;!i[n]&&e.isPointInBox(a,o)&&(i[n]=t)}))}}},{key:"mapXY",value:function(t,e){for(var r=this.screen,i=r.window,n=r.ctx,a=new Mt(t,e),o=n.canvas;o;)a.x-=o.offsetLeft,a.y-=o.offsetTop,o=o.offsetParent;return(null==i?void 0:i.scrollX)&&(a.x+=i.scrollX),(null==i?void 0:i.scrollY)&&(a.y+=i.scrollY),a}},{key:"onClick",value:function(t){var e=this.mapXY(t.clientX,t.clientY),r=e.x,i=e.y;this.events.push({type:"onclick",x:r,y:i,run:function(t){t.onClick&&t.onClick()}})}},{key:"onMouseMove",value:function(t){var e=this.mapXY(t.clientX,t.clientY),r=e.x,i=e.y;this.events.push({type:"onmousemove",x:r,y:i,run:function(t){t.onMouseMove&&t.onMouseMove()}})}}]),t}(),_t="undefined"!=typeof window?window:null,Rt="undefined"!=typeof fetch?fetch.bind(void 0):void 0,It=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.fetch,n=void 0===i?Rt:i,a=r.window,o=void 0===a?_t:a;if(g(this,t),this.ctx=e,this.viewPort=new Et,this.mouse=new Vt(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=o,!n)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=n}return y(t,[{key:"wait",value:function(t){this.waits.push(t)}},{key:"ready",value:function(){return this.readyPromise?this.readyPromise:Promise.resolve()}},{key:"isReady",value:function(){if(this.isReadyLock)return!0;var t=this.waits.every((function(t){return t()}));return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}},{key:"setDefaults",value:function(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}},{key:"setViewBox",value:function(t){var e=t.document,r=t.ctx,i=t.aspectRatio,n=t.width,a=t.desiredWidth,o=t.height,s=t.desiredHeight,u=t.minX,l=void 0===u?0:u,h=t.minY,c=void 0===h?0:h,f=t.refX,g=t.refY,v=t.clip,y=void 0!==v&&v,p=t.clipX,m=void 0===p?0:p,x=t.clipY,b=void 0===x?0:x,w=d(nt(i).replace(/^defer\s/,"").split(" "),2),S=w[0]||"xMidYMid",k=w[1]||"meet",T=n/a,A=o/s,C=Math.min(T,A),O=Math.max(T,A),P=a,E=s;"meet"===k&&(P*=C,E*=C),"slice"===k&&(P*=O,E*=O);var N=new Pt(e,"refX",f),M=new Pt(e,"refY",g),V=N.hasValue()&&M.hasValue();if(V&&r.translate(-C*N.getPixels("x"),-C*M.getPixels("y")),y){var _=C*m,R=C*b;r.beginPath(),r.moveTo(_,R),r.lineTo(n,R),r.lineTo(n,o),r.lineTo(_,o),r.closePath(),r.clip()}if(!V){var I="meet"===k&&C===A,L="slice"===k&&O===A,B="meet"===k&&C===T,D="slice"===k&&O===T;S.startsWith("xMid")&&(I||L)&&r.translate(n/2-P/2,0),S.endsWith("YMid")&&(B||D)&&r.translate(0,o/2-E/2),S.startsWith("xMax")&&(I||L)&&r.translate(n-P,0),S.endsWith("YMax")&&(B||D)&&r.translate(0,o-E)}switch(!0){case"none"===S:r.scale(T,A);break;case"meet"===k:r.scale(C,C);break;case"slice"===k:r.scale(O,O)}r.translate(-l,-c)}},{key:"start",value:function(e){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.enableRedraw,a=void 0!==n&&n,o=i.ignoreMouse,s=void 0!==o&&o,u=i.ignoreAnimation,l=void 0!==u&&u,h=i.ignoreDimensions,c=void 0!==h&&h,f=i.ignoreClear,g=void 0!==f&&f,v=i.forceRedraw,y=i.scaleWidth,d=i.scaleHeight,p=i.offsetX,m=i.offsetY,x=this.mouse,b=1e3/t.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=b,this.readyPromise=new Promise((function(t){r.resolveReady=t})),this.isReady()&&this.render(e,c,g,y,d,p,m),a){var w=Date.now(),S=w,k=0,T=function t(){w=Date.now(),(k=w-S)>=b&&(S=w-k%b,r.shouldUpdate(l,v)&&(r.render(e,c,g,y,d,p,m),x.runEvents())),r.intervalId=N(t)};s||x.start(),this.intervalId=N(T)}}},{key:"stop",value:function(){this.intervalId&&(N.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}},{key:"shouldUpdate",value:function(t,e){if(!t){var r=this.frameDuration,i=this.animations.reduce((function(t,e){return e.update(r)||t}),!1);if(i)return!0}return!("function"!=typeof e||!e())||(!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents())}},{key:"render",value:function(t,e,r,i,n,a,o){var s=this.viewPort,u=this.ctx,l=this.isFirstRender,h=u.canvas;s.clear(),h.width&&h.height&&s.setCurrent(h.width,h.height);var c=t.getStyle("width"),f=t.getStyle("height");!e&&(l||"number"!=typeof i&&"number"!=typeof n)&&(c.hasValue()&&(h.width=c.getPixels("x"),h.style&&(h.style.width="".concat(h.width,"px"))),f.hasValue()&&(h.height=f.getPixels("y"),h.style&&(h.style.height="".concat(h.height,"px"))));var g=h.clientWidth||h.width,v=h.clientHeight||h.height;if(e&&c.hasValue()&&f.hasValue()&&(g=c.getPixels("x"),v=f.getPixels("y")),s.setCurrent(g,v),"number"==typeof a&&t.getAttribute("x",!0).setValue(a),"number"==typeof o&&t.getAttribute("y",!0).setValue(o),"number"==typeof i||"number"==typeof n){var y=at(t.getAttribute("viewBox").getString()),d=0,p=0;if("number"==typeof i){var m=t.getStyle("width");m.hasValue()?d=m.getPixels("x")/i:y[2]&&!isNaN(y[2])&&(d=y[2]/i)}if("number"==typeof n){var x=t.getStyle("height");x.hasValue()?p=x.getPixels("y")/n:y[3]&&!isNaN(y[3])&&(p=y[3]/n)}d||(d=p),p||(p=d),t.getAttribute("width",!0).setValue(i),t.getAttribute("height",!0).setValue(n);var b=t.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/d,", ").concat(1/p,")"))}r||u.clearRect(0,0,g,v),t.render(u),l&&(this.isFirstRender=!1)}}]),t}();It.defaultWindow=_t,It.defaultFetch=Rt,It.FRAMERATE=30,It.MAX_VIRTUAL_PIXELS=3e4;var Lt=It.defaultFetch,Bt="undefined"!=typeof DOMParser?DOMParser:void 0,Dt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.fetch,i=void 0===r?Lt:r,n=e.DOMParser,a=void 0===n?Bt:n;if(g(this,t),!i)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!a)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=i,this.DOMParser=a}var e,r;return y(t,[{key:"parse",value:(r=b(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.startsWith("<")){t.next=2;break}return t.abrupt("return",this.parseFromString(e));case 2:return t.abrupt("return",this.load(e));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"parseFromString",value:function(t){var e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(r){return this.checkDocument(e.parseFromString(t,"text/xml"))}}},{key:"checkDocument",value:function(t){var e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}},{key:"load",value:(e=b(regeneratorRuntime.mark((function t(e){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetch(e);case 2:return r=t.sent,t.next=5,r.text();case 5:return i=t.sent,t.abrupt("return",this.parseFromString(i));case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Ht=function(){function t(e,r){g(this,t),this.type="translate",this.point=Mt.parse(r)}return y(t,[{key:"apply",value:function(t){var e=this.point,r=e.x,i=e.y;t.translate(r||0,i||0)}},{key:"unapply",value:function(t){var e=this.point,r=e.x,i=e.y;t.translate(-1*r||0,-1*i||0)}},{key:"applyToPoint",value:function(t){var e=this.point,r=e.x,i=e.y;t.applyTransform([1,0,0,1,r||0,i||0])}}]),t}(),zt=function(){function t(e,r,i){g(this,t),this.type="rotate";var n=at(r);this.angle=new Pt(e,"angle",n[0]),this.originX=i[0],this.originY=i[1],this.cx=n[1]||0,this.cy=n[2]||0}return y(t,[{key:"apply",value:function(t){var e=this.cx,r=this.cy,i=this.originX,n=this.originY,a=this.angle,o=e+i.getPixels("x"),s=r+n.getPixels("y");t.translate(o,s),t.rotate(a.getRadians()),t.translate(-o,-s)}},{key:"unapply",value:function(t){var e=this.cx,r=this.cy,i=this.originX,n=this.originY,a=this.angle,o=e+i.getPixels("x"),s=r+n.getPixels("y");t.translate(o,s),t.rotate(-1*a.getRadians()),t.translate(-o,-s)}},{key:"applyToPoint",value:function(t){var e=this.cx,r=this.cy,i=this.angle.getRadians();t.applyTransform([1,0,0,1,e||0,r||0]),t.applyTransform([Math.cos(i),Math.sin(i),-Math.sin(i),Math.cos(i),0,0]),t.applyTransform([1,0,0,1,-e||0,-r||0])}}]),t}(),Ft=function(){function t(e,r,i){g(this,t),this.type="scale";var n=Mt.parseScale(r);0!==n.x&&0!==n.y||(n.x=pt,n.y=pt),this.scale=n,this.originX=i[0],this.originY=i[1]}return y(t,[{key:"apply",value:function(t){var e=this.scale,r=e.x,i=e.y,n=this.originX,a=this.originY,o=n.getPixels("x"),s=a.getPixels("y");t.translate(o,s),t.scale(r,i||r),t.translate(-o,-s)}},{key:"unapply",value:function(t){var e=this.scale,r=e.x,i=e.y,n=this.originX,a=this.originY,o=n.getPixels("x"),s=a.getPixels("y");t.translate(o,s),t.scale(1/r,1/i||r),t.translate(-o,-s)}},{key:"applyToPoint",value:function(t){var e=this.scale,r=e.x,i=e.y;t.applyTransform([r||0,0,0,i||0,0,0])}}]),t}(),Ut=function(){function t(e,r,i){var n;g(this,t),this.type="matrix",this.matrix=[(n=at(r))[0]||0,n[1]||0,n[2]||0,n[3]||0,n[4]||0,n[5]||0],this.originX=i[0],this.originY=i[1]}return y(t,[{key:"apply",value:function(t){var e=this.originX,r=this.originY,i=this.matrix,n=e.getPixels("x"),a=r.getPixels("y");t.translate(n,a),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),t.translate(-n,-a)}},{key:"unapply",value:function(t){var e=this.originX,r=this.originY,i=this.matrix,n=i[0],a=i[2],o=i[4],s=i[1],u=i[3],l=i[5],h=1/(n*(1*u-0*l)-a*(1*s-0*l)+o*(0*s-0*u)),c=e.getPixels("x"),f=r.getPixels("y");t.translate(c,f),t.transform(h*(1*u-0*l),h*(0*l-1*s),h*(0*o-1*a),h*(1*n-0*o),h*(a*l-o*u),h*(o*s-n*l)),t.translate(-c,-f)}},{key:"applyToPoint",value:function(t){t.applyTransform(this.matrix)}}]),t}(),Xt=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="skew",a.angle=new Pt(t,"angle",i),a}return y(r)}(Ut),Yt=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="skewX",a.matrix=[1,0,Math.tan(a.angle.getRadians()),1,0,0],a}return y(r)}(Xt),qt=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="skewY",a.matrix=[1,Math.tan(a.angle.getRadians()),0,1,0,0],a}return y(r)}(Xt);var jt=function(){function t(e,r,i){var n=this;g(this,t),this.document=e,this.transforms=[],nt(r).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/).forEach((function(e){if("none"!==e){var r=function(t){var e=d(t.split("("),2),r=e[0],i=void 0===r?"":r,n=e[1],a=void 0===n?"":n;return[i.trim(),a.trim().replace(")","")]}(e),a=d(r,2),o=a[0],s=a[1],u=t.transformTypes[o];u&&n.transforms.push(new u(n.document,s,i))}}))}return y(t,[{key:"apply",value:function(t){this.transforms.forEach((function(e){return e.apply(t)}))}},{key:"unapply",value:function(t){this.transforms.forEach((function(e){return e.unapply(t)}))}},{key:"applyToPoint",value:function(t){this.transforms.forEach((function(e){return e.applyToPoint(t)}))}}],[{key:"fromElement",value:function(e,r){var i=r.getStyle("transform",!1,!0);if(i.hasValue()){var n=d(r.getStyle("transform-origin",!1,!0).split(),2),a=n[0],o=n[1],s=void 0===o?a:o;if(a&&s){var u=[a,s];return new t(e,i.getString(),u)}}return null}}]),t}();jt.transformTypes={translate:Ht,rotate:zt,scale:Ft,matrix:Ut,skewX:Yt,skewY:qt};var Wt=function(){function t(e,r){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(g(this,t),this.document=e,this.node=r,this.captureTextNodes=n,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],r&&1===r.nodeType){if(Array.from(r.attributes).forEach((function(t){var r=st(t.nodeName);i.attributes[r]=new Pt(e,r,t.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){var a=this.getAttribute("style").getString().split(";").map((function(t){return t.trim()}));a.forEach((function(t){if(t){var r=t.split(":").map((function(t){return t.trim()})),n=d(r,2),a=n[0],o=n[1];a&&(i.styles[a]=new Pt(e,a,o))}}))}var o=e.definitions,s=this.getAttribute("id");s.hasValue()&&(o[s.getString()]||(o[s.getString()]=this)),Array.from(r.childNodes).forEach((function(t){if(1===t.nodeType)i.addChild(t);else if(n&&(3===t.nodeType||4===t.nodeType)){var r=e.createTextNode(t);r.getText().length>0&&i.addChild(r)}}))}}return y(t,[{key:"getAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.attributes[t];if(!r&&e){var i=new Pt(this.document,t,"");return this.attributes[t]=i,i}return r||Pt.empty(this.document)}},{key:"getHrefAttribute",value:function(){var t;for(var e in this.attributes)if("href"===e||e.endsWith(":href")){t=this.attributes[e];break}return t||Pt.empty(this.document)}},{key:"getStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.styles[t];if(i)return i;var n=this.getAttribute(t);if(n.hasValue())return this.styles[t]=n,n;if(!r){var a=this.parent;if(a){var o=a.getStyle(t);if(o.hasValue())return o}}if(e){var s=new Pt(this.document,t,"");return this.styles[t]=s,s}return Pt.empty(this.document)}},{key:"render",value:function(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){var e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("none")){var r=this.getStyle("filter").getDefinition();r&&(this.applyEffects(t),r.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}},{key:"setContext",value:function(t){}},{key:"applyEffects",value:function(t){var e=jt.fromElement(this.document,this);e&&e.apply(t);var r=this.getStyle("clip-path",!1,!0);if(r.hasValue()){var i=r.getDefinition();i&&i.apply(t)}}},{key:"clearContext",value:function(t){}},{key:"renderChildren",value:function(t){this.children.forEach((function(e){e.render(t)}))}},{key:"addChild",value:function(e){var r=e instanceof t?e:this.document.createElement(e);r.parent=this,t.ignoreChildTypes.includes(r.type)||this.children.push(r)}},{key:"matchesSelector",value:function(t){var e,r=this.node;if("function"==typeof r.matches)return r.matches(t);var i=null===(e=r.getAttribute)||void 0===e?void 0:e.call(r,"class");return!(!i||""===i)&&i.split(" ").some((function(e){return".".concat(e)===t}))}},{key:"addStylesFromStyleDefinition",value:function(){var t,e=this.document,r=e.styles,i=e.stylesSpecificity;for(var n in r)if(!n.startsWith("@")&&this.matchesSelector(n)){var a=r[n],o=i[n];if(a)for(var s in a){var u=this.stylesSpecificity[s];void 0===u&&(u="000"),o&&o>=u&&((t=a[s])&&(this.styles[s]=t),this.stylesSpecificity[s]=o)}}}},{key:"removeStyles",value:function(t,e){return e.reduce((function(e,r){var i=t.getStyle(r);if(!i.hasValue())return e;var n=i.getString();return i.setValue(""),[].concat(o(e),[[r,n]])}),[])}},{key:"restoreStyles",value:function(t,e){e.forEach((function(e){var r=d(e,2),i=r[0],n=r[1];t.getStyle(i,!0).setValue(n)}))}},{key:"isFirstChild",value:function(){var t;return 0===(null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this))}}]),t}();Wt.ignoreChildTypes=["title"];var Qt=function(t){s(r,t);var e=l(r);function r(t,i,n){return g(this,r),e.call(this,t,i,n)}return y(r)}(Wt);function Gt(t){var e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function $t(t){if(!t)return"";var e=t.trim().toLowerCase();switch(e){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return e;default:return/^oblique\s+(-|)\d+deg$/.test(e)?e:""}}function Zt(t){if(!t)return"";var e=t.trim().toLowerCase();switch(e){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return e;default:return/^[\d.]+$/.test(e)?e:""}}var Kt=function(){function t(e,r,i,n,a,o){g(this,t);var s=o?"string"==typeof o?t.parse(o):o:{};this.fontFamily=a||s.fontFamily,this.fontSize=n||s.fontSize,this.fontStyle=e||s.fontStyle,this.fontWeight=i||s.fontWeight,this.fontVariant=r||s.fontVariant}return y(t,[{key:"toString",value:function(){return[$t(this.fontStyle),this.fontVariant,Zt(this.fontWeight),this.fontSize,(t=this.fontFamily,"undefined"==typeof process?t:t.trim().split(",").map(Gt).join(","))].join(" ").trim();var t}}],[{key:"parse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,i="",n="",a="",o="",s="",u=nt(e).trim().split(" "),l={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return u.forEach((function(e){switch(!0){case!l.fontStyle&&t.styles.includes(e):"inherit"!==e&&(i=e),l.fontStyle=!0;break;case!l.fontVariant&&t.variants.includes(e):"inherit"!==e&&(n=e),l.fontStyle=!0,l.fontVariant=!0;break;case!l.fontWeight&&t.weights.includes(e):"inherit"!==e&&(a=e),l.fontStyle=!0,l.fontVariant=!0,l.fontWeight=!0;break;case!l.fontSize:"inherit"!==e&&(o=e.split("/")[0]||""),l.fontStyle=!0,l.fontVariant=!0,l.fontWeight=!0,l.fontSize=!0;break;default:"inherit"!==e&&(s+=e)}})),new t(i,n,a,o,s,r)}}]),t}();Kt.styles="normal|italic|oblique|inherit",Kt.variants="normal|small-caps|inherit",Kt.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";var Jt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;g(this,t),this.x1=e,this.y1=r,this.x2=i,this.y2=n,this.addPoint(e,r),this.addPoint(i,n)}return y(t,[{key:"x",get:function(){return this.x1}},{key:"y",get:function(){return this.y1}},{key:"width",get:function(){return this.x2-this.x1}},{key:"height",get:function(){return this.y2-this.y1}},{key:"addPoint",value:function(t,e){void 0!==t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),void 0!==e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))}},{key:"addX",value:function(t){this.addPoint(t,0)}},{key:"addY",value:function(t){this.addPoint(0,t)}},{key:"addBoundingBox",value:function(t){if(t){var e=t.x1,r=t.y1,i=t.x2,n=t.y2;this.addPoint(e,r),this.addPoint(i,n)}}},{key:"sumCubic",value:function(t,e,r,i,n){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*r+3*(1-t)*Math.pow(t,2)*i+Math.pow(t,3)*n}},{key:"bezierCurveAdd",value:function(t,e,r,i,n){var a=6*e-12*r+6*i,o=-3*e+9*r-9*i+3*n,s=3*r-3*e;if(0!==o){var u=Math.pow(a,2)-4*s*o;if(!(u<0)){var l=(-a+Math.sqrt(u))/(2*o);01&&void 0!==arguments[1]&&arguments[1];if(!e){var r=this.getStyle("fill"),i=this.getStyle("fill-opacity"),n=this.getStyle("stroke"),a=this.getStyle("stroke-opacity");if(r.isUrlDefinition()){var o=r.getFillStyleDefinition(this,i);o&&(t.fillStyle=o)}else if(r.hasValue()){"currentColor"===r.getString()&&r.setValue(this.getStyle("color").getColor());var s=r.getColor();"inherit"!==s&&(t.fillStyle="none"===s?"rgba(0,0,0,0)":s)}if(i.hasValue()){var u=new Pt(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=u}if(n.isUrlDefinition()){var l=n.getFillStyleDefinition(this,a);l&&(t.strokeStyle=l)}else if(n.hasValue()){"currentColor"===n.getString()&&n.setValue(this.getStyle("color").getColor());var h=n.getString();"inherit"!==h&&(t.strokeStyle="none"===h?"rgba(0,0,0,0)":h)}if(a.hasValue()){var c=new Pt(this.document,"stroke",t.strokeStyle).addOpacity(a).getString();t.strokeStyle=c}var f=this.getStyle("stroke-width");if(f.hasValue()){var g=f.getPixels();t.lineWidth=g||pt}var v=this.getStyle("stroke-linecap"),y=this.getStyle("stroke-linejoin"),d=this.getStyle("stroke-miterlimit"),p=this.getStyle("stroke-dasharray"),m=this.getStyle("stroke-dashoffset");if(v.hasValue()&&(t.lineCap=v.getString()),y.hasValue()&&(t.lineJoin=y.getString()),d.hasValue()&&(t.miterLimit=d.getNumber()),p.hasValue()&&"none"!==p.getString()){var x=at(p.getString());void 0!==t.setLineDash?t.setLineDash(x):void 0!==t.webkitLineDash?t.webkitLineDash=x:void 0===t.mozDash||1===x.length&&0===x[0]||(t.mozDash=x);var b=m.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=b:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=b:void 0!==t.mozDashOffset&&(t.mozDashOffset=b)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){var w=this.getStyle("font"),S=this.getStyle("font-style"),k=this.getStyle("font-variant"),T=this.getStyle("font-weight"),A=this.getStyle("font-size"),C=this.getStyle("font-family"),O=new Kt(S.getString(),k.getString(),T.getString(),A.hasValue()?"".concat(A.getPixels(!0),"px"):"",C.getString(),Kt.parse(w.getString(),t.font));S.setValue(O.fontStyle),k.setValue(O.fontVariant),T.setValue(O.fontWeight),A.setValue(O.fontSize),C.setValue(O.fontFamily),t.font=O.toString(),A.isPixels()&&(this.document.emSize=A.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}},{key:"clearContext",value:function(t){n(f(r.prototype),"clearContext",this).call(this,t),this.modifiedEmSizeStack&&this.document.popEmSize()}}]),r}(Wt),ee=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,(this instanceof r?this.constructor:void 0)===r||n)).type="text",a.x=0,a.y=0,a.leafTexts=[],a.textChunkStart=0,a.minX=Number.POSITIVE_INFINITY,a.maxX=Number.NEGATIVE_INFINITY,a.measureCache=-1,a}return y(r,[{key:"setContext",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(f(r.prototype),"setContext",this).call(this,t,e);var i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}},{key:"initializeCoordinates",value:function(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}},{key:"getBoundingBox",value:function(t){var e=this;if("text"!==this.type)return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);var r=null;return this.children.forEach((function(i,n){var a=e.getChildBoundingBox(t,e,e,n);r?r.addBoundingBox(a):r=a})),r}},{key:"getFontSize",value:function(){var t=this.document,e=this.parent,r=Kt.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(r)}},{key:"getTElementBoundingBox",value:function(t){var e=this.getFontSize();return new Jt(this.x,this.y-e,this.x+this.measureText(t),this.y)}},{key:"getGlyph",value:function(t,e,r){var i,n=e[r];if(t.isArabic){var a,o=e.length,s=e[r-1],u=e[r+1],l="isolated";(0===r||" "===s)&&r0&&" "!==s&&r0&&" "!==s&&(r===o-1||" "===u)&&(l="initial"),i=(null===(a=t.arabicGlyphs[n])||void 0===a?void 0:a[l])||t.glyphs[n]}else i=t.glyphs[n];return i||(i=t.missingGlyph),i}},{key:"getText",value:function(){return""}},{key:"getTextFromNode",value:function(t){var e=t||this.node,r=Array.from(e.parentNode.childNodes),i=r.indexOf(e),n=r.length-1,a=nt(e.textContent||"");return 0===i&&(a=a.replace(/^[\n \t]+/,"")),i===n&&(a=function(t){return t.replace(/[\n \t]+$/,"")}(a)),a}},{key:"renderChildren",value:function(t){var e=this;if("text"===this.type){this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach((function(r,i){e.renderChild(t,e,e,i)}));var r=this.document.screen.mouse;r.isWorking()&&r.checkBoundingBox(this,this.getBoundingBox(t))}else this.renderTElementChildren(t)}},{key:"renderTElementChildren",value:function(t){var e=this.document,r=this.parent,i=this.getText(),n=r.getStyle("font-family").getDefinition();if(n)for(var a=n.fontFace.unitsPerEm,o=Kt.parse(e.ctx.font),s=r.getStyle("font-size").getNumber(o.fontSize),u=r.getStyle("font-style").getString(o.fontStyle),l=s/a,h=n.isRTL?i.split("").reverse().join(""):i,c=at(r.getAttribute("dx").getString()),f=h.length,g=0;g=this.leafTexts.length)){var t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),r=0;r="start"===e?t.x-this.minX:"end"===e?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(var i=this.textChunkStart;i0?n.children.forEach((function(r,i){e.adjustChildCoordinatesRecursiveCore(t,e,n,i)})):this.adjustChildCoordinates(t,e,r,i)}},{key:"adjustChildCoordinates",value:function(t,e,r,i){var n=r.children[i];if("function"!=typeof n.measureText)return n;t.save(),n.setContext(t,!0);var a=n.getAttribute("x"),o=n.getAttribute("y"),s=n.getAttribute("dx"),u=n.getAttribute("dy"),l=n.getStyle("font-family").getDefinition(),h=Boolean(null==l?void 0:l.isRTL);0===i&&(a.hasValue()||a.setValue(n.getInheritedAttribute("x")),o.hasValue()||o.setValue(n.getInheritedAttribute("y")),s.hasValue()||s.setValue(n.getInheritedAttribute("dx")),u.hasValue()||u.setValue(n.getInheritedAttribute("dy")));var c=n.measureText(t);return h&&(e.x-=c),a.hasValue()?(e.applyAnchoring(),n.x=a.getPixels("x"),s.hasValue()&&(n.x+=s.getPixels("x"))):(s.hasValue()&&(e.x+=s.getPixels("x")),n.x=e.x),e.x=n.x,h||(e.x+=c),o.hasValue()?(n.y=o.getPixels("y"),u.hasValue()&&(n.y+=u.getPixels("y"))):(u.hasValue()&&(e.y+=u.getPixels("y")),n.y=e.y),e.y=n.y,e.leafTexts.push(n),e.minX=Math.min(e.minX,n.x,n.x+c),e.maxX=Math.max(e.maxX,n.x,n.x+c),n.clearContext(t),t.restore(),n}},{key:"getChildBoundingBox",value:function(t,e,r,i){var n=r.children[i];if("function"!=typeof n.getBoundingBox)return null;var a=n.getBoundingBox(t);return a&&n.children.forEach((function(r,i){var o=e.getChildBoundingBox(t,e,n,i);a.addBoundingBox(o)})),a}},{key:"renderChild",value:function(t,e,r,i){var n=r.children[i];n.render(t),n.children.forEach((function(r,i){e.renderChild(t,e,n,i)}))}},{key:"measureText",value:function(t){var e=this.measureCache;if(~e)return e;var r=this.getText(),i=this.measureTargetText(t,r);return this.measureCache=i,i}},{key:"measureTargetText",value:function(t,e){if(!e.length)return 0;var r=this.parent,i=r.getStyle("font-family").getDefinition();if(i){for(var n=this.getFontSize(),a=i.isRTL?e.split("").reverse().join(""):e,o=at(r.getAttribute("dx").getString()),s=a.length,u=0,l=0;l0?"":a.getTextFromNode(),a}return y(r,[{key:"getText",value:function(){return this.text}}]),r}(ee),ie=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a=this.commands.length-1}},{key:"next",value:function(){var t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}},{key:"getPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",r=new Mt(this.command[t],this.command[e]);return this.makeAbsolute(r)}},{key:"getAsControlPoint",value:function(t,e){var r=this.getPoint(t,e);return this.control=r,r}},{key:"getAsCurrentPoint",value:function(t,e){var r=this.getPoint(t,e);return this.current=r,r}},{key:"getReflectedControlPoint",value:function(){var t=this.previousCommand.type;if(t!==$.CURVE_TO&&t!==$.SMOOTH_CURVE_TO&&t!==$.QUAD_TO&&t!==$.SMOOTH_QUAD_TO)return this.current;var e=this.current,r=e.x,i=e.y,n=this.control,a=n.x,o=n.y;return new Mt(2*r-a,2*i-o)}},{key:"makeAbsolute",value:function(t){if(this.command.relative){var e=this.current,r=e.x,i=e.y;t.x+=r,t.y+=i}return t}},{key:"addMarker",value:function(t,e,r){var i=this.points,n=this.angles;r&&n.length>0&&!n[n.length-1]&&(n[n.length-1]=i[i.length-1].angleTo(r)),this.addMarkerAngle(t,e?e.angleTo(t):null)}},{key:"addMarkerAngle",value:function(t,e){this.points.push(t),this.angles.push(e)}},{key:"getMarkerPoints",value:function(){return this.points}},{key:"getMarkerAngles",value:function(){for(var t=this.angles,e=t.length,r=0;rs?o:s,p=o>s?1:o/s,m=o>s?s/o:1;t.translate(h.x,h.y),t.rotate(l),t.scale(p,m),t.arc(0,0,d,c,c+f,Boolean(1-u)),t.scale(1/p,1/m),t.rotate(-l),t.translate(-h.x,-h.y)}}},{key:"pathZ",value:function(t,e){r.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}}],[{key:"pathM",value:function(t){var e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}},{key:"pathL",value:function(t){return{current:t.current,point:t.getAsCurrentPoint()}}},{key:"pathH",value:function(t){var e=t.current,r=t.command,i=new Mt((r.relative?e.x:0)+r.x,e.y);return t.current=i,{current:e,point:i}}},{key:"pathV",value:function(t){var e=t.current,r=t.command,i=new Mt(e.x,(r.relative?e.y:0)+r.y);return t.current=i,{current:e,point:i}}},{key:"pathC",value:function(t){return{current:t.current,point:t.getPoint("x1","y1"),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathS",value:function(t){return{current:t.current,point:t.getReflectedControlPoint(),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathQ",value:function(t){return{current:t.current,controlPoint:t.getAsControlPoint("x1","y1"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathT",value:function(t){var e=t.current,r=t.getReflectedControlPoint();return t.control=r,{current:e,controlPoint:r,currentPoint:t.getAsCurrentPoint()}}},{key:"pathA",value:function(t){var e=t.current,r=t.command,i=r.rX,n=r.rY,a=r.xRot,o=r.lArcFlag,s=r.sweepFlag,u=a*(Math.PI/180),l=t.getAsCurrentPoint(),h=new Mt(Math.cos(u)*(e.x-l.x)/2+Math.sin(u)*(e.y-l.y)/2,-Math.sin(u)*(e.x-l.x)/2+Math.cos(u)*(e.y-l.y)/2),c=Math.pow(h.x,2)/Math.pow(i,2)+Math.pow(h.y,2)/Math.pow(n,2);c>1&&(i*=Math.sqrt(c),n*=Math.sqrt(c));var f=(o===s?-1:1)*Math.sqrt((Math.pow(i,2)*Math.pow(n,2)-Math.pow(i,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(i,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2)));isNaN(f)&&(f=0);var g=new Mt(f*i*h.y/n,f*-n*h.x/i),v=new Mt((e.x+l.x)/2+Math.cos(u)*g.x-Math.sin(u)*g.y,(e.y+l.y)/2+Math.sin(u)*g.x+Math.cos(u)*g.y),y=bt([1,0],[(h.x-g.x)/i,(h.y-g.y)/n]),d=[(h.x-g.x)/i,(h.y-g.y)/n],p=[(-h.x-g.x)/i,(-h.y-g.y)/n],m=bt(d,p);return xt(d,p)<=-1&&(m=Math.PI),xt(d,p)>=1&&(m=0),{currentPoint:l,rX:i,rY:n,sweepFlag:s,xAxisRotation:u,centp:v,a1:y,ad:m}}},{key:"pathZ",value:function(t){t.current=t.start}}]),r}(te),oe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.getAttribute("width",!0),n=this.getAttribute("height",!0),a=this.getAttribute("viewBox"),o=this.getAttribute("style"),s=i.getNumber(0),u=n.getNumber(0);if(r)if("string"==typeof r)this.getAttribute("preserveAspectRatio",!0).setValue(r);else{var l=this.getAttribute("preserveAspectRatio");l.hasValue()&&l.setValue(l.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(i.setValue(t),n.setValue(e),a.hasValue()||a.setValue("0 0 ".concat(s||t," ").concat(u||e)),o.hasValue()){var h=this.getStyle("width"),c=this.getStyle("height");h.hasValue()&&h.setValue("".concat(t,"px")),c.hasValue()&&c.setValue("".concat(e,"px"))}}}]),r}(te),se=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a0&&i>0&&(t.moveTo(e+s,r),t.lineTo(e+i-s,r),t.bezierCurveTo(e+i-s+l*s,r,e+i,r+u-l*u,e+i,r+u),t.lineTo(e+i,r+n-u),t.bezierCurveTo(e+i,r+n-u+l*u,e+i-s+l*s,r+n,e+i-s,r+n),t.lineTo(e+s,r+n),t.bezierCurveTo(e+s-l*s,r+n,e,r+n-u+l*u,e,r+n-u),t.lineTo(e,r+u),t.bezierCurveTo(e,r+u-l*u,e+s-l*s,r,e+s,r),t.closePath())}return new Jt(e,r,e+i,r+n)}},{key:"getMarkers",value:function(){return null}}]),r}(ae),ue=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a0&&(t.beginPath(),t.arc(e,r,i,0,2*Math.PI,!1),t.closePath()),new Jt(e-i,r-i,e+i,r+i)}},{key:"getMarkers",value:function(){return null}}]),r}(ae),le=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a0&&i>0&&(t.beginPath(),t.moveTo(n+r,a),t.bezierCurveTo(n+r,a+e*i,n+e*r,a+i,n,a+i),t.bezierCurveTo(n-e*r,a+i,n-r,a+e*i,n-r,a),t.bezierCurveTo(n-r,a-e*i,n-e*r,a-i,n,a-i),t.bezierCurveTo(n+e*r,a-i,n+r,a-e*i,n+r,a),t.closePath()),new Jt(n-r,a-i,n+r,a+i)}},{key:"getMarkers",value:function(){return null}}]),r}(ae),he=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a0&&r.push([t[t.length-1],r[r.length-1][1]]),r}}]),r}(ae),fe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;athis.maxDuration){var i=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==i||this.frozen){if("remove"===i&&!this.removed)return this.removed=!0,e&&r&&r.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e&&r&&(e.animationFrozen=!0,e.animationFrozenValue=r.getString());return!1}this.duration+=t;var n=!1;if(this.begin0&&Array.from(o).every((function(t){return 3===t.nodeType}));return a.hasText=u,a.text=u?a.getTextFromNode(s):"",a}return y(r,[{key:"getText",value:function(){return this.text}},{key:"renderChildren",value:function(t){if(this.hasText){n(f(r.prototype),"renderChildren",this).call(this,t);var e=this.document,i=this.x,a=this.y,o=e.screen.mouse,s=new Pt(e,"fontSize",Kt.parse(e.ctx.font).fontSize);o.isWorking()&&o.checkBoundingBox(this,new Jt(i,a-s.getPixels("y"),i+this.measureText(t),a))}else if(this.children.length>0){var u=new de(this.document);u.children=this.children,u.parent=this,u.render(t)}}},{key:"onClick",value:function(){var t=this.document.window;t&&t.open(this.getHrefAttribute().getString())}},{key:"onMouseMove",value:function(){this.document.ctx.canvas.style.cursor="pointer"}}]),r}(ee),Ne=function(t){s(n,t);var r=l(n);function n(t,e,i){var a;g(this,n),(a=r.call(this,t,e,i)).type="textPath",a.textWidth=0,a.textHeight=0,a.pathLength=-1,a.glyphInfo=null,a.letterSpacingCache=[],a.measuresCache=new Map([["",0]]);var o=a.getHrefAttribute().getDefinition();return a.text=a.getTextFromNode(),a.dataArray=a.parsePathData(o),a}return y(n,[{key:"getText",value:function(){return this.text}},{key:"path",value:function(t){var e=this.dataArray;t&&t.beginPath(),e.forEach((function(e){var r=e.type,i=e.points;switch(r){case ne.LINE_TO:t&&t.lineTo(i[0],i[1]);break;case ne.MOVE_TO:t&&t.moveTo(i[0],i[1]);break;case ne.CURVE_TO:t&&t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]);break;case ne.QUAD_TO:t&&t.quadraticCurveTo(i[0],i[1],i[2],i[3]);break;case ne.ARC:var n=d(i,8),a=n[0],o=n[1],s=n[2],u=n[3],l=n[4],h=n[5],c=n[6],f=n[7],g=s>u?s:u,v=s>u?1:s/u,y=s>u?u/s:1;t&&(t.translate(a,o),t.rotate(c),t.scale(v,y),t.arc(0,0,g,l,l+h,Boolean(1-f)),t.scale(1/v,1/y),t.rotate(-c),t.translate(-a,-o));break;case ne.CLOSE_PATH:t&&t.closePath()}}))}},{key:"renderChildren",value:function(t){this.setTextData(t),t.save();var e=this.parent.getStyle("text-decoration").getString(),r=this.getFontSize(),i=this.glyphInfo,n=t.fillStyle;"underline"===e&&t.beginPath(),i.forEach((function(i,n){var a=i.p0,o=i.p1,s=i.rotation,u=i.text;t.save(),t.translate(a.x,a.y),t.rotate(s),t.fillStyle&&t.fillText(u,0,0),t.strokeStyle&&t.strokeText(u,0,0),t.restore(),"underline"===e&&(0===n&&t.moveTo(a.x,a.y+r/8),t.lineTo(o.x,o.y+r/5))})),"underline"===e&&(t.lineWidth=r/20,t.strokeStyle=n,t.stroke(),t.closePath()),t.restore()}},{key:"getLetterSpacingAt",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[t]||0}},{key:"findSegmentToFitChar",value:function(t,r,i,n,a,o,s,u,l){var h=o,c=this.measureText(t,u);" "===u&&"justify"===r&&i-1&&(h+=this.getLetterSpacingAt(l));var f=this.textHeight/20,g=this.getEquidistantPointOnPath(h,f,0),v=this.getEquidistantPointOnPath(h+c,f,0),y={p0:g,p1:v},d=g&&v?Math.atan2(v.y-g.y,v.x-g.x):0;if(s){var p=Math.cos(Math.PI/2+d)*s,m=Math.cos(-d)*s;y.p0=e(e({},g),{},{x:g.x+p,y:g.y+m}),y.p1=e(e({},v),{},{x:v.x+p,y:v.y+m})}return{offset:h+=c,segment:y,rotation:d}}},{key:"measureText",value:function(t,e){var r=this.measuresCache,i=e||this.getText();if(r.has(i))return r.get(i);var n=this.measureTargetText(t,i);return r.set(i,n),n}},{key:"setTextData",value:function(t){var e=this;if(!this.glyphInfo){var r=this.getText(),i=r.split(""),n=r.split(" ").length-1,a=this.parent.getAttribute("dx").split().map((function(t){return t.getPixels("x")})),o=this.parent.getAttribute("dy").getPixels("y"),s=this.parent.getStyle("text-anchor").getString("start"),u=this.getStyle("letter-spacing"),l=this.parent.getStyle("letter-spacing"),h=0;u.hasValue()&&"inherit"!==u.getValue()?u.hasValue()&&"initial"!==u.getValue()&&"unset"!==u.getValue()&&(h=u.getPixels()):h=l.getPixels();var c=[],f=r.length;this.letterSpacingCache=c;for(var g=0;g0&&(u-=2*Math.PI),1===n&&u<0&&(u+=2*Math.PI),[o.x,o.y,r,i,s,u,a,n]}},{key:"calcLength",value:function(t,e,r,i){var n=0,a=null,o=null,s=0;switch(r){case ne.LINE_TO:return this.getLineLength(t,e,i[0],i[1]);case ne.CURVE_TO:for(n=0,a=this.getPointOnCubicBezier(0,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),s=.01;s<=1;s+=.01)o=this.getPointOnCubicBezier(s,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;return n;case ne.QUAD_TO:for(n=0,a=this.getPointOnQuadraticBezier(0,t,e,i[0],i[1],i[2],i[3]),s=.01;s<=1;s+=.01)o=this.getPointOnQuadraticBezier(s,t,e,i[0],i[1],i[2],i[3]),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;return n;case ne.ARC:n=0;var u=i[4],l=i[5],h=i[4]+l,c=Math.PI/180;if(Math.abs(u-h)h;s-=c)o=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],s,0),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(s=u+c;s5&&void 0!==arguments[5]?arguments[5]:e,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,s=(n-r)/(i-e+pt),u=Math.sqrt(t*t/(1+s*s));ie)return null;var a,o=i(this.dataArray);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(!s||!(s.pathLength<5e-5||r+s.pathLength+5e-5=0&&l>f)break;n=this.getPointOnEllipticalArc(s.points[0],s.points[1],s.points[2],s.points[3],l,s.points[6]);break;case ne.CURVE_TO:(l=u/s.pathLength)>1&&(l=1),n=this.getPointOnCubicBezier(l,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3],s.points[4],s.points[5]);break;case ne.QUAD_TO:(l=u/s.pathLength)>1&&(l=1),n=this.getPointOnQuadraticBezier(l,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3])}if(n)return n;break}r+=s.pathLength}}catch(g){o.e(g)}finally{o.f()}return null}},{key:"getLineLength",value:function(t,e,r,i){return Math.sqrt((r-t)*(r-t)+(i-e)*(i-e))}},{key:"getPathLength",value:function(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce((function(t,e){return e.pathLength>0?t+e.pathLength:t}),0)),this.pathLength}},{key:"getPointOnCubicBezier",value:function(t,e,r,i,n,a,o,s,u){return{x:s*wt(t)+a*St(t)+i*kt(t)+e*Tt(t),y:u*wt(t)+o*St(t)+n*kt(t)+r*Tt(t)}}},{key:"getPointOnQuadraticBezier",value:function(t,e,r,i,n,a,o){return{x:a*At(t)+i*Ct(t)+e*Ot(t),y:o*At(t)+n*Ct(t)+r*Ot(t)}}},{key:"getPointOnEllipticalArc",value:function(t,e,r,i,n,a){var o=Math.cos(a),s=Math.sin(a),u=r*Math.cos(n),l=i*Math.sin(n);return{x:t+(u*o-l*s),y:e+(u*s+l*o)}}},{key:"buildEquidistantCache",value:function(t,e){var r=this.getPathLength(),i=e||.25,n=t||r/100;if(!this.equidistantCache||this.equidistantCache.step!==n||this.equidistantCache.precision!==i){this.equidistantCache={step:n,precision:i,points:[]};for(var a=0,o=0;o<=r;o+=i){var s=this.getPointOnPath(o),u=this.getPointOnPath(o+i);s&&u&&((a+=this.getLineLength(s.x,s.y,u.x,u.y))>=n&&(this.equidistantCache.points.push({x:s.x,y:s.y,distance:o}),a-=n))}}}},{key:"getEquidistantPointOnPath",value:function(t,e,r){if(this.buildEquidistantCache(e,r),t<0||t-this.getPathLength()>5e-5)return null;var i=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[i]||null}}]),n}(ee),Me=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i,Ve=function(t){s(n,t);var e,r,i=l(n);function n(t,e,r){var a;g(this,n),(a=i.call(this,t,e,r)).type="image",a.loaded=!1;var o=a.getHrefAttribute().getString();if(!o)return h(a);var s=o.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(o);return t.images.push(c(a)),s?a.loadSvg(o):a.loadImage(o),a}return y(n,[{key:"loadImage",value:(r=b(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.document.createImage(e);case 3:r=t.sent,this.image=r,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.error('Error while loading image "'.concat(e,'":'),t.t0);case 10:this.loaded=!0;case 11:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return r.apply(this,arguments)})},{key:"loadSvg",value:(e=b(regeneratorRuntime.mark((function t(e){var r,i,n,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=Me.exec(e))){t.next=6;break}(i=r[5])&&("base64"===r[4]?this.image=atob(i):this.image=decodeURIComponent(i)),t.next=19;break;case 6:return t.prev=6,t.next=9,this.document.fetch(e);case 9:return n=t.sent,t.next=12,n.text();case 12:a=t.sent,this.image=a,t.next=19;break;case 16:t.prev=16,t.t0=t.catch(6),console.error('Error while loading image "'.concat(e,'":'),t.t0);case 19:this.loaded=!0;case 20:case"end":return t.stop()}}),t,this,[[6,16]])}))),function(t){return e.apply(this,arguments)})},{key:"renderChildren",value:function(t){var e=this.document,r=this.image,i=this.loaded,n=this.getAttribute("x").getPixels("x"),a=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");if(i&&r&&o&&s){if(t.save(),t.translate(n,a),"string"==typeof r){var u=e.canvg.forkString(t,r,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:o,scaleHeight:s}),l=u.document.documentElement;l&&(l.parent=this),u.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:o,desiredWidth:r.width,height:s,desiredHeight:r.height}),this.loaded&&("complete"in r&&!r.complete||t.drawImage(r,0,0));t.restore()}}},{key:"getBoundingBox",value:function(){var t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),r=this.getStyle("width").getPixels("x"),i=this.getStyle("height").getPixels("y");return new Jt(t,e,t+r,e+i)}}]),n}(te),_e=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a~]/g," ").replace(/[#.]/g," "),yt),2);return r=h[0],i=h[1],e[2]+=i,e.join("")}(r),"@font-face"===r){var n=i["font-family"].getString().replace(/"|'/g,"");i.src.getString().split(",").forEach((function(e){if(e.indexOf('format("svg")')>0){var r=ut(e);r&&new Re(t).load(n,r)}}))}}}))}})),a}return y(r)}(Wt);Ie.parseExternalUrl=ut;var Le=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a1&&void 0!==n[1]&&n[1],i=document.createElement("img"),r&&(i.crossOrigin="Anonymous"),t.abrupt("return",new Promise((function(t,r){i.onload=function(){t(i)},i.onerror=function(t,e,i,n,a){r(a)},i.src=e})));case 4:case"end":return t.stop()}}),t)}))),Je.apply(this,arguments)}var tr=function(){function t(e){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.rootEmSize,a=void 0===n?12:n,o=i.emSize,s=void 0===o?12:o,u=i.createCanvas,l=void 0===u?t.createCanvas:u,h=i.createImage,c=void 0===h?t.createImage:h,f=i.anonymousCrossOrigin;g(this,t),this.canvg=e,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=a,this.emSize=s,this.createCanvas=l,this.createImage=this.bindCreateImage(c,f),this.screen.wait((function(){return r.isImagesLoaded()})),this.screen.wait((function(){return r.isFontsLoaded()}))}return y(t,[{key:"bindCreateImage",value:function(t,e){return"boolean"==typeof e?function(r,i){return t(r,"boolean"==typeof i?i:e)}:t}},{key:"window",get:function(){return this.screen.window}},{key:"fetch",get:function(){return this.screen.fetch}},{key:"ctx",get:function(){return this.screen.ctx}},{key:"emSize",get:function(){var t=this.emSizeStack;return t[t.length-1]||12},set:function(t){this.emSizeStack.push(t)}},{key:"popEmSize",value:function(){this.emSizeStack.pop()}},{key:"getUniqueId",value:function(){return"canvg".concat(++this.uniqueId)}},{key:"isImagesLoaded",value:function(){return this.images.every((function(t){return t.loaded}))}},{key:"isFontsLoaded",value:function(){return this.fonts.every((function(t){return t.loaded}))}},{key:"createDocumentElement",value:function(t){var e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}},{key:"createElement",value:function(e){var r=e.nodeName.replace(/^[^:]+:/,""),i=t.elementTypes[r];return i?new i(this,e):new Qt(this,e)}},{key:"createTextNode",value:function(t){return new ie(this,t)}},{key:"setViewBox",value:function(t){this.screen.setViewBox(e({document:this},t))}}]),t}();tr.createCanvas=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,r},tr.createImage=function(t){return Je.apply(this,arguments)},tr.elementTypes=Ke;var er=function(){function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};g(this,t),this.parser=new Dt(i),this.screen=new It(e,i),this.options=i;var n=new tr(this,i),a=n.createDocumentElement(r);this.document=n,this.documentElement=a}var r,i;return y(t,[{key:"fork",value:function(r,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.from(r,i,e(e({},this.options),n))}},{key:"forkString",value:function(r,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.fromString(r,i,e(e({},this.options),n))}},{key:"ready",value:function(){return this.screen.ready()}},{key:"isReady",value:function(){return this.screen.isReady()}},{key:"render",value:(i=b(regeneratorRuntime.mark((function t(){var r,i=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i.length>0&&void 0!==i[0]?i[0]:{},this.start(e({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},r)),t.next=4,this.ready();case 4:this.stop();case 5:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.documentElement,i=this.screen,n=this.options;i.start(r,e(e({enableRedraw:!0},n),t))}},{key:"stop",value:function(){this.screen.stop()}},{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(t,e,r)}}],[{key:"from",value:(r=b(regeneratorRuntime.mark((function e(r,i){var n,a,o,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]?s[2]:{},a=new Dt(n),e.next=4,a.parse(i);case 4:return o=e.sent,e.abrupt("return",new t(r,o,n));case 6:case"end":return e.stop()}}),e)}))),function(t,e){return r.apply(this,arguments)})},{key:"fromString",value:function(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=new Dt(i),a=n.parseFromString(r);return new t(e,a,i)}}]),t}();window.OffscreenCanvas||(window.OffscreenCanvas=y((function t(e,r){var i=this;return g(this,t),this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=r,this.canvas.convertToBlob=function(){return new Promise((function(t){i.canvas.toBlob(t)}))},this.canvas})));var rr=it.offscreen(),ir=function(t){return new Promise((function(e,r){var i=new FileReader;i.onloadend=function(){return e(i.result)},i.readAsDataURL(t)}))},nr=null,ar=(t("s",function(){var t=b(regeneratorRuntime.mark((function t(e,r,i){var n,a,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return nr||(nr=new OffscreenCanvas(r,i)),n=nr.getContext("2d"),t.next=4,er.fromString(n,e,rr);case 4:return(a=t.sent).resize(2*r,2*i,"xMidYMid meet"),t.next=8,a.start();case 8:return t.next=10,nr.convertToBlob();case 10:return o=t.sent,t.next=13,ir(o);case 13:return s=t.sent,n.clearRect(0,0,nr.width,nr.height),t.next=17,a.stop();case 17:return a=null,t.abrupt("return",s);case 19:case"end":return t.stop()}}),t)})));return function(e,r,i){return t.apply(this,arguments)}}()),t("f",(function(t){if(!t)return"";var e,r=(new DOMParser).parseFromString(t,"text/xml"),n=-1,a=-1,o=i(r.getElementsByTagName("measure"));try{for(o.s();!(e=o.n()).done;){var s,u=e.value;-1===n&&u.getElementsByTagName("beats").length&&(n=parseInt(u.getElementsByTagName("beats")[0].textContent||"4")),-1===a&&u.getElementsByTagName("beat-type").length&&(a=parseInt(u.getElementsByTagName("beat-type")[0].textContent||"4"));var l=parseInt((null===(s=u.getElementsByTagName("divisions")[0])||void 0===s?void 0:s.textContent)||"256");if(0===u.getElementsByTagName("note").length){var h,c=null===(h=u.getElementsByTagName("forward")[0])||void 0===h?void 0:h.getElementsByTagName("duration")[0];c&&(c.textContent="0"),u.innerHTML=u.innerHTML+'\n \n \n '.concat(l*n,"\n 1\n whole\n ")}}}catch(f){o.e(f)}finally{o.f()}return(new XMLSerializer).serializeToString(r)})),t("o",(function(t,e){var r,n,a,s;if(!t)return"";var u=(new DOMParser).parseFromString(t,"text/xml"),l=(null===(r=u.getElementsByTagName("part-list"))||void 0===r||null===(n=r[0])||void 0===n?void 0:n.getElementsByTagName("score-part"))||[],h=Array.from(l).map((function(t){var e;return(null===(e=t.getElementsByTagName("part-name"))||void 0===e?void 0:e[0].textContent)||""})),c=u.getElementsByTagName("part"),f=c[0],g=o(f.getElementsByTagName("measure")),v=o(f.getElementsByTagName("metronome"));o(f.getElementsByTagName("words")),o(f.getElementsByTagName("coda")),o(f.getElementsByTagName("rehearsal")),"COMMON"===(null===(a=h[0])||void 0===a||null===(s=a.toLocaleUpperCase)||void 0===s?void 0:s.call(a))&&(e++,h.shift());var y=l[e];if(y){var d=y.getAttribute("id");Array.from(c).forEach((function(t){var e;if(t&&t.getAttribute("id")!==d)null===(e=t.parentNode)||void 0===e||e.removeChild(t);else if(t&&"P1"!==t.getAttribute("id")){for(var r={},n=0;n-1){var u=g.indexOf(n),l=t.getElementsByTagName("measure")[u];or(i,n,l)}}))}if(t&&t.getAttribute("id")===d){var h,c,f=t.getElementsByTagName("barline"),y=null===(h=f[f.length-1])||void 0===h?void 0:h.parentElement;if("barline"!==(null==y||null===(c=y.lastElementChild)||void 0===c?void 0:c.tagName)){var p,m=i((null==y?void 0:y.children)||[]);try{for(m.s();!(p=m.n()).done;){var x=p.value;if("barline"===x.tagName){null==y||y.appendChild(x);break}}}catch(b){m.e(b)}finally{m.f()}}}})),Array.from(l).forEach((function(t){var e;t&&t.getAttribute("id")!==d&&(null===(e=t.parentNode)||void 0===e||e.removeChild(t))}));var p=u.getElementsByTagName("note");Array.from(p).forEach((function(t,e){var r=t.getElementsByTagName("grace");r&&r.length}))}return(new XMLSerializer).serializeToString(ar(u))})),function(t){if(!t)return t;var e=t.querySelectorAll("grace");if(!e.length)return t;var r,n=function t(e){return e.querySelector("grace")?t(null==e?void 0:e.nextElementSibling):e},a=i(e);try{for(a.s();!(r=a.n()).done;){var o,s=r.value,u=null===(o=s.parentElement)||void 0===o?void 0:o.querySelector("notations");if(u&&u.querySelectorAll("slur").length>1){var l,h=n(null===(l=s.parentElement)||void 0===l?void 0:l.nextElementSibling);if(h&&h.querySelectorAll("slur").length>0){var c,f,g=Array.from((null===(c=h.querySelector("notations"))||void 0===c?void 0:c.children)||[]).map((function(t){return t.getAttribute("number")})),v=i(u.querySelectorAll("slur"));try{for(v.s();!(f=v.n()).done;){var y,d=f.value;if(!g.includes(d.getAttribute("number")))null===(y=h.querySelector("notations"))||void 0===y||y.appendChild(d)}}catch(p){v.e(p)}finally{v.f()}}}}}catch(p){a.e(p)}finally{a.f()}return t}),or=function(t,e,r){var i=0;if(e){for(var n=0;n0){var o=0,s=Array.from(r.childNodes).filter((function(t){return"note"===t.nodeName})),u=s[s.length-1];if(i>=s.length&&u)return void r.insertBefore(t,r.childNodes[Array.from(r.childNodes).indexOf(u)]);for(var l=0;l