index-legacy-093fd590.js 110 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. System.register(["./instrument-legacy-46adc00c.js"],(function(t,e){"use strict";var i,r,s,n,a,o,h,l,c,u,g,d,p,f=document.createElement("style");return f.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(f),{setters:[t=>{i=t.c,r=t.d,s=t.g,n=t.r,a=t.E,o=t.o,h=t.s,l=t.a,c=t.b,u=t.M,g=t.m,d=t.n,p=t.e}],execute:function(){const e="_detail_vtlsh_12",f="_container_vtlsh_20";var y={},m={get exports(){return y},set exports(t){y=t}},x={},b={get exports(){return x},set exports(t){x=t}};(function(){var t,e,i,r,s,n;"undefined"!=typeof performance&&null!==performance&&performance.now?b.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(b.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?(b.exports=function(){return Date.now()-i},i=Date.now()):(b.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(i);for(var v=x,w="undefined"==typeof window?i:window,S=["moz","webkit"],T="AnimationFrame",A=w["request"+T],C=w["cancel"+T]||w["cancelRequest"+T],P=0;!A&&P<S.length;P++)A=w[S[P]+"Request"+T],C=w[S[P]+"Cancel"+T]||w[S[P]+"CancelRequest"+T];if(!A||!C){var E=0,N=0,O=[];A=function(t){if(0===O.length){var e=v(),i=Math.max(0,16.666666666666668-(e-E));E=i+e,setTimeout((function(){var t=O.slice(0);O.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(E)}catch(i){setTimeout((function(){throw i}),0)}}),Math.round(i))}return O.push({handle:++N,callback:t,cancelled:!1}),N},C=function(t){for(var e=0;e<O.length;e++)O[e].handle===t&&(O[e].cancelled=!0)}}m.exports=function(t){return A.call(w,t)},y.cancel=function(){C.apply(w,arguments)},y.polyfill=function(t){t||(t=w),t.requestAnimationFrame=A,t.cancelAnimationFrame=C};var M=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}},_=function(t,e){return(_=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 V(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}_(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function R(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 k(){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 I=Math.PI;function L(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=R([(e-n)/2,(i-a)/2],-t.xRot/180*I),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=R([d,p],t.xRot/180*I);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*I),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*I),t.phi1*=180/I,t.phi2*=180/I}function D(t,e,i){k(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 B,z=Math.PI/180;function U(t,e,i){return(1-i)*t+i*e}function H(t,e,i,r){return t+Math.cos(r/180*I)*e+Math.sin(r/180*I)*i}function F(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 X(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&$.SMOOTH_CURVE_TO&&(s.type=$.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&$.CURVE_TO?(t=s.relative?n+s.x2:s.x2,e=s.relative?a+s.y2:s.y2):(t=NaN,e=NaN),s.type&$.SMOOTH_QUAD_TO&&(s.type=$.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&$.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&$.SMOOTH_QUAD_TO&&(i.type=$.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&$.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=$.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&$.MOVE_TO))throw new Error("path must start with moveto");var a=t(n,e,i,r,s);return n.type&$.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&$.MOVE_TO&&(r=e,s=i),a}}function n(t,e,i,r,n,a){return k(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&$.HORIZ_LINE_TO&&0!==e&&(s.type=$.LINE_TO,s.y=s.relative?0:h),s.type&$.VERT_LINE_TO&&0!==i&&(s.type=$.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=$.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),E=S*i*i-T*t*i+A*t*t,N=(Math.atan2(P,C-E)+Math.PI)%Math.PI/2,O=Math.sin(N),M=Math.cos(N);s.rX=Math.abs(y)/Math.sqrt(C*f(M)+P*O*M+E*f(O)),s.rY=Math.abs(y)/Math.sqrt(C*f(O)-P*O*M+E*f(M)),s.xRot=180*N/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),k(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&$.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&$.HORIZ_LINE_TO&&(r.type=$.LINE_TO,r.y=r.relative?0:n),i&&r.type&$.VERT_LINE_TO&&(r.type=$.LINE_TO,r.x=r.relative?0:s),t&&r.type&$.CLOSE_PATH&&(r.type=$.LINE_TO,r.x=r.relative?a-s:a,r.y=r.relative?o-n:o),r.type&$.ARC&&(0===r.rX||0===r.rY)&&(r.type=$.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),k(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&$.SMOOTH_CURVE_TO&&(g=isNaN(e)?0:a-e,d=isNaN(i)?0:o-i),s.type&($.CURVE_TO|$.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&$.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,n=isNaN(n)?o:2*o-n):s.type&$.QUAD_TO?(r=s.relative?a+s.x1:s.x1,n=s.relative?o+s.y1:s.y2):(r=NaN,n=NaN),s.type&$.LINE_COMMANDS||s.type&$.ARC&&(0===s.rX||0===s.rY||!s.lArcFlag)||s.type&$.CURVE_TO||s.type&$.SMOOTH_CURVE_TO||s.type&$.QUAD_TO||s.type&$.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&$.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),k(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),k(t,e),n(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),k(t,e),n(t,0,0,e,0,0)},t.SKEW_X=function(t){return k(t),n(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return k(t),n(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),k(t),n(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),k(t),n(1,0,0,-1,0,t)},t.A_TO_C=function(){return s((function(t,e,i){return $.ARC===t.type?function(t,e,i){var r,s,n,a;t.cX||L(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=U(t.phi1,t.phi2,d/l),f=U(t.phi1,t.phi2,(d+1)/l),y=f-p,m=4/3*Math.tan(y*z/4),x=[Math.cos(p*z)-m*Math.sin(p*z),Math.sin(p*z)+m*Math.cos(p*z)],b=x[0],v=x[1],w=[Math.cos(f*z),Math.sin(f*z)],S=w[0],T=w[1],A=[S+m*Math.sin(f*z),T-m*Math.cos(f*z)],C=A[0],P=A[1];c[d]={relative:t.relative,type:$.CURVE_TO};var E=function(e,i){var r=R([e*t.rX,i*t.rY],t.xRot),s=r[0],n=r[1];return[t.cX+s,t.cY+n]};r=E(b,v),c[d].x1=r[0],c[d].y1=r[1],s=E(C,P),c[d].x2=s[0],c[d].y2=s[1],n=E(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),$.ARC===t.type&&L(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&$.DRAWING_COMMANDS&&(h(i),l(r)),s.type&$.HORIZ_LINE_TO&&h(s.x),s.type&$.VERT_LINE_TO&&l(s.y),s.type&$.LINE_TO&&(h(s.x),l(s.y)),s.type&$.CURVE_TO){h(s.x),l(s.y);for(var c=0,u=F(i,s.x1,s.x2,s.x);c<u.length;c++)0<(E=u[c])&&1>E&&h(X(i,s.x1,s.x2,s.x,E));for(var g=0,d=F(r,s.y1,s.y2,s.y);g<d.length;g++)0<(E=d[g])&&1>E&&l(X(r,s.y1,s.y2,s.y,E))}if(s.type&$.ARC){h(s.x),l(s.y),L(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=D(m,-f,0).map(S);T<A.length;T++)(E=A[T])>v&&E<w&&h(H(s.cX,f,m,E));for(var C=0,P=D(x,-y,0).map(S);C<P.length;C++){var E;(E=P[C])>v&&E<w&&l(H(s.cY,y,x,E))}}return e}));return o.minX=1/0,o.maxX=-1/0,o.minY=1/0,o.maxY=-1/0,o}}(B||(B={}));var Y,q=function(){function t(){}return t.prototype.round=function(t){return this.transform(B.ROUND(t))},t.prototype.toAbs=function(){return this.transform(B.TO_ABS())},t.prototype.toRel=function(){return this.transform(B.TO_REL())},t.prototype.normalizeHVZ=function(t,e,i){return this.transform(B.NORMALIZE_HVZ(t,e,i))},t.prototype.normalizeST=function(){return this.transform(B.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(B.QT_TO_C())},t.prototype.aToC=function(){return this.transform(B.A_TO_C())},t.prototype.sanitize=function(t){return this.transform(B.SANITIZE(t))},t.prototype.translate=function(t,e){return this.transform(B.TRANSLATE(t,e))},t.prototype.scale=function(t,e){return this.transform(B.SCALE(t,e))},t.prototype.rotate=function(t,e,i){return this.transform(B.ROTATE(t,e,i))},t.prototype.matrix=function(t,e,i,r,s,n){return this.transform(B.MATRIX(t,e,i,r,s,n))},t.prototype.skewX=function(t){return this.transform(B.SKEW_X(t))},t.prototype.skewY=function(t){return this.transform(B.SKEW_Y(t))},t.prototype.xSymmetry=function(t){return this.transform(B.X_AXIS_SYMMETRY(t))},t.prototype.ySymmetry=function(t){return this.transform(B.Y_AXIS_SYMMETRY(t))},t.prototype.annotateArcs=function(){return this.transform(B.ANNOTATE_ARCS())},t}(),W=function(t){return" "===t||"\t"===t||"\r"===t||"\n"===t},Q=function(t){return"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0)},G=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 V(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!==$.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),o=Q(n)&&("0"===this.curNumber&&"0"===n||a);if(!Q(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===$.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===Z[this.curCommandType]&&($.HORIZ_LINE_TO===this.curCommandType?r({type:$.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):$.VERT_LINE_TO===this.curCommandType?r({type:$.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===$.MOVE_TO||this.curCommandType===$.LINE_TO||this.curCommandType===$.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),$.MOVE_TO===this.curCommandType&&(this.curCommandType=$.LINE_TO)):this.curCommandType===$.CURVE_TO?r({type:$.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===$.SMOOTH_CURVE_TO?r({type:$.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.QUAD_TO?r({type:$.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.ARC&&r({type:$.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!W(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=$.HORIZ_LINE_TO,this.curCommandRelative="h"===n;else if("v"===n||"V"===n)this.curCommandType=$.VERT_LINE_TO,this.curCommandRelative="v"===n;else if("m"===n||"M"===n)this.curCommandType=$.MOVE_TO,this.curCommandRelative="m"===n;else if("l"===n||"L"===n)this.curCommandType=$.LINE_TO,this.curCommandRelative="l"===n;else if("c"===n||"C"===n)this.curCommandType=$.CURVE_TO,this.curCommandRelative="c"===n;else if("s"===n||"S"===n)this.curCommandType=$.SMOOTH_CURVE_TO,this.curCommandRelative="s"===n;else if("q"===n||"Q"===n)this.curCommandType=$.QUAD_TO,this.curCommandRelative="q"===n;else if("t"===n||"T"===n)this.curCommandType=$.SMOOTH_QUAD_TO,this.curCommandRelative="t"===n;else{if("a"!==n&&"A"!==n)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+".");this.curCommandType=$.ARC,this.curCommandRelative="a"===n}else e.push({type:$.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}(q),$=function(t){function e(i){var r=t.call(this)||this;return r.commands="string"==typeof i?e.parse(i):i,r}return V(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var t=B.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===$.CLOSE_PATH)e+="z";else if(r.type===$.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===$.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===$.MOVE_TO)e+=(r.relative?"m":"M")+r.x+" "+r.y;else if(r.type===$.LINE_TO)e+=(r.relative?"l":"L")+r.x+" "+r.y;else if(r.type===$.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+" "+r.y1+" "+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===$.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===$.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+" "+r.y1+" "+r.x+" "+r.y;else if(r.type===$.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+" "+r.y;else{if(r.type!==$.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 G,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}(q),Z=((Y={})[$.MOVE_TO]=2,Y[$.LINE_TO]=2,Y[$.HORIZ_LINE_TO]=1,Y[$.VERT_LINE_TO]=1,Y[$.CLOSE_PATH]=0,Y[$.QUAD_TO]=4,Y[$.SMOOTH_QUAD_TO]=2,Y[$.CURVE_TO]=6,Y[$.SMOOTH_CURVE_TO]=4,Y[$.ARC]=7,Y);function j(t){return j="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},j(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 J=[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],K=[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 tt(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"!==j(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 et,p=d,f=1;f<h;f++)p=p.next=new et,f===u&&(a=p);p.next=d;for(var y=null,m=null,x=0,b=0,v=J[n],w=K[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],E=0;E<u;E++)p.r=T,p.g=A,p.b=C,p.a=P,p=p.next;for(var N=0,O=0,M=0,_=0,V=u*T,R=u*A,k=u*C,I=u*P,L=g*T,D=g*A,B=g*C,z=g*P,U=1;U<u;U++){var H=b+((l<U?l:U)<<2),F=o[H],X=o[H+1],Y=o[H+2],q=o[H+3],W=u-U;L+=(p.r=F)*W,D+=(p.g=X)*W,B+=(p.b=Y)*W,z+=(p.a=q)*W,N+=F,O+=X,M+=Y,_+=q,p=p.next}y=d,m=a;for(var Q=0;Q<r;Q++){var G=z*v>>w;if(o[b+3]=G,0!==G){var $=255/G;o[b]=(L*v>>w)*$,o[b+1]=(D*v>>w)*$,o[b+2]=(B*v>>w)*$}else o[b]=o[b+1]=o[b+2]=0;L-=V,D-=R,B-=k,z-=I,V-=y.r,R-=y.g,k-=y.b,I-=y.a;var Z=Q+n+1;Z=x+(Z<l?Z:l)<<2,L+=N+=y.r=o[Z],D+=O+=y.g=o[Z+1],B+=M+=y.b=o[Z+2],z+=_+=y.a=o[Z+3],y=y.next;var j=m,tt=j.r,it=j.g,rt=j.b,st=j.a;V+=tt,R+=it,k+=rt,I+=st,N-=tt,O-=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 Et=b<<2;o[Et+3]=lt=mt*v>>w,lt>0?(lt=255/lt,o[Et]=(pt*v>>w)*lt,o[Et+1]=(ft*v>>w)*lt,o[Et+2]=(yt*v>>w)*lt):o[Et]=o[Et+1]=o[Et+2]=0,pt-=ct,ft-=ut,yt-=gt,mt-=dt,ct-=y.r,ut-=y.g,gt-=y.b,dt-=y.a,Et=nt+((Et=Pt+u)<c?Et:c)*r<<2,pt+=Tt+=y.r=o[Et],ft+=vt+=y.g=o[Et+1],yt+=wt+=y.b=o[Et+2],mt+=St+=y.a=o[Et+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 et=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 it(t){return t.replace(/(?!\u3000)\s+/gm," ")}function rt(t){const e=t.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return e?e.map(parseFloat):[]}const st=/^[A-Z-]+$/;function nt(t){const e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t);return e&&(e[2]||e[3]||e[4])||""}const at=/(\[[^\]]+\])/g,ot=/(#[^\s+>~.[:]+)/g,ht=/(\.[^\s+>~.[:]+)/g,lt=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,ct=/(:[\w-]+\([^)]*\))/gi,ut=/(:[^\s+>~.[:]+)/g,gt=/([^\s+>~.[:]+)/g;function dt(t,e){const i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}const pt=1e-8;function ft(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function yt(t,e){return(t[0]*e[0]+t[1]*e[1])/(ft(t)*ft(e))}function mt(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(yt(t,e))}function xt(t){return t*t*t}function bt(t){return 3*t*t*(1-t)}function vt(t){return 3*t*(1-t)*(1-t)}function wt(t){return(1-t)*(1-t)*(1-t)}function St(t){return t*t}function Tt(t){return 2*t*(1-t)}function At(t){return(1-t)*(1-t)}class Ct{static empty(t){return new Ct(t,"EMPTY","")}split(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ";const{document:e,name:i}=this;return it(this.getString()).trim().split(t).map((t=>new Ct(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 Ct.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 M(e);i.ok&&(i.alpha=t.getNumber(),e=i.toRGBA())}return new Ct(this.document,this.name,e)}constructor(t,e,i){this.document=t,this.name=e,this.value=i,this.isNormalizedColor=!1}}Ct.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 Pt{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||Et()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||Et()}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 Et(){return{width:Pt.DEFAULT_VIEWPORT_WIDTH,height:Pt.DEFAULT_VIEWPORT_HEIGHT}}Pt.DEFAULT_VIEWPORT_WIDTH=800,Pt.DEFAULT_VIEWPORT_HEIGHT=600;class Nt{static parse(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const[i=e,r=e]=rt(t);return new Nt(i,r)}static parseScale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const[i=e,r=i]=rt(t);return new Nt(i,r)}static parsePath(t){const e=rt(t),i=e.length,r=[];for(let s=0;s<i;s+=2)r.push(new Nt(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 Ot{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 Nt(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 Mt="undefined"!=typeof window?window:null,_t="undefined"!=typeof fetch?fetch.bind(void 0):void 0;class Vt{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=it(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 Ct(e,"refX",c),E=new Ct(e,"refY",u),N=P.hasValue()&&E.hasValue();if(N&&i.translate(-S*P.getPixels("x"),-S*E.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(!N){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:e=!1,ignoreMouse:i=!1,ignoreAnimation:r=!1,ignoreDimensions:s=!1,ignoreClear:n=!1,forceRedraw:a,scaleWidth:o,scaleHeight:h,offsetX:l,offsetY:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mouse:u}=this,g=1e3/Vt.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=g,this.readyPromise=new Promise((t=>{this.resolveReady=t})),this.isReady()&&this.render(t,s,n,o,h,l,c),!e)return;let d=Date.now(),p=d,f=0;const m=()=>{d=Date.now(),f=d-p,f>=g&&(p=d-f%g,this.shouldUpdate(r,a)&&(this.render(t,s,n,o,h,l,c),u.runEvents())),this.intervalId=y(m)};i||u.start(),this.intervalId=y(m)}stop(){this.intervalId&&(y.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=rt(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=_t,window:i=Mt}={}){if(this.ctx=t,this.viewPort=new Pt,this.mouse=new Ot(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}}Vt.defaultWindow=Mt,Vt.defaultFetch=_t,Vt.FRAMERATE=30,Vt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:Rt}=Vt,kt="undefined"!=typeof DOMParser?DOMParser:void 0;class It{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=Rt,DOMParser:e=kt}={}){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 Lt{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=rt(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 Dt extends Lt{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new Ct(t,"angle",e)}}class Bt{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 Bt(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=[],it(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=Bt.transformTypes[e];s&&this.transforms.push(new s(this.document,r,i))}))}}Bt.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=Nt.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=rt(e);this.angle=new Ct(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=Nt.parseScale(e);0!==r.x&&0!==r.y||(r.x=pt,r.y=pt),this.scale=r,this.originX=i[0],this.originY=i[1]}},matrix:Lt,skewX:class extends Dt{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 Dt{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}};class zt{getAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.attributes[t];if(!i&&e){const e=new Ct(this.document,t,"");return this.attributes[t]=e,e}return i||Ct.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||Ct.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 Ct(this.document,t,"");return this.styles[t]=e,e}return Ct.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=Bt.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 zt?t:this.document.createElement(t);e.parent=this,zt.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,st.test(r)?r.toLowerCase():r);var r;this.attributes[i]=new Ct(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 Ct(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)}}))}}zt.ignoreChildTypes=["title"];class Ut extends zt{constructor(t,e,i){super(t,e,i)}}function Ht(t){const e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function Ft(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 Xt(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 Yt{static parse(){let t=arguments.length>1?arguments[1]:void 0,e="",i="",r="",s="",n="";const a=it(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&&Yt.styles.includes(t):"inherit"!==t&&(e=t),o.fontStyle=!0;break;case!o.fontVariant&&Yt.variants.includes(t):"inherit"!==t&&(i=t),o.fontStyle=!0,o.fontVariant=!0;break;case!o.fontWeight&&Yt.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 Yt(e,i,r,s,n,t)}toString(){return[Ft(this.fontStyle),this.fontVariant,Xt(this.fontWeight),this.fontSize,(t=this.fontFamily,"undefined"==typeof process?t:t.trim().split(",").map(Ht).join(","))].join(" ").trim();var t}constructor(t,e,i,r,s,n){const a=n?"string"==typeof n?Yt.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}}Yt.styles="normal|italic|oblique|inherit",Yt.variants="normal|small-caps|inherit",Yt.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class qt{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 Wt extends zt{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 Ct(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 Ct(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||pt}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=rt(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 Yt(i.getString(),r.getString(),s.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),Yt.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 Qt extends Wt{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=Yt.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){const e=this.getFontSize();return new qt(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=it(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=Yt.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=rt(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=rt(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 Qt&&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===Qt||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 Gt extends Qt{getText(){return this.text}constructor(t,e,i){super(t,e,new.target===Gt||i),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}}class $t extends Gt{constructor(...t){super(...t),this.type="textNode"}}class Zt extends ${reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Nt(0,0),this.control=new Nt(0,0),this.current=new Nt(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 Nt(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!==$.CURVE_TO&&t!==$.SMOOTH_CURVE_TO&&t!==$.QUAD_TO&&t!==$.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:i},control:{x:r,y:s}}=this;return new Nt(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 Nt(0,0),this.start=new Nt(0,0),this.current=new Nt(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class jt extends Wt{path(t){const{pathParser:e}=this,i=new qt;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case Zt.MOVE_TO:this.pathM(t,i);break;case Zt.LINE_TO:this.pathL(t,i);break;case Zt.HORIZ_LINE_TO:this.pathH(t,i);break;case Zt.VERT_LINE_TO:this.pathV(t,i);break;case Zt.CURVE_TO:this.pathC(t,i);break;case Zt.SMOOTH_CURVE_TO:this.pathS(t,i);break;case Zt.QUAD_TO:this.pathQ(t,i);break;case Zt.SMOOTH_QUAD_TO:this.pathT(t,i);break;case Zt.ARC:this.pathA(t,i);break;case Zt.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}=jt.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}=jt.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 Nt((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}=jt.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 Nt(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}=jt.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}=jt.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}=jt.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}=jt.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}=jt.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 Nt(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 Nt(g*r*c.y/s,g*-s*c.x/r),p=new Nt((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=mt([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=mt(y,m);return yt(y,m)<=-1&&(x=Math.PI),yt(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}=jt.pathA(i),u=1-a?1:-1,g=l+u*(c/2),d=new Nt(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){jt.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 Zt(this.getAttribute("d").getString())}}class Jt extends Wt{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 Ct(i,"fontSize",Yt.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()?rt(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 Kt extends jt{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 qt(e,i,e+r,i+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class te extends jt{path(t){const{points:e}=this,[{x:i,y:r}]=e,s=new qt(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=Nt.parsePath(this.getAttribute("points").getString())}}class ee extends Wt{getBoundingBox(t){const e=new qt;return this.children.forEach((i=>{e.addBoundingBox(i.getBoundingBox(t))})),e}constructor(...t){super(...t),this.type="g"}}class ie extends zt{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}=Vt,{viewPort:i}=t.screen,r=i.getRoot(),s=new Kt(t);s.attributes.x=new Ct(t,"x",-e/3),s.attributes.y=new Ct(t,"y",-e/3),s.attributes.width=new Ct(t,"width",e),s.attributes.height=new Ct(t,"height",e);const a=new ee(t);a.attributes.transform=new Ct(t,"transform",this.getAttribute("gradientTransform").getValue()),a.children=[s];const o=new Jt(t);o.attributes.x=new Ct(t,"x",0),o.attributes.y=new Ct(t,"y",0),o.attributes.width=new Ct(t,"width",r.width),o.attributes.height=new Ct(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 Ct(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 re extends zt{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 Ct(t,"from",h?parseFloat(h):0),h=e.getValue()[o],r=new Ct(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 Ct(t,"values",null);const r=this.getAttribute("values");r.hasValue()&&this.values.setValue(r.getString().split(";"))}}class se extends zt{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 ne extends jt{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 ae extends ne{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}const oe=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class he{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 le extends zt{constructor(t,e,i){super(t,e,i),this.type="style";const r=it(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 Ct(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]=dt(i,at),e[1]+=r,[i,r]=dt(i,ot),e[0]+=r,[i,r]=dt(i,ht),e[1]+=r,[i,r]=dt(i,lt),e[2]+=r,[i,r]=dt(i,ct),e[1]+=r,[i,r]=dt(i,ut),e[1]+=r,i=i.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[i,r]=dt(i,gt),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=nt(i);r&&new he(t).load(e,r)}}))}}))}))}}function ce(t,e,i,r,s,n){return t[i*r*4+4*e+n]}function ue(t,e,i,r,s,n,a){t[i*r*4+4*e+n]=a}function ge(t,e,i){return t[e]*i}function de(t,e,i,r){return e+Math.cos(t)*i+Math.sin(t)*r}le.parseExternalUrl=nt;class pe extends zt{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=ce(o.data,t,h,r,0,0),i=ce(o.data,t,h,r,0,1),s=ce(o.data,t,h,r,0,2),l=ce(o.data,t,h,r,0,3);let c=ge(a,0,e)+ge(a,1,i)+ge(a,2,s)+ge(a,3,l)+ge(a,4,1),u=ge(a,5,e)+ge(a,6,i)+ge(a,7,s)+ge(a,8,l)+ge(a,9,1),g=ge(a,10,e)+ge(a,11,i)+ge(a,12,s)+ge(a,13,l)+ge(a,14,1),d=ge(a,15,e)+ge(a,16,i)+ge(a,17,s)+ge(a,18,l)+ge(a,19,1);n&&(c=0,u=0,g=0,d*=l/255),ue(o.data,t,h,r,0,0,c),ue(o.data,t,h,r,0,1,u),ue(o.data,t,h,r,0,2,g),ue(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=rt(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=[de(t,.213,.787,-.213),de(t,.715,-.715,-.715),de(t,.072,-.072,.928),0,0,de(t,.213,-.213,.143),de(t,.715,.285,.14),de(t,.072,-.072,-.283),0,0,de(t,.213,-.213,-.787),de(t,.715,-.715,.715),de(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 fe extends zt{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 qt;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,fe.ignoreStyles),h=i.createCanvas(r+n,s+a),l=h.getContext("2d");i.screen.setDefaults(l),this.renderChildren(l),new pe(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"}}fe.ignoreStyles=["mask","transform","clip-path"];const ye=()=>{};class me extends zt{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,me.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"}}me.ignoreStyles=["filter","transform","clip-path"];const xe={svg:Jt,rect:Kt,circle:class extends jt{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 qt(e-r,i-r,e+r,i+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}},ellipse:class extends jt{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 qt(s-i,n-r,s+i,n+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}},line:class extends jt{getPoints(){return[new Nt(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Nt(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 qt(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:te,polygon:class extends te{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:jt,pattern:class extends zt{createPattern(t,e,i){const r=this.getStyle("width").getPixels("x",!0),s=this.getStyle("height").getPixels("y",!0),n=new Jt(this.document,null);n.attributes.viewBox=new Ct(this.document,"viewBox",this.getAttribute("viewBox").getValue()),n.attributes.width=new Ct(this.document,"width","".concat(r,"px")),n.attributes.height=new Ct(this.document,"height","".concat(s,"px")),n.attributes.transform=new Ct(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 Ct(this.document,"x",c*a.width),n.attributes.y=new Ct(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 zt{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 Jt(this.document);o.type=this.type,o.attributes.viewBox=new Ct(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.refX=new Ct(this.document,"refX",this.getAttribute("refX").getValue()),o.attributes.refY=new Ct(this.document,"refY",this.getAttribute("refY").getValue()),o.attributes.width=new Ct(this.document,"width",this.getAttribute("markerWidth").getValue()),o.attributes.height=new Ct(this.document,"height",this.getAttribute("markerHeight").getValue()),o.attributes.overflow=new Ct(this.document,"overflow",this.getAttribute("overflow").getValue()),o.attributes.fill=new Ct(this.document,"fill",this.getAttribute("fill").getColor("black")),o.attributes.stroke=new Ct(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 zt{render(){}constructor(...t){super(...t),this.type="defs"}},linearGradient:class extends ie{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 ie{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 zt{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:re,animateColor:class extends re{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),r=new M(e.getColor()),s=new M(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 re{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),r=rt(e.getString()),s=rt(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 zt{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 se){this.fontFace=n;const t=n.getStyle("font-family");t.hasValue()&&(r[t.getString()]=this)}else if(n instanceof ae)this.missingGlyph=n;else if(n instanceof ne)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":se,"missing-glyph":ae,glyph:ne,text:Qt,tspan:Gt,tref:class extends Qt{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 Qt{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 Ct(e,"fontSize",Yt.parse(e.ctx.font).fontSize);s.isWorking()&&s.checkBoundingBox(this,new qt(i,r-n.getPixels("y"),i+this.measureText(t),r))}else if(this.children.length>0){const e=new ee(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 Qt{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 Zt.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case Zt.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case Zt.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case Zt.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case Zt.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 Zt.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 Zt.MOVE_TO:this.pathM(i,o);break;case Zt.LINE_TO:a=this.pathL(i,o);break;case Zt.HORIZ_LINE_TO:a=this.pathH(i,o);break;case Zt.VERT_LINE_TO:a=this.pathV(i,o);break;case Zt.CURVE_TO:this.pathC(i,o);break;case Zt.SMOOTH_CURVE_TO:a=this.pathS(i,o);break;case Zt.QUAD_TO:this.pathQ(i,o);break;case Zt.SMOOTH_QUAD_TO:a=this.pathT(i,o);break;case Zt.ARC:o=this.pathA(i);break;case Zt.CLOSE_PATH:jt.pathZ(i)}n.type!==Zt.CLOSE_PATH?e.push({type:a,points:o,start:{x:r,y:s},pathLength:this.calcLength(r,s,a,o)}):e.push({type:Zt.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:i,y:r}=jt.pathM(t).point;e.push(i,r)}pathL(t,e){const{x:i,y:r}=jt.pathL(t).point;return e.push(i,r),Zt.LINE_TO}pathH(t,e){const{x:i,y:r}=jt.pathH(t).point;return e.push(i,r),Zt.LINE_TO}pathV(t,e){const{x:i,y:r}=jt.pathV(t).point;return e.push(i,r),Zt.LINE_TO}pathC(t,e){const{point:i,controlPoint:r,currentPoint:s}=jt.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}=jt.pathS(t);return e.push(i.x,i.y,r.x,r.y,s.x,s.y),Zt.CURVE_TO}pathQ(t,e){const{controlPoint:i,currentPoint:r}=jt.pathQ(t);e.push(i.x,i.y,r.x,r.y)}pathT(t,e){const{controlPoint:i,currentPoint:r}=jt.pathT(t);return e.push(i.x,i.y,r.x,r.y),Zt.QUAD_TO}pathA(t){let{rX:e,rY:i,sweepFlag:r,xAxisRotation:s,centp:n,a1:a,ad:o}=jt.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 Zt.LINE_TO:return this.getLineLength(t,e,r[0],r[1]);case Zt.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 Zt.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 Zt.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+pt);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+pt)===o)c={x:n+h,y:a+l};else{let u=0,g=0;const d=this.getLineLength(e,i,r,s);if(d<pt)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 Zt.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 Zt.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 Zt.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 Zt.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*xt(t)+n*bt(t)+r*vt(t)+e*wt(t),y:h*xt(t)+a*bt(t)+s*vt(t)+i*wt(t)}}getPointOnQuadraticBezier(t,e,i,r,s,n,a){return{x:n*St(t)+r*Tt(t)+e*At(t),y:a*St(t)+s*Tt(t)+i*At(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 Wt{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=oe.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 qt(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:ee,symbol:class extends Wt{render(t){}constructor(...t){super(...t),this.type="symbol"}},style:le,use:class extends Wt{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 Jt(e),r.attributes.viewBox=new Ct(e,"viewBox",i.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new Ct(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new Ct(e,"overflow",i.getAttribute("overflow").getString()),r.children=i.children,i.styles.opacity=new Ct(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 Ct(e,"width",t.getString())),i.hasValue()&&(r.attributes.height=new Ct(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?Bt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}},mask:fe,clipPath:class extends zt{apply(t){const{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:r,closePath:s}=t;i&&(i.beginPath=ye,i.closePath=ye),Reflect.apply(r,t,[]),this.children.forEach((r=>{if(!("path"in r))return;let n="elementTransform"in r?r.elementTransform():null;n||(n=Bt.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:me,feDropShadow:class extends zt{apply(t,e,i,r,s){}constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}},feMorphology:class extends zt{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feMorphology"}},feComposite:class extends zt{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feComposite"}},feColorMatrix:pe,feGaussianBlur:class extends zt{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)),tt(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 zt{constructor(...t){super(...t),this.type="title"}},desc:class extends zt{constructor(...t){super(...t),this.type="desc"}}};class be{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=be.elementTypes[e];return i?new i(this,t):new Ut(this,t)}createTextNode(t){return new $t(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=12,emSize:i=12,createCanvas:r=be.createCanvas,createImage:s=be.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()))}}be.createCanvas=function(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},be.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}))},be.elementTypes=xe;class ve{static async from(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new It(i),s=await r.parse(e);return new ve(t,s,i)}static fromString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new It(i).parseFromString(e);return new ve(t,r,i)}fork(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ve.from(t,e,{...this.options,...i})}forkString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ve.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 It(i),this.screen=new Vt(t,i),this.options=i;const r=new be(this,i),s=r.createDocumentElement(e);this.document=r,this.documentElement=s}}t("default",r({name:"transfer-to-img",setup(){const t=s(),i="productRenderType",r=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:""}],isSpecialXml:!1});o((()=>{window.appName="colexiu",h.isSingleLine=!1,h.isCreateImg=!0,h.isEvxml=!0,h.xmlUrl=decodeURIComponent(t.xmlUrl),["https://oss.dayaedu.com/MECMP/1715332965751.xml","https://oss.dayaedu.com/MECMP/1715326622946.xml"].includes(h.xmlUrl)&&(r.isSpecialXml=!0),sessionStorage.setItem(i,r.product[r.step].type),h.musicRenderType=r.product[r.step].type,l({message:"生成中",duration:0}),setTimeout((()=>{r.isLoading=!1}),500)}));const y=async()=>{var t;document.getElementById("scrollContainer")&&g(r.isSpecialXml),r.product[r.step].state=!0,r.product[r.step].base64=await m();try{console.log(JSON.parse(JSON.stringify(r.product)),r.step)}catch(e){}if(r.step+=1,r.step!==r.product.length)return sessionStorage.setItem(i,r.product[r.step].type),h.musicRenderType=r.product[r.step].type,void d((()=>{r.isLoading=!0,setTimeout((()=>{r.isLoading=!1}),500)}));p(),console.log(r.product,123456),null===(t=window.parent)||void 0===t||t.postMessage({api:"webApi_renderSvg",product:JSON.stringify(r.product)},"*")},m=()=>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?(ve.fromString(i,t).start(),e):e})(i.outerHTML),o=a.toDataURL("image/png",1);t(o)}catch(i){t("")}}),500)}));return()=>c("div",{class:e},[c("div",{id:"scrollContainer",class:[f,"hideCursor"]},[!r.isLoading&&c(u,{renderTypeKey:i,showSelection:!1,onRendered:y},null)])])}}))}}}));