@coppsary/motionly 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/assets/index-bTggaIHQ.js +6 -0
- package/dist/assets/index-bTggaIHQ.js.map +1 -0
- package/dist/assets/index-uMHqBndL.js +16 -0
- package/dist/assets/index-uMHqBndL.js.map +1 -0
- package/dist/assets/main-BWhvHbtr.css +1 -0
- package/dist/assets/main-CrcFUwRU.js +2470 -0
- package/dist/assets/main-CrcFUwRU.js.map +1 -0
- package/dist/index.html +2 -2
- package/motionly-skills/AGENTS.md +20 -0
- package/motionly-skills/README.md +28 -0
- package/motionly-skills/llms.txt +16 -0
- package/motionly-skills/skills/animation/SKILL.md +73 -0
- package/motionly-skills/skills/animation/agents/openai.yaml +4 -0
- package/motionly-skills/skills/assets/SKILL.md +45 -0
- package/motionly-skills/skills/assets/agents/openai.yaml +4 -0
- package/motionly-skills/skills/camera/SKILL.md +57 -0
- package/motionly-skills/skills/camera/agents/openai.yaml +4 -0
- package/motionly-skills/skills/composition/SKILL.md +42 -0
- package/motionly-skills/skills/composition/agents/openai.yaml +4 -0
- package/motionly-skills/skills/easing/SKILL.md +44 -0
- package/motionly-skills/skills/easing/agents/openai.yaml +4 -0
- package/motionly-skills/skills/motion-dsl/SKILL.md +93 -0
- package/motionly-skills/skills/motion-dsl/agents/openai.yaml +4 -0
- package/motionly-skills/skills/rendering/SKILL.md +45 -0
- package/motionly-skills/skills/rendering/agents/openai.yaml +4 -0
- package/motionly-skills/skills/svg/SKILL.md +82 -0
- package/motionly-skills/skills/svg/agents/openai.yaml +4 -0
- package/motionly-skills/skills/templates/SKILL.md +51 -0
- package/motionly-skills/skills/templates/agents/openai.yaml +4 -0
- package/motionly-skills/skills/timeline/SKILL.md +57 -0
- package/motionly-skills/skills/timeline/agents/openai.yaml +4 -0
- package/motionly-skills/skills/transitions/SKILL.md +45 -0
- package/motionly-skills/skills/transitions/agents/openai.yaml +4 -0
- package/motionly-skills/skills/typography/SKILL.md +42 -0
- package/motionly-skills/skills/typography/agents/openai.yaml +4 -0
- package/package.json +6 -1
- package/templates/motionly-skill/SKILL.md +10 -1
- package/templates/project/AGENTS.md +2 -0
- package/dist/assets/main-C8oSjoH0.css +0 -1
- package/dist/assets/main-CQ2W0QKo.js +0 -2475
- package/dist/assets/main-CQ2W0QKo.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _e(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var vt={exports:{}},gt={exports:{}},es=gt.exports,me;function ss(){return me||(me=1,(function(){var l,t,e,s,i,r;typeof performance<"u"&&performance!==null&&performance.now?gt.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(gt.exports=function(){return(l()-i)/1e6},t=process.hrtime,l=function(){var o;return o=t(),o[0]*1e9+o[1]},s=l(),r=process.uptime()*1e9,i=s-r):Date.now?(gt.exports=function(){return Date.now()-e},e=Date.now()):(gt.exports=function(){return new Date().getTime()-e},e=new Date().getTime())}).call(es)),gt.exports}var xe;function is(){if(xe)return vt.exports;xe=1;for(var l=ss(),t=typeof window>"u"?ts:window,e=["moz","webkit"],s="AnimationFrame",i=t["request"+s],r=t["cancel"+s]||t["cancelRequest"+s],o=0;!i&&o<e.length;o++)i=t[e[o]+"Request"+s],r=t[e[o]+"Cancel"+s]||t[e[o]+"CancelRequest"+s];if(!i||!r){var n=0,a=0,h=[],c=1e3/60;i=function(f){if(h.length===0){var g=l(),u=Math.max(0,c-(g-n));n=u+g,setTimeout(function(){var d=h.slice(0);h.length=0;for(var p=0;p<d.length;p++)if(!d[p].cancelled)try{d[p].callback(n)}catch(y){setTimeout(function(){throw y},0)}},Math.round(u))}return h.push({handle:++a,callback:f,cancelled:!1}),a},r=function(f){for(var g=0;g<h.length;g++)h[g].handle===f&&(h[g].cancelled=!0)}}return vt.exports=function(f){return i.call(t,f)},vt.exports.cancel=function(){r.apply(t,arguments)},vt.exports.polyfill=function(f){f||(f=t),f.requestAnimationFrame=i,f.cancelAnimationFrame=r},vt.exports}var rs=is();const jt=_e(rs);var Kt,be;function ns(){return be||(be=1,Kt=function(l){this.ok=!1,this.alpha=1,l.charAt(0)=="#"&&(l=l.substr(1,6)),l=l.replace(/ /g,""),l=l.toLowerCase();var t={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"};l=t[l]||l;for(var e=[{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(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseFloat(a[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(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],s=0;s<e.length;s++){var i=e[s].re,r=e[s].process,o=i.exec(l);if(o){var n=r(o);this.r=n[0],this.g=n[1],this.b=n[2],n.length>3&&(this.alpha=n[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 a=this.r.toString(16),h=this.g.toString(16),c=this.b.toString(16);return a.length==1&&(a="0"+a),h.length==1&&(h="0"+h),c.length==1&&(c="0"+c),"#"+a+h+c},this.getHelpXML=function(){for(var a=new Array,h=0;h<e.length;h++)for(var c=e[h].example,f=0;f<c.length;f++)a[a.length]=c[f];for(var g in t)a[a.length]=g;var u=document.createElement("ul");u.setAttribute("id","rgbcolor-examples");for(var h=0;h<a.length;h++)try{var d=document.createElement("li"),p=new RGBColor(a[h]),y=document.createElement("div");y.style.cssText="margin: 3px; border: 1px solid black; background:"+p.toHex()+"; color:"+p.toHex(),y.appendChild(document.createTextNode("test"));var x=document.createTextNode(" "+a[h]+" -> "+p.toRGB()+" -> "+p.toHex());d.appendChild(y),d.appendChild(x),u.appendChild(d)}catch{}return u}}),Kt}var os=ns();const se=_e(os);/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */var Fe=function(l,t){return(Fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,s){e.__proto__=s}||function(e,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])})(l,t)};function ze(l,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=l}Fe(l,t),l.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function as(l){var t="";Array.isArray(l)||(l=[l]);for(var e=0;e<l.length;e++){var s=l[e];if(s.type===m.CLOSE_PATH)t+="z";else if(s.type===m.HORIZ_LINE_TO)t+=(s.relative?"h":"H")+s.x;else if(s.type===m.VERT_LINE_TO)t+=(s.relative?"v":"V")+s.y;else if(s.type===m.MOVE_TO)t+=(s.relative?"m":"M")+s.x+" "+s.y;else if(s.type===m.LINE_TO)t+=(s.relative?"l":"L")+s.x+" "+s.y;else if(s.type===m.CURVE_TO)t+=(s.relative?"c":"C")+s.x1+" "+s.y1+" "+s.x2+" "+s.y2+" "+s.x+" "+s.y;else if(s.type===m.SMOOTH_CURVE_TO)t+=(s.relative?"s":"S")+s.x2+" "+s.y2+" "+s.x+" "+s.y;else if(s.type===m.QUAD_TO)t+=(s.relative?"q":"Q")+s.x1+" "+s.y1+" "+s.x+" "+s.y;else if(s.type===m.SMOOTH_QUAD_TO)t+=(s.relative?"t":"T")+s.x+" "+s.y;else{if(s.type!==m.ARC)throw new Error('Unexpected command type "'+s.type+'" at index '+e+".");t+=(s.relative?"a":"A")+s.rX+" "+s.rY+" "+s.xRot+" "+ +s.lArcFlag+" "+ +s.sweepFlag+" "+s.x+" "+s.y}}return t}function ie(l,t){var e=l[0],s=l[1];return[e*Math.cos(t)-s*Math.sin(t),e*Math.sin(t)+s*Math.cos(t)]}function K(){for(var l=[],t=0;t<arguments.length;t++)l[t]=arguments[t];for(var e=0;e<l.length;e++)if(typeof l[e]!="number")throw new Error("assertNumbers arguments["+e+"] is not a number. "+typeof l[e]+" == typeof "+l[e]);return!0}var nt=Math.PI;function Jt(l,t,e){l.lArcFlag=l.lArcFlag===0?0:1,l.sweepFlag=l.sweepFlag===0?0:1;var s=l.rX,i=l.rY,r=l.x,o=l.y;s=Math.abs(l.rX),i=Math.abs(l.rY);var n=ie([(t-r)/2,(e-o)/2],-l.xRot/180*nt),a=n[0],h=n[1],c=Math.pow(a,2)/Math.pow(s,2)+Math.pow(h,2)/Math.pow(i,2);1<c&&(s*=Math.sqrt(c),i*=Math.sqrt(c)),l.rX=s,l.rY=i;var f=Math.pow(s,2)*Math.pow(h,2)+Math.pow(i,2)*Math.pow(a,2),g=(l.lArcFlag!==l.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(s,2)*Math.pow(i,2)-f)/f)),u=s*h/i*g,d=-i*a/s*g,p=ie([u,d],l.xRot/180*nt);l.cX=p[0]+(t+r)/2,l.cY=p[1]+(e+o)/2,l.phi1=Math.atan2((h-d)/i,(a-u)/s),l.phi2=Math.atan2((-h-d)/i,(-a-u)/s),l.sweepFlag===0&&l.phi2>l.phi1&&(l.phi2-=2*nt),l.sweepFlag===1&&l.phi2<l.phi1&&(l.phi2+=2*nt),l.phi1*=180/nt,l.phi2*=180/nt}function ve(l,t,e){K(l,t,e);var s=l*l+t*t-e*e;if(0>s)return[];if(s===0)return[[l*e/(l*l+t*t),t*e/(l*l+t*t)]];var i=Math.sqrt(s);return[[(l*e+t*i)/(l*l+t*t),(t*e-l*i)/(l*l+t*t)],[(l*e-t*i)/(l*l+t*t),(t*e+l*i)/(l*l+t*t)]]}var D,et=Math.PI/180;function Ae(l,t,e){return(1-e)*l+e*t}function Se(l,t,e,s){return l+Math.cos(s/180*nt)*t+Math.sin(s/180*nt)*e}function Te(l,t,e,s){var i=1e-6,r=t-l,o=e-t,n=3*r+3*(s-e)-6*o,a=6*(o-r),h=3*r;return Math.abs(n)<i?[-h/a]:(function(c,f,g){var u=c*c/4-f;if(u<-g)return[];if(u<=g)return[-c/2];var d=Math.sqrt(u);return[-c/2-d,-c/2+d]})(a/n,h/n,i)}function we(l,t,e,s,i){var r=1-i;return l*(r*r*r)+t*(3*r*r*i)+e*(3*r*i*i)+s*(i*i*i)}(function(l){function t(){return i((function(n,a,h){return n.relative&&(n.x1!==void 0&&(n.x1+=a),n.y1!==void 0&&(n.y1+=h),n.x2!==void 0&&(n.x2+=a),n.y2!==void 0&&(n.y2+=h),n.x!==void 0&&(n.x+=a),n.y!==void 0&&(n.y+=h),n.relative=!1),n}))}function e(){var n=NaN,a=NaN,h=NaN,c=NaN;return i((function(f,g,u){return f.type&m.SMOOTH_CURVE_TO&&(f.type=m.CURVE_TO,n=isNaN(n)?g:n,a=isNaN(a)?u:a,f.x1=f.relative?g-n:2*g-n,f.y1=f.relative?u-a:2*u-a),f.type&m.CURVE_TO?(n=f.relative?g+f.x2:f.x2,a=f.relative?u+f.y2:f.y2):(n=NaN,a=NaN),f.type&m.SMOOTH_QUAD_TO&&(f.type=m.QUAD_TO,h=isNaN(h)?g:h,c=isNaN(c)?u:c,f.x1=f.relative?g-h:2*g-h,f.y1=f.relative?u-c:2*u-c),f.type&m.QUAD_TO?(h=f.relative?g+f.x1:f.x1,c=f.relative?u+f.y1:f.y1):(h=NaN,c=NaN),f}))}function s(){var n=NaN,a=NaN;return i((function(h,c,f){if(h.type&m.SMOOTH_QUAD_TO&&(h.type=m.QUAD_TO,n=isNaN(n)?c:n,a=isNaN(a)?f:a,h.x1=h.relative?c-n:2*c-n,h.y1=h.relative?f-a:2*f-a),h.type&m.QUAD_TO){n=h.relative?c+h.x1:h.x1,a=h.relative?f+h.y1:h.y1;var g=h.x1,u=h.y1;h.type=m.CURVE_TO,h.x1=((h.relative?0:c)+2*g)/3,h.y1=((h.relative?0:f)+2*u)/3,h.x2=(h.x+2*g)/3,h.y2=(h.y+2*u)/3}else n=NaN,a=NaN;return h}))}function i(n){var a=0,h=0,c=NaN,f=NaN;return function(g){if(isNaN(c)&&!(g.type&m.MOVE_TO))throw new Error("path must start with moveto");var u=n(g,a,h,c,f);return g.type&m.CLOSE_PATH&&(a=c,h=f),g.x!==void 0&&(a=g.relative?a+g.x:g.x),g.y!==void 0&&(h=g.relative?h+g.y:g.y),g.type&m.MOVE_TO&&(c=a,f=h),u}}function r(n,a,h,c,f,g){return K(n,a,h,c,f,g),i((function(u,d,p,y){var x=u.x1,S=u.x2,b=u.relative&&!isNaN(y),v=u.x!==void 0?u.x:b?0:d,E=u.y!==void 0?u.y:b?0:p;function C(Z){return Z*Z}u.type&m.HORIZ_LINE_TO&&a!==0&&(u.type=m.LINE_TO,u.y=u.relative?0:p),u.type&m.VERT_LINE_TO&&h!==0&&(u.type=m.LINE_TO,u.x=u.relative?0:d),u.x!==void 0&&(u.x=u.x*n+E*h+(b?0:f)),u.y!==void 0&&(u.y=v*a+u.y*c+(b?0:g)),u.x1!==void 0&&(u.x1=u.x1*n+u.y1*h+(b?0:f)),u.y1!==void 0&&(u.y1=x*a+u.y1*c+(b?0:g)),u.x2!==void 0&&(u.x2=u.x2*n+u.y2*h+(b?0:f)),u.y2!==void 0&&(u.y2=S*a+u.y2*c+(b?0:g));var T=n*c-a*h;if(u.xRot!==void 0&&(n!==1||a!==0||h!==0||c!==1))if(T===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=m.LINE_TO;else{var N=u.xRot*Math.PI/180,R=Math.sin(N),F=Math.cos(N),z=1/C(u.rX),_=1/C(u.rY),X=C(F)*z+C(R)*_,B=2*R*F*(z-_),L=C(R)*z+C(F)*_,H=X*c*c-B*a*c+L*a*a,U=B*(n*c+a*h)-2*(X*h*c+L*n*a),G=X*h*h-B*n*h+L*n*n,k=(Math.atan2(U,H-G)+Math.PI)%Math.PI/2,O=Math.sin(k),Y=Math.cos(k);u.rX=Math.abs(T)/Math.sqrt(H*C(Y)+U*O*Y+G*C(O)),u.rY=Math.abs(T)/Math.sqrt(H*C(O)-U*O*Y+G*C(Y)),u.xRot=180*k/Math.PI}return u.sweepFlag!==void 0&&0>T&&(u.sweepFlag=+!u.sweepFlag),u}))}function o(){return function(n){var a={};for(var h in n)a[h]=n[h];return a}}l.ROUND=function(n){function a(h){return Math.round(h*n)/n}return n===void 0&&(n=1e13),K(n),function(h){return h.x1!==void 0&&(h.x1=a(h.x1)),h.y1!==void 0&&(h.y1=a(h.y1)),h.x2!==void 0&&(h.x2=a(h.x2)),h.y2!==void 0&&(h.y2=a(h.y2)),h.x!==void 0&&(h.x=a(h.x)),h.y!==void 0&&(h.y=a(h.y)),h.rX!==void 0&&(h.rX=a(h.rX)),h.rY!==void 0&&(h.rY=a(h.rY)),h}},l.TO_ABS=t,l.TO_REL=function(){return i((function(n,a,h){return n.relative||(n.x1!==void 0&&(n.x1-=a),n.y1!==void 0&&(n.y1-=h),n.x2!==void 0&&(n.x2-=a),n.y2!==void 0&&(n.y2-=h),n.x!==void 0&&(n.x-=a),n.y!==void 0&&(n.y-=h),n.relative=!0),n}))},l.NORMALIZE_HVZ=function(n,a,h){return n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=!0),i((function(c,f,g,u,d){if(isNaN(u)&&!(c.type&m.MOVE_TO))throw new Error("path must start with moveto");return a&&c.type&m.HORIZ_LINE_TO&&(c.type=m.LINE_TO,c.y=c.relative?0:g),h&&c.type&m.VERT_LINE_TO&&(c.type=m.LINE_TO,c.x=c.relative?0:f),n&&c.type&m.CLOSE_PATH&&(c.type=m.LINE_TO,c.x=c.relative?u-f:u,c.y=c.relative?d-g:d),c.type&m.ARC&&(c.rX===0||c.rY===0)&&(c.type=m.LINE_TO,delete c.rX,delete c.rY,delete c.xRot,delete c.lArcFlag,delete c.sweepFlag),c}))},l.NORMALIZE_ST=e,l.QT_TO_C=s,l.INFO=i,l.SANITIZE=function(n){n===void 0&&(n=0),K(n);var a=NaN,h=NaN,c=NaN,f=NaN;return i((function(g,u,d,p,y){var x=Math.abs,S=!1,b=0,v=0;if(g.type&m.SMOOTH_CURVE_TO&&(b=isNaN(a)?0:u-a,v=isNaN(h)?0:d-h),g.type&(m.CURVE_TO|m.SMOOTH_CURVE_TO)?(a=g.relative?u+g.x2:g.x2,h=g.relative?d+g.y2:g.y2):(a=NaN,h=NaN),g.type&m.SMOOTH_QUAD_TO?(c=isNaN(c)?u:2*u-c,f=isNaN(f)?d:2*d-f):g.type&m.QUAD_TO?(c=g.relative?u+g.x1:g.x1,f=g.relative?d+g.y1:g.y2):(c=NaN,f=NaN),g.type&m.LINE_COMMANDS||g.type&m.ARC&&(g.rX===0||g.rY===0||!g.lArcFlag)||g.type&m.CURVE_TO||g.type&m.SMOOTH_CURVE_TO||g.type&m.QUAD_TO||g.type&m.SMOOTH_QUAD_TO){var E=g.x===void 0?0:g.relative?g.x:g.x-u,C=g.y===void 0?0:g.relative?g.y:g.y-d;b=isNaN(c)?g.x1===void 0?b:g.relative?g.x:g.x1-u:c-u,v=isNaN(f)?g.y1===void 0?v:g.relative?g.y:g.y1-d:f-d;var T=g.x2===void 0?0:g.relative?g.x:g.x2-u,N=g.y2===void 0?0:g.relative?g.y:g.y2-d;x(E)<=n&&x(C)<=n&&x(b)<=n&&x(v)<=n&&x(T)<=n&&x(N)<=n&&(S=!0)}return g.type&m.CLOSE_PATH&&x(u-p)<=n&&x(d-y)<=n&&(S=!0),S?[]:g}))},l.MATRIX=r,l.ROTATE=function(n,a,h){a===void 0&&(a=0),h===void 0&&(h=0),K(n,a,h);var c=Math.sin(n),f=Math.cos(n);return r(f,c,-c,f,a-a*f+h*c,h-a*c-h*f)},l.TRANSLATE=function(n,a){return a===void 0&&(a=0),K(n,a),r(1,0,0,1,n,a)},l.SCALE=function(n,a){return a===void 0&&(a=n),K(n,a),r(n,0,0,a,0,0)},l.SKEW_X=function(n){return K(n),r(1,0,Math.atan(n),1,0,0)},l.SKEW_Y=function(n){return K(n),r(1,Math.atan(n),0,1,0,0)},l.X_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(-1,0,0,1,n,0)},l.Y_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(1,0,0,-1,0,n)},l.A_TO_C=function(){return i((function(n,a,h){return m.ARC===n.type?(function(c,f,g){var u,d,p,y;c.cX||Jt(c,f,g);for(var x=Math.min(c.phi1,c.phi2),S=Math.max(c.phi1,c.phi2)-x,b=Math.ceil(S/90),v=new Array(b),E=f,C=g,T=0;T<b;T++){var N=Ae(c.phi1,c.phi2,T/b),R=Ae(c.phi1,c.phi2,(T+1)/b),F=R-N,z=4/3*Math.tan(F*et/4),_=[Math.cos(N*et)-z*Math.sin(N*et),Math.sin(N*et)+z*Math.cos(N*et)],X=_[0],B=_[1],L=[Math.cos(R*et),Math.sin(R*et)],H=L[0],U=L[1],G=[H+z*Math.sin(R*et),U-z*Math.cos(R*et)],k=G[0],O=G[1];v[T]={relative:c.relative,type:m.CURVE_TO};var Y=function(Z,tt){var rt=ie([Z*c.rX,tt*c.rY],c.xRot),yt=rt[0],wt=rt[1];return[c.cX+yt,c.cY+wt]};u=Y(X,B),v[T].x1=u[0],v[T].y1=u[1],d=Y(k,O),v[T].x2=d[0],v[T].y2=d[1],p=Y(H,U),v[T].x=p[0],v[T].y=p[1],c.relative&&(v[T].x1-=E,v[T].y1-=C,v[T].x2-=E,v[T].y2-=C,v[T].x-=E,v[T].y-=C),E=(y=[v[T].x,v[T].y])[0],C=y[1]}return v})(n,n.relative?0:a,n.relative?0:h):n}))},l.ANNOTATE_ARCS=function(){return i((function(n,a,h){return n.relative&&(a=0,h=0),m.ARC===n.type&&Jt(n,a,h),n}))},l.CLONE=o,l.CALCULATE_BOUNDS=function(){var n=function(g){var u={};for(var d in g)u[d]=g[d];return u},a=t(),h=s(),c=e(),f=i((function(g,u,d){var p=c(h(a(n(g))));function y(O){O>f.maxX&&(f.maxX=O),O<f.minX&&(f.minX=O)}function x(O){O>f.maxY&&(f.maxY=O),O<f.minY&&(f.minY=O)}if(p.type&m.DRAWING_COMMANDS&&(y(u),x(d)),p.type&m.HORIZ_LINE_TO&&y(p.x),p.type&m.VERT_LINE_TO&&x(p.y),p.type&m.LINE_TO&&(y(p.x),x(p.y)),p.type&m.CURVE_TO){y(p.x),x(p.y);for(var S=0,b=Te(u,p.x1,p.x2,p.x);S<b.length;S++)0<(k=b[S])&&1>k&&y(we(u,p.x1,p.x2,p.x,k));for(var v=0,E=Te(d,p.y1,p.y2,p.y);v<E.length;v++)0<(k=E[v])&&1>k&&x(we(d,p.y1,p.y2,p.y,k))}if(p.type&m.ARC){y(p.x),x(p.y),Jt(p,u,d);for(var C=p.xRot/180*Math.PI,T=Math.cos(C)*p.rX,N=Math.sin(C)*p.rX,R=-Math.sin(C)*p.rY,F=Math.cos(C)*p.rY,z=p.phi1<p.phi2?[p.phi1,p.phi2]:-180>p.phi2?[p.phi2+360,p.phi1+360]:[p.phi2,p.phi1],_=z[0],X=z[1],B=function(O){var Y=O[0],Z=O[1],tt=180*Math.atan2(Z,Y)/Math.PI;return tt<_?tt+360:tt},L=0,H=ve(R,-T,0).map(B);L<H.length;L++)(k=H[L])>_&&k<X&&y(Se(p.cX,T,R,k));for(var U=0,G=ve(F,-N,0).map(B);U<G.length;U++){var k;(k=G[U])>_&&k<X&&x(Se(p.cY,N,F,k))}}return g}));return f.minX=1/0,f.maxX=-1/0,f.minY=1/0,f.maxY=-1/0,f}})(D||(D={}));var j,Ue=(function(){function l(){}return l.prototype.round=function(t){return this.transform(D.ROUND(t))},l.prototype.toAbs=function(){return this.transform(D.TO_ABS())},l.prototype.toRel=function(){return this.transform(D.TO_REL())},l.prototype.normalizeHVZ=function(t,e,s){return this.transform(D.NORMALIZE_HVZ(t,e,s))},l.prototype.normalizeST=function(){return this.transform(D.NORMALIZE_ST())},l.prototype.qtToC=function(){return this.transform(D.QT_TO_C())},l.prototype.aToC=function(){return this.transform(D.A_TO_C())},l.prototype.sanitize=function(t){return this.transform(D.SANITIZE(t))},l.prototype.translate=function(t,e){return this.transform(D.TRANSLATE(t,e))},l.prototype.scale=function(t,e){return this.transform(D.SCALE(t,e))},l.prototype.rotate=function(t,e,s){return this.transform(D.ROTATE(t,e,s))},l.prototype.matrix=function(t,e,s,i,r,o){return this.transform(D.MATRIX(t,e,s,i,r,o))},l.prototype.skewX=function(t){return this.transform(D.SKEW_X(t))},l.prototype.skewY=function(t){return this.transform(D.SKEW_Y(t))},l.prototype.xSymmetry=function(t){return this.transform(D.X_AXIS_SYMMETRY(t))},l.prototype.ySymmetry=function(t){return this.transform(D.Y_AXIS_SYMMETRY(t))},l.prototype.annotateArcs=function(){return this.transform(D.ANNOTATE_ARCS())},l})(),hs=function(l){return l===" "||l===" "||l==="\r"||l===`
|
|
15
|
+
`},Ce=function(l){return 48<=l.charCodeAt(0)&&l.charCodeAt(0)<=57},ls=(function(l){function t(){var e=l.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 ze(t,l),t.prototype.finish=function(e){if(e===void 0&&(e=[]),this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e},t.prototype.parse=function(e,s){var i=this;s===void 0&&(s=[]);for(var r=function(f){s.push(f),i.curArgs.length=0,i.canParseCommandOrComma=!0},o=0;o<e.length;o++){var n=e[o],a=!(this.curCommandType!==m.ARC||this.curArgs.length!==3&&this.curArgs.length!==4||this.curNumber.length!==1||this.curNumber!=="0"&&this.curNumber!=="1"),h=Ce(n)&&(this.curNumber==="0"&&n==="0"||a);if(!Ce(n)||h)if(n!=="e"&&n!=="E")if(n!=="-"&&n!=="+"||!this.curNumberHasExp||this.curNumberHasExpDigits)if(n!=="."||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&this.curCommandType!==-1){var c=Number(this.curNumber);if(isNaN(c))throw new SyntaxError("Invalid number ending at "+o);if(this.curCommandType===m.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>c)throw new SyntaxError('Expected positive number, got "'+c+'" at index "'+o+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+o+'"')}this.curArgs.push(c),this.curArgs.length===cs[this.curCommandType]&&(m.HORIZ_LINE_TO===this.curCommandType?r({type:m.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):m.VERT_LINE_TO===this.curCommandType?r({type:m.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===m.MOVE_TO||this.curCommandType===m.LINE_TO||this.curCommandType===m.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),m.MOVE_TO===this.curCommandType&&(this.curCommandType=m.LINE_TO)):this.curCommandType===m.CURVE_TO?r({type:m.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===m.SMOOTH_CURVE_TO?r({type:m.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===m.QUAD_TO?r({type:m.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===m.ARC&&r({type:m.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(!hs(n))if(n===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(n!=="+"&&n!=="-"&&n!==".")if(h)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+o+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+o+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,n!=="z"&&n!=="Z")if(n==="h"||n==="H")this.curCommandType=m.HORIZ_LINE_TO,this.curCommandRelative=n==="h";else if(n==="v"||n==="V")this.curCommandType=m.VERT_LINE_TO,this.curCommandRelative=n==="v";else if(n==="m"||n==="M")this.curCommandType=m.MOVE_TO,this.curCommandRelative=n==="m";else if(n==="l"||n==="L")this.curCommandType=m.LINE_TO,this.curCommandRelative=n==="l";else if(n==="c"||n==="C")this.curCommandType=m.CURVE_TO,this.curCommandRelative=n==="c";else if(n==="s"||n==="S")this.curCommandType=m.SMOOTH_CURVE_TO,this.curCommandRelative=n==="s";else if(n==="q"||n==="Q")this.curCommandType=m.QUAD_TO,this.curCommandRelative=n==="q";else if(n==="t"||n==="T")this.curCommandType=m.SMOOTH_QUAD_TO,this.curCommandRelative=n==="t";else{if(n!=="a"&&n!=="A")throw new SyntaxError('Unexpected character "'+n+'" at index '+o+".");this.curCommandType=m.ARC,this.curCommandRelative=n==="a"}else s.push({type:m.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 s},t.prototype.transform=function(e){return Object.create(this,{parse:{value:function(s,i){i===void 0&&(i=[]);for(var r=0,o=Object.getPrototypeOf(this).parse.call(this,s);r<o.length;r++){var n=o[r],a=e(n);Array.isArray(a)?i.push.apply(i,a):i.push(a)}return i}}})},t})(Ue),m=(function(l){function t(e){var s=l.call(this)||this;return s.commands=typeof e=="string"?t.parse(e):e,s}return ze(t,l),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var e=D.CALCULATE_BOUNDS();return this.transform(e),e},t.prototype.transform=function(e){for(var s=[],i=0,r=this.commands;i<r.length;i++){var o=e(r[i]);Array.isArray(o)?s.push.apply(s,o):s.push(o)}return this.commands=s,this},t.encode=function(e){return as(e)},t.parse=function(e){var s=new ls,i=[];return s.parse(e,i),s.finish(i),i},t.CLOSE_PATH=1,t.MOVE_TO=2,t.HORIZ_LINE_TO=4,t.VERT_LINE_TO=8,t.LINE_TO=16,t.CURVE_TO=32,t.SMOOTH_CURVE_TO=64,t.QUAD_TO=128,t.SMOOTH_QUAD_TO=256,t.ARC=512,t.LINE_COMMANDS=t.LINE_TO|t.HORIZ_LINE_TO|t.VERT_LINE_TO,t.DRAWING_COMMANDS=t.HORIZ_LINE_TO|t.VERT_LINE_TO|t.LINE_TO|t.CURVE_TO|t.SMOOTH_CURVE_TO|t.QUAD_TO|t.SMOOTH_QUAD_TO|t.ARC,t})(Ue),cs=((j={})[m.MOVE_TO]=2,j[m.LINE_TO]=2,j[m.HORIZ_LINE_TO]=1,j[m.VERT_LINE_TO]=1,j[m.CLOSE_PATH]=0,j[m.QUAD_TO]=4,j[m.SMOOTH_QUAD_TO]=2,j[m.CURVE_TO]=6,j[m.SMOOTH_CURVE_TO]=4,j[m.ARC]=7,j);function It(l){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?It=function(t){return typeof t}:It=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(l)}function us(l,t){if(!(l instanceof t))throw new TypeError("Cannot call a class as a function")}var fs=[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],gs=[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 ds(l,t,e,s,i){if(typeof l=="string"&&(l=document.getElementById(l)),!l||It(l)!=="object"||!("getContext"in l))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var r=l.getContext("2d");try{return r.getImageData(t,e,s,i)}catch(o){throw new Error("unable to access image data: "+o)}}function ps(l,t,e,s,i,r){if(!(isNaN(r)||r<1)){r|=0;var o=ds(l,t,e,s,i);o=ys(o,t,e,s,i,r),l.getContext("2d").putImageData(o,t,e)}}function ys(l,t,e,s,i,r){for(var o=l.data,n=2*r+1,a=s-1,h=i-1,c=r+1,f=c*(c+1)/2,g=new Ee,u=g,d,p=1;p<n;p++)u=u.next=new Ee,p===c&&(d=u);u.next=g;for(var y=null,x=null,S=0,b=0,v=fs[r],E=gs[r],C=0;C<i;C++){u=g;for(var T=o[b],N=o[b+1],R=o[b+2],F=o[b+3],z=0;z<c;z++)u.r=T,u.g=N,u.b=R,u.a=F,u=u.next;for(var _=0,X=0,B=0,L=0,H=c*T,U=c*N,G=c*R,k=c*F,O=f*T,Y=f*N,Z=f*R,tt=f*F,rt=1;rt<c;rt++){var yt=b+((a<rt?a:rt)<<2),wt=o[yt],he=o[yt+1],le=o[yt+2],ce=o[yt+3],Ct=c-rt;O+=(u.r=wt)*Ct,Y+=(u.g=he)*Ct,Z+=(u.b=le)*Ct,tt+=(u.a=ce)*Ct,_+=wt,X+=he,B+=le,L+=ce,u=u.next}y=g,x=d;for(var Ft=0;Ft<s;Ft++){var zt=tt*v>>>E;if(o[b+3]=zt,zt!==0){var Ut=255/zt;o[b]=(O*v>>>E)*Ut,o[b+1]=(Y*v>>>E)*Ut,o[b+2]=(Z*v>>>E)*Ut}else o[b]=o[b+1]=o[b+2]=0;O-=H,Y-=U,Z-=G,tt-=k,H-=y.r,U-=y.g,G-=y.b,k-=y.a;var ht=Ft+r+1;ht=S+(ht<a?ht:a)<<2,_+=y.r=o[ht],X+=y.g=o[ht+1],B+=y.b=o[ht+2],L+=y.a=o[ht+3],O+=_,Y+=X,Z+=B,tt+=L,y=y.next;var Et=x,ue=Et.r,fe=Et.g,ge=Et.b,de=Et.a;H+=ue,U+=fe,G+=ge,k+=de,_-=ue,X-=fe,B-=ge,L-=de,x=x.next,b+=4}S+=s}for(var mt=0;mt<s;mt++){b=mt<<2;var lt=o[b],ct=o[b+1],ut=o[b+2],q=o[b+3],Xt=c*lt,Ht=c*ct,Yt=c*ut,Wt=c*q,Pt=f*lt,Mt=f*ct,Nt=f*ut,Ot=f*q;u=g;for(var pe=0;pe<c;pe++)u.r=lt,u.g=ct,u.b=ut,u.a=q,u=u.next;for(var ye=s,qt=0,Qt=0,Gt=0,$t=0,Vt=1;Vt<=r;Vt++){b=ye+mt<<2;var kt=c-Vt;Pt+=(u.r=lt=o[b])*kt,Mt+=(u.g=ct=o[b+1])*kt,Nt+=(u.b=ut=o[b+2])*kt,Ot+=(u.a=q=o[b+3])*kt,$t+=lt,qt+=ct,Qt+=ut,Gt+=q,u=u.next,Vt<h&&(ye+=s)}b=mt,y=g,x=d;for(var Zt=0;Zt<i;Zt++){var Q=b<<2;o[Q+3]=q=Ot*v>>>E,q>0?(q=255/q,o[Q]=(Pt*v>>>E)*q,o[Q+1]=(Mt*v>>>E)*q,o[Q+2]=(Nt*v>>>E)*q):o[Q]=o[Q+1]=o[Q+2]=0,Pt-=Xt,Mt-=Ht,Nt-=Yt,Ot-=Wt,Xt-=y.r,Ht-=y.g,Yt-=y.b,Wt-=y.a,Q=mt+((Q=Zt+c)<h?Q:h)*s<<2,Pt+=$t+=y.r=o[Q],Mt+=qt+=y.g=o[Q+1],Nt+=Qt+=y.b=o[Q+2],Ot+=Gt+=y.a=o[Q+3],y=y.next,Xt+=lt=x.r,Ht+=ct=x.g,Yt+=ut=x.b,Wt+=q=x.a,$t-=lt,qt-=ct,Qt-=ut,Gt-=q,x=x.next,b+=s}}return l}var Ee=function l(){us(this,l),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function bt(l){return l.replace(/(?!\u3000)\s+/gm," ")}function ms(l){return l.replace(/^[\n \t]+/,"")}function xs(l){return l.replace(/[\n \t]+$/,"")}function $(l){const t=l.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return t?t.map(parseFloat):[]}function bs(l){const t=$(l);return[t[0]||0,t[1]||0,t[2]||0,t[3]||0,t[4]||0,t[5]||0]}const vs=/^[A-Z-]+$/;function As(l){return vs.test(l)?l.toLowerCase():l}function Xe(l){const t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(l);return t&&(t[2]||t[3]||t[4])||""}function Ss(l){if(!l.startsWith("rgb"))return l;let t=3;return l.replace(/\d+(\.\d+)?/g,(s,i)=>t--&&i?String(Math.round(parseFloat(s))):s)}const Ts=/(\[[^\]]+\])/g,ws=/(#[^\s+>~.[:]+)/g,Cs=/(\.[^\s+>~.[:]+)/g,Es=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Ps=/(:[\w-]+\([^)]*\))/gi,Ms=/(:[^\s+>~.[:]+)/g,Ns=/([^\s+>~.[:]+)/g;function ft(l,t){const e=t.exec(l);return e?[l.replace(t," "),e.length]:[l,0]}function Os(l){const t=[0,0,0];let e=l.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),s=0;return[e,s]=ft(e,Ts),t[1]+=s,[e,s]=ft(e,ws),t[0]+=s,[e,s]=ft(e,Cs),t[1]+=s,[e,s]=ft(e,Es),t[2]+=s,[e,s]=ft(e,Ps),t[1]+=s,[e,s]=ft(e,Ms),t[1]+=s,e=e.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[e,s]=ft(e,Ns),t[2]+=s,t.join("")}const xt=1e-8;function Pe(l){return Math.sqrt(Math.pow(l[0],2)+Math.pow(l[1],2))}function re(l,t){return(l[0]*t[0]+l[1]*t[1])/(Pe(l)*Pe(t))}function Me(l,t){return(l[0]*t[1]<l[1]*t[0]?-1:1)*Math.acos(re(l,t))}function Ne(l){return l*l*l}function Oe(l){return 3*l*l*(1-l)}function Ve(l){return 3*l*(1-l)*(1-l)}function ke(l){return(1-l)*(1-l)*(1-l)}function Re(l){return l*l}function Le(l){return 2*l*(1-l)}function Ie(l){return(1-l)*(1-l)}class A{static empty(t){return new A(t,"EMPTY","")}split(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:" ";const{document:e,name:s}=this;return bt(this.getString()).trim().split(t).map(i=>new A(e,s,i))}hasValue(t){const e=this.value;return e!==null&&e!==""&&(t||e!==0)&&typeof e<"u"}isString(t){const{value:e}=this,s=typeof e=="string";return!s||!t?s:t.test(e)}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 typeof t>"u"||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return typeof t>"u"?0:parseFloat(t);const{value:e}=this;let s=parseFloat(e);return this.isString(/%$/)&&(s/=100),s}getString(t){return typeof t>"u"||this.hasValue()?typeof this.value>"u"?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=Ss(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&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[s,i]=typeof t=="boolean"?[void 0,t]:[t],{viewPort:r}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(r.computeSize("x"),r.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(r.computeSize("x"),r.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*r.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*r.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 this.getNumber()*15;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(/%$/)&&i):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*r.computeSize(s);default:{const o=this.getNumber();return e&&o<1?o*r.computeSize(s):o}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3: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),s=e?.[1]||t;return this.document.definitions.get(s)}getFillStyleDefinition(t,e){let s=this.getDefinition();if(!s)return null;if(typeof s.createGradient=="function"&&"getBoundingBox"in t)return s.createGradient(this.document.ctx,t,e);if(typeof s.createPattern=="function"){if(s.getHrefAttribute().hasValue()){const i=s.getAttribute("patternTransform");s=s.getHrefAttribute().getDefinition(),s&&i.hasValue()&&s.getAttribute("patternTransform",!0).setValue(i.value)}if(s)return s.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return A.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const s=e.length;let i=0;for(let r=0;r<s&&(e[r]===","&&i++,i!==3);r++);if(t.hasValue()&&this.isString()&&i!==3){const r=new se(e);r.ok&&(r.alpha=t.getNumber(),e=r.toRGBA())}return new A(this.document,this.name,e)}constructor(t,e,s){this.document=t,this.name=e,this.value=s,this.isNormalizedColor=!1}}A.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 St{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||De()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||De()}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return typeof t=="number"?t:t==="x"?this.width:t==="y"?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}constructor(){this.viewPorts=[]}}St.DEFAULT_VIEWPORT_WIDTH=800;St.DEFAULT_VIEWPORT_HEIGHT=600;function De(){return{width:St.DEFAULT_VIEWPORT_WIDTH,height:St.DEFAULT_VIEWPORT_HEIGHT}}class V{static parse(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const[s=e,i=e]=$(t);return new V(s,i)}static parseScale(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[s=e,i=s]=$(t);return new V(s,i)}static parsePath(t){const e=$(t),s=e.length,i=[];for(let r=0;r<s;r+=2)i.push(new V(e[r],e[r+1]));return i}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){const{x:e,y:s}=this,i=e*t[0]+s*t[2]+t[4],r=e*t[1]+s*t[3]+t[5];this.x=i,this.y=r}constructor(t,e){this.x=t,this.y=e}}class Vs{isWorking(){return this.working}start(){if(this.working)return;const{screen:t,onClick:e,onMouseMove:s}=this,i=t.ctx.canvas;i.onclick=e,i.onmousemove=s,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:s}=this,{style:i}=t.ctx.canvas;let r;i&&(i.cursor=""),e.forEach((o,n)=>{let{run:a}=o;for(r=s[n];r;)a(r),r=r.parent}),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:s,eventElements:i}=this;s.forEach((r,o)=>{let{x:n,y:a}=r;!i[o]&&e.isPointInPath&&e.isPointInPath(n,a)&&(i[o]=t)})}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:s,eventElements:i}=this;s.forEach((r,o)=>{let{x:n,y:a}=r;!i[o]&&e.isPointInBox(n,a)&&(i[o]=t)})}mapXY(t,e){const{window:s,ctx:i}=this.screen,r=new V(t,e);let o=i.canvas;for(;o;)r.x-=o.offsetLeft,r.y-=o.offsetTop,o=o.offsetParent;return s?.scrollX&&(r.x+=s.scrollX),s?.scrollY&&(r.y+=s.scrollY),r}onClick(t){const{x:e,y:s}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:s,run(i){i.onClick&&i.onClick()}})}onMouseMove(t){const{x:e,y:s}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:s,run(i){i.onMouseMove&&i.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 He=typeof window<"u"?window:null,Ye=typeof fetch<"u"?fetch.bind(void 0):void 0;class it{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(e=>e());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:s,aspectRatio:i,width:r,desiredWidth:o,height:n,desiredHeight:a,minX:h=0,minY:c=0,refX:f,refY:g,clip:u=!1,clipX:d=0,clipY:p=0}=t;const y=bt(i).replace(/^defer\s/,""),[x,S]=y.split(" "),b=x||"xMidYMid",v=S||"meet",E=r/o,C=n/a,T=Math.min(E,C),N=Math.max(E,C);let R=o,F=a;v==="meet"&&(R*=T,F*=T),v==="slice"&&(R*=N,F*=N);const z=new A(e,"refX",f),_=new A(e,"refY",g),X=z.hasValue()&&_.hasValue();if(X&&s.translate(-T*z.getPixels("x"),-T*_.getPixels("y")),u){const B=T*d,L=T*p;s.beginPath(),s.moveTo(B,L),s.lineTo(r,L),s.lineTo(r,n),s.lineTo(B,n),s.closePath(),s.clip()}if(!X){const B=v==="meet"&&T===C,L=v==="slice"&&N===C,H=v==="meet"&&T===E,U=v==="slice"&&N===E;b.startsWith("xMid")&&(B||L)&&s.translate(r/2-R/2,0),b.endsWith("YMid")&&(H||U)&&s.translate(0,n/2-F/2),b.startsWith("xMax")&&(B||L)&&s.translate(r-R,0),b.endsWith("YMax")&&(H||U)&&s.translate(0,n-F)}switch(!0){case b==="none":s.scale(E,C);break;case v==="meet":s.scale(T,T);break;case v==="slice":s.scale(N,N);break}s.translate(-h,-c)}start(t){let{enableRedraw:e=!1,ignoreMouse:s=!1,ignoreAnimation:i=!1,ignoreDimensions:r=!1,ignoreClear:o=!1,forceRedraw:n,scaleWidth:a,scaleHeight:h,offsetX:c,offsetY:f}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:g}=this,u=1e3/it.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=u,this.readyPromise=new Promise(S=>{this.resolveReady=S}),this.isReady()&&this.render(t,r,o,a,h,c,f),!e)return;let d=Date.now(),p=d,y=0;const x=()=>{d=Date.now(),y=d-p,y>=u&&(p=d-y%u,this.shouldUpdate(i,n)&&(this.render(t,r,o,a,h,c,f),g.runEvents())),this.intervalId=jt(x)};s||g.start(),this.intervalId=jt(x)}stop(){this.intervalId&&(jt.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:s}=this;if(this.animations.reduce((r,o)=>o.update(s)||r,!1))return!0}return!!(typeof e=="function"&&e()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(t,e,s,i,r,o,n){const{viewPort:a,ctx:h,isFirstRender:c}=this,f=h.canvas;a.clear(),f.width&&f.height&&a.setCurrent(f.width,f.height);const g=t.getStyle("width"),u=t.getStyle("height");!e&&(c||typeof i!="number"&&typeof r!="number")&&(g.hasValue()&&(f.width=g.getPixels("x"),f.style&&(f.style.width="".concat(f.width,"px"))),u.hasValue()&&(f.height=u.getPixels("y"),f.style&&(f.style.height="".concat(f.height,"px"))));let d=f.clientWidth||f.width,p=f.clientHeight||f.height;if(e&&g.hasValue()&&u.hasValue()&&(d=g.getPixels("x"),p=u.getPixels("y")),a.setCurrent(d,p),typeof o=="number"&&t.getAttribute("x",!0).setValue(o),typeof n=="number"&&t.getAttribute("y",!0).setValue(n),typeof i=="number"||typeof r=="number"){const y=$(t.getAttribute("viewBox").getString());let x=0,S=0;if(typeof i=="number"){const v=t.getStyle("width");v.hasValue()?x=v.getPixels("x")/i:y[2]&&!isNaN(y[2])&&(x=y[2]/i)}if(typeof r=="number"){const v=t.getStyle("height");v.hasValue()?S=v.getPixels("y")/r:y[3]&&!isNaN(y[3])&&(S=y[3]/r)}x||(x=S),S||(S=x),t.getAttribute("width",!0).setValue(i),t.getAttribute("height",!0).setValue(r);const b=t.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/x,", ").concat(1/S,")"))}s||h.clearRect(0,0,d,p),t.render(h),c&&(this.isFirstRender=!1)}constructor(t,{fetch:e=Ye,window:s=He}={}){if(this.ctx=t,this.viewPort=new St,this.mouse=new Vs(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=s,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}it.defaultWindow=He;it.defaultFetch=Ye;it.FRAMERATE=30;it.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:ks}=it,Rs=typeof DOMParser<"u"?DOMParser:void 0;class te{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{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 s=await(await this.fetch(t)).text();return this.parseFromString(s)}constructor({fetch:t=ks,DOMParser:e=Rs}={}){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 Ls{apply(t){const{x:e,y:s}=this.point;t.translate(e||0,s||0)}unapply(t){const{x:e,y:s}=this.point;t.translate(-1*e||0,-1*s||0)}applyToPoint(t){const{x:e,y:s}=this.point;t.applyTransform([1,0,0,1,e||0,s||0])}constructor(t,e){this.type="translate",this.point=V.parse(e)}}class Is{apply(t){const{cx:e,cy:s,originX:i,originY:r,angle:o}=this,n=e+i.getPixels("x"),a=s+r.getPixels("y");t.translate(n,a),t.rotate(o.getRadians()),t.translate(-n,-a)}unapply(t){const{cx:e,cy:s,originX:i,originY:r,angle:o}=this,n=e+i.getPixels("x"),a=s+r.getPixels("y");t.translate(n,a),t.rotate(-1*o.getRadians()),t.translate(-n,-a)}applyToPoint(t){const{cx:e,cy:s,angle:i}=this,r=i.getRadians();t.applyTransform([1,0,0,1,e||0,s||0]),t.applyTransform([Math.cos(r),Math.sin(r),-Math.sin(r),Math.cos(r),0,0]),t.applyTransform([1,0,0,1,-e||0,-s||0])}constructor(t,e,s){this.type="rotate";const i=$(e);this.angle=new A(t,"angle",i[0]),this.originX=s[0],this.originY=s[1],this.cx=i[1]||0,this.cy=i[2]||0}}class Ds{apply(t){const{scale:{x:e,y:s},originX:i,originY:r}=this,o=i.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(e,s||e),t.translate(-o,-n)}unapply(t){const{scale:{x:e,y:s},originX:i,originY:r}=this,o=i.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(1/e,1/s||e),t.translate(-o,-n)}applyToPoint(t){const{x:e,y:s}=this.scale;t.applyTransform([e||0,0,0,s||0,0,0])}constructor(t,e,s){this.type="scale";const i=V.parseScale(e);(i.x===0||i.y===0)&&(i.x=xt,i.y=xt),this.scale=i,this.originX=s[0],this.originY=s[1]}}class We{apply(t){const{originX:e,originY:s,matrix:i}=this,r=e.getPixels("x"),o=s.getPixels("y");t.translate(r,o),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),t.translate(-r,-o)}unapply(t){const{originX:e,originY:s,matrix:i}=this,r=i[0],o=i[2],n=i[4],a=i[1],h=i[3],c=i[5],f=0,g=0,u=1,d=1/(r*(h*u-c*g)-o*(a*u-c*f)+n*(a*g-h*f)),p=e.getPixels("x"),y=s.getPixels("y");t.translate(p,y),t.transform(d*(h*u-c*g),d*(c*f-a*u),d*(n*g-o*u),d*(r*u-n*f),d*(o*c-n*h),d*(n*a-r*c)),t.translate(-p,-y)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,s){this.type="matrix",this.matrix=bs(e),this.originX=s[0],this.originY=s[1]}}class qe extends We{constructor(t,e,s){super(t,e,s),this.type="skew",this.angle=new A(t,"angle",e)}}class Bs extends qe{constructor(t,e,s){super(t,e,s),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class _s extends qe{constructor(t,e,s){super(t,e,s),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function Fs(l){return bt(l).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function zs(l){const[t="",e=""]=l.split("(");return[t.trim(),e.trim().replace(")","")]}class dt{static fromElement(t,e){const s=e.getStyle("transform",!1,!0);if(s.hasValue()){const[i,r=i]=e.getStyle("transform-origin",!1,!0).split();if(i&&r){const o=[i,r];return new dt(t,s.getString(),o)}}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,s){this.document=t,this.transforms=[],Fs(e).forEach(r=>{if(r==="none")return;const[o,n]=zs(r),a=dt.transformTypes[o];a&&this.transforms.push(new a(this.document,n,s))})}}dt.transformTypes={translate:Ls,rotate:Is,scale:Ds,matrix:We,skewX:Bs,skewY:_s};class M{getAttribute(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const s=this.attributes.get(t);if(!s&&e){const i=new A(this.document,t,"");return this.attributes.set(t,i),i}return s||A.empty(this.document)}getHrefAttribute(){let t;for(const[e,s]of this.attributes)if(e==="href"||e.endsWith(":href")){t=s;break}return t||A.empty(this.document)}getStyle(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=this.styles.get(t);if(i)return i;const r=this.getAttribute(t);if(r.hasValue())return this.styles.set(t,r),r;if(!s){const{parent:o}=this;if(o){const n=o.getStyle(t);if(n.hasValue())return n}}if(e){const o=new A(this.document,t,"");return this.styles.set(t,o),o}return A.empty(this.document)}render(t){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if(this.getStyle("filter").getValue("none")!=="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=dt.fromElement(this.document,this);e&&e.apply(t);const s=this.getStyle("clip-path",!1,!0);if(s.hasValue()){const i=s.getDefinition();i&&i.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach(e=>{e.render(t)})}addChild(t){const e=t instanceof M?t:this.document.createElement(t);e.parent=this,M.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:s}=this;if(typeof s.matches=="function")return s.matches(t);const i=(e=s.getAttribute)===null||e===void 0?void 0:e.call(s,"class");return!i||i===""?!1:i.split(" ").some(r=>".".concat(r)===t)}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;for(const[s,i]of t)if(!s.startsWith("@")&&this.matchesSelector(s)){const r=e.get(s);if(i)for(const[o,n]of i){let a=this.stylesSpecificity.get(o);typeof a>"u"&&(a="000"),r&&r>=a&&(n&&this.styles.set(o,n),this.stylesSpecificity.set(o,r))}}}removeStyles(t,e){return e.reduce((i,r)=>{const o=t.getStyle(r);if(!o.hasValue())return i;const n=o.getString();return o.setValue(""),[...i,[r,n]]},[])}restoreStyles(t,e){e.forEach(s=>{let[i,r]=s;t.getStyle(i,!0).setValue(r)})}isFirstChild(){var t;return((t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))===0}constructor(t,e,s=!1){if(this.document=t,this.node=e,this.captureTextNodes=s,this.type="",this.attributes=new Map,this.styles=new Map,this.stylesSpecificity=new Map,this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||e.nodeType!==1)return;Array.from(e.attributes).forEach(o=>{const n=As(o.nodeName);this.attributes.set(n,new A(t,n,o.value))}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(n=>n.trim()).forEach(n=>{if(!n)return;const[a,h]=n.split(":").map(c=>c.trim());a&&this.styles.set(a,new A(t,a,h))});const{definitions:i}=t,r=this.getAttribute("id");r.hasValue()&&(i.has(r.getString())||i.set(r.getString(),this)),Array.from(e.childNodes).forEach(o=>{if(o.nodeType===1)this.addChild(o);else if(s&&(o.nodeType===3||o.nodeType===4)){const n=t.createTextNode(o);n.getText().length>0&&this.addChild(n)}})}}M.ignoreChildTypes=["title"];class Us extends M{constructor(t,e,s){super(t,e,s)}}function Xs(l){const t=l.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function Hs(l){return typeof process>"u"?l:l.trim().split(",").map(Xs).join(",")}function Ys(l){if(!l)return"";const t=l.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function Ws(l){if(!l)return"";const t=l.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class W{static parse(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,s="",i="",r="",o="",n="";const a=bt(t).trim().split(" "),h={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach(c=>{switch(!0){case(!h.fontStyle&&W.styles.includes(c)):c!=="inherit"&&(s=c),h.fontStyle=!0;break;case(!h.fontVariant&&W.variants.includes(c)):c!=="inherit"&&(i=c),h.fontStyle=!0,h.fontVariant=!0;break;case(!h.fontWeight&&W.weights.includes(c)):c!=="inherit"&&(r=c),h.fontStyle=!0,h.fontVariant=!0,h.fontWeight=!0;break;case!h.fontSize:c!=="inherit"&&(o=c.split("/")[0]||""),h.fontStyle=!0,h.fontVariant=!0,h.fontWeight=!0,h.fontSize=!0;break;default:c!=="inherit"&&(n+=c)}}),new W(s,i,r,o,n,e)}toString(){return[Ys(this.fontStyle),this.fontVariant,Ws(this.fontWeight),this.fontSize,Hs(this.fontFamily)].join(" ").trim()}constructor(t,e,s,i,r,o){const n=o?typeof o=="string"?W.parse(o):o:{};this.fontFamily=r||n.fontFamily,this.fontSize=i||n.fontSize,this.fontStyle=t||n.fontStyle,this.fontWeight=s||n.fontWeight,this.fontVariant=e||n.fontVariant}}W.styles="normal|italic|oblique|inherit";W.variants="normal|small-caps|inherit";W.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class J{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){typeof t<"u"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),typeof e<"u"&&((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:s,x2:i,y2:r}=t;this.addPoint(e,s),this.addPoint(i,r)}sumCubic(t,e,s,i,r){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*s+3*(1-t)*Math.pow(t,2)*i+Math.pow(t,3)*r}bezierCurveAdd(t,e,s,i,r){const o=6*e-12*s+6*i,n=-3*e+9*s-9*i+3*r,a=3*s-3*e;if(n===0){if(o===0)return;const g=-a/o;0<g&&g<1&&(t?this.addX(this.sumCubic(g,e,s,i,r)):this.addY(this.sumCubic(g,e,s,i,r)));return}const h=Math.pow(o,2)-4*a*n;if(h<0)return;const c=(-o+Math.sqrt(h))/(2*n);0<c&&c<1&&(t?this.addX(this.sumCubic(c,e,s,i,r)):this.addY(this.sumCubic(c,e,s,i,r)));const f=(-o-Math.sqrt(h))/(2*n);0<f&&f<1&&(t?this.addX(this.sumCubic(f,e,s,i,r)):this.addY(this.sumCubic(f,e,s,i,r)))}addBezierCurve(t,e,s,i,r,o,n,a){this.addPoint(t,e),this.addPoint(n,a),this.bezierCurveAdd(!0,t,s,r,n),this.bezierCurveAdd(!1,e,i,o,a)}addQuadraticCurve(t,e,s,i,r,o){const n=t+.6666666666666666*(s-t),a=e+2/3*(i-e),h=n+1/3*(r-t),c=a+1/3*(o-e);this.addBezierCurve(t,e,n,h,a,c,r,o)}isPointInBox(t,e){const{x1:s,y1:i,x2:r,y2:o}=this;return s<=t&&t<=r&&i<=e&&e<=o}constructor(t=Number.NaN,e=Number.NaN,s=Number.NaN,i=Number.NaN){this.x1=t,this.y1=e,this.x2=s,this.y2=i,this.addPoint(t,e),this.addPoint(s,i)}}class pt extends M{calculateOpacity(){let t=1,e=this;for(;e;){const s=e.getStyle("opacity",!1,!0);s.hasValue(!0)&&(t*=s.getNumber()),e=e.parent}return t}setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!e){const s=this.getStyle("fill"),i=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(s.isUrlDefinition()){const u=s.getFillStyleDefinition(this,i);u&&(t.fillStyle=u)}else if(s.hasValue()){s.getString()==="currentColor"&&s.setValue(this.getStyle("color").getColor());const u=s.getColor();u!=="inherit"&&(t.fillStyle=u==="none"?"rgba(0,0,0,0)":u)}if(i.hasValue()){const u=new A(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=u}if(r.isUrlDefinition()){const u=r.getFillStyleDefinition(this,o);u&&(t.strokeStyle=u)}else if(r.hasValue()){r.getString()==="currentColor"&&r.setValue(this.getStyle("color").getColor());const u=r.getString();u!=="inherit"&&(t.strokeStyle=u==="none"?"rgba(0,0,0,0)":u)}if(o.hasValue()){const u=new A(this.document,"stroke",t.strokeStyle).addOpacity(o).getString();t.strokeStyle=u}const n=this.getStyle("stroke-width");if(n.hasValue()){const u=n.getPixels();t.lineWidth=u||xt}const a=this.getStyle("stroke-linecap"),h=this.getStyle("stroke-linejoin"),c=this.getStyle("stroke-miterlimit"),f=this.getStyle("stroke-dasharray"),g=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),h.hasValue()&&(t.lineJoin=h.getString()),c.hasValue()&&(t.miterLimit=c.getNumber()),f.hasValue()&&f.getString()!=="none"){const u=$(f.getString());typeof t.setLineDash<"u"?t.setLineDash(u):typeof t.webkitLineDash<"u"?t.webkitLineDash=u:typeof t.mozDash<"u"&&!(u.length===1&&u[0]===0)&&(t.mozDash=u);const d=g.getPixels();typeof t.lineDashOffset<"u"?t.lineDashOffset=d:typeof t.webkitLineDashOffset<"u"?t.webkitLineDashOffset=d:typeof t.mozDashOffset<"u"&&(t.mozDashOffset=d)}}if(this.modifiedEmSizeStack=!1,typeof t.font<"u"){const s=this.getStyle("font"),i=this.getStyle("font-style"),r=this.getStyle("font-variant"),o=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),h=new W(i.getString(),r.getString(),o.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),W.parse(s.getString(),t.font));i.setValue(h.fontStyle),r.setValue(h.fontVariant),o.setValue(h.fontWeight),n.setValue(h.fontSize),a.setValue(h.fontFamily),t.font=h.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 at extends pt{setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(t,e);const s=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();s&&(t.textBaseline=s)}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(this.type!=="text")return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach((s,i)=>{const r=this.getChildBoundingBox(t,this,this,i);e?e.addBoundingBox(r):e=r}),e}getFontSize(){const{document:t,parent:e}=this,s=W.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(s)}getTElementBoundingBox(t){const e=this.getFontSize();return new J(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,s){const i=e[s];let r;if(t.isArabic){var o;const n=e.length,a=e[s-1],h=e[s+1];let c="isolated";(s===0||a===" ")&&s<n-1&&h!==" "&&(c="terminal"),s>0&&a!==" "&&s<n-1&&h!==" "&&(c="medial"),s>0&&a!==" "&&(s===n-1||h===" ")&&(c="initial"),r=((o=t.arabicGlyphs.get(i))===null||o===void 0?void 0:o.get(c))||t.glyphs.get(i)}else r=t.glyphs.get(i);return r||(r=t.missingGlyph),r}getText(){return""}getTextFromNode(t){const e=t||this.node,s=Array.from(e.parentNode.childNodes),i=s.indexOf(e),r=s.length-1;let o=bt(e.textContent||"");return i===0&&(o=ms(o)),i===r&&(o=xs(o)),o}renderChildren(t){if(this.type!=="text"){this.renderTElementChildren(t);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach((s,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:s}=this,i=this.getText(),r=s.getStyle("font-family").getDefinition();if(r){const{unitsPerEm:a}=r.fontFace,h=W.parse(e.ctx.font),c=s.getStyle("font-size").getNumber(h.fontSize),f=s.getStyle("font-style").getString(h.fontStyle),g=c/a,u=r.isRTL?i.split("").reverse().join(""):i,d=$(s.getAttribute("dx").getString()),p=u.length;for(let y=0;y<p;y++){const x=this.getGlyph(r,u,y);t.translate(this.x,this.y),t.scale(g,-g);const S=t.lineWidth;t.lineWidth=t.lineWidth*a/c,f==="italic"&&t.transform(1,0,.4,1,0,0),x.render(t),f==="italic"&&t.transform(1,0,-.4,1,0,0),t.lineWidth=S,t.scale(1/g,-1/g),t.translate(-this.x,-this.y),this.x+=c*(x.horizAdvX||r.horizAdvX)/a,typeof d[y]<"u"&&!isNaN(d[y])&&(this.x+=d[y])}return}const{x:o,y:n}=this;t.fillStyle&&t.fillText(i,o,n),t.strokeStyle&&t.strokeText(i,o,n)}applyAnchoring(){if(this.textChunkStart>=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),s=!1;let i=0;e==="start"&&!s||e==="end"&&s?i=t.x-this.minX:e==="end"&&!s||e==="start"&&s?i=t.x-this.maxX:i=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,s)=>{this.adjustChildCoordinatesRecursiveCore(t,this,this,s)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,s,i){const r=s.children[i];r.children.length>0?r.children.forEach((o,n)=>{e.adjustChildCoordinatesRecursiveCore(t,e,r,n)}):this.adjustChildCoordinates(t,e,s,i)}adjustChildCoordinates(t,e,s,i){const r=s.children[i];if(typeof r.measureText!="function")return r;t.save(),r.setContext(t,!0);const o=r.getAttribute("x"),n=r.getAttribute("y"),a=r.getAttribute("dx"),h=r.getAttribute("dy"),c=r.getStyle("font-family").getDefinition(),f=!!c?.isRTL;i===0&&(o.hasValue()||o.setValue(r.getInheritedAttribute("x")),n.hasValue()||n.setValue(r.getInheritedAttribute("y")),a.hasValue()||a.setValue(r.getInheritedAttribute("dx")),h.hasValue()||h.setValue(r.getInheritedAttribute("dy")));const g=r.measureText(t);return f&&(e.x-=g),o.hasValue()?(e.applyAnchoring(),r.x=o.getPixels("x"),a.hasValue()&&(r.x+=a.getPixels("x"))):(a.hasValue()&&(e.x+=a.getPixels("x")),r.x=e.x),e.x=r.x,f||(e.x+=g),n.hasValue()?(r.y=n.getPixels("y"),h.hasValue()&&(r.y+=h.getPixels("y"))):(h.hasValue()&&(e.y+=h.getPixels("y")),r.y=e.y),e.y=r.y,e.leafTexts.push(r),e.minX=Math.min(e.minX,r.x,r.x+g),e.maxX=Math.max(e.maxX,r.x,r.x+g),r.clearContext(t),t.restore(),r}getChildBoundingBox(t,e,s,i){const r=s.children[i];if(typeof r.getBoundingBox!="function")return null;const o=r.getBoundingBox(t);return o&&r.children.forEach((n,a)=>{const h=e.getChildBoundingBox(t,e,r,a);o.addBoundingBox(h)}),o}renderChild(t,e,s,i){const r=s.children[i];r.render(t),r.children.forEach((o,n)=>{e.renderChild(t,e,r,n)})}measureText(t){const{measureCache:e}=this;if(~e)return e;const s=this.getText(),i=this.measureTargetText(t,s);return this.measureCache=i,i}measureTargetText(t,e){if(!e.length)return 0;const{parent:s}=this,i=s.getStyle("font-family").getDefinition();if(i){const o=this.getFontSize(),n=i.isRTL?e.split("").reverse().join(""):e,a=$(s.getAttribute("dx").getString()),h=n.length;let c=0;for(let f=0;f<h;f++){const g=this.getGlyph(i,n,f);c+=(g.horizAdvX||i.horizAdvX)*o/i.fontFace.unitsPerEm,typeof a[f]<"u"&&!isNaN(a[f])&&(c+=a[f])}return c}if(!t.measureText)return e.length*10;t.save(),this.setContext(t,!0);const{width:r}=t.measureText(e);return this.clearContext(t),t.restore(),r}getInheritedAttribute(t){let e=this;for(;e instanceof at&&e.isFirstChild()&&e.parent;){const s=e.parent.getAttribute(t);if(s.hasValue(!0))return s.getString("0");e=e.parent}return null}constructor(t,e,s){super(t,e,new.target===at?!0:s),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 Dt extends at{getText(){return this.text}constructor(t,e,s){super(t,e,new.target===Dt?!0:s),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}}class qs extends Dt{constructor(...t){super(...t),this.type="textNode"}}class w extends m{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new V(0,0),this.control=new V(0,0),this.current=new V(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&&arguments[0]!==void 0?arguments[0]:"x",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const s=new V(this.command[t],this.command[e]);return this.makeAbsolute(s)}getAsControlPoint(t,e){const s=this.getPoint(t,e);return this.control=s,s}getAsCurrentPoint(t,e){const s=this.getPoint(t,e);return this.current=s,s}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==m.CURVE_TO&&t!==m.SMOOTH_CURVE_TO&&t!==m.QUAD_TO&&t!==m.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:s},control:{x:i,y:r}}=this;return new V(2*e-i,2*s-r)}makeAbsolute(t){if(this.command.relative){const{x:e,y:s}=this.current;t.x+=e,t.y+=s}return t}addMarker(t,e,s){const{points:i,angles:r}=this;s&&r.length>0&&!r[r.length-1]&&(r[r.length-1]=i[i.length-1].angleTo(s)),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 s=0;s<e;s++)if(!t[s]){for(let i=s+1;i<e;i++)if(t[i]){t[s]=t[i];break}}return t}constructor(t){super(t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=new V(0,0),this.start=new V(0,0),this.current=new V(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class P extends pt{path(t){const{pathParser:e}=this,s=new J;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case w.MOVE_TO:this.pathM(t,s);break;case w.LINE_TO:this.pathL(t,s);break;case w.HORIZ_LINE_TO:this.pathH(t,s);break;case w.VERT_LINE_TO:this.pathV(t,s);break;case w.CURVE_TO:this.pathC(t,s);break;case w.SMOOTH_CURVE_TO:this.pathS(t,s);break;case w.QUAD_TO:this.pathQ(t,s);break;case w.SMOOTH_QUAD_TO:this.pathT(t,s);break;case w.ARC:this.pathA(t,s);break;case w.CLOSE_PATH:this.pathZ(t,s);break}return s}getBoundingBox(t){return this.path()}getMarkers(){const{pathParser:t}=this,e=t.getMarkerPoints(),s=t.getMarkerAngles();return e.map((r,o)=>[r,s[o]])}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");t.fillStyle!==""&&(e.getString("inherit")!=="inherit"?t.fill(e.getString()):t.fill()),t.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const s=this.getMarkers();if(s){const i=s.length-1,r=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const a=r.getDefinition(),[h,c]=s[0];a.render(t,h,c)}if(o.isUrlDefinition()){const a=o.getDefinition();for(let h=1;h<i;h++){const[c,f]=s[h];a.render(t,c,f)}}if(n.isUrlDefinition()){const a=n.getDefinition(),[h,c]=s[i];a.render(t,h,c)}}}static pathM(t){const e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}pathM(t,e){const{pathParser:s}=this,{point:i}=P.pathM(s),{x:r,y:o}=i;s.addMarker(i),e.addPoint(r,o),t&&t.moveTo(r,o)}static pathL(t){const{current:e}=t,s=t.getAsCurrentPoint();return{current:e,point:s}}pathL(t,e){const{pathParser:s}=this,{current:i,point:r}=P.pathL(s),{x:o,y:n}=r;s.addMarker(r,i),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathH(t){const{current:e,command:s}=t,i=new V((s.relative?e.x:0)+s.x,e.y);return t.current=i,{current:e,point:i}}pathH(t,e){const{pathParser:s}=this,{current:i,point:r}=P.pathH(s),{x:o,y:n}=r;s.addMarker(r,i),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathV(t){const{current:e,command:s}=t,i=new V(e.x,(s.relative?e.y:0)+s.y);return t.current=i,{current:e,point:i}}pathV(t,e){const{pathParser:s}=this,{current:i,point:r}=P.pathV(s),{x:o,y:n}=r;s.addMarker(r,i),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathC(t){const{current:e}=t,s=t.getPoint("x1","y1"),i=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:s,controlPoint:i,currentPoint:r}}pathC(t,e){const{pathParser:s}=this,{current:i,point:r,controlPoint:o,currentPoint:n}=P.pathC(s);s.addMarker(n,o,r),e.addBezierCurve(i.x,i.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathS(t){const{current:e}=t,s=t.getReflectedControlPoint(),i=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:s,controlPoint:i,currentPoint:r}}pathS(t,e){const{pathParser:s}=this,{current:i,point:r,controlPoint:o,currentPoint:n}=P.pathS(s);s.addMarker(n,o,r),e.addBezierCurve(i.x,i.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathQ(t){const{current:e}=t,s=t.getAsControlPoint("x1","y1"),i=t.getAsCurrentPoint();return{current:e,controlPoint:s,currentPoint:i}}pathQ(t,e){const{pathParser:s}=this,{current:i,controlPoint:r,currentPoint:o}=P.pathQ(s);s.addMarker(o,r,r),e.addQuadraticCurve(i.x,i.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathT(t){const{current:e}=t,s=t.getReflectedControlPoint();t.control=s;const i=t.getAsCurrentPoint();return{current:e,controlPoint:s,currentPoint:i}}pathT(t,e){const{pathParser:s}=this,{current:i,controlPoint:r,currentPoint:o}=P.pathT(s);s.addMarker(o,r,r),e.addQuadraticCurve(i.x,i.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathA(t){const{current:e,command:s}=t;let{rX:i,rY:r,xRot:o,lArcFlag:n,sweepFlag:a}=s;const h=o*(Math.PI/180),c=t.getAsCurrentPoint(),f=new V(Math.cos(h)*(e.x-c.x)/2+Math.sin(h)*(e.y-c.y)/2,-Math.sin(h)*(e.x-c.x)/2+Math.cos(h)*(e.y-c.y)/2),g=Math.pow(f.x,2)/Math.pow(i,2)+Math.pow(f.y,2)/Math.pow(r,2);g>1&&(i*=Math.sqrt(g),r*=Math.sqrt(g));let u=(n===a?-1:1)*Math.sqrt((Math.pow(i,2)*Math.pow(r,2)-Math.pow(i,2)*Math.pow(f.y,2)-Math.pow(r,2)*Math.pow(f.x,2))/(Math.pow(i,2)*Math.pow(f.y,2)+Math.pow(r,2)*Math.pow(f.x,2)));isNaN(u)&&(u=0);const d=new V(u*i*f.y/r,u*-r*f.x/i),p=new V((e.x+c.x)/2+Math.cos(h)*d.x-Math.sin(h)*d.y,(e.y+c.y)/2+Math.sin(h)*d.x+Math.cos(h)*d.y),y=Me([1,0],[(f.x-d.x)/i,(f.y-d.y)/r]),x=[(f.x-d.x)/i,(f.y-d.y)/r],S=[(-f.x-d.x)/i,(-f.y-d.y)/r];let b=Me(x,S);return re(x,S)<=-1&&(b=Math.PI),re(x,S)>=1&&(b=0),{currentPoint:c,rX:i,rY:r,sweepFlag:a,xAxisRotation:h,centp:p,a1:y,ad:b}}pathA(t,e){const{pathParser:s}=this,{currentPoint:i,rX:r,rY:o,sweepFlag:n,xAxisRotation:a,centp:h,a1:c,ad:f}=P.pathA(s),g=1-n?1:-1,u=c+g*(f/2),d=new V(h.x+r*Math.cos(u),h.y+o*Math.sin(u));if(s.addMarkerAngle(d,u-g*Math.PI/2),s.addMarkerAngle(i,u-g*Math.PI),e.addPoint(i.x,i.y),t&&!isNaN(c)&&!isNaN(f)){const p=r>o?r:o,y=r>o?1:r/o,x=r>o?o/r:1;t.translate(h.x,h.y),t.rotate(a),t.scale(y,x),t.arc(0,0,p,c,c+f,!!(1-n)),t.scale(1/y,1/x),t.rotate(-a),t.translate(-h.x,-h.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){P.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,s){super(t,e,s),this.type="path",this.pathParser=new w(this.getAttribute("d").getString())}}class Tt extends pt{setContext(t){var e;const{document:s}=this,{screen:i,window:r}=s,o=t.canvas;if(i.setDefaults(t),"style"in o&&typeof t.font<"u"&&r&&typeof r.getComputedStyle<"u"){t.font=r.getComputedStyle(o).getPropertyValue("font");const S=new A(s,"fontSize",W.parse(t.font).fontSize);S.hasValue()&&(s.rootEmSize=S.getPixels("y"),s.emSize=s.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:n,height:a}=i.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"),c=this.getAttribute("refY"),f=this.getAttribute("viewBox"),g=f.hasValue()?$(f.getString()):null,u=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let d=0,p=0,y=0,x=0;g&&(d=g[0],p=g[1]),this.root||(n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y"),this.type==="marker"&&(y=d,x=p,d=0,p=0)),i.viewPort.setCurrent(n,a),this.node&&(!this.parent||((e=this.node.parentNode)===null||e===void 0?void 0:e.nodeName)==="foreignObject")&&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")),g&&(n=g[2],a=g[3]),s.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:i.viewPort.width,desiredWidth:n,height:i.viewPort.height,desiredHeight:a,minX:d,minY:p,refX:h.getValue(),refY:c.getValue(),clip:u,clipX:y,clipY:x}),g&&(i.viewPort.removeCurrent(),i.viewPort.setCurrent(n,a))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=this.getAttribute("width",!0),r=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),n=this.getAttribute("style"),a=i.getNumber(0),h=r.getNumber(0);if(s)if(typeof s=="string")this.getAttribute("preserveAspectRatio",!0).setValue(s);else{const c=this.getAttribute("preserveAspectRatio");c.hasValue()&&c.setValue(c.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(i.setValue(t),r.setValue(e),o.hasValue()||o.setValue("0 0 ".concat(a||t," ").concat(h||e)),n.hasValue()){const c=this.getStyle("width"),f=this.getStyle("height");c.hasValue()&&c.setValue("".concat(t,"px")),f.hasValue()&&f.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class Qe extends P{path(t){const e=this.getAttribute("x").getPixels("x"),s=this.getAttribute("y").getPixels("y"),i=this.getStyle("width",!1,!0).getPixels("x"),r=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),n=this.getAttribute("ry");let a=o.getPixels("x"),h=n.getPixels("y");if(o.hasValue()&&!n.hasValue()&&(h=a),n.hasValue()&&!o.hasValue()&&(a=h),a=Math.min(a,i/2),h=Math.min(h,r/2),t){const c=4*((Math.sqrt(2)-1)/3);t.beginPath(),r>0&&i>0&&(t.moveTo(e+a,s),t.lineTo(e+i-a,s),t.bezierCurveTo(e+i-a+c*a,s,e+i,s+h-c*h,e+i,s+h),t.lineTo(e+i,s+r-h),t.bezierCurveTo(e+i,s+r-h+c*h,e+i-a+c*a,s+r,e+i-a,s+r),t.lineTo(e+a,s+r),t.bezierCurveTo(e+a-c*a,s+r,e,s+r-h+c*h,e,s+r-h),t.lineTo(e,s+h),t.bezierCurveTo(e,s+h-c*h,e+a-c*a,s,e+a,s),t.closePath())}return new J(e,s,e+i,s+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class Qs extends P{path(t){const e=this.getAttribute("cx").getPixels("x"),s=this.getAttribute("cy").getPixels("y"),i=this.getAttribute("r").getPixels();return t&&i>0&&(t.beginPath(),t.arc(e,s,i,0,Math.PI*2,!1),t.closePath()),new J(e-i,s-i,e+i,s+i)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}}class Gs extends P{path(t){const e=4*((Math.sqrt(2)-1)/3),s=this.getAttribute("rx").getPixels("x"),i=this.getAttribute("ry").getPixels("y"),r=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return t&&s>0&&i>0&&(t.beginPath(),t.moveTo(r+s,o),t.bezierCurveTo(r+s,o+e*i,r+e*s,o+i,r,o+i),t.bezierCurveTo(r-e*s,o+i,r-s,o+e*i,r-s,o),t.bezierCurveTo(r-s,o-e*i,r-e*s,o-i,r,o-i),t.bezierCurveTo(r+e*s,o-i,r+s,o-e*i,r+s,o),t.closePath()),new J(r-s,o-i,r+s,o+i)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}}class $s extends P{getPoints(){return[new V(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new V(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:s},{x:i,y:r}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,s),t.lineTo(i,r)),new J(e,s,i,r)}getMarkers(){const[t,e]=this.getPoints(),s=t.angleTo(e);return[[t,s],[e,s]]}constructor(...t){super(...t),this.type="line"}}class Ge extends P{path(t){const{points:e}=this,[{x:s,y:i}]=e,r=new J(s,i);return t&&(t.beginPath(),t.moveTo(s,i)),e.forEach(o=>{let{x:n,y:a}=o;r.addPoint(n,a),t&&t.lineTo(n,a)}),r}getMarkers(){const{points:t}=this,e=t.length-1,s=[];return t.forEach((i,r)=>{r!==e&&s.push([i,i.angleTo(t[r+1])])}),s.length>0&&s.push([t[t.length-1],s[s.length-1][1]]),s}constructor(t,e,s){super(t,e,s),this.type="polyline",this.points=[],this.points=V.parsePath(this.getAttribute("points").getString())}}class Zs extends Ge{path(t){const e=super.path(t),[{x:s,y:i}]=this.points;return t&&(t.lineTo(s,i),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}}class js extends M{createPattern(t,e,s){const i=this.getStyle("width").getPixels("x",!0),r=this.getStyle("height").getPixels("y",!0),o=new Tt(this.document,null);o.attributes.set("viewBox",new A(this.document,"viewBox",this.getAttribute("viewBox").getValue())),o.attributes.set("width",new A(this.document,"width","".concat(i,"px"))),o.attributes.set("height",new A(this.document,"height","".concat(r,"px"))),o.attributes.set("transform",new A(this.document,"transform",this.getAttribute("patternTransform").getValue())),o.children=this.children;const n=this.document.createCanvas(i,r),a=n.getContext("2d"),h=this.getAttribute("x"),c=this.getAttribute("y");h.hasValue()&&c.hasValue()&&a.translate(h.getPixels("x",!0),c.getPixels("y",!0)),s.hasValue()?this.styles.set("fill-opacity",s):this.styles.delete("fill-opacity");for(let g=-1;g<=1;g++)for(let u=-1;u<=1;u++)a.save(),o.attributes.set("x",new A(this.document,"x",g*n.width)),o.attributes.set("y",new A(this.document,"y",u*n.height)),o.render(a),a.restore();return t.createPattern(n,"repeat")}constructor(...t){super(...t),this.type="pattern"}}class Ks extends M{render(t,e,s){if(!e)return;const{x:i,y:r}=e,o=this.getAttribute("orient").getString("auto"),n=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(i,r),o==="auto"&&t.rotate(s),n==="strokeWidth"&&t.scale(t.lineWidth,t.lineWidth),t.save();const a=new Tt(this.document);a.type=this.type,a.attributes.set("viewBox",new A(this.document,"viewBox",this.getAttribute("viewBox").getValue())),a.attributes.set("refX",new A(this.document,"refX",this.getAttribute("refX").getValue())),a.attributes.set("refY",new A(this.document,"refY",this.getAttribute("refY").getValue())),a.attributes.set("width",new A(this.document,"width",this.getAttribute("markerWidth").getValue())),a.attributes.set("height",new A(this.document,"height",this.getAttribute("markerHeight").getValue())),a.attributes.set("overflow",new A(this.document,"overflow",this.getAttribute("overflow").getValue())),a.attributes.set("fill",new A(this.document,"fill",this.getAttribute("fill").getColor("black"))),a.attributes.set("stroke",new A(this.document,"stroke",this.getAttribute("stroke").getValue("none"))),a.children=this.children,a.render(t),t.restore(),n==="strokeWidth"&&t.scale(1/t.lineWidth,1/t.lineWidth),o==="auto"&&t.rotate(-s),t.translate(-i,-r)}constructor(...t){super(...t),this.type="marker"}}class Js extends M{render(){}constructor(...t){super(...t),this.type="defs"}}class ne extends pt{getBoundingBox(t){const e=new J;return this.children.forEach(s=>{e.addBoundingBox(s.getBoundingBox(t))}),e}constructor(...t){super(...t),this.type="g"}}class $e extends M{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,s){let i=this;this.getHrefAttribute().hasValue()&&(i=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(i));const{stops:r}=i,o=this.getGradient(t,e);if(!o)return this.addParentOpacity(s,r[r.length-1].color);if(r.forEach(n=>{o.addColorStop(n.offset,this.addParentOpacity(s,n.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:n}=this,{MAX_VIRTUAL_PIXELS:a}=it,{viewPort:h}=n.screen,c=h.getRoot(),f=new Qe(n);f.attributes.set("x",new A(n,"x",-a/3)),f.attributes.set("y",new A(n,"y",-a/3)),f.attributes.set("width",new A(n,"width",a)),f.attributes.set("height",new A(n,"height",a));const g=new ne(n);g.attributes.set("transform",new A(n,"transform",this.getAttribute("gradientTransform").getValue())),g.children=[f];const u=new Tt(n);u.attributes.set("x",new A(n,"x",0)),u.attributes.set("y",new A(n,"y",0)),u.attributes.set("width",new A(n,"width",c.width)),u.attributes.set("height",new A(n,"height",c.height)),u.children=[g];const d=n.createCanvas(c.width,c.height),p=d.getContext("2d");return p.fillStyle=o,u.render(p),p.createPattern(d,"no-repeat")}return o}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 A(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,s){super(t,e,s),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:i,children:r}=this;r.forEach(o=>{o.type==="stop"&&i.push(o)})}}class ti extends $e{getGradient(t,e){const s=this.getGradientUnits()==="objectBoundingBox",i=s?e.getBoundingBox(t):null;if(s&&!i)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 r=s?i.x+i.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=s?i.y+i.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),n=s?i.x+i.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),a=s?i.y+i.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return r===n&&o===a?null:t.createLinearGradient(r,o,n,a)}constructor(t,e,s){super(t,e,s),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class ei extends $e{getGradient(t,e){const s=this.getGradientUnits()==="objectBoundingBox",i=e.getBoundingBox(t);if(s&&!i)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 r=s?i.x+i.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=s?i.y+i.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let n=r,a=o;this.getAttribute("fx").hasValue()&&(n=s?i.x+i.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(a=s?i.y+i.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const h=s?(i.width+i.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),c=this.getAttribute("fr").getPixels();return t.createRadialGradient(n,a,c,r,o,h)}constructor(t,e,s){super(t,e,s),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class si extends M{constructor(t,e,s){super(t,e,s),this.type="stop";const i=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),r=this.getStyle("stop-opacity");let o=this.getStyle("stop-color",!0);o.getString()===""&&o.setValue("#000"),r.hasValue()&&(o=o.addOpacity(r)),this.offset=i,this.color=o.getColor()}}class oe extends M{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return t==="CSS"?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:s,to:i}=this.getProgress();let r=s.getNumber()+(i.getNumber()-s.getNumber())*e;return t==="%"&&(r*=100),"".concat(r).concat(t)}update(t){const{parent:e}=this,s=this.getProperty();if(this.initialValue||(this.initialValue=s.getString(),this.initialUnits=s.getUnits()),this.duration>this.maxDuration){const r=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(r==="freeze"&&!this.frozen)this.frozen=!0,e&&s&&(e.animationFrozen=!0,e.animationFrozenValue=s.getString());else if(r==="remove"&&!this.removed)return this.removed=!0,e&&s&&s.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=t;let i=!1;if(this.begin<this.duration){let r=this.calcValue();const o=this.getAttribute("type");if(o.hasValue()){const n=o.getString();r="".concat(n,"(").concat(r,")")}s.setValue(r),i=!0}return i}getProgress(){const{document:t,values:e}=this;let s=(this.duration-this.begin)/(this.maxDuration-this.begin),i,r;if(e.hasValue()){const o=s*(e.getValue().length-1),n=Math.floor(o),a=Math.ceil(o);let h;h=e.getValue()[n],i=new A(t,"from",h?parseFloat(h):0),h=e.getValue()[a],r=new A(t,"to",h?parseFloat(h):0),s=(o-n)/(a-n)}else i=this.from,r=this.to;return{progress:s,from:i,to:r}}constructor(t,e,s){super(t,e,s),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 A(t,"values",null);const i=this.getAttribute("values");i.hasValue()&&this.values.setValue(i.getString().split(";"))}}class ii extends oe{calcValue(){const{progress:t,from:e,to:s}=this.getProgress(),i=new se(e.getColor()),r=new se(s.getColor());if(i.ok&&r.ok){const o=i.r+(r.r-i.r)*t,n=i.g+(r.g-i.g)*t,a=i.b+(r.b-i.b)*t;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(n),", ").concat(Math.floor(a),")")}return this.getAttribute("from").getColor()}constructor(...t){super(...t),this.type="animateColor"}}class ri extends oe{calcValue(){const{progress:t,from:e,to:s}=this.getProgress(),i=$(e.getString()),r=$(s.getString());return i.map((n,a)=>{const h=r[a];return n+(h-n)*t}).join(" ")}constructor(...t){super(...t),this.type="animateTransform"}}class Ze extends M{constructor(t,e,s){super(t,e,s),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 ae extends P{constructor(t,e,s){super(t,e,s),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 je extends ae{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}class ni extends M{render(){}constructor(t,e,s){super(t,e,s),this.type="font",this.isArabic=!1,this.glyphs=new Map,this.arabicGlyphs=new Map,this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:i}=t,{children:r}=this;for(const o of r)if(o instanceof Ze){this.fontFace=o;const n=o.getStyle("font-family");n.hasValue()&&i.set(n.getString(),this)}else if(o instanceof je)this.missingGlyph=o;else if(o instanceof ae)if(o.arabicForm){this.isRTL=!0,this.isArabic=!0;let n=this.arabicGlyphs.get(o.unicode);typeof n>"u"&&(n=new Map,this.arabicGlyphs.set(o.unicode,n)),n.set(o.arabicForm,o)}else this.glyphs.set(o.unicode,o)}}class oi extends at{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"}}class ai extends at{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:s,y:i}=this,{mouse:r}=e.screen,o=new A(e,"fontSize",W.parse(e.ctx.font).fontSize);r.isWorking()&&r.checkBoundingBox(this,new J(s,i-o.getPixels("y"),s+this.measureText(t),i))}else if(this.children.length>0){const e=new ne(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(){const t=this.document.ctx;t.canvas.style.cursor="pointer"}constructor(t,e,s){super(t,e,s),this.type="a";const{childNodes:i}=e,r=i[0],o=i.length>0&&Array.from(i).every(n=>n.nodeType===3);this.hasText=o,this.text=o?this.getTextFromNode(r):""}}class hi extends at{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach(s=>{let{type:i,points:r}=s;switch(i){case w.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case w.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case w.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case w.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case w.ARC:{const[o,n,a,h,c,f,g,u]=r,d=a>h?a:h,p=a>h?1:a/h,y=a>h?h/a:1;t&&(t.translate(o,n),t.rotate(g),t.scale(p,y),t.arc(0,0,d,c,c+f,!!(1-u)),t.scale(1/p,1/y),t.rotate(-g),t.translate(-o,-n));break}case w.CLOSE_PATH:t&&t.closePath();break}})}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),s=this.getFontSize(),{glyphInfo:i}=this,r=t.fillStyle;e==="underline"&&t.beginPath(),i.forEach((o,n)=>{const{p0:a,p1:h,rotation:c,text:f}=o;t.save(),t.translate(a.x,a.y),t.rotate(c),t.fillStyle&&t.fillText(f,0,0),t.strokeStyle&&t.strokeText(f,0,0),t.restore(),e==="underline"&&(n===0&&t.moveTo(a.x,a.y+s/8),t.lineTo(h.x,h.y+s/5))}),e==="underline"&&(t.lineWidth=s/20,t.strokeStyle=r,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,s,i,r,o,n,a,h){let c=o,f=this.measureText(t,a);a===" "&&e==="justify"&&s<i&&(f+=(i-s)/r),h>-1&&(c+=this.getLetterSpacingAt(h));const g=this.textHeight/20,u=this.getEquidistantPointOnPath(c,g,0),d=this.getEquidistantPointOnPath(c+f,g,0),p={p0:u,p1:d},y=u&&d?Math.atan2(d.y-u.y,d.x-u.x):0;if(n){const x=Math.cos(Math.PI/2+y)*n,S=Math.cos(-y)*n;p.p0={...u,x:u.x+x,y:u.y+S},p.p1={...d,x:d.x+x,y:d.y+S}}return c+=f,{offset:c,segment:p,rotation:y}}measureText(t,e){const{measuresCache:s}=this,i=e||this.getText();if(s.has(i))return s.get(i);const r=this.measureTargetText(t,i);return s.set(i,r),r}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),s=e.split(""),i=e.split(" ").length-1,r=this.parent.getAttribute("dx").split().map(b=>b.getPixels("x")),o=this.parent.getAttribute("dy").getPixels("y"),n=this.parent.getStyle("text-anchor").getString("start"),a=this.getStyle("letter-spacing"),h=this.parent.getStyle("letter-spacing");let c=0;!a.hasValue()||a.getValue()==="inherit"?c=h.getPixels():a.hasValue()&&a.getValue()!=="initial"&&a.getValue()!=="unset"&&(c=a.getPixels());const f=[],g=e.length;this.letterSpacingCache=f;for(let b=0;b<g;b++)f.push(typeof r[b]<"u"?r[b]:c);const u=f.reduce((b,v,E)=>E===0?0:b+v||0,0),d=this.measureText(t),p=Math.max(d+u,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const y=this.getPathLength(),x=this.getStyle("startOffset").getNumber(0)*y;let S=0;(n==="middle"||n==="center")&&(S=-p/2),(n==="end"||n==="right")&&(S=-p),S+=x,s.forEach((b,v)=>{const{offset:E,segment:C,rotation:T}=this.findSegmentToFitChar(t,n,p,y,i,S,o,b,v);S=E,!(!C.p0||!C.p1)&&this.glyphInfo.push({text:s[v],p0:C.p0,p1:C.p1,rotation:T})})}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:s}=t;for(s.reset();!s.isEnd();){const{current:i}=s,r=i?i.x:0,o=i?i.y:0,n=s.next();let a=n.type,h=[];switch(n.type){case w.MOVE_TO:this.pathM(s,h);break;case w.LINE_TO:a=this.pathL(s,h);break;case w.HORIZ_LINE_TO:a=this.pathH(s,h);break;case w.VERT_LINE_TO:a=this.pathV(s,h);break;case w.CURVE_TO:this.pathC(s,h);break;case w.SMOOTH_CURVE_TO:a=this.pathS(s,h);break;case w.QUAD_TO:this.pathQ(s,h);break;case w.SMOOTH_QUAD_TO:a=this.pathT(s,h);break;case w.ARC:h=this.pathA(s);break;case w.CLOSE_PATH:P.pathZ(s);break}n.type!==w.CLOSE_PATH?e.push({type:a,points:h,start:{x:r,y:o},pathLength:this.calcLength(r,o,a,h)}):e.push({type:w.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:s,y:i}=P.pathM(t).point;e.push(s,i)}pathL(t,e){const{x:s,y:i}=P.pathL(t).point;return e.push(s,i),w.LINE_TO}pathH(t,e){const{x:s,y:i}=P.pathH(t).point;return e.push(s,i),w.LINE_TO}pathV(t,e){const{x:s,y:i}=P.pathV(t).point;return e.push(s,i),w.LINE_TO}pathC(t,e){const{point:s,controlPoint:i,currentPoint:r}=P.pathC(t);e.push(s.x,s.y,i.x,i.y,r.x,r.y)}pathS(t,e){const{point:s,controlPoint:i,currentPoint:r}=P.pathS(t);return e.push(s.x,s.y,i.x,i.y,r.x,r.y),w.CURVE_TO}pathQ(t,e){const{controlPoint:s,currentPoint:i}=P.pathQ(t);e.push(s.x,s.y,i.x,i.y)}pathT(t,e){const{controlPoint:s,currentPoint:i}=P.pathT(t);return e.push(s.x,s.y,i.x,i.y),w.QUAD_TO}pathA(t){let{rX:e,rY:s,sweepFlag:i,xAxisRotation:r,centp:o,a1:n,ad:a}=P.pathA(t);return i===0&&a>0&&(a-=2*Math.PI),i===1&&a<0&&(a+=2*Math.PI),[o.x,o.y,e,s,n,a,r,i]}calcLength(t,e,s,i){let r=0,o=null,n=null,a=0;switch(s){case w.LINE_TO:return this.getLineLength(t,e,i[0],i[1]);case w.CURVE_TO:for(r=0,o=this.getPointOnCubicBezier(0,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),a=.01;a<=1;a+=.01)n=this.getPointOnCubicBezier(a,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case w.QUAD_TO:for(r=0,o=this.getPointOnQuadraticBezier(0,t,e,i[0],i[1],i[2],i[3]),a=.01;a<=1;a+=.01)n=this.getPointOnQuadraticBezier(a,t,e,i[0],i[1],i[2],i[3]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case w.ARC:{r=0;const h=i[4],c=i[5],f=i[4]+c;let g=Math.PI/180;if(Math.abs(h-f)<g&&(g=Math.abs(h-f)),o=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),c<0)for(a=h-g;a>f;a-=g)n=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;else for(a=h+g;a<f;a+=g)n=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return n=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],f,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),r}}return 0}getPointOnLine(t,e,s,i,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:e,n=arguments.length>6&&arguments[6]!==void 0?arguments[6]:s;const a=(r-s)/(i-e+xt);let h=Math.sqrt(t*t/(1+a*a));i<e&&(h*=-1);let c=a*h,f=null;if(i===e)f={x:o,y:n+c};else if((n-s)/(o-e+xt)===a)f={x:o+h,y:n+c};else{let g=0,u=0;const d=this.getLineLength(e,s,i,r);if(d<xt)return null;let p=(o-e)*(i-e)+(n-s)*(r-s);p/=d*d,g=e+p*(i-e),u=s+p*(r-s);const y=this.getLineLength(o,n,g,u),x=Math.sqrt(t*t-y*y);h=Math.sqrt(x*x/(1+a*a)),i<e&&(h*=-1),c=a*h,f={x:g+h,y:u+c}}return f}getPointOnPath(t){const e=this.getPathLength();let s=0,i=null;if(t<-5e-5||t-5e-5>e)return null;const{dataArray:r}=this;for(const o of r){if(o&&(o.pathLength<5e-5||s+o.pathLength+5e-5<t)){s+=o.pathLength;continue}const n=t-s;let a=0;switch(o.type){case w.LINE_TO:i=this.getPointOnLine(n,o.start.x,o.start.y,o.points[0],o.points[1],o.start.x,o.start.y);break;case w.ARC:{const h=o.points[4],c=o.points[5],f=o.points[4]+c;if(a=h+n/o.pathLength*c,c<0&&a<f||c>=0&&a>f)break;i=this.getPointOnEllipticalArc(o.points[0],o.points[1],o.points[2],o.points[3],a,o.points[6]);break}case w.CURVE_TO:a=n/o.pathLength,a>1&&(a=1),i=this.getPointOnCubicBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3],o.points[4],o.points[5]);break;case w.QUAD_TO:a=n/o.pathLength,a>1&&(a=1),i=this.getPointOnQuadraticBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3]);break}if(i)return i;break}return null}getLineLength(t,e,s,i){return Math.sqrt((s-t)*(s-t)+(i-e)*(i-e))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((t,e)=>e.pathLength>0?t+e.pathLength:t,0)),this.pathLength}getPointOnCubicBezier(t,e,s,i,r,o,n,a,h){const c=a*Ne(t)+o*Oe(t)+i*Ve(t)+e*ke(t),f=h*Ne(t)+n*Oe(t)+r*Ve(t)+s*ke(t);return{x:c,y:f}}getPointOnQuadraticBezier(t,e,s,i,r,o,n){const a=o*Re(t)+i*Le(t)+e*Ie(t),h=n*Re(t)+r*Le(t)+s*Ie(t);return{x:a,y:h}}getPointOnEllipticalArc(t,e,s,i,r,o){const n=Math.cos(o),a=Math.sin(o),h={x:s*Math.cos(r),y:i*Math.sin(r)};return{x:t+(h.x*n-h.y*a),y:e+(h.x*a+h.y*n)}}buildEquidistantCache(t,e){const s=this.getPathLength(),i=e||.25,r=t||s/100;if(!this.equidistantCache||this.equidistantCache.step!==r||this.equidistantCache.precision!==i){this.equidistantCache={step:r,precision:i,points:[]};let o=0;for(let n=0;n<=s;n+=i){const a=this.getPointOnPath(n),h=this.getPointOnPath(n+i);!a||!h||(o+=this.getLineLength(a.x,a.y,h.x,h.y),o>=r&&(this.equidistantCache.points.push({x:a.x,y:a.y,distance:n}),o-=r))}}}getEquidistantPointOnPath(t,e,s){if(this.buildEquidistantCache(e,s),t<0||t-this.getPathLength()>5e-5)return null;const i=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[i]||null}constructor(t,e,s){super(t,e,s),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const i=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(i)}}const li=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ci extends pt{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=li.exec(t);if(e){const s=e[5];s&&(e[4]==="base64"?this.image=atob(s):this.image=decodeURIComponent(s))}else try{const i=await(await this.document.fetch(t)).text();this.image=i}catch(s){console.error('Error while loading image "'.concat(t,'":'),s)}this.loaded=!0}renderChildren(t){const{document:e,image:s,loaded:i}=this,r=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!(!i||!s||!n||!a)){if(t.save(),t.translate(r,o),typeof s=="string"){const h=e.canvg.forkString(t,s,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:n,scaleHeight:a}),{documentElement:c}=h.document;c&&(c.parent=this),h.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:n,desiredWidth:s.width,height:a,desiredHeight:s.height}),this.loaded&&(!("complete"in s)||s.complete)&&t.drawImage(s,0,0);t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),s=this.getStyle("width").getPixels("x"),i=this.getStyle("height").getPixels("y");return new J(t,e,t+s,e+i)}constructor(t,e,s){super(t,e,s),this.type="image",this.loaded=!1;const i=this.getHrefAttribute().getString();if(!i)return;const r=i.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(i);t.images.push(this),r?this.loadSvg(i):this.loadImage(i)}}class ui extends pt{render(t){}constructor(...t){super(...t),this.type="symbol"}}class fi{async load(t,e){try{const{document:s}=this,r=(await s.canvg.parser.load(e)).getElementsByTagName("font");Array.from(r).forEach(o=>{const n=s.createElement(o);s.definitions.set(t,n)})}catch(s){console.error('Error while loading font "'.concat(e,'":'),s)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class Ke extends M{constructor(t,e,s){super(t,e,s),this.type="style",bt(Array.from(e.childNodes).map(o=>o.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(o=>{const n=o.trim();if(!n)return;const a=n.split("{"),h=a[0].split(","),c=a[1].split(";");h.forEach(f=>{const g=f.trim();if(!g)return;const u=t.styles.get(g)||new Map;if(c.forEach(d=>{const p=d.indexOf(":"),y=d.substr(0,p).trim(),x=d.substr(p+1,d.length-p).trim();y&&x&&u.set(y,new A(t,y,x))}),t.styles.set(g,u),t.stylesSpecificity.set(g,Os(g)),g==="@font-face"){const d=u.get("font-family").getString().replace(/"|'/g,"");u.get("src").getString().split(",").forEach(y=>{if(y.indexOf('format("svg")')>0){const x=Xe(y);x&&new fi(t).load(d,x)}})}})})}}Ke.parseExternalUrl=Xe;class gi extends pt{setContext(t){super.setContext(t);const e=this.getAttribute("x"),s=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),s.hasValue()&&t.translate(0,s.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:s}=this;if(s){let i=s;if(s.type==="symbol"&&(i=new Tt(e),i.attributes.set("viewBox",new A(e,"viewBox",s.getAttribute("viewBox").getString())),i.attributes.set("preserveAspectRatio",new A(e,"preserveAspectRatio",s.getAttribute("preserveAspectRatio").getString())),i.attributes.set("overflow",new A(e,"overflow",s.getAttribute("overflow").getString())),i.children=s.children,s.styles.set("opacity",new A(e,"opacity",this.calculateOpacity()))),i.type==="svg"){const o=this.getStyle("width",!1,!0),n=this.getStyle("height",!1,!0);o.hasValue()&&i.attributes.set("width",new A(e,"width",o.getString())),n.hasValue()&&i.attributes.set("height",new A(e,"height",n.getString()))}const r=i.parent;i.parent=this,i.render(t),i.parent=r}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?dt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}}function Rt(l,t,e,s,i,r){return l[e*s*4+t*4+r]}function Lt(l,t,e,s,i,r,o){l[e*s*4+t*4+r]=o}function I(l,t,e){return l[t]*e}function st(l,t,e,s){return t+Math.cos(l)*e+Math.sin(l)*s}class Je extends M{apply(t,e,s,i,r){const{includeOpacity:o,matrix:n}=this,a=t.getImageData(0,0,i,r);for(let h=0;h<r;h++)for(let c=0;c<i;c++){const f=Rt(a.data,c,h,i,r,0),g=Rt(a.data,c,h,i,r,1),u=Rt(a.data,c,h,i,r,2),d=Rt(a.data,c,h,i,r,3);let p=I(n,0,f)+I(n,1,g)+I(n,2,u)+I(n,3,d)+I(n,4,1),y=I(n,5,f)+I(n,6,g)+I(n,7,u)+I(n,8,d)+I(n,9,1),x=I(n,10,f)+I(n,11,g)+I(n,12,u)+I(n,13,d)+I(n,14,1),S=I(n,15,f)+I(n,16,g)+I(n,17,u)+I(n,18,d)+I(n,19,1);o&&(p=0,y=0,x=0,S*=d/255),Lt(a.data,c,h,i,r,0,p),Lt(a.data,c,h,i,r,1,y),Lt(a.data,c,h,i,r,2,x),Lt(a.data,c,h,i,r,3,S)}t.clearRect(0,0,i,r),t.putImageData(a,0,0)}constructor(t,e,s){super(t,e,s),this.type="feColorMatrix";let i=$(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":{const r=i[0];i=[.213+.787*r,.715-.715*r,.072-.072*r,0,0,.213-.213*r,.715+.285*r,.072-.072*r,0,0,.213-.213*r,.715-.715*r,.072+.928*r,0,0,0,0,0,1,0,0,0,0,0,1];break}case"hueRotate":{const r=i[0]*Math.PI/180;i=[st(r,.213,.787,-.213),st(r,.715,-.715,-.715),st(r,.072,-.072,.928),0,0,st(r,.213,-.213,.143),st(r,.715,.285,.14),st(r,.072,-.072,-.283),0,0,st(r,.213,-.213,-.787),st(r,.715,-.715,.715),st(r,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break}case"luminanceToAlpha":i=[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];break}this.matrix=i,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}}class Bt extends M{apply(t,e){const{document:s}=this;let i=this.getAttribute("x").getPixels("x"),r=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),n=this.getStyle("height").getPixels("y");if(!o&&!n){const u=new J;this.children.forEach(d=>{u.addBoundingBox(d.getBoundingBox(t))}),i=Math.floor(u.x1),r=Math.floor(u.y1),o=Math.floor(u.width),n=Math.floor(u.height)}const a=this.removeStyles(e,Bt.ignoreStyles),h=s.createCanvas(i+o,r+n),c=h.getContext("2d");s.screen.setDefaults(c),this.renderChildren(c),new Je(s,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(c,0,0,i+o,r+n);const f=s.createCanvas(i+o,r+n),g=f.getContext("2d");s.screen.setDefaults(g),e.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=c.createPattern(h,"no-repeat"),g.fillRect(0,0,i+o,r+n),t.fillStyle=g.createPattern(f,"no-repeat"),t.fillRect(0,0,i+o,r+n),this.restoreStyles(e,a)}render(t){}constructor(...t){super(...t),this.type="mask"}}Bt.ignoreStyles=["mask","transform","clip-path"];const Be=()=>{};class di extends M{apply(t){const{document:e}=this,s=Reflect.getPrototypeOf(t),{beginPath:i,closePath:r}=t;s&&(s.beginPath=Be,s.closePath=Be),Reflect.apply(i,t,[]),this.children.forEach(o=>{if(!("path"in o))return;let n="elementTransform"in o?o.elementTransform():null;n||(n=dt.fromElement(e,o)),n&&n.apply(t),o.path(t),s&&(s.closePath=r),n&&n.unapply(t)}),Reflect.apply(r,t,[]),t.clip(),s&&(s.beginPath=i,s.closePath=r)}render(t){}constructor(...t){super(...t),this.type="clipPath"}}class _t extends M{apply(t,e){const{document:s,children:i}=this,r="getBoundingBox"in e?e.getBoundingBox(t):null;if(!r)return;let o=0,n=0;i.forEach(x=>{const S=x.extraFilterDistance||0;o=Math.max(o,S),n=Math.max(n,S)});const a=Math.floor(r.width),h=Math.floor(r.height),c=a+2*o,f=h+2*n;if(c<1||f<1)return;const g=Math.floor(r.x),u=Math.floor(r.y),d=this.removeStyles(e,_t.ignoreStyles),p=s.createCanvas(c,f),y=p.getContext("2d");s.screen.setDefaults(y),y.translate(-g+o,-u+n),e.render(y),i.forEach(x=>{typeof x.apply=="function"&&x.apply(y,0,0,c,f)}),t.drawImage(p,0,0,c,f,g-o,u-n,c,f),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}_t.ignoreStyles=["filter","transform","clip-path"];class pi extends M{apply(t,e,s,i,r){}constructor(t,e,s){super(t,e,s),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class yi extends M{apply(t,e,s,i,r){}constructor(...t){super(...t),this.type="feMorphology"}}class mi extends M{apply(t,e,s,i,r){}constructor(...t){super(...t),this.type="feComposite"}}class xi extends M{apply(t,e,s,i,r){const{document:o,blurRadius:n}=this,a=o.window?o.window.document.body:null,h=t.canvas;h.id=o.getUniqueId(),a&&(h.style.display="none",a.appendChild(h)),ps(h,e,s,i,r,n),a&&a.removeChild(h)}constructor(t,e,s){super(t,e,s),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class bi extends M{constructor(...t){super(...t),this.type="title"}}class vi extends M{constructor(...t){super(...t),this.type="desc"}}const Ai={svg:Tt,rect:Qe,circle:Qs,ellipse:Gs,line:$s,polyline:Ge,polygon:Zs,path:P,pattern:js,marker:Ks,defs:Js,linearGradient:ti,radialGradient:ei,stop:si,animate:oe,animateColor:ii,animateTransform:ri,font:ni,"font-face":Ze,"missing-glyph":je,glyph:ae,text:at,tspan:Dt,tref:oi,a:ai,textPath:hi,image:ci,g:ne,symbol:ui,style:Ke,use:gi,mask:Bt,clipPath:di,filter:_t,feDropShadow:pi,feMorphology:yi,feComposite:mi,feColorMatrix:Je,feGaussianBlur:xi,title:bi,desc:vi};function Si(l,t){const e=document.createElement("canvas");return e.width=l,e.height=t,e}async function Ti(l){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const e=document.createElement("img");return t&&(e.crossOrigin="Anonymous"),new Promise((s,i)=>{e.onload=()=>{s(e)},e.onerror=(r,o,n,a,h)=>{i(h)},e.src=l})}const ee=12;class ot{bindCreateImage(t,e){return typeof e=="boolean"?(s,i)=>t(s,typeof i=="boolean"?i: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]||ee}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(/^[^:]+:/,""),s=ot.elementTypes[e];return s?new s(this,t):new Us(this,t)}createTextNode(t){return new qs(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=ee,emSize:s=ee,createCanvas:i=ot.createCanvas,createImage:r=ot.createImage,anonymousCrossOrigin:o}={}){this.canvg=t,this.definitions=new Map,this.styles=new Map,this.stylesSpecificity=new Map,this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=t.screen,this.rootEmSize=e,this.emSize=s,this.createCanvas=i,this.createImage=this.bindCreateImage(r,o),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}ot.createCanvas=Si;ot.createImage=Ti;ot.elementTypes=Ai;class At{static async from(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=await new te(s).parse(e);return new At(t,r,s)}static fromString(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=new te(s).parseFromString(e);return new At(t,r,s)}fork(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return At.from(t,e,{...this.options,...s})}forkString(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return At.fromString(t,e,{...this.options,...s})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:e,screen:s,options:i}=this;s.start(e,{enableRedraw:!0,...i,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(t,e,s)}constructor(t,e,s={}){this.parser=new te(s),this.screen=new it(t,s),this.options=s;const i=new ot(this,s),r=i.createDocumentElement(e);this.document=i,this.documentElement=r}}export{ai as AElement,ii as AnimateColorElement,oe as AnimateElement,ri as AnimateTransformElement,J as BoundingBox,Ne as CB1,Oe as CB2,Ve as CB3,ke as CB4,At as Canvg,Qs as CircleElement,di as ClipPathElement,Js as DefsElement,vi as DescElement,ot as Document,M as Element,Gs as EllipseElement,Je as FeColorMatrixElement,mi as FeCompositeElement,pi as FeDropShadowElement,xi as FeGaussianBlurElement,yi as FeMorphologyElement,_t as FilterElement,W as Font,ni as FontElement,Ze as FontFaceElement,ne as GElement,ae as GlyphElement,$e as GradientElement,ci as ImageElement,$s as LineElement,ti as LinearGradientElement,Ks as MarkerElement,Bt as MaskElement,We as Matrix,je as MissingGlyphElement,Vs as Mouse,xt as PSEUDO_ZERO,te as Parser,P as PathElement,w as PathParser,js as PatternElement,V as Point,Zs as PolygonElement,Ge as PolylineElement,A as Property,Re as QB1,Le as QB2,Ie as QB3,ei as RadialGradientElement,Qe as RectElement,pt as RenderedElement,Is as Rotate,Tt as SVGElement,fi as SVGFontLoader,Ds as Scale,it as Screen,qe as Skew,Bs as SkewX,_s as SkewY,si as StopElement,Ke as StyleElement,ui as SymbolElement,oi as TRefElement,Dt as TSpanElement,at as TextElement,hi as TextPathElement,bi as TitleElement,dt as Transform,Ls as Translate,Us as UnknownElement,gi as UseElement,St as ViewPort,bt as compressSpaces,Ai as elements,Os as getSelectorSpecificity,As as normalizeAttributeName,Ss as normalizeColor,Xe as parseExternalUrl,bs as toMatrixValue,$ as toNumbers,ms as trimLeft,xs as trimRight,Pe as vectorMagnitude,Me as vectorsAngle,re as vectorsRatio};
|
|
16
|
+
//# sourceMappingURL=index-uMHqBndL.js.map
|