index-legacy-9d2cbd34.js 110 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. System.register(["./index-legacy-e28491f2.js"],(function(t,e){"use strict";var i,r,s,n,a,o,h,l,c,u,g,d,p=document.createElement("style");return p.textContent="._skeleton_vtlsh_1{position:fixed;left:0;top:0;width:100vw;height:100vh;padding:.53333rem .8rem;background-color:#fff;z-index:1000;--van-skeleton-paragraph-height: .8rem}._detail_vtlsh_12{width:100vw;height:100vh;overflow:hidden;overflow-y:auto;--header-height: 1.65333rem;background:var(--container-background)}._detail_vtlsh_12 ._container_vtlsh_20{margin:0 .26667rem;border-radius:.26667rem}._detail_vtlsh_12 #musicAndSelection{overflow:initial!important;height:initial!important;max-height:initial!important}\n",document.head.appendChild(p),{setters:[t=>{i=t.bZ,r=t.d,s=t.g,n=t.n,a=t.bc,o=t.c,h=t.m,l=t.Z,c=t.f,u=t.ai,g=t.as,d=t.$}],execute:function(){var e={},p={get exports(){return e},set exports(t){e=t}},f={},y={get exports(){return f},set exports(t){f=t}};(function(){var t,e,i,r,s,n;"undefined"!=typeof performance&&null!==performance&&performance.now?y.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(y.exports=function(){return(t()-s)/1e6},e=process.hrtime,r=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),n=1e9*process.uptime(),s=r-n):Date.now?(y.exports=function(){return Date.now()-i},i=Date.now()):(y.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(i);for(var m=f,x="undefined"==typeof window?i:window,b=["moz","webkit"],v="AnimationFrame",w=x["request"+v],S=x["cancel"+v]||x["cancelRequest"+v],T=0;!w&&T<b.length;T++)w=x[b[T]+"Request"+v],S=x[b[T]+"Cancel"+v]||x[b[T]+"CancelRequest"+v];if(!w||!S){var A=0,C=0,P=[];w=function(t){if(0===P.length){var e=m(),i=Math.max(0,16.666666666666668-(e-A));A=i+e,setTimeout((function(){var t=P.slice(0);P.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(A)}catch(i){setTimeout((function(){throw i}),0)}}),Math.round(i))}return P.push({handle:++C,callback:t,cancelled:!1}),C},S=function(t){for(var e=0;e<P.length;e++)P[e].handle===t&&(P[e].cancelled=!0)}}p.exports=function(t){return w.call(x,t)},e.cancel=function(){S.apply(x,arguments)},e.polyfill=function(t){t||(t=x),t.requestAnimationFrame=w,t.cancelAnimationFrame=S};var N=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var i=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r<i.length;r++){var s=i[r].re,n=i[r].process,a=s.exec(t);if(a){var o=n(a);this.r=o[0],this.g=o[1],this.b=o[2],o.length>3&&(this.alpha=o[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),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,r=0;r<i.length;r++)for(var s=i[r].example,n=0;n<s.length;n++)t[t.length]=s[n];for(var a in e)t[t.length]=a;var o=document.createElement("ul");for(o.setAttribute("id","rgbcolor-examples"),r=0;r<t.length;r++)try{var h=document.createElement("li"),l=new RGBColor(t[r]),c=document.createElement("div");c.style.cssText="margin: 3px; border: 1px solid black; background:"+l.toHex()+"; color:"+l.toHex(),c.appendChild(document.createTextNode("test"));var u=document.createTextNode(" "+t[r]+" -> "+l.toRGB()+" -> "+l.toHex());h.appendChild(c),h.appendChild(u),o.appendChild(h)}catch(g){}return o}},O=function(t,e){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};
  2. /*! *****************************************************************************
  3. Copyright (c) Microsoft Corporation.
  4. Permission to use, copy, modify, and/or distribute this software for any
  5. purpose with or without fee is hereby granted.
  6. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  7. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  8. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  9. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  10. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  11. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  12. PERFORMANCE OF THIS SOFTWARE.
  13. ***************************************************************************** */function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function M(t,e){var i=t[0],r=t[1];return[i*Math.cos(e)-r*Math.sin(e),i*Math.sin(e)+r*Math.cos(e)]}function _(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=0;i<t.length;i++)if("number"!=typeof t[i])throw new Error("assertNumbers arguments["+i+"] is not a number. "+typeof t[i]+" == typeof "+t[i]);return!0}var V=Math.PI;function R(t,e,i){t.lArcFlag=0===t.lArcFlag?0:1,t.sweepFlag=0===t.sweepFlag?0:1;var r=t.rX,s=t.rY,n=t.x,a=t.y;r=Math.abs(t.rX),s=Math.abs(t.rY);var o=M([(e-n)/2,(i-a)/2],-t.xRot/180*V),h=o[0],l=o[1],c=Math.pow(h,2)/Math.pow(r,2)+Math.pow(l,2)/Math.pow(s,2);1<c&&(r*=Math.sqrt(c),s*=Math.sqrt(c)),t.rX=r,t.rY=s;var u=Math.pow(r,2)*Math.pow(l,2)+Math.pow(s,2)*Math.pow(h,2),g=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-u)/u)),d=r*l/s*g,p=-s*h/r*g,f=M([d,p],t.xRot/180*V);t.cX=f[0]+(e+n)/2,t.cY=f[1]+(i+a)/2,t.phi1=Math.atan2((l-p)/s,(h-d)/r),t.phi2=Math.atan2((-l-p)/s,(-h-d)/r),0===t.sweepFlag&&t.phi2>t.phi1&&(t.phi2-=2*V),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*V),t.phi1*=180/V,t.phi2*=180/V}function k(t,e,i){_(t,e,i);var r=t*t+e*e-i*i;if(0>r)return[];if(0===r)return[[t*i/(t*t+e*e),e*i/(t*t+e*e)]];var s=Math.sqrt(r);return[[(t*i+e*s)/(t*t+e*e),(e*i-t*s)/(t*t+e*e)],[(t*i-e*s)/(t*t+e*e),(e*i+t*s)/(t*t+e*e)]]}var I,L=Math.PI/180;function D(t,e,i){return(1-i)*t+i*e}function z(t,e,i,r){return t+Math.cos(r/180*V)*e+Math.sin(r/180*V)*i}function B(t,e,i,r){var s=1e-6,n=e-t,a=i-e,o=3*n+3*(r-i)-6*a,h=6*(a-n),l=3*n;return Math.abs(o)<s?[-l/h]:function(t,e,i){void 0===i&&(i=1e-6);var r=t*t/4-e;if(r<-i)return[];if(r<=i)return[-t/2];var s=Math.sqrt(r);return[-t/2-s,-t/2+s]}(h/o,l/o,s)}function H(t,e,i,r,s){var n=1-s;return t*(n*n*n)+e*(3*n*n*s)+i*(3*n*s*s)+r*(s*s*s)}!function(t){function e(){return s((function(t,e,i){return t.relative&&(void 0!==t.x1&&(t.x1+=e),void 0!==t.y1&&(t.y1+=i),void 0!==t.x2&&(t.x2+=e),void 0!==t.y2&&(t.y2+=i),void 0!==t.x&&(t.x+=e),void 0!==t.y&&(t.y+=i),t.relative=!1),t}))}function i(){var t=NaN,e=NaN,i=NaN,r=NaN;return s((function(s,n,a){return s.type&W.SMOOTH_CURVE_TO&&(s.type=W.CURVE_TO,t=isNaN(t)?n:t,e=isNaN(e)?a:e,s.x1=s.relative?n-t:2*n-t,s.y1=s.relative?a-e:2*a-e),s.type&W.CURVE_TO?(t=s.relative?n+s.x2:s.x2,e=s.relative?a+s.y2:s.y2):(t=NaN,e=NaN),s.type&W.SMOOTH_QUAD_TO&&(s.type=W.QUAD_TO,i=isNaN(i)?n:i,r=isNaN(r)?a:r,s.x1=s.relative?n-i:2*n-i,s.y1=s.relative?a-r:2*a-r),s.type&W.QUAD_TO?(i=s.relative?n+s.x1:s.x1,r=s.relative?a+s.y1:s.y1):(i=NaN,r=NaN),s}))}function r(){var t=NaN,e=NaN;return s((function(i,r,s){if(i.type&W.SMOOTH_QUAD_TO&&(i.type=W.QUAD_TO,t=isNaN(t)?r:t,e=isNaN(e)?s:e,i.x1=i.relative?r-t:2*r-t,i.y1=i.relative?s-e:2*s-e),i.type&W.QUAD_TO){t=i.relative?r+i.x1:i.x1,e=i.relative?s+i.y1:i.y1;var n=i.x1,a=i.y1;i.type=W.CURVE_TO,i.x1=((i.relative?0:r)+2*n)/3,i.y1=((i.relative?0:s)+2*a)/3,i.x2=(i.x+2*n)/3,i.y2=(i.y+2*a)/3}else t=NaN,e=NaN;return i}))}function s(t){var e=0,i=0,r=NaN,s=NaN;return function(n){if(isNaN(r)&&!(n.type&W.MOVE_TO))throw new Error("path must start with moveto");var a=t(n,e,i,r,s);return n.type&W.CLOSE_PATH&&(e=r,i=s),void 0!==n.x&&(e=n.relative?e+n.x:n.x),void 0!==n.y&&(i=n.relative?i+n.y:n.y),n.type&W.MOVE_TO&&(r=e,s=i),a}}function n(t,e,i,r,n,a){return _(t,e,i,r,n,a),s((function(s,o,h,l){var c=s.x1,u=s.x2,g=s.relative&&!isNaN(l),d=void 0!==s.x?s.x:g?0:o,p=void 0!==s.y?s.y:g?0:h;function f(t){return t*t}s.type&W.HORIZ_LINE_TO&&0!==e&&(s.type=W.LINE_TO,s.y=s.relative?0:h),s.type&W.VERT_LINE_TO&&0!==i&&(s.type=W.LINE_TO,s.x=s.relative?0:o),void 0!==s.x&&(s.x=s.x*t+p*i+(g?0:n)),void 0!==s.y&&(s.y=d*e+s.y*r+(g?0:a)),void 0!==s.x1&&(s.x1=s.x1*t+s.y1*i+(g?0:n)),void 0!==s.y1&&(s.y1=c*e+s.y1*r+(g?0:a)),void 0!==s.x2&&(s.x2=s.x2*t+s.y2*i+(g?0:n)),void 0!==s.y2&&(s.y2=u*e+s.y2*r+(g?0:a));var y=t*r-e*i;if(void 0!==s.xRot&&(1!==t||0!==e||0!==i||1!==r))if(0===y)delete s.rX,delete s.rY,delete s.xRot,delete s.lArcFlag,delete s.sweepFlag,s.type=W.LINE_TO;else{var m=s.xRot*Math.PI/180,x=Math.sin(m),b=Math.cos(m),v=1/f(s.rX),w=1/f(s.rY),S=f(b)*v+f(x)*w,T=2*x*b*(v-w),A=f(x)*v+f(b)*w,C=S*r*r-T*e*r+A*e*e,P=T*(t*r+e*i)-2*(S*i*r+A*t*e),N=S*i*i-T*t*i+A*t*t,O=(Math.atan2(P,C-N)+Math.PI)%Math.PI/2,E=Math.sin(O),M=Math.cos(O);s.rX=Math.abs(y)/Math.sqrt(C*f(M)+P*E*M+N*f(E)),s.rY=Math.abs(y)/Math.sqrt(C*f(E)-P*E*M+N*f(M)),s.xRot=180*O/Math.PI}return void 0!==s.sweepFlag&&0>y&&(s.sweepFlag=+!s.sweepFlag),s}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),_(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 s((function(t,e,i){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=i),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=i),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=i),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),s((function(r,s,n,a,o){if(isNaN(a)&&!(r.type&W.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&W.HORIZ_LINE_TO&&(r.type=W.LINE_TO,r.y=r.relative?0:n),i&&r.type&W.VERT_LINE_TO&&(r.type=W.LINE_TO,r.x=r.relative?0:s),t&&r.type&W.CLOSE_PATH&&(r.type=W.LINE_TO,r.x=r.relative?a-s:a,r.y=r.relative?o-n:o),r.type&W.ARC&&(0===r.rX||0===r.rY)&&(r.type=W.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},t.NORMALIZE_ST=i,t.QT_TO_C=r,t.INFO=s,t.SANITIZE=function(t){void 0===t&&(t=0),_(t);var e=NaN,i=NaN,r=NaN,n=NaN;return s((function(s,a,o,h,l){var c=Math.abs,u=!1,g=0,d=0;if(s.type&W.SMOOTH_CURVE_TO&&(g=isNaN(e)?0:a-e,d=isNaN(i)?0:o-i),s.type&(W.CURVE_TO|W.SMOOTH_CURVE_TO)?(e=s.relative?a+s.x2:s.x2,i=s.relative?o+s.y2:s.y2):(e=NaN,i=NaN),s.type&W.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,n=isNaN(n)?o:2*o-n):s.type&W.QUAD_TO?(r=s.relative?a+s.x1:s.x1,n=s.relative?o+s.y1:s.y2):(r=NaN,n=NaN),s.type&W.LINE_COMMANDS||s.type&W.ARC&&(0===s.rX||0===s.rY||!s.lArcFlag)||s.type&W.CURVE_TO||s.type&W.SMOOTH_CURVE_TO||s.type&W.QUAD_TO||s.type&W.SMOOTH_QUAD_TO){var p=void 0===s.x?0:s.relative?s.x:s.x-a,f=void 0===s.y?0:s.relative?s.y:s.y-o;g=isNaN(r)?void 0===s.x1?g:s.relative?s.x:s.x1-a:r-a,d=isNaN(n)?void 0===s.y1?d:s.relative?s.y:s.y1-o:n-o;var y=void 0===s.x2?0:s.relative?s.x:s.x2-a,m=void 0===s.y2?0:s.relative?s.y:s.y2-o;c(p)<=t&&c(f)<=t&&c(g)<=t&&c(d)<=t&&c(y)<=t&&c(m)<=t&&(u=!0)}return s.type&W.CLOSE_PATH&&c(a-h)<=t&&c(o-l)<=t&&(u=!0),u?[]:s}))},t.MATRIX=n,t.ROTATE=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),_(t,e,i);var r=Math.sin(t),s=Math.cos(t);return n(s,r,-r,s,e-e*s+i*r,i-e*r-i*s)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),_(t,e),n(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),_(t,e),n(t,0,0,e,0,0)},t.SKEW_X=function(t){return _(t),n(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return _(t),n(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),_(t),n(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),_(t),n(1,0,0,-1,0,t)},t.A_TO_C=function(){return s((function(t,e,i){return W.ARC===t.type?function(t,e,i){var r,s,n,a;t.cX||R(t,e,i);for(var o=Math.min(t.phi1,t.phi2),h=Math.max(t.phi1,t.phi2)-o,l=Math.ceil(h/90),c=new Array(l),u=e,g=i,d=0;d<l;d++){var p=D(t.phi1,t.phi2,d/l),f=D(t.phi1,t.phi2,(d+1)/l),y=f-p,m=4/3*Math.tan(y*L/4),x=[Math.cos(p*L)-m*Math.sin(p*L),Math.sin(p*L)+m*Math.cos(p*L)],b=x[0],v=x[1],w=[Math.cos(f*L),Math.sin(f*L)],S=w[0],T=w[1],A=[S+m*Math.sin(f*L),T-m*Math.cos(f*L)],C=A[0],P=A[1];c[d]={relative:t.relative,type:W.CURVE_TO};var N=function(e,i){var r=M([e*t.rX,i*t.rY],t.xRot),s=r[0],n=r[1];return[t.cX+s,t.cY+n]};r=N(b,v),c[d].x1=r[0],c[d].y1=r[1],s=N(C,P),c[d].x2=s[0],c[d].y2=s[1],n=N(S,T),c[d].x=n[0],c[d].y=n[1],t.relative&&(c[d].x1-=u,c[d].y1-=g,c[d].x2-=u,c[d].y2-=g,c[d].x-=u,c[d].y-=g),u=(a=[c[d].x,c[d].y])[0],g=a[1]}return c}(t,t.relative?0:e,t.relative?0:i):t}))},t.ANNOTATE_ARCS=function(){return s((function(t,e,i){return t.relative&&(e=0,i=0),W.ARC===t.type&&R(t,e,i),t}))},t.CLONE=function(){return function(t){var e={};for(var i in t)e[i]=t[i];return e}},t.CALCULATE_BOUNDS=function(){var t=e(),n=r(),a=i(),o=s((function(e,i,r){var s=a(n(t(function(t){var e={};for(var i in t)e[i]=t[i];return e}(e))));function h(t){t>o.maxX&&(o.maxX=t),t<o.minX&&(o.minX=t)}function l(t){t>o.maxY&&(o.maxY=t),t<o.minY&&(o.minY=t)}if(s.type&W.DRAWING_COMMANDS&&(h(i),l(r)),s.type&W.HORIZ_LINE_TO&&h(s.x),s.type&W.VERT_LINE_TO&&l(s.y),s.type&W.LINE_TO&&(h(s.x),l(s.y)),s.type&W.CURVE_TO){h(s.x),l(s.y);for(var c=0,u=B(i,s.x1,s.x2,s.x);c<u.length;c++)0<(N=u[c])&&1>N&&h(H(i,s.x1,s.x2,s.x,N));for(var g=0,d=B(r,s.y1,s.y2,s.y);g<d.length;g++)0<(N=d[g])&&1>N&&l(H(r,s.y1,s.y2,s.y,N))}if(s.type&W.ARC){h(s.x),l(s.y),R(s,i,r);for(var p=s.xRot/180*Math.PI,f=Math.cos(p)*s.rX,y=Math.sin(p)*s.rX,m=-Math.sin(p)*s.rY,x=Math.cos(p)*s.rY,b=s.phi1<s.phi2?[s.phi1,s.phi2]:-180>s.phi2?[s.phi2+360,s.phi1+360]:[s.phi2,s.phi1],v=b[0],w=b[1],S=function(t){var e=t[0],i=t[1],r=180*Math.atan2(i,e)/Math.PI;return r<v?r+360:r},T=0,A=k(m,-f,0).map(S);T<A.length;T++)(N=A[T])>v&&N<w&&h(z(s.cX,f,m,N));for(var C=0,P=k(x,-y,0).map(S);C<P.length;C++){var N;(N=P[C])>v&&N<w&&l(z(s.cY,y,x,N))}}return e}));return o.minX=1/0,o.maxX=-1/0,o.minY=1/0,o.maxY=-1/0,o}}(I||(I={}));var U,F=function(){function t(){}return t.prototype.round=function(t){return this.transform(I.ROUND(t))},t.prototype.toAbs=function(){return this.transform(I.TO_ABS())},t.prototype.toRel=function(){return this.transform(I.TO_REL())},t.prototype.normalizeHVZ=function(t,e,i){return this.transform(I.NORMALIZE_HVZ(t,e,i))},t.prototype.normalizeST=function(){return this.transform(I.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(I.QT_TO_C())},t.prototype.aToC=function(){return this.transform(I.A_TO_C())},t.prototype.sanitize=function(t){return this.transform(I.SANITIZE(t))},t.prototype.translate=function(t,e){return this.transform(I.TRANSLATE(t,e))},t.prototype.scale=function(t,e){return this.transform(I.SCALE(t,e))},t.prototype.rotate=function(t,e,i){return this.transform(I.ROTATE(t,e,i))},t.prototype.matrix=function(t,e,i,r,s,n){return this.transform(I.MATRIX(t,e,i,r,s,n))},t.prototype.skewX=function(t){return this.transform(I.SKEW_X(t))},t.prototype.skewY=function(t){return this.transform(I.SKEW_Y(t))},t.prototype.xSymmetry=function(t){return this.transform(I.X_AXIS_SYMMETRY(t))},t.prototype.ySymmetry=function(t){return this.transform(I.Y_AXIS_SYMMETRY(t))},t.prototype.annotateArcs=function(){return this.transform(I.ANNOTATE_ARCS())},t}(),X=function(t){return" "===t||"\t"===t||"\r"===t||"\n"===t},Y=function(t){return"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0)},q=function(t){function e(){var e=t.call(this)||this;return e.curNumber="",e.curCommandType=-1,e.curCommandRelative=!1,e.canParseCommandOrComma=!0,e.curNumberHasExp=!1,e.curNumberHasExpDigits=!1,e.curNumberHasDecimal=!1,e.curArgs=[],e}return E(e,t),e.prototype.finish=function(t){if(void 0===t&&(t=[]),this.parse(" ",t),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t},e.prototype.parse=function(t,e){var i=this;void 0===e&&(e=[]);for(var r=function(t){e.push(t),i.curArgs.length=0,i.canParseCommandOrComma=!0},s=0;s<t.length;s++){var n=t[s],a=!(this.curCommandType!==W.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),o=Y(n)&&("0"===this.curNumber&&"0"===n||a);if(!Y(n)||o)if("e"!==n&&"E"!==n)if("-"!==n&&"+"!==n||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==n||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&-1!==this.curCommandType){var h=Number(this.curNumber);if(isNaN(h))throw new SyntaxError("Invalid number ending at "+s);if(this.curCommandType===W.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>h)throw new SyntaxError('Expected positive number, got "'+h+'" at index "'+s+'"')}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 "'+s+'"');this.curArgs.push(h),this.curArgs.length===Q[this.curCommandType]&&(W.HORIZ_LINE_TO===this.curCommandType?r({type:W.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):W.VERT_LINE_TO===this.curCommandType?r({type:W.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===W.MOVE_TO||this.curCommandType===W.LINE_TO||this.curCommandType===W.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),W.MOVE_TO===this.curCommandType&&(this.curCommandType=W.LINE_TO)):this.curCommandType===W.CURVE_TO?r({type:W.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===W.SMOOTH_CURVE_TO?r({type:W.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===W.QUAD_TO?r({type:W.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===W.ARC&&r({type:W.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(!X(n))if(","===n&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==n&&"-"!==n&&"."!==n)if(o)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+s+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==n&&"Z"!==n)if("h"===n||"H"===n)this.curCommandType=W.HORIZ_LINE_TO,this.curCommandRelative="h"===n;else if("v"===n||"V"===n)this.curCommandType=W.VERT_LINE_TO,this.curCommandRelative="v"===n;else if("m"===n||"M"===n)this.curCommandType=W.MOVE_TO,this.curCommandRelative="m"===n;else if("l"===n||"L"===n)this.curCommandType=W.LINE_TO,this.curCommandRelative="l"===n;else if("c"===n||"C"===n)this.curCommandType=W.CURVE_TO,this.curCommandRelative="c"===n;else if("s"===n||"S"===n)this.curCommandType=W.SMOOTH_CURVE_TO,this.curCommandRelative="s"===n;else if("q"===n||"Q"===n)this.curCommandType=W.QUAD_TO,this.curCommandRelative="q"===n;else if("t"===n||"T"===n)this.curCommandType=W.SMOOTH_QUAD_TO,this.curCommandRelative="t"===n;else{if("a"!==n&&"A"!==n)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+".");this.curCommandType=W.ARC,this.curCommandRelative="a"===n}else e.push({type:W.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=n,this.curNumberHasDecimal="."===n}else this.curNumber+=n,this.curNumberHasDecimal=!0;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=!0;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp}return e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,i){void 0===i&&(i=[]);for(var r=0,s=Object.getPrototypeOf(this).parse.call(this,e);r<s.length;r++){var n=s[r],a=t(n);Array.isArray(a)?i.push.apply(i,a):i.push(a)}return i}}})},e}(F),W=function(t){function e(i){var r=t.call(this)||this;return r.commands="string"==typeof i?e.parse(i):i,r}return E(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var t=I.CALCULATE_BOUNDS();return this.transform(t),t},e.prototype.transform=function(t){for(var e=[],i=0,r=this.commands;i<r.length;i++){var s=t(r[i]);Array.isArray(s)?e.push.apply(e,s):e.push(s)}return this.commands=e,this},e.encode=function(t){return function(t){var e="";Array.isArray(t)||(t=[t]);for(var i=0;i<t.length;i++){var r=t[i];if(r.type===W.CLOSE_PATH)e+="z";else if(r.type===W.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===W.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===W.MOVE_TO)e+=(r.relative?"m":"M")+r.x+" "+r.y;else if(r.type===W.LINE_TO)e+=(r.relative?"l":"L")+r.x+" "+r.y;else if(r.type===W.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+" "+r.y1+" "+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===W.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===W.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+" "+r.y1+" "+r.x+" "+r.y;else if(r.type===W.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+" "+r.y;else{if(r.type!==W.ARC)throw new Error('Unexpected command type "'+r.type+'" at index '+i+".");e+=(r.relative?"a":"A")+r.rX+" "+r.rY+" "+r.xRot+" "+ +r.lArcFlag+" "+ +r.sweepFlag+" "+r.x+" "+r.y}}return e}(t)},e.parse=function(t){var e=new q,i=[];return e.parse(t,i),e.finish(i),i},e.CLOSE_PATH=1,e.MOVE_TO=2,e.HORIZ_LINE_TO=4,e.VERT_LINE_TO=8,e.LINE_TO=16,e.CURVE_TO=32,e.SMOOTH_CURVE_TO=64,e.QUAD_TO=128,e.SMOOTH_QUAD_TO=256,e.ARC=512,e.LINE_COMMANDS=e.LINE_TO|e.HORIZ_LINE_TO|e.VERT_LINE_TO,e.DRAWING_COMMANDS=e.HORIZ_LINE_TO|e.VERT_LINE_TO|e.LINE_TO|e.CURVE_TO|e.SMOOTH_CURVE_TO|e.QUAD_TO|e.SMOOTH_QUAD_TO|e.ARC,e}(F),Q=((U={})[W.MOVE_TO]=2,U[W.LINE_TO]=2,U[W.HORIZ_LINE_TO]=1,U[W.VERT_LINE_TO]=1,U[W.CLOSE_PATH]=0,U[W.QUAD_TO]=4,U[W.SMOOTH_QUAD_TO]=2,U[W.CURVE_TO]=6,U[W.SMOOTH_CURVE_TO]=4,U[W.ARC]=7,U);function G(t){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(t)}
  14. /**
  15. * StackBlur - a fast almost Gaussian Blur For Canvas
  16. *
  17. * In case you find this class useful - especially in commercial projects -
  18. * I am not totally unhappy for a small donation to my PayPal account
  19. * mario@quasimondo.de
  20. *
  21. * Or support me on flattr:
  22. * {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}.
  23. *
  24. * @module StackBlur
  25. * @author Mario Klingemann
  26. * Contact: mario@quasimondo.com
  27. * Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html}
  28. * Twitter: @quasimondo
  29. *
  30. * @copyright (c) 2010 Mario Klingemann
  31. *
  32. * Permission is hereby granted, free of charge, to any person
  33. * obtaining a copy of this software and associated documentation
  34. * files (the "Software"), to deal in the Software without
  35. * restriction, including without limitation the rights to use,
  36. * copy, modify, merge, publish, distribute, sublicense, and/or sell
  37. * copies of the Software, and to permit persons to whom the
  38. * Software is furnished to do so, subject to the following
  39. * conditions:
  40. *
  41. * The above copyright notice and this permission notice shall be
  42. * included in all copies or substantial portions of the Software.
  43. *
  44. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  45. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  46. * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  47. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  48. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  49. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  50. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  51. * OTHER DEALINGS IN THE SOFTWARE.
  52. */
  53. var $=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Z=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function j(t,e,i,r,s,n){if(!(isNaN(n)||n<1)){n|=0;var a=function(t,e,i,r,s){if("string"==typeof t&&(t=document.getElementById(t)),!t||"object"!==G(t)||!("getContext"in t))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var n=t.getContext("2d");try{return n.getImageData(e,i,r,s)}catch(a){throw new Error("unable to access image data: "+a)}}(t,e,i,r,s);a=function(t,e,i,r,s,n){for(var a,o=t.data,h=2*n+1,l=r-1,c=s-1,u=n+1,g=u*(u+1)/2,d=new J,p=d,f=1;f<h;f++)p=p.next=new J,f===u&&(a=p);p.next=d;for(var y=null,m=null,x=0,b=0,v=$[n],w=Z[n],S=0;S<s;S++){p=d;for(var T=o[b],A=o[b+1],C=o[b+2],P=o[b+3],N=0;N<u;N++)p.r=T,p.g=A,p.b=C,p.a=P,p=p.next;for(var O=0,E=0,M=0,_=0,V=u*T,R=u*A,k=u*C,I=u*P,L=g*T,D=g*A,z=g*C,B=g*P,H=1;H<u;H++){var U=b+((l<H?l:H)<<2),F=o[U],X=o[U+1],Y=o[U+2],q=o[U+3],W=u-H;L+=(p.r=F)*W,D+=(p.g=X)*W,z+=(p.b=Y)*W,B+=(p.a=q)*W,O+=F,E+=X,M+=Y,_+=q,p=p.next}y=d,m=a;for(var Q=0;Q<r;Q++){var G=B*v>>w;if(o[b+3]=G,0!==G){var j=255/G;o[b]=(L*v>>w)*j,o[b+1]=(D*v>>w)*j,o[b+2]=(z*v>>w)*j}else o[b]=o[b+1]=o[b+2]=0;L-=V,D-=R,z-=k,B-=I,V-=y.r,R-=y.g,k-=y.b,I-=y.a;var K=Q+n+1;K=x+(K<l?K:l)<<2,L+=O+=y.r=o[K],D+=E+=y.g=o[K+1],z+=M+=y.b=o[K+2],B+=_+=y.a=o[K+3],y=y.next;var tt=m,et=tt.r,it=tt.g,rt=tt.b,st=tt.a;V+=et,R+=it,k+=rt,I+=st,O-=et,E-=it,M-=rt,_-=st,m=m.next,b+=4}x+=r}for(var nt=0;nt<r;nt++){var at=o[b=nt<<2],ot=o[b+1],ht=o[b+2],lt=o[b+3],ct=u*at,ut=u*ot,gt=u*ht,dt=u*lt,pt=g*at,ft=g*ot,yt=g*ht,mt=g*lt;p=d;for(var xt=0;xt<u;xt++)p.r=at,p.g=ot,p.b=ht,p.a=lt,p=p.next;for(var bt=r,vt=0,wt=0,St=0,Tt=0,At=1;At<=n;At++){b=bt+nt<<2;var Ct=u-At;pt+=(p.r=at=o[b])*Ct,ft+=(p.g=ot=o[b+1])*Ct,yt+=(p.b=ht=o[b+2])*Ct,mt+=(p.a=lt=o[b+3])*Ct,Tt+=at,vt+=ot,wt+=ht,St+=lt,p=p.next,At<c&&(bt+=r)}b=nt,y=d,m=a;for(var Pt=0;Pt<s;Pt++){var Nt=b<<2;o[Nt+3]=lt=mt*v>>w,lt>0?(lt=255/lt,o[Nt]=(pt*v>>w)*lt,o[Nt+1]=(ft*v>>w)*lt,o[Nt+2]=(yt*v>>w)*lt):o[Nt]=o[Nt+1]=o[Nt+2]=0,pt-=ct,ft-=ut,yt-=gt,mt-=dt,ct-=y.r,ut-=y.g,gt-=y.b,dt-=y.a,Nt=nt+((Nt=Pt+u)<c?Nt:c)*r<<2,pt+=Tt+=y.r=o[Nt],ft+=vt+=y.g=o[Nt+1],yt+=wt+=y.b=o[Nt+2],mt+=St+=y.a=o[Nt+3],y=y.next,ct+=at=m.r,ut+=ot=m.g,gt+=ht=m.b,dt+=lt=m.a,Tt-=at,vt-=ot,wt-=ht,St-=lt,m=m.next,b+=r}}return t}(a,0,0,r,s,n),t.getContext("2d").putImageData(a,e,i)}}var J=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function K(t){return t.replace(/(?!\u3000)\s+/gm," ")}function tt(t){const e=t.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return e?e.map(parseFloat):[]}const et=/^[A-Z-]+$/;function it(t){const e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t);return e&&(e[2]||e[3]||e[4])||""}const rt=/(\[[^\]]+\])/g,st=/(#[^\s+>~.[:]+)/g,nt=/(\.[^\s+>~.[:]+)/g,at=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,ot=/(:[\w-]+\([^)]*\))/gi,ht=/(:[^\s+>~.[:]+)/g,lt=/([^\s+>~.[:]+)/g;function ct(t,e){const i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}const ut=1e-8;function gt(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function dt(t,e){return(t[0]*e[0]+t[1]*e[1])/(gt(t)*gt(e))}function pt(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(dt(t,e))}function ft(t){return t*t*t}function yt(t){return 3*t*t*(1-t)}function mt(t){return 3*t*(1-t)*(1-t)}function xt(t){return(1-t)*(1-t)*(1-t)}function bt(t){return t*t}function vt(t){return 2*t*(1-t)}function wt(t){return(1-t)*(1-t)}class St{static empty(t){return new St(t,"EMPTY","")}split(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ";const{document:e,name:i}=this;return K(this.getString()).trim().split(t).map((t=>new St(e,i,t)))}hasValue(t){const e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}isString(t){const{value:e}=this,i="string"==typeof e;return i&&t?t.test(e):i}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}setValue(t){return this.value=t,this}getValue(t){return void 0===t||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);const{value:e}=this;let i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}getString(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=function(t){if(!t.startsWith("rgb"))return t;let e=3;return t.replace(/\d+(\.\d+)?/g,((t,i)=>e--&&i?String(Math.round(parseFloat(t))):t))}(e),this.value=e),e}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;const[i,r]="boolean"==typeof t?[void 0,t]:[t],{viewPort:s}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(s.computeSize("x"),s.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(s.computeSize("x"),s.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*s.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*s.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(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*s.computeSize(i);default:{const t=this.getNumber();return e&&t<1?t*s.computeSize(i):t}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}getRadians(){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)}}getDefinition(){const t=this.getString(),e=/#([^)'"]+)/.exec(t),i=(null==e?void 0:e[1])||t;return this.document.definitions[i]}getFillStyleDefinition(t,e){let i=this.getDefinition();if(!i)return null;if("function"==typeof i.createGradient&&"getBoundingBox"in t)return i.createGradient(this.document.ctx,t,e);if("function"==typeof i.createPattern){if(i.getHrefAttribute().hasValue()){const t=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),i&&t.hasValue()&&i.getAttribute("patternTransform",!0).setValue(t.value)}if(i)return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return St.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const i=e.length;let r=0;for(let s=0;s<i&&(","===e[s]&&r++,3!==r);s++);if(t.hasValue()&&this.isString()&&3!==r){const i=new N(e);i.ok&&(i.alpha=t.getNumber(),e=i.toRGBA())}return new St(this.document,this.name,e)}constructor(t,e,i){this.document=t,this.name=e,this.value=i,this.isNormalizedColor=!1}}St.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class Tt{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||At()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||At()}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return"number"==typeof t?t:"x"===t?this.width:"y"===t?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}constructor(){this.viewPorts=[]}}function At(){return{width:Tt.DEFAULT_VIEWPORT_WIDTH,height:Tt.DEFAULT_VIEWPORT_HEIGHT}}Tt.DEFAULT_VIEWPORT_WIDTH=800,Tt.DEFAULT_VIEWPORT_HEIGHT=600;class Ct{static parse(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const[i=e,r=e]=tt(t);return new Ct(i,r)}static parseScale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const[i=e,r=i]=tt(t);return new Ct(i,r)}static parsePath(t){const e=tt(t),i=e.length,r=[];for(let s=0;s<i;s+=2)r.push(new Ct(e[s],e[s+1]));return r}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){const{x:e,y:i}=this,r=e*t[0]+i*t[2]+t[4],s=e*t[1]+i*t[3]+t[5];this.x=r,this.y=s}constructor(t,e){this.x=t,this.y=e}}class Pt{isWorking(){return this.working}start(){if(this.working)return;const{screen:t,onClick:e,onMouseMove:i}=this,r=t.ctx.canvas;r.onclick=e,r.onmousemove=i,this.working=!0}stop(){if(!this.working)return;const t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:i}=this,{style:r}=t.ctx.canvas;let s;r&&(r.cursor=""),e.forEach(((t,e)=>{let{run:r}=t;for(s=i[e];s;)r(s),s=s.parent})),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInPath&&e.isPointInPath(n,a)&&(r[s]=t)}))}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInBox(n,a)&&(r[s]=t)}))}mapXY(t,e){const{window:i,ctx:r}=this.screen,s=new Ct(t,e);let n=r.canvas;for(;n;)s.x-=n.offsetLeft,s.y-=n.offsetTop,n=n.offsetParent;return(null==i?void 0:i.scrollX)&&(s.x+=i.scrollX),(null==i?void 0:i.scrollY)&&(s.y+=i.scrollY),s}onClick(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:i,run(t){t.onClick&&t.onClick()}})}onMouseMove(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:i,run(t){t.onMouseMove&&t.onMouseMove()}})}constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const Nt="undefined"!=typeof window?window:null,Ot="undefined"!=typeof fetch?fetch.bind(void 0):void 0;class Et{wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const t=this.waits.every((t=>t()));return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}setDefaults(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}setViewBox(t){let{document:e,ctx:i,aspectRatio:r,width:s,desiredWidth:n,height:a,desiredHeight:o,minX:h=0,minY:l=0,refX:c,refY:u,clip:g=!1,clipX:d=0,clipY:p=0}=t;const f=K(r).replace(/^defer\s/,""),[y,m]=f.split(" "),x=y||"xMidYMid",b=m||"meet",v=s/n,w=a/o,S=Math.min(v,w),T=Math.max(v,w);let A=n,C=o;"meet"===b&&(A*=S,C*=S),"slice"===b&&(A*=T,C*=T);const P=new St(e,"refX",c),N=new St(e,"refY",u),O=P.hasValue()&&N.hasValue();if(O&&i.translate(-S*P.getPixels("x"),-S*N.getPixels("y")),g){const t=S*d,e=S*p;i.beginPath(),i.moveTo(t,e),i.lineTo(s,e),i.lineTo(s,a),i.lineTo(t,a),i.closePath(),i.clip()}if(!O){const t="meet"===b&&S===w,e="slice"===b&&T===w,r="meet"===b&&S===v,n="slice"===b&&T===v;x.startsWith("xMid")&&(t||e)&&i.translate(s/2-A/2,0),x.endsWith("YMid")&&(r||n)&&i.translate(0,a/2-C/2),x.startsWith("xMax")&&(t||e)&&i.translate(s-A,0),x.endsWith("YMax")&&(r||n)&&i.translate(0,a-C)}switch(!0){case"none"===x:i.scale(v,w);break;case"meet"===b:i.scale(S,S);break;case"slice"===b:i.scale(T,T)}i.translate(-h,-l)}start(t){let{enableRedraw:i=!1,ignoreMouse:r=!1,ignoreAnimation:s=!1,ignoreDimensions:n=!1,ignoreClear:a=!1,forceRedraw:o,scaleWidth:h,scaleHeight:l,offsetX:c,offsetY:u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mouse:g}=this,d=1e3/Et.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=d,this.readyPromise=new Promise((t=>{this.resolveReady=t})),this.isReady()&&this.render(t,n,a,h,l,c,u),!i)return;let p=Date.now(),f=p,y=0;const m=()=>{p=Date.now(),y=p-f,y>=d&&(f=p-y%d,this.shouldUpdate(s,o)&&(this.render(t,n,a,h,l,c,u),g.runEvents())),this.intervalId=e(m)};r||g.start(),this.intervalId=e(m)}stop(){this.intervalId&&(e.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:t}=this;if(this.animations.reduce(((e,i)=>i.update(t)||e),!1))return!0}return!("function"!=typeof e||!e())||!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents()}render(t,e,i,r,s,n,a){const{viewPort:o,ctx:h,isFirstRender:l}=this,c=h.canvas;o.clear(),c.width&&c.height&&o.setCurrent(c.width,c.height);const u=t.getStyle("width"),g=t.getStyle("height");!e&&(l||"number"!=typeof r&&"number"!=typeof s)&&(u.hasValue()&&(c.width=u.getPixels("x"),c.style&&(c.style.width="".concat(c.width,"px"))),g.hasValue()&&(c.height=g.getPixels("y"),c.style&&(c.style.height="".concat(c.height,"px"))));let d=c.clientWidth||c.width,p=c.clientHeight||c.height;if(e&&u.hasValue()&&g.hasValue()&&(d=u.getPixels("x"),p=g.getPixels("y")),o.setCurrent(d,p),"number"==typeof n&&t.getAttribute("x",!0).setValue(n),"number"==typeof a&&t.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof s){const e=tt(t.getAttribute("viewBox").getString());let i=0,n=0;if("number"==typeof r){const s=t.getStyle("width");s.hasValue()?i=s.getPixels("x")/r:e[2]&&!isNaN(e[2])&&(i=e[2]/r)}if("number"==typeof s){const i=t.getStyle("height");i.hasValue()?n=i.getPixels("y")/s:e[3]&&!isNaN(e[3])&&(n=e[3]/s)}i||(i=n),n||(n=i),t.getAttribute("width",!0).setValue(r),t.getAttribute("height",!0).setValue(s);const a=t.getStyle("transform",!0,!0);a.setValue("".concat(a.getString()," scale(").concat(1/i,", ").concat(1/n,")"))}i||h.clearRect(0,0,d,p),t.render(h),l&&(this.isFirstRender=!1)}constructor(t,{fetch:e=Ot,window:i=Nt}={}){if(this.ctx=t,this.viewPort=new Tt,this.mouse=new Pt(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}Et.defaultWindow=Nt,Et.defaultFetch=Ot,Et.FRAMERATE=30,Et.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:Mt}=Et,_t="undefined"!=typeof DOMParser?DOMParser:void 0;class Vt{async parse(t){return t.startsWith("<")?this.parseFromString(t):this.load(t)}parseFromString(t){const e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(i){return this.checkDocument(e.parseFromString(t,"text/xml"))}}checkDocument(t){const e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}async load(t){const e=await this.fetch(t),i=await e.text();return this.parseFromString(i)}constructor({fetch:t=Mt,DOMParser:e=_t}={}){if(!t)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!e)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=t,this.DOMParser=e}}class Rt{apply(t){const{originX:e,originY:i,matrix:r}=this,s=e.getPixels("x"),n=i.getPixels("y");t.translate(s,n),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),t.translate(-s,-n)}unapply(t){const{originX:e,originY:i,matrix:r}=this,s=r[0],n=r[2],a=r[4],o=r[1],h=r[3],l=r[5],c=1/(s*(1*h-0*l)-n*(1*o-0*l)+a*(0*o-0*h)),u=e.getPixels("x"),g=i.getPixels("y");t.translate(u,g),t.transform(c*(1*h-0*l),c*(0*l-1*o),c*(0*a-1*n),c*(1*s-0*a),c*(n*l-a*h),c*(a*o-s*l)),t.translate(-u,-g)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,i){this.type="matrix",this.matrix=function(t){const e=tt(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||0,e[4]||0,e[5]||0]}(e),this.originX=i[0],this.originY=i[1]}}class kt extends Rt{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new St(t,"angle",e)}}class It{static fromElement(t,e){const i=e.getStyle("transform",!1,!0);if(i.hasValue()){const[r,s=r]=e.getStyle("transform-origin",!1,!0).split();if(r&&s){const e=[r,s];return new It(t,i.getString(),e)}}return null}apply(t){this.transforms.forEach((e=>e.apply(t)))}unapply(t){this.transforms.forEach((e=>e.unapply(t)))}applyToPoint(t){this.transforms.forEach((e=>e.applyToPoint(t)))}constructor(t,e,i){this.document=t,this.transforms=[],K(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/).forEach((t=>{if("none"===t)return;const[e,r]=function(t){const[e="",i=""]=t.split("(");return[e.trim(),i.trim().replace(")","")]}(t),s=It.transformTypes[e];s&&this.transforms.push(new s(this.document,r,i))}))}}It.transformTypes={translate:class{apply(t){const{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){const{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){const{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}constructor(t,e){this.type="translate",this.point=Ct.parse(e)}},rotate:class{apply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(n.getRadians()),t.translate(-a,-o)}unapply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(-1*n.getRadians()),t.translate(-a,-o)}applyToPoint(t){const{cx:e,cy:i,angle:r}=this,s=r.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(s),Math.sin(s),-Math.sin(s),Math.cos(s),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}constructor(t,e,i){this.type="rotate";const r=tt(e);this.angle=new St(t,"angle",r[0]),this.originX=i[0],this.originY=i[1],this.cx=r[1]||0,this.cy=r[2]||0}},scale:class{apply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(e,i||e),t.translate(-n,-a)}unapply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(1/e,1/i||e),t.translate(-n,-a)}applyToPoint(t){const{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}constructor(t,e,i){this.type="scale";const r=Ct.parseScale(e);0!==r.x&&0!==r.y||(r.x=ut,r.y=ut),this.scale=r,this.originX=i[0],this.originY=i[1]}},matrix:Rt,skewX:class extends kt{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}},skewY:class extends kt{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}};class Lt{getAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.attributes[t];if(!i&&e){const e=new St(this.document,t,"");return this.attributes[t]=e,e}return i||St.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if("href"===e||e.endsWith(":href")){t=this.attributes[e];break}return t||St.empty(this.document)}getStyle(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.styles[t];if(r)return r;const s=this.getAttribute(t);if(s.hasValue())return this.styles[t]=s,s;if(!i){const{parent:e}=this;if(e){const i=e.getStyle(t);if(i.hasValue())return i}}if(e){const e=new St(this.document,t,"");return this.styles[t]=e,e}return St.empty(this.document)}render(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("none")){const e=this.getStyle("filter").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){const e=It.fromElement(this.document,this);e&&e.apply(t);const i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){const e=i.getDefinition();e&&e.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach((e=>{e.render(t)}))}addChild(t){const e=t instanceof Lt?t:this.document.createElement(t);e.parent=this,Lt.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:i}=this;if("function"==typeof i.matches)return i.matches(t);const r=null===(e=i.getAttribute)||void 0===e?void 0:e.call(i,"class");return!(!r||""===r)&&r.split(" ").some((e=>".".concat(e)===t))}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let i;for(const r in t)if(!r.startsWith("@")&&this.matchesSelector(r)){const s=t[r],n=e[r];if(s)for(const t in s){let e=this.stylesSpecificity[t];void 0===e&&(e="000"),n&&n>=e&&(i=s[t],i&&(this.styles[t]=i),this.stylesSpecificity[t]=n)}}}removeStyles(t,e){return e.reduce(((e,i)=>{const r=t.getStyle(i);if(!r.hasValue())return e;const s=r.getString();return r.setValue(""),[...e,[i,s]]}),[])}restoreStyles(t,e){e.forEach((e=>{let[i,r]=e;t.getStyle(i,!0).setValue(r)}))}isFirstChild(){var t;return 0===(null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this))}constructor(t,e,i=!1){if(this.document=t,this.node=e,this.captureTextNodes=i,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||1!==e.nodeType)return;if(Array.from(e.attributes).forEach((e=>{const i=(r=e.nodeName,et.test(r)?r.toLowerCase():r);var r;this.attributes[i]=new St(t,i,e.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){const e=this.getAttribute("style").getString().split(";").map((t=>t.trim()));e.forEach((e=>{if(!e)return;const[i,r]=e.split(":").map((t=>t.trim()));i&&(this.styles[i]=new St(t,i,r))}))}const{definitions:r}=t,s=this.getAttribute("id");s.hasValue()&&(r[s.getString()]||(r[s.getString()]=this)),Array.from(e.childNodes).forEach((e=>{if(1===e.nodeType)this.addChild(e);else if(i&&(3===e.nodeType||4===e.nodeType)){const i=t.createTextNode(e);i.getText().length>0&&this.addChild(i)}}))}}Lt.ignoreChildTypes=["title"];class Dt extends Lt{constructor(t,e,i){super(t,e,i)}}function zt(t){const e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function Bt(t){if(!t)return"";const 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 Ht(t){if(!t)return"";const 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:""}}class Ut{static parse(){let t=arguments.length>1?arguments[1]:void 0,e="",i="",r="",s="",n="";const a=K(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),o={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach((t=>{switch(!0){case!o.fontStyle&&Ut.styles.includes(t):"inherit"!==t&&(e=t),o.fontStyle=!0;break;case!o.fontVariant&&Ut.variants.includes(t):"inherit"!==t&&(i=t),o.fontStyle=!0,o.fontVariant=!0;break;case!o.fontWeight&&Ut.weights.includes(t):"inherit"!==t&&(r=t),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0;break;case!o.fontSize:"inherit"!==t&&(s=t.split("/")[0]||""),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0,o.fontSize=!0;break;default:"inherit"!==t&&(n+=t)}})),new Ut(e,i,r,s,n,t)}toString(){return[Bt(this.fontStyle),this.fontVariant,Ht(this.fontWeight),this.fontSize,(t=this.fontFamily,"undefined"==typeof process?t:t.trim().split(",").map(zt).join(","))].join(" ").trim();var t}constructor(t,e,i,r,s,n){const a=n?"string"==typeof n?Ut.parse(n):n:{};this.fontFamily=s||a.fontFamily,this.fontSize=r||a.fontSize,this.fontStyle=t||a.fontStyle,this.fontWeight=i||a.fontWeight,this.fontVariant=e||a.fontVariant}}Ut.styles="normal|italic|oblique|inherit",Ut.variants="normal|small-caps|inherit",Ut.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class Ft{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(t,e){void 0!==t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),void 0!==e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}addX(t){this.addPoint(t,0)}addY(t){this.addPoint(0,t)}addBoundingBox(t){if(!t)return;const{x1:e,y1:i,x2:r,y2:s}=t;this.addPoint(e,i),this.addPoint(r,s)}sumCubic(t,e,i,r,s){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*i+3*(1-t)*Math.pow(t,2)*r+Math.pow(t,3)*s}bezierCurveAdd(t,e,i,r,s){const n=6*e-12*i+6*r,a=-3*e+9*i-9*r+3*s,o=3*i-3*e;if(0===a){if(0===n)return;const a=-o/n;return void(0<a&&a<1&&(t?this.addX(this.sumCubic(a,e,i,r,s)):this.addY(this.sumCubic(a,e,i,r,s))))}const h=Math.pow(n,2)-4*o*a;if(h<0)return;const l=(-n+Math.sqrt(h))/(2*a);0<l&&l<1&&(t?this.addX(this.sumCubic(l,e,i,r,s)):this.addY(this.sumCubic(l,e,i,r,s)));const c=(-n-Math.sqrt(h))/(2*a);0<c&&c<1&&(t?this.addX(this.sumCubic(c,e,i,r,s)):this.addY(this.sumCubic(c,e,i,r,s)))}addBezierCurve(t,e,i,r,s,n,a,o){this.addPoint(t,e),this.addPoint(a,o),this.bezierCurveAdd(!0,t,i,s,a),this.bezierCurveAdd(!1,e,r,n,o)}addQuadraticCurve(t,e,i,r,s,n){const a=t+2/3*(i-t),o=e+2/3*(r-e),h=a+1/3*(s-t),l=o+1/3*(n-e);this.addBezierCurve(t,e,a,h,o,l,s,n)}isPointInBox(t,e){const{x1:i,y1:r,x2:s,y2:n}=this;return i<=t&&t<=s&&r<=e&&e<=n}constructor(t=Number.NaN,e=Number.NaN,i=Number.NaN,r=Number.NaN){this.x1=t,this.y1=e,this.x2=i,this.y2=r,this.addPoint(t,e),this.addPoint(i,r)}}class Xt extends Lt{calculateOpacity(){let t=1,e=this;for(;e;){const i=e.getStyle("opacity",!1,!0);i.hasValue(!0)&&(t*=i.getNumber()),e=e.parent}return t}setContext(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e){const e=this.getStyle("fill"),i=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),s=this.getStyle("stroke-opacity");if(e.isUrlDefinition()){const r=e.getFillStyleDefinition(this,i);r&&(t.fillStyle=r)}else if(e.hasValue()){"currentColor"===e.getString()&&e.setValue(this.getStyle("color").getColor());const i=e.getColor();"inherit"!==i&&(t.fillStyle="none"===i?"rgba(0,0,0,0)":i)}if(i.hasValue()){const e=new St(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=e}if(r.isUrlDefinition()){const e=r.getFillStyleDefinition(this,s);e&&(t.strokeStyle=e)}else if(r.hasValue()){"currentColor"===r.getString()&&r.setValue(this.getStyle("color").getColor());const e=r.getString();"inherit"!==e&&(t.strokeStyle="none"===e?"rgba(0,0,0,0)":e)}if(s.hasValue()){const e=new St(this.document,"stroke",t.strokeStyle).addOpacity(s).getString();t.strokeStyle=e}const n=this.getStyle("stroke-width");if(n.hasValue()){const e=n.getPixels();t.lineWidth=e||ut}const a=this.getStyle("stroke-linecap"),o=this.getStyle("stroke-linejoin"),h=this.getStyle("stroke-miterlimit"),l=this.getStyle("stroke-dasharray"),c=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),o.hasValue()&&(t.lineJoin=o.getString()),h.hasValue()&&(t.miterLimit=h.getNumber()),l.hasValue()&&"none"!==l.getString()){const e=tt(l.getString());void 0!==t.setLineDash?t.setLineDash(e):void 0!==t.webkitLineDash?t.webkitLineDash=e:void 0===t.mozDash||1===e.length&&0===e[0]||(t.mozDash=e);const i=c.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=i:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=i:void 0!==t.mozDashOffset&&(t.mozDashOffset=i)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){const e=this.getStyle("font"),i=this.getStyle("font-style"),r=this.getStyle("font-variant"),s=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),o=new Ut(i.getString(),r.getString(),s.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),Ut.parse(e.getString(),t.font));i.setValue(o.fontStyle),r.setValue(o.fontVariant),s.setValue(o.fontWeight),n.setValue(o.fontSize),a.setValue(o.fontFamily),t.font=o.toString(),n.isPixels()&&(this.document.emSize=n.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}clearContext(t){super.clearContext(t),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...t){super(...t),this.modifiedEmSizeStack=!1}}class Yt extends Xt{setContext(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(t,e);const i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(t){if("text"!==this.type)return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach(((i,r)=>{const s=this.getChildBoundingBox(t,this,this,r);e?e.addBoundingBox(s):e=s})),e}getFontSize(){const{document:t,parent:e}=this,i=Ut.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){const e=this.getFontSize();return new Ft(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,i){const r=e[i];let s;if(t.isArabic){var n;const a=e.length,o=e[i-1],h=e[i+1];let l="isolated";(0===i||" "===o)&&i<a-1&&" "!==h&&(l="terminal"),i>0&&" "!==o&&i<a-1&&" "!==h&&(l="medial"),i>0&&" "!==o&&(i===a-1||" "===h)&&(l="initial"),s=(null===(n=t.arabicGlyphs[r])||void 0===n?void 0:n[l])||t.glyphs[r]}else s=t.glyphs[r];return s||(s=t.missingGlyph),s}getText(){return""}getTextFromNode(t){const e=t||this.node,i=Array.from(e.parentNode.childNodes),r=i.indexOf(e),s=i.length-1;let n=K(e.textContent||"");return 0===r&&(n=n.replace(/^[\n \t]+/,"")),r===s&&(n=function(t){return t.replace(/[\n \t]+$/,"")}(n)),n}renderChildren(t){if("text"!==this.type)return void this.renderTElementChildren(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach(((e,i)=>{this.renderChild(t,this,this,i)}));const{mouse:e}=this.document.screen;e.isWorking()&&e.checkBoundingBox(this,this.getBoundingBox(t))}renderTElementChildren(t){const{document:e,parent:i}=this,r=this.getText(),s=i.getStyle("font-family").getDefinition();if(s){const{unitsPerEm:n}=s.fontFace,a=Ut.parse(e.ctx.font),o=i.getStyle("font-size").getNumber(a.fontSize),h=i.getStyle("font-style").getString(a.fontStyle),l=o/n,c=s.isRTL?r.split("").reverse().join(""):r,u=tt(i.getAttribute("dx").getString()),g=c.length;for(let e=0;e<g;e++){const i=this.getGlyph(s,c,e);t.translate(this.x,this.y),t.scale(l,-l);const r=t.lineWidth;t.lineWidth=t.lineWidth*n/o,"italic"===h&&t.transform(1,0,.4,1,0,0),i.render(t),"italic"===h&&t.transform(1,0,-.4,1,0,0),t.lineWidth=r,t.scale(1/l,-1/l),t.translate(-this.x,-this.y),this.x+=o*(i.horizAdvX||s.horizAdvX)/n,void 0===u[e]||isNaN(u[e])||(this.x+=u[e])}return}const{x:n,y:a}=this;t.fillStyle&&t.fillText(r,n,a),t.strokeStyle&&t.strokeText(r,n,a)}applyAnchoring(){if(this.textChunkStart>=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start");let i=0;i="start"===e?t.x-this.minX:"end"===e?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(let r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=i;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}adjustChildCoordinatesRecursive(t){this.children.forEach(((e,i)=>{this.adjustChildCoordinatesRecursiveCore(t,this,this,i)})),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,i,r){const s=i.children[r];s.children.length>0?s.children.forEach(((i,r)=>{e.adjustChildCoordinatesRecursiveCore(t,e,s,r)})):this.adjustChildCoordinates(t,e,i,r)}adjustChildCoordinates(t,e,i,r){const s=i.children[r];if("function"!=typeof s.measureText)return s;t.save(),s.setContext(t,!0);const n=s.getAttribute("x"),a=s.getAttribute("y"),o=s.getAttribute("dx"),h=s.getAttribute("dy"),l=s.getStyle("font-family").getDefinition(),c=Boolean(null==l?void 0:l.isRTL);0===r&&(n.hasValue()||n.setValue(s.getInheritedAttribute("x")),a.hasValue()||a.setValue(s.getInheritedAttribute("y")),o.hasValue()||o.setValue(s.getInheritedAttribute("dx")),h.hasValue()||h.setValue(s.getInheritedAttribute("dy")));const u=s.measureText(t);return c&&(e.x-=u),n.hasValue()?(e.applyAnchoring(),s.x=n.getPixels("x"),o.hasValue()&&(s.x+=o.getPixels("x"))):(o.hasValue()&&(e.x+=o.getPixels("x")),s.x=e.x),e.x=s.x,c||(e.x+=u),a.hasValue()?(s.y=a.getPixels("y"),h.hasValue()&&(s.y+=h.getPixels("y"))):(h.hasValue()&&(e.y+=h.getPixels("y")),s.y=e.y),e.y=s.y,e.leafTexts.push(s),e.minX=Math.min(e.minX,s.x,s.x+u),e.maxX=Math.max(e.maxX,s.x,s.x+u),s.clearContext(t),t.restore(),s}getChildBoundingBox(t,e,i,r){const s=i.children[r];if("function"!=typeof s.getBoundingBox)return null;const n=s.getBoundingBox(t);return n&&s.children.forEach(((i,r)=>{const a=e.getChildBoundingBox(t,e,s,r);n.addBoundingBox(a)})),n}renderChild(t,e,i,r){const s=i.children[r];s.render(t),s.children.forEach(((i,r)=>{e.renderChild(t,e,s,r)}))}measureText(t){const{measureCache:e}=this;if(~e)return e;const i=this.getText(),r=this.measureTargetText(t,i);return this.measureCache=r,r}measureTargetText(t,e){if(!e.length)return 0;const{parent:i}=this,r=i.getStyle("font-family").getDefinition();if(r){const t=this.getFontSize(),s=r.isRTL?e.split("").reverse().join(""):e,n=tt(i.getAttribute("dx").getString()),a=s.length;let o=0;for(let e=0;e<a;e++)o+=(this.getGlyph(r,s,e).horizAdvX||r.horizAdvX)*t/r.fontFace.unitsPerEm,void 0===n[e]||isNaN(n[e])||(o+=n[e]);return o}if(!t.measureText)return 10*e.length;t.save(),this.setContext(t,!0);const{width:s}=t.measureText(e);return this.clearContext(t),t.restore(),s}getInheritedAttribute(t){let e=this;for(;e instanceof Yt&&e.isFirstChild()&&e.parent;){const i=e.parent.getAttribute(t);if(i.hasValue(!0))return i.getString("0");e=e.parent}return null}constructor(t,e,i){super(t,e,new.target===Yt||i),this.type="text",this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.measureCache=-1}}class qt extends Yt{getText(){return this.text}constructor(t,e,i){super(t,e,new.target===qt||i),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}}class Wt extends qt{constructor(...t){super(...t),this.type="textNode"}}class Qt extends W{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Ct(0,0),this.control=new Ct(0,0),this.current=new Ct(0,0),this.points=[],this.angles=[]}isEnd(){const{i:t,commands:e}=this;return t>=e.length-1}next(){const t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}getPoint(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y";const i=new Ct(this.command[t],this.command[e]);return this.makeAbsolute(i)}getAsControlPoint(t,e){const i=this.getPoint(t,e);return this.control=i,i}getAsCurrentPoint(t,e){const i=this.getPoint(t,e);return this.current=i,i}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==W.CURVE_TO&&t!==W.SMOOTH_CURVE_TO&&t!==W.QUAD_TO&&t!==W.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:i},control:{x:r,y:s}}=this;return new Ct(2*e-r,2*i-s)}makeAbsolute(t){if(this.command.relative){const{x:e,y:i}=this.current;t.x+=e,t.y+=i}return t}addMarker(t,e,i){const{points:r,angles:s}=this;i&&s.length>0&&!s[s.length-1]&&(s[s.length-1]=r[r.length-1].angleTo(i)),this.addMarkerAngle(t,e?e.angleTo(t):null)}addMarkerAngle(t,e){this.points.push(t),this.angles.push(e)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:t}=this,e=t.length;for(let i=0;i<e;i++)if(!t[i])for(let r=i+1;r<e;r++)if(t[r]){t[i]=t[r];break}return t}constructor(t){super(t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=new Ct(0,0),this.start=new Ct(0,0),this.current=new Ct(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class Gt extends Xt{path(t){const{pathParser:e}=this,i=new Ft;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case Qt.MOVE_TO:this.pathM(t,i);break;case Qt.LINE_TO:this.pathL(t,i);break;case Qt.HORIZ_LINE_TO:this.pathH(t,i);break;case Qt.VERT_LINE_TO:this.pathV(t,i);break;case Qt.CURVE_TO:this.pathC(t,i);break;case Qt.SMOOTH_CURVE_TO:this.pathS(t,i);break;case Qt.QUAD_TO:this.pathQ(t,i);break;case Qt.SMOOTH_QUAD_TO:this.pathT(t,i);break;case Qt.ARC:this.pathA(t,i);break;case Qt.CLOSE_PATH:this.pathZ(t,i)}return i}getBoundingBox(t){return this.path()}getMarkers(){const{pathParser:t}=this,e=t.getMarkerPoints(),i=t.getMarkerAngles(),r=e.map(((t,e)=>[t,i[e]]));return r}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");""!==t.fillStyle&&("inherit"!==e.getString("inherit")?t.fill(e.getString()):t.fill()),""!==t.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const i=this.getMarkers();if(i){const e=i.length-1,r=this.getStyle("marker-start"),s=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const e=r.getDefinition(),[s,n]=i[0];e.render(t,s,n)}if(s.isUrlDefinition()){const r=s.getDefinition();for(let s=1;s<e;s++){const[e,n]=i[s];r.render(t,e,n)}}if(n.isUrlDefinition()){const r=n.getDefinition(),[s,a]=i[e];r.render(t,s,a)}}}static pathM(t){const e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}pathM(t,e){const{pathParser:i}=this,{point:r}=Gt.pathM(i),{x:s,y:n}=r;i.addMarker(r),e.addPoint(s,n),t&&t.moveTo(s,n)}static pathL(t){const{current:e}=t;return{current:e,point:t.getAsCurrentPoint()}}pathL(t,e){const{pathParser:i}=this,{current:r,point:s}=Gt.pathL(i),{x:n,y:a}=s;i.addMarker(s,r),e.addPoint(n,a),t&&t.lineTo(n,a)}static pathH(t){const{current:e,command:i}=t,r=new Ct((i.relative?e.x:0)+i.x,e.y);return t.current=r,{current:e,point:r}}pathH(t,e){const{pathParser:i}=this,{current:r,point:s}=Gt.pathH(i),{x:n,y:a}=s;i.addMarker(s,r),e.addPoint(n,a),t&&t.lineTo(n,a)}static pathV(t){const{current:e,command:i}=t,r=new Ct(e.x,(i.relative?e.y:0)+i.y);return t.current=r,{current:e,point:r}}pathV(t,e){const{pathParser:i}=this,{current:r,point:s}=Gt.pathV(i),{x:n,y:a}=s;i.addMarker(s,r),e.addPoint(n,a),t&&t.lineTo(n,a)}static pathC(t){const{current:e}=t;return{current:e,point:t.getPoint("x1","y1"),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}pathC(t,e){const{pathParser:i}=this,{current:r,point:s,controlPoint:n,currentPoint:a}=Gt.pathC(i);i.addMarker(a,n,s),e.addBezierCurve(r.x,r.y,s.x,s.y,n.x,n.y,a.x,a.y),t&&t.bezierCurveTo(s.x,s.y,n.x,n.y,a.x,a.y)}static pathS(t){const{current:e}=t;return{current:e,point:t.getReflectedControlPoint(),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}pathS(t,e){const{pathParser:i}=this,{current:r,point:s,controlPoint:n,currentPoint:a}=Gt.pathS(i);i.addMarker(a,n,s),e.addBezierCurve(r.x,r.y,s.x,s.y,n.x,n.y,a.x,a.y),t&&t.bezierCurveTo(s.x,s.y,n.x,n.y,a.x,a.y)}static pathQ(t){const{current:e}=t;return{current:e,controlPoint:t.getAsControlPoint("x1","y1"),currentPoint:t.getAsCurrentPoint()}}pathQ(t,e){const{pathParser:i}=this,{current:r,controlPoint:s,currentPoint:n}=Gt.pathQ(i);i.addMarker(n,s,s),e.addQuadraticCurve(r.x,r.y,s.x,s.y,n.x,n.y),t&&t.quadraticCurveTo(s.x,s.y,n.x,n.y)}static pathT(t){const{current:e}=t,i=t.getReflectedControlPoint();return t.control=i,{current:e,controlPoint:i,currentPoint:t.getAsCurrentPoint()}}pathT(t,e){const{pathParser:i}=this,{current:r,controlPoint:s,currentPoint:n}=Gt.pathT(i);i.addMarker(n,s,s),e.addQuadraticCurve(r.x,r.y,s.x,s.y,n.x,n.y),t&&t.quadraticCurveTo(s.x,s.y,n.x,n.y)}static pathA(t){const{current:e,command:i}=t;let{rX:r,rY:s,xRot:n,lArcFlag:a,sweepFlag:o}=i;const h=n*(Math.PI/180),l=t.getAsCurrentPoint(),c=new Ct(Math.cos(h)*(e.x-l.x)/2+Math.sin(h)*(e.y-l.y)/2,-Math.sin(h)*(e.x-l.x)/2+Math.cos(h)*(e.y-l.y)/2),u=Math.pow(c.x,2)/Math.pow(r,2)+Math.pow(c.y,2)/Math.pow(s,2);u>1&&(r*=Math.sqrt(u),s*=Math.sqrt(u));let g=(a===o?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(s,2)-Math.pow(r,2)*Math.pow(c.y,2)-Math.pow(s,2)*Math.pow(c.x,2))/(Math.pow(r,2)*Math.pow(c.y,2)+Math.pow(s,2)*Math.pow(c.x,2)));isNaN(g)&&(g=0);const d=new Ct(g*r*c.y/s,g*-s*c.x/r),p=new Ct((e.x+l.x)/2+Math.cos(h)*d.x-Math.sin(h)*d.y,(e.y+l.y)/2+Math.sin(h)*d.x+Math.cos(h)*d.y),f=pt([1,0],[(c.x-d.x)/r,(c.y-d.y)/s]),y=[(c.x-d.x)/r,(c.y-d.y)/s],m=[(-c.x-d.x)/r,(-c.y-d.y)/s];let x=pt(y,m);return dt(y,m)<=-1&&(x=Math.PI),dt(y,m)>=1&&(x=0),{currentPoint:l,rX:r,rY:s,sweepFlag:o,xAxisRotation:h,centp:p,a1:f,ad:x}}pathA(t,e){const{pathParser:i}=this,{currentPoint:r,rX:s,rY:n,sweepFlag:a,xAxisRotation:o,centp:h,a1:l,ad:c}=Gt.pathA(i),u=1-a?1:-1,g=l+u*(c/2),d=new Ct(h.x+s*Math.cos(g),h.y+n*Math.sin(g));if(i.addMarkerAngle(d,g-u*Math.PI/2),i.addMarkerAngle(r,g-u*Math.PI),e.addPoint(r.x,r.y),t&&!isNaN(l)&&!isNaN(c)){const e=s>n?s:n,i=s>n?1:s/n,r=s>n?n/s:1;t.translate(h.x,h.y),t.rotate(o),t.scale(i,r),t.arc(0,0,e,l,l+c,Boolean(1-a)),t.scale(1/i,1/r),t.rotate(-o),t.translate(-h.x,-h.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){Gt.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,i){super(t,e,i),this.type="path",this.pathParser=new Qt(this.getAttribute("d").getString())}}class $t extends Xt{setContext(t){var e;const{document:i}=this,{screen:r,window:s}=i,n=t.canvas;if(r.setDefaults(t),"style"in n&&void 0!==t.font&&s&&void 0!==s.getComputedStyle){t.font=s.getComputedStyle(n).getPropertyValue("font");const e=new St(i,"fontSize",Ut.parse(t.font).fontSize);e.hasValue()&&(i.rootEmSize=e.getPixels("y"),i.emSize=i.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:a,height:o}=r.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const h=this.getAttribute("refX"),l=this.getAttribute("refY"),c=this.getAttribute("viewBox"),u=c.hasValue()?tt(c.getString()):null,g=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden");let d=0,p=0,f=0,y=0;u&&(d=u[0],p=u[1]),this.root||(a=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y"),"marker"===this.type&&(f=d,y=p,d=0,p=0)),r.viewPort.setCurrent(a,o),!this.node||this.parent&&"foreignObject"!==(null===(e=this.node.parentNode)||void 0===e?void 0:e.nodeName)||!this.getStyle("transform",!1,!0).hasValue()||this.getStyle("transform-origin",!1,!0).hasValue()||this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),u&&(a=u[2],o=u[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:a,height:r.viewPort.height,desiredHeight:o,minX:d,minY:p,refX:h.getValue(),refY:l.getValue(),clip:g,clipX:f,clipY:y}),u&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(a,o))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.getAttribute("width",!0),s=this.getAttribute("height",!0),n=this.getAttribute("viewBox"),a=this.getAttribute("style"),o=r.getNumber(0),h=s.getNumber(0);if(i)if("string"==typeof i)this.getAttribute("preserveAspectRatio",!0).setValue(i);else{const t=this.getAttribute("preserveAspectRatio");t.hasValue()&&t.setValue(t.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(t),s.setValue(e),n.hasValue()||n.setValue("0 0 ".concat(o||t," ").concat(h||e)),a.hasValue()){const i=this.getStyle("width"),r=this.getStyle("height");i.hasValue()&&i.setValue("".concat(t,"px")),r.hasValue()&&r.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class Zt extends Gt{path(t){const e=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),s=this.getStyle("height",!1,!0).getPixels("y"),n=this.getAttribute("rx"),a=this.getAttribute("ry");let o=n.getPixels("x"),h=a.getPixels("y");if(n.hasValue()&&!a.hasValue()&&(h=o),a.hasValue()&&!n.hasValue()&&(o=h),o=Math.min(o,r/2),h=Math.min(h,s/2),t){const n=(Math.sqrt(2)-1)/3*4;t.beginPath(),s>0&&r>0&&(t.moveTo(e+o,i),t.lineTo(e+r-o,i),t.bezierCurveTo(e+r-o+n*o,i,e+r,i+h-n*h,e+r,i+h),t.lineTo(e+r,i+s-h),t.bezierCurveTo(e+r,i+s-h+n*h,e+r-o+n*o,i+s,e+r-o,i+s),t.lineTo(e+o,i+s),t.bezierCurveTo(e+o-n*o,i+s,e,i+s-h+n*h,e,i+s-h),t.lineTo(e,i+h),t.bezierCurveTo(e,i+h-n*h,e+o-n*o,i,e+o,i),t.closePath())}return new Ft(e,i,e+r,i+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class jt extends Gt{path(t){const{points:e}=this,[{x:i,y:r}]=e,s=new Ft(i,r);return t&&(t.beginPath(),t.moveTo(i,r)),e.forEach((e=>{let{x:i,y:r}=e;s.addPoint(i,r),t&&t.lineTo(i,r)})),s}getMarkers(){const{points:t}=this,e=t.length-1,i=[];return t.forEach(((r,s)=>{s!==e&&i.push([r,r.angleTo(t[s+1])])})),i.length>0&&i.push([t[t.length-1],i[i.length-1][1]]),i}constructor(t,e,i){super(t,e,i),this.type="polyline",this.points=[],this.points=Ct.parsePath(this.getAttribute("points").getString())}}class Jt extends Xt{getBoundingBox(t){const e=new Ft;return this.children.forEach((i=>{e.addBoundingBox(i.getBoundingBox(t))})),e}constructor(...t){super(...t),this.type="g"}}class Kt extends Lt{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,i){let r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));const{stops:s}=r,n=this.getGradient(t,e);if(!n)return this.addParentOpacity(i,s[s.length-1].color);if(s.forEach((t=>{n.addColorStop(t.offset,this.addParentOpacity(i,t.color))})),this.getAttribute("gradientTransform").hasValue()){const{document:t}=this,{MAX_VIRTUAL_PIXELS:e}=Et,{viewPort:i}=t.screen,r=i.getRoot(),s=new Zt(t);s.attributes.x=new St(t,"x",-e/3),s.attributes.y=new St(t,"y",-e/3),s.attributes.width=new St(t,"width",e),s.attributes.height=new St(t,"height",e);const a=new Jt(t);a.attributes.transform=new St(t,"transform",this.getAttribute("gradientTransform").getValue()),a.children=[s];const o=new $t(t);o.attributes.x=new St(t,"x",0),o.attributes.y=new St(t,"y",0),o.attributes.width=new St(t,"width",r.width),o.attributes.height=new St(t,"height",r.height),o.children=[a];const h=t.createCanvas(r.width,r.height),l=h.getContext("2d");return l.fillStyle=n,o.render(l),l.createPattern(h,"no-repeat")}return n}inheritStopContainer(t){this.attributesToInherit.forEach((e=>{!this.getAttribute(e).hasValue()&&t.getAttribute(e).hasValue()&&this.getAttribute(e,!0).setValue(t.getAttribute(e).getValue())}))}addParentOpacity(t,e){return t.hasValue()?new St(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,i){super(t,e,i),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:r,children:s}=this;s.forEach((t=>{"stop"===t.type&&r.push(t)}))}}class te extends Lt{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return"CSS"===t?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:i,to:r}=this.getProgress();let s=i.getNumber()+(r.getNumber()-i.getNumber())*e;return"%"===t&&(s*=100),"".concat(s).concat(t)}update(t){const{parent:e}=this,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){const t=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==t||this.frozen){if("remove"===t&&!this.removed)return this.removed=!0,e&&i&&i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e&&i&&(e.animationFrozen=!0,e.animationFrozenValue=i.getString());return!1}this.duration+=t;let r=!1;if(this.begin<this.duration){let t=this.calcValue();const e=this.getAttribute("type");if(e.hasValue()){const i=e.getString();t="".concat(i,"(").concat(t,")")}i.setValue(t),r=!0}return r}getProgress(){const{document:t,values:e}=this;let i,r,s=(this.duration-this.begin)/(this.maxDuration-this.begin);if(e.hasValue()){const n=s*(e.getValue().length-1),a=Math.floor(n),o=Math.ceil(n);let h;h=e.getValue()[a],i=new St(t,"from",h?parseFloat(h):0),h=e.getValue()[o],r=new St(t,"to",h?parseFloat(h):0),s=(n-a)/(o-a)}else i=this.from,r=this.to;return{progress:s,from:i,to:r}}constructor(t,e,i){super(t,e,i),this.type="animate",this.duration=0,this.initialUnits="",this.removed=!1,this.frozen=!1,t.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new St(t,"values",null);const r=this.getAttribute("values");r.hasValue()&&this.values.setValue(r.getString().split(";"))}}class ee extends Lt{constructor(t,e,i){super(t,e,i),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class ie extends Gt{constructor(t,e,i){super(t,e,i),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class re extends ie{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}const se=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ne{async load(t,e){try{const{document:i}=this,r=(await i.canvg.parser.load(e)).getElementsByTagName("font");Array.from(r).forEach((e=>{const r=i.createElement(e);i.definitions[t]=r}))}catch(i){console.error('Error while loading font "'.concat(e,'":'),i)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class ae extends Lt{constructor(t,e,i){super(t,e,i),this.type="style";const r=K(Array.from(e.childNodes).map((t=>t.textContent)).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,""));r.split("}").forEach((e=>{const i=e.trim();if(!i)return;const r=i.split("{"),s=r[0].split(","),n=r[1].split(";");s.forEach((e=>{const i=e.trim();if(!i)return;const r=t.styles[i]||{};if(n.forEach((e=>{const i=e.indexOf(":"),s=e.substr(0,i).trim(),n=e.substr(i+1,e.length-i).trim();s&&n&&(r[s]=new St(t,s,n))})),t.styles[i]=r,t.stylesSpecificity[i]=function(t){const e=[0,0,0];let i=t.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[i,r]=ct(i,rt),e[1]+=r,[i,r]=ct(i,st),e[0]+=r,[i,r]=ct(i,nt),e[1]+=r,[i,r]=ct(i,at),e[2]+=r,[i,r]=ct(i,ot),e[1]+=r,[i,r]=ct(i,ht),e[1]+=r,i=i.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[i,r]=ct(i,lt),e[2]+=r,e.join("")}(i),"@font-face"===i){const e=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((i=>{if(i.indexOf('format("svg")')>0){const r=it(i);r&&new ne(t).load(e,r)}}))}}))}))}}function oe(t,e,i,r,s,n){return t[i*r*4+4*e+n]}function he(t,e,i,r,s,n,a){t[i*r*4+4*e+n]=a}function le(t,e,i){return t[e]*i}function ce(t,e,i,r){return e+Math.cos(t)*i+Math.sin(t)*r}ae.parseExternalUrl=it;class ue extends Lt{apply(t,e,i,r,s){const{includeOpacity:n,matrix:a}=this,o=t.getImageData(0,0,r,s);for(let h=0;h<s;h++)for(let t=0;t<r;t++){const e=oe(o.data,t,h,r,0,0),i=oe(o.data,t,h,r,0,1),s=oe(o.data,t,h,r,0,2),l=oe(o.data,t,h,r,0,3);let c=le(a,0,e)+le(a,1,i)+le(a,2,s)+le(a,3,l)+le(a,4,1),u=le(a,5,e)+le(a,6,i)+le(a,7,s)+le(a,8,l)+le(a,9,1),g=le(a,10,e)+le(a,11,i)+le(a,12,s)+le(a,13,l)+le(a,14,1),d=le(a,15,e)+le(a,16,i)+le(a,17,s)+le(a,18,l)+le(a,19,1);n&&(c=0,u=0,g=0,d*=l/255),he(o.data,t,h,r,0,0,c),he(o.data,t,h,r,0,1,u),he(o.data,t,h,r,0,2,g),he(o.data,t,h,r,0,3,d)}t.clearRect(0,0,r,s),t.putImageData(o,0,0)}constructor(t,e,i){super(t,e,i),this.type="feColorMatrix";let r=tt(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":{const t=r[0];r=[.213+.787*t,.715-.715*t,.072-.072*t,0,0,.213-.213*t,.715+.285*t,.072-.072*t,0,0,.213-.213*t,.715-.715*t,.072+.928*t,0,0,0,0,0,1,0,0,0,0,0,1];break}case"hueRotate":{const t=r[0]*Math.PI/180;r=[ce(t,.213,.787,-.213),ce(t,.715,-.715,-.715),ce(t,.072,-.072,.928),0,0,ce(t,.213,-.213,.143),ce(t,.715,.285,.14),ce(t,.072,-.072,-.283),0,0,ce(t,.213,-.213,-.787),ce(t,.715,-.715,.715),ce(t,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break}case"luminanceToAlpha":r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.matrix=r,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}}class ge extends Lt{apply(t,e){const{document:i}=this;let r=this.getAttribute("x").getPixels("x"),s=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!n&&!a){const e=new Ft;this.children.forEach((i=>{e.addBoundingBox(i.getBoundingBox(t))})),r=Math.floor(e.x1),s=Math.floor(e.y1),n=Math.floor(e.width),a=Math.floor(e.height)}const o=this.removeStyles(e,ge.ignoreStyles),h=i.createCanvas(r+n,s+a),l=h.getContext("2d");i.screen.setDefaults(l),this.renderChildren(l),new ue(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(l,0,0,r+n,s+a);const c=i.createCanvas(r+n,s+a),u=c.getContext("2d");i.screen.setDefaults(u),e.render(u),u.globalCompositeOperation="destination-in",u.fillStyle=l.createPattern(h,"no-repeat"),u.fillRect(0,0,r+n,s+a),t.fillStyle=u.createPattern(c,"no-repeat"),t.fillRect(0,0,r+n,s+a),this.restoreStyles(e,o)}render(t){}constructor(...t){super(...t),this.type="mask"}}ge.ignoreStyles=["mask","transform","clip-path"];const de=()=>{};class pe extends Lt{apply(t,e){const{document:i,children:r}=this,s="getBoundingBox"in e?e.getBoundingBox(t):null;if(!s)return;let n=0,a=0;r.forEach((t=>{const e=t.extraFilterDistance||0;n=Math.max(n,e),a=Math.max(a,e)}));const o=Math.floor(s.width),h=Math.floor(s.height),l=o+2*n,c=h+2*a;if(l<1||c<1)return;const u=Math.floor(s.x),g=Math.floor(s.y),d=this.removeStyles(e,pe.ignoreStyles),p=i.createCanvas(l,c),f=p.getContext("2d");i.screen.setDefaults(f),f.translate(-u+n,-g+a),e.render(f),r.forEach((t=>{"function"==typeof t.apply&&t.apply(f,0,0,l,c)})),t.drawImage(p,0,0,l,c,u-n,g-a,l,c),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}pe.ignoreStyles=["filter","transform","clip-path"];const fe={svg:$t,rect:Zt,circle:class extends Gt{path(t){const e=this.getAttribute("cx").getPixels("x"),i=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return t&&r>0&&(t.beginPath(),t.arc(e,i,r,0,2*Math.PI,!1),t.closePath()),new Ft(e-r,i-r,e+r,i+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}},ellipse:class extends Gt{path(t){const e=(Math.sqrt(2)-1)/3*4,i=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),s=this.getAttribute("cx").getPixels("x"),n=this.getAttribute("cy").getPixels("y");return t&&i>0&&r>0&&(t.beginPath(),t.moveTo(s+i,n),t.bezierCurveTo(s+i,n+e*r,s+e*i,n+r,s,n+r),t.bezierCurveTo(s-e*i,n+r,s-i,n+e*r,s-i,n),t.bezierCurveTo(s-i,n-e*r,s-e*i,n-r,s,n-r),t.bezierCurveTo(s+e*i,n-r,s+i,n-e*r,s+i,n),t.closePath()),new Ft(s-i,n-r,s+i,n+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}},line:class extends Gt{getPoints(){return[new Ct(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Ct(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:i},{x:r,y:s}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,i),t.lineTo(r,s)),new Ft(e,i,r,s)}getMarkers(){const[t,e]=this.getPoints(),i=t.angleTo(e);return[[t,i],[e,i]]}constructor(...t){super(...t),this.type="line"}},polyline:jt,polygon:class extends jt{path(t){const e=super.path(t),[{x:i,y:r}]=this.points;return t&&(t.lineTo(i,r),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}},path:Gt,pattern:class extends Lt{createPattern(t,e,i){const r=this.getStyle("width").getPixels("x",!0),s=this.getStyle("height").getPixels("y",!0),n=new $t(this.document,null);n.attributes.viewBox=new St(this.document,"viewBox",this.getAttribute("viewBox").getValue()),n.attributes.width=new St(this.document,"width","".concat(r,"px")),n.attributes.height=new St(this.document,"height","".concat(s,"px")),n.attributes.transform=new St(this.document,"transform",this.getAttribute("patternTransform").getValue()),n.children=this.children;const a=this.document.createCanvas(r,s),o=a.getContext("2d"),h=this.getAttribute("x"),l=this.getAttribute("y");h.hasValue()&&l.hasValue()&&o.translate(h.getPixels("x",!0),l.getPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:Reflect.deleteProperty(this.styles,"fill-opacity");for(let c=-1;c<=1;c++)for(let t=-1;t<=1;t++)o.save(),n.attributes.x=new St(this.document,"x",c*a.width),n.attributes.y=new St(this.document,"y",t*a.height),n.render(o),o.restore();return t.createPattern(a,"repeat")}constructor(...t){super(...t),this.type="pattern"}},marker:class extends Lt{render(t,e,i){if(!e)return;const{x:r,y:s}=e,n=this.getAttribute("orient").getString("auto"),a=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(r,s),"auto"===n&&t.rotate(i),"strokeWidth"===a&&t.scale(t.lineWidth,t.lineWidth),t.save();const o=new $t(this.document);o.type=this.type,o.attributes.viewBox=new St(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.refX=new St(this.document,"refX",this.getAttribute("refX").getValue()),o.attributes.refY=new St(this.document,"refY",this.getAttribute("refY").getValue()),o.attributes.width=new St(this.document,"width",this.getAttribute("markerWidth").getValue()),o.attributes.height=new St(this.document,"height",this.getAttribute("markerHeight").getValue()),o.attributes.overflow=new St(this.document,"overflow",this.getAttribute("overflow").getValue()),o.attributes.fill=new St(this.document,"fill",this.getAttribute("fill").getColor("black")),o.attributes.stroke=new St(this.document,"stroke",this.getAttribute("stroke").getValue("none")),o.children=this.children,o.render(t),t.restore(),"strokeWidth"===a&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"===n&&t.rotate(-i),t.translate(-r,-s)}constructor(...t){super(...t),this.type="marker"}},defs:class extends Lt{render(){}constructor(...t){super(...t),this.type="defs"}},linearGradient:class extends Kt{getGradient(t,e){const i="objectBoundingBox"===this.getGradientUnits(),r=i?e.getBoundingBox(t):null;if(i&&!r)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const s=i?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),n=i?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),a=i?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),o=i?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return s===a&&n===o?null:t.createLinearGradient(s,n,a,o)}constructor(t,e,i){super(t,e,i),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}},radialGradient:class extends Kt{getGradient(t,e){const i="objectBoundingBox"===this.getGradientUnits(),r=e.getBoundingBox(t);if(i&&!r)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const s=i?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),n=i?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let a=s,o=n;this.getAttribute("fx").hasValue()&&(a=i?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(o=i?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const h=i?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return t.createRadialGradient(a,o,l,s,n,h)}constructor(t,e,i){super(t,e,i),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}},stop:class extends Lt{constructor(t,e,i){super(t,e,i),this.type="stop";const r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),s=this.getStyle("stop-opacity");let n=this.getStyle("stop-color",!0);""===n.getString()&&n.setValue("#000"),s.hasValue()&&(n=n.addOpacity(s)),this.offset=r,this.color=n.getColor()}},animate:te,animateColor:class extends te{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),r=new N(e.getColor()),s=new N(i.getColor());if(r.ok&&s.ok){const e=r.r+(s.r-r.r)*t,i=r.g+(s.g-r.g)*t,n=r.b+(s.b-r.b)*t;return"rgb(".concat(Math.floor(e),", ").concat(Math.floor(i),", ").concat(Math.floor(n),")")}return this.getAttribute("from").getColor()}constructor(...t){super(...t),this.type="animateColor"}},animateTransform:class extends te{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),r=tt(e.getString()),s=tt(i.getString()),n=r.map(((e,i)=>e+(s[i]-e)*t)).join(" ");return n}constructor(...t){super(...t),this.type="animateTransform"}},font:class extends Lt{render(){}constructor(t,e,i){super(t,e,i),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:r}=t,{children:s}=this;for(const n of s)if(n instanceof ee){this.fontFace=n;const t=n.getStyle("font-family");t.hasValue()&&(r[t.getString()]=this)}else if(n instanceof re)this.missingGlyph=n;else if(n instanceof ie)if(n.arabicForm){this.isRTL=!0,this.isArabic=!0;const t=this.arabicGlyphs[n.unicode];void 0===t?this.arabicGlyphs[n.unicode]={[n.arabicForm]:n}:t[n.arabicForm]=n}else this.glyphs[n.unicode]=n}},"font-face":ee,"missing-glyph":re,glyph:ie,text:Yt,tspan:qt,tref:class extends Yt{getText(){const t=this.getHrefAttribute().getDefinition();if(t){const e=t.children[0];if(e)return e.getText()}return""}constructor(...t){super(...t),this.type="tref"}},a:class extends Yt{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:i,y:r}=this,{mouse:s}=e.screen,n=new St(e,"fontSize",Ut.parse(e.ctx.font).fontSize);s.isWorking()&&s.checkBoundingBox(this,new Ft(i,r-n.getPixels("y"),i+this.measureText(t),r))}else if(this.children.length>0){const e=new Jt(this.document);e.children=this.children,e.parent=this,e.render(t)}}onClick(){const{window:t}=this.document;t&&t.open(this.getHrefAttribute().getString())}onMouseMove(){this.document.ctx.canvas.style.cursor="pointer"}constructor(t,e,i){super(t,e,i),this.type="a";const{childNodes:r}=e,s=r[0],n=r.length>0&&Array.from(r).every((t=>3===t.nodeType));this.hasText=n,this.text=n?this.getTextFromNode(s):""}},textPath:class extends Yt{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach((e=>{let{type:i,points:r}=e;switch(i){case Qt.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case Qt.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case Qt.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case Qt.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case Qt.ARC:{const[e,i,s,n,a,o,h,l]=r,c=s>n?s:n,u=s>n?1:s/n,g=s>n?n/s:1;t&&(t.translate(e,i),t.rotate(h),t.scale(u,g),t.arc(0,0,c,a,a+o,Boolean(1-l)),t.scale(1/u,1/g),t.rotate(-h),t.translate(-e,-i));break}case Qt.CLOSE_PATH:t&&t.closePath()}}))}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),{glyphInfo:r}=this,s=t.fillStyle;"underline"===e&&t.beginPath(),r.forEach(((r,s)=>{const{p0:n,p1:a,rotation:o,text:h}=r;t.save(),t.translate(n.x,n.y),t.rotate(o),t.fillStyle&&t.fillText(h,0,0),t.strokeStyle&&t.strokeText(h,0,0),t.restore(),"underline"===e&&(0===s&&t.moveTo(n.x,n.y+i/8),t.lineTo(a.x,a.y+i/5))})),"underline"===e&&(t.lineWidth=i/20,t.strokeStyle=s,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,i,r,s,n,a,o,h){let l=n,c=this.measureText(t,o);" "===o&&"justify"===e&&i<r&&(c+=(r-i)/s),h>-1&&(l+=this.getLetterSpacingAt(h));const u=this.textHeight/20,g=this.getEquidistantPointOnPath(l,u,0),d=this.getEquidistantPointOnPath(l+c,u,0),p={p0:g,p1:d},f=g&&d?Math.atan2(d.y-g.y,d.x-g.x):0;if(a){const t=Math.cos(Math.PI/2+f)*a,e=Math.cos(-f)*a;p.p0={...g,x:g.x+t,y:g.y+e},p.p1={...d,x:d.x+t,y:d.y+e}}return l+=c,{offset:l,segment:p,rotation:f}}measureText(t,e){const{measuresCache:i}=this,r=e||this.getText();if(i.has(r))return i.get(r);const s=this.measureTargetText(t,r);return i.set(r,s),s}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),i=e.split(""),r=e.split(" ").length-1,s=this.parent.getAttribute("dx").split().map((t=>t.getPixels("x"))),n=this.parent.getAttribute("dy").getPixels("y"),a=this.parent.getStyle("text-anchor").getString("start"),o=this.getStyle("letter-spacing"),h=this.parent.getStyle("letter-spacing");let l=0;o.hasValue()&&"inherit"!==o.getValue()?o.hasValue()&&"initial"!==o.getValue()&&"unset"!==o.getValue()&&(l=o.getPixels()):l=h.getPixels();const c=[],u=e.length;this.letterSpacingCache=c;for(let x=0;x<u;x++)c.push(void 0!==s[x]?s[x]:l);const g=c.reduce(((t,e,i)=>0===i?0:t+e||0),0),d=this.measureText(t),p=Math.max(d+g,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const f=this.getPathLength(),y=this.getStyle("startOffset").getNumber(0)*f;let m=0;"middle"!==a&&"center"!==a||(m=-p/2),"end"!==a&&"right"!==a||(m=-p),m+=y,i.forEach(((e,s)=>{const{offset:o,segment:h,rotation:l}=this.findSegmentToFitChar(t,a,p,f,r,m,n,e,s);m=o,h.p0&&h.p1&&this.glyphInfo.push({text:i[s],p0:h.p0,p1:h.p1,rotation:l})}))}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:i}=t;for(i.reset();!i.isEnd();){const{current:t}=i,r=t?t.x:0,s=t?t.y:0,n=i.next();let a=n.type,o=[];switch(n.type){case Qt.MOVE_TO:this.pathM(i,o);break;case Qt.LINE_TO:a=this.pathL(i,o);break;case Qt.HORIZ_LINE_TO:a=this.pathH(i,o);break;case Qt.VERT_LINE_TO:a=this.pathV(i,o);break;case Qt.CURVE_TO:this.pathC(i,o);break;case Qt.SMOOTH_CURVE_TO:a=this.pathS(i,o);break;case Qt.QUAD_TO:this.pathQ(i,o);break;case Qt.SMOOTH_QUAD_TO:a=this.pathT(i,o);break;case Qt.ARC:o=this.pathA(i);break;case Qt.CLOSE_PATH:Gt.pathZ(i)}n.type!==Qt.CLOSE_PATH?e.push({type:a,points:o,start:{x:r,y:s},pathLength:this.calcLength(r,s,a,o)}):e.push({type:Qt.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:i,y:r}=Gt.pathM(t).point;e.push(i,r)}pathL(t,e){const{x:i,y:r}=Gt.pathL(t).point;return e.push(i,r),Qt.LINE_TO}pathH(t,e){const{x:i,y:r}=Gt.pathH(t).point;return e.push(i,r),Qt.LINE_TO}pathV(t,e){const{x:i,y:r}=Gt.pathV(t).point;return e.push(i,r),Qt.LINE_TO}pathC(t,e){const{point:i,controlPoint:r,currentPoint:s}=Gt.pathC(t);e.push(i.x,i.y,r.x,r.y,s.x,s.y)}pathS(t,e){const{point:i,controlPoint:r,currentPoint:s}=Gt.pathS(t);return e.push(i.x,i.y,r.x,r.y,s.x,s.y),Qt.CURVE_TO}pathQ(t,e){const{controlPoint:i,currentPoint:r}=Gt.pathQ(t);e.push(i.x,i.y,r.x,r.y)}pathT(t,e){const{controlPoint:i,currentPoint:r}=Gt.pathT(t);return e.push(i.x,i.y,r.x,r.y),Qt.QUAD_TO}pathA(t){let{rX:e,rY:i,sweepFlag:r,xAxisRotation:s,centp:n,a1:a,ad:o}=Gt.pathA(t);return 0===r&&o>0&&(o-=2*Math.PI),1===r&&o<0&&(o+=2*Math.PI),[n.x,n.y,e,i,a,o,s,r]}calcLength(t,e,i,r){let s=0,n=null,a=null,o=0;switch(i){case Qt.LINE_TO:return this.getLineLength(t,e,r[0],r[1]);case Qt.CURVE_TO:for(s=0,n=this.getPointOnCubicBezier(0,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),o=.01;o<=1;o+=.01)a=this.getPointOnCubicBezier(o,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return s;case Qt.QUAD_TO:for(s=0,n=this.getPointOnQuadraticBezier(0,t,e,r[0],r[1],r[2],r[3]),o=.01;o<=1;o+=.01)a=this.getPointOnQuadraticBezier(o,t,e,r[0],r[1],r[2],r[3]),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return s;case Qt.ARC:{s=0;const t=r[4],e=r[5],i=r[4]+e;let h=Math.PI/180;if(Math.abs(t-i)<h&&(h=Math.abs(t-i)),n=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],t,0),e<0)for(o=t-h;o>i;o-=h)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;else for(o=t+h;o<i;o+=h)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],i,0),s+=this.getLineLength(n.x,n.y,a.x,a.y),s}}return 0}getPointOnLine(t,e,i,r,s){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:i;const o=(s-i)/(r-e+ut);let h=Math.sqrt(t*t/(1+o*o));r<e&&(h*=-1);let l=o*h,c=null;if(r===e)c={x:n,y:a+l};else if((a-i)/(n-e+ut)===o)c={x:n+h,y:a+l};else{let u=0,g=0;const d=this.getLineLength(e,i,r,s);if(d<ut)return null;let p=(n-e)*(r-e)+(a-i)*(s-i);p/=d*d,u=e+p*(r-e),g=i+p*(s-i);const f=this.getLineLength(n,a,u,g),y=Math.sqrt(t*t-f*f);h=Math.sqrt(y*y/(1+o*o)),r<e&&(h*=-1),l=o*h,c={x:u+h,y:g+l}}return c}getPointOnPath(t){const e=this.getPathLength();let i=0,r=null;if(t<-5e-5||t-5e-5>e)return null;const{dataArray:s}=this;for(const n of s){if(n&&(n.pathLength<5e-5||i+n.pathLength+5e-5<t)){i+=n.pathLength;continue}const e=t-i;let s=0;switch(n.type){case Qt.LINE_TO:r=this.getPointOnLine(e,n.start.x,n.start.y,n.points[0],n.points[1],n.start.x,n.start.y);break;case Qt.ARC:{const t=n.points[4],i=n.points[5],a=n.points[4]+i;if(s=t+e/n.pathLength*i,i<0&&s<a||i>=0&&s>a)break;r=this.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],s,n.points[6]);break}case Qt.CURVE_TO:s=e/n.pathLength,s>1&&(s=1),r=this.getPointOnCubicBezier(s,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);break;case Qt.QUAD_TO:s=e/n.pathLength,s>1&&(s=1),r=this.getPointOnQuadraticBezier(s,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3])}if(r)return r;break}return null}getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}getPathLength(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce(((t,e)=>e.pathLength>0?t+e.pathLength:t),0)),this.pathLength}getPointOnCubicBezier(t,e,i,r,s,n,a,o,h){return{x:o*ft(t)+n*yt(t)+r*mt(t)+e*xt(t),y:h*ft(t)+a*yt(t)+s*mt(t)+i*xt(t)}}getPointOnQuadraticBezier(t,e,i,r,s,n,a){return{x:n*bt(t)+r*vt(t)+e*wt(t),y:a*bt(t)+s*vt(t)+i*wt(t)}}getPointOnEllipticalArc(t,e,i,r,s,n){const a=Math.cos(n),o=Math.sin(n),h=i*Math.cos(s),l=r*Math.sin(s);return{x:t+(h*a-l*o),y:e+(h*o+l*a)}}buildEquidistantCache(t,e){const i=this.getPathLength(),r=e||.25,s=t||i/100;if(!this.equidistantCache||this.equidistantCache.step!==s||this.equidistantCache.precision!==r){this.equidistantCache={step:s,precision:r,points:[]};let t=0;for(let e=0;e<=i;e+=r){const i=this.getPointOnPath(e),n=this.getPointOnPath(e+r);i&&n&&(t+=this.getLineLength(i.x,i.y,n.x,n.y),t>=s&&(this.equidistantCache.points.push({x:i.x,y:i.y,distance:e}),t-=s))}}}getEquidistantPointOnPath(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;const r=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}constructor(t,e,i){super(t,e,i),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const r=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(r)}},image:class extends Xt{async loadImage(t){try{const e=await this.document.createImage(t);this.image=e}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}this.loaded=!0}async loadSvg(t){const e=se.exec(t);if(e){const t=e[5];t&&("base64"===e[4]?this.image=atob(t):this.image=decodeURIComponent(t))}else try{const e=await this.document.fetch(t),i=await e.text();this.image=i}catch(i){console.error('Error while loading image "'.concat(t,'":'),i)}this.loaded=!0}renderChildren(t){const{document:e,image:i,loaded:r}=this,s=this.getAttribute("x").getPixels("x"),n=this.getAttribute("y").getPixels("y"),a=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y");if(r&&i&&a&&o){if(t.save(),t.translate(s,n),"string"==typeof i){const r=e.canvg.forkString(t,i,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:o}),{documentElement:s}=r.document;s&&(s.parent=this),r.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:i.width,height:o,desiredHeight:i.height}),this.loaded&&("complete"in i&&!i.complete||t.drawImage(i,0,0));t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new Ft(t,e,t+i,e+r)}constructor(t,e,i){super(t,e,i),this.type="image",this.loaded=!1;const r=this.getHrefAttribute().getString();if(!r)return;const s=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);t.images.push(this),s?this.loadSvg(r):this.loadImage(r)}},g:Jt,symbol:class extends Xt{render(t){}constructor(...t){super(...t),this.type="symbol"}},style:ae,use:class extends Xt{setContext(t){super.setContext(t);const e=this.getAttribute("x"),i=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),i.hasValue()&&t.translate(0,i.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:i}=this;if(i){let r=i;if("symbol"===i.type&&(r=new $t(e),r.attributes.viewBox=new St(e,"viewBox",i.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new St(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new St(e,"overflow",i.getAttribute("overflow").getString()),r.children=i.children,i.styles.opacity=new St(e,"opacity",this.calculateOpacity())),"svg"===r.type){const t=this.getStyle("width",!1,!0),i=this.getStyle("height",!1,!0);t.hasValue()&&(r.attributes.width=new St(e,"width",t.getString())),i.hasValue()&&(r.attributes.height=new St(e,"height",i.getString()))}const s=r.parent;r.parent=this,r.render(t),r.parent=s}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?It.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}},mask:ge,clipPath:class extends Lt{apply(t){const{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:r,closePath:s}=t;i&&(i.beginPath=de,i.closePath=de),Reflect.apply(r,t,[]),this.children.forEach((r=>{if(!("path"in r))return;let n="elementTransform"in r?r.elementTransform():null;n||(n=It.fromElement(e,r)),n&&n.apply(t),r.path(t),i&&(i.closePath=s),n&&n.unapply(t)})),Reflect.apply(s,t,[]),t.clip(),i&&(i.beginPath=r,i.closePath=s)}render(t){}constructor(...t){super(...t),this.type="clipPath"}},filter:pe,feDropShadow:class extends Lt{apply(t,e,i,r,s){}constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}},feMorphology:class extends Lt{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feMorphology"}},feComposite:class extends Lt{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feComposite"}},feColorMatrix:ue,feGaussianBlur:class extends Lt{apply(t,e,i,r,s){const{document:n,blurRadius:a}=this,o=n.window?n.window.document.body:null,h=t.canvas;h.id=n.getUniqueId(),o&&(h.style.display="none",o.appendChild(h)),j(h,e,i,r,s,a),o&&o.removeChild(h)}constructor(t,e,i){super(t,e,i),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}},title:class extends Lt{constructor(...t){super(...t),this.type="title"}},desc:class extends Lt{constructor(...t){super(...t),this.type="desc"}}};class ye{bindCreateImage(t,e){return"boolean"==typeof e?(i,r)=>t(i,"boolean"==typeof r?r:e):t}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:t}=this;return t[t.length-1]||12}set emSize(t){const{emSizeStack:e}=this;e.push(t)}popEmSize(){const{emSizeStack:t}=this;t.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every((t=>t.loaded))}isFontsLoaded(){return this.fonts.every((t=>t.loaded))}createDocumentElement(t){const e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}createElement(t){const e=t.nodeName.replace(/^[^:]+:/,""),i=ye.elementTypes[e];return i?new i(this,t):new Dt(this,t)}createTextNode(t){return new Wt(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=12,emSize:i=12,createCanvas:r=ye.createCanvas,createImage:s=ye.createImage,anonymousCrossOrigin:n}={}){this.canvg=t,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=t.screen,this.rootEmSize=e,this.emSize=i,this.createCanvas=r,this.createImage=this.bindCreateImage(s,n),this.screen.wait((()=>this.isImagesLoaded())),this.screen.wait((()=>this.isFontsLoaded()))}}ye.createCanvas=function(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},ye.createImage=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");return e&&(i.crossOrigin="Anonymous"),new Promise(((e,r)=>{i.onload=()=>{e(i)},i.onerror=(t,e,i,s,n)=>{r(n)},i.src=t}))},ye.elementTypes=fe;class me{static async from(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new Vt(i),s=await r.parse(e);return new me(t,s,i)}static fromString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new Vt(i).parseFromString(e);return new me(t,r,i)}fork(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return me.from(t,e,{...this.options,...i})}forkString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return me.fromString(t,e,{...this.options,...i})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{documentElement:e,screen:i,options:r}=this;i.start(e,{enableRedraw:!0,...r,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(t,e,i)}constructor(t,e,i={}){this.parser=new Vt(i),this.screen=new Et(t,i),this.options=i;const r=new ye(this,i),s=r.createDocumentElement(e);this.document=r,this.documentElement=s}}const xe="_detail_vtlsh_12",be="_container_vtlsh_20";t("default",r({name:"music-list",setup(){const t=s(),e="productRenderType",i=n({isLoading:!0,isProductLoading:!1,step:0,product:[{state:!1,name:"五线谱",type:a.staff,base64:""},{state:!1,name:"首调",type:a.firstTone,base64:""},{state:!1,name:"固定调",type:a.fixedTone,base64:""}]});o((()=>{window.appName="colexiu",h.xmlUrl=t.xmlUrl,sessionStorage.setItem(e,i.product[i.step].type),l({message:"生成中",duration:0}),setTimeout((()=>{i.isLoading=!1}),500)}));const r=async()=>{var t;i.product[i.step].state=!0,i.product[i.step].base64=await p();try{console.log(JSON.parse(JSON.stringify(i.product)),i.step)}catch(r){}if(i.step+=1,i.step!==i.product.length)return sessionStorage.setItem(e,i.product[i.step].type),void g((()=>{i.isLoading=!0,setTimeout((()=>{i.isLoading=!1}),500)}));d(),console.log(i.product),null===(t=window.parent)||void 0===t||t.postMessage({api:"webApi_renderSvg",product:JSON.stringify(i.product)},"*")},p=()=>new Promise((t=>{setTimeout((async()=>{try{var e;const i=null===(e=document.getElementById("osmdSvgPage1"))||void 0===e?void 0:e.cloneNode(!0);if(!i)return void t("");const r=i.width.animVal.value,s=i.height.animVal.value,n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width",""+2*r),n.setAttribute("height",""+2*s),n.setAttribute("fill","#fff"),i.prepend(n);const a=(t=>{const e=document.createElement("canvas"),i=e.getContext("2d");return i?(me.fromString(i,t).start(),e):e})(i.outerHTML),o=a.toDataURL("image/png",1);t(o)}catch(i){t("")}}),500)}));return()=>c("div",{class:xe},[c("div",{id:"scrollContainer",class:[be,"hideCursor"]},[!i.isLoading&&c(u,{renderTypeKey:e,showSelection:!1,onRendered:r},null)])])}}))}}}));