import{b as sr,c as nr,d as hr,e as or,f as ur,h as lr,i as fr,j as gr,k as cr,m as vr,g as Yt,n as dr,o as pr,p as mr,q as yr,s as br}from"./index-D4mISQVM.js";import{_ as it}from"./jspdf.es.min-B0xhe8Uc.js";import"./index-BbYcdrlh.js";sr();function xt(o,e,t,r,i,a,n){try{var s=o[a](n),h=s.value}catch(u){return void t(u)}s.done?e(h):Promise.resolve(h).then(r,i)}function ie(o){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=o.apply(e,t);function n(h){xt(a,r,i,n,s,"next",h)}function s(h){xt(a,r,i,n,s,"throw",h)}n(void 0)})}}nr();hr();or();ur();lr();function xr(o,e){if(it(o)!="object"||!o)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var r=t.call(o,e);if(it(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function wr(o){var e=xr(o,"string");return it(e)=="symbol"?e:e+""}function ot(o,e,t){return(e=wr(e))in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}fr();gr();cr();var we={exports:{}},ve={exports:{}},Ar=ve.exports,wt;function Tr(){return wt||(wt=1,(function(){var o,e,t,r,i,a;typeof performance<"u"&&performance!==null&&performance.now?ve.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(ve.exports=function(){return(o()-i)/1e6},e=process.hrtime,o=function(){var n;return n=e(),n[0]*1e9+n[1]},r=o(),a=process.uptime()*1e9,i=r-a):Date.now?(ve.exports=function(){return Date.now()-t},t=Date.now()):(ve.exports=function(){return new Date().getTime()-t},t=new Date().getTime())}).call(Ar)),ve.exports}var At;function Cr(){if(At)return we.exports;At=1;for(var o=Tr(),e=typeof window>"u"?vr:window,t=["moz","webkit"],r="AnimationFrame",i=e["request"+r],a=e["cancel"+r]||e["cancelRequest"+r],n=0;!i&&n3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var h=this.r.toString(16),u=this.g.toString(16),l=this.b.toString(16);return h.length==1&&(h="0"+h),u.length==1&&(u="0"+u),l.length==1&&(l="0"+l),"#"+h+u+l},this.getHelpXML=function(){for(var h=new Array,u=0;u "+v.toRGB()+" -> "+v.toHex());d.appendChild(p),d.appendChild(y),f.appendChild(d)}catch{}return f}}),et}var Sr=Or();const at=Yt(Sr);pr();mr();yr();/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var qt=function(o,e){return(qt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])})(o,e)};function jt(o,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=o}qt(o,e),o.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Nr(o){var e="";Array.isArray(o)||(o=[o]);for(var t=0;to.phi1&&(o.phi2-=2*se),o.sweepFlag===1&&o.phi2r)return[];if(r===0)return[[o*t/(o*o+e*e),e*t/(o*o+e*e)]];var i=Math.sqrt(r);return[[(o*t+e*i)/(o*o+e*e),(e*t-o*i)/(o*o+e*e)],[(o*t-e*i)/(o*o+e*e),(e*t+o*i)/(o*o+e*e)]]}var B,te=Math.PI/180;function Et(o,e,t){return(1-t)*o+t*e}function Ot(o,e,t,r){return o+Math.cos(r/180*se)*e+Math.sin(r/180*se)*t}function St(o,e,t,r){var i=1e-6,a=e-o,n=t-e,s=3*a+3*(r-t)-6*n,h=6*(n-a),u=3*a;return Math.abs(s)w&&(f.sweepFlag=+!f.sweepFlag),f}))}function n(){return function(s){var h={};for(var u in s)h[u]=s[u];return h}}o.ROUND=function(s){function h(u){return Math.round(u*s)/s}return s===void 0&&(s=1e13),J(s),function(u){return u.x1!==void 0&&(u.x1=h(u.x1)),u.y1!==void 0&&(u.y1=h(u.y1)),u.x2!==void 0&&(u.x2=h(u.x2)),u.y2!==void 0&&(u.y2=h(u.y2)),u.x!==void 0&&(u.x=h(u.x)),u.y!==void 0&&(u.y=h(u.y)),u.rX!==void 0&&(u.rX=h(u.rX)),u.rY!==void 0&&(u.rY=h(u.rY)),u}},o.TO_ABS=e,o.TO_REL=function(){return i((function(s,h,u){return s.relative||(s.x1!==void 0&&(s.x1-=h),s.y1!==void 0&&(s.y1-=u),s.x2!==void 0&&(s.x2-=h),s.y2!==void 0&&(s.y2-=u),s.x!==void 0&&(s.x-=h),s.y!==void 0&&(s.y-=u),s.relative=!0),s}))},o.NORMALIZE_HVZ=function(s,h,u){return s===void 0&&(s=!0),h===void 0&&(h=!0),u===void 0&&(u=!0),i((function(l,g,c,f,d){if(isNaN(f)&&!(l.type&m.MOVE_TO))throw new Error("path must start with moveto");return h&&l.type&m.HORIZ_LINE_TO&&(l.type=m.LINE_TO,l.y=l.relative?0:c),u&&l.type&m.VERT_LINE_TO&&(l.type=m.LINE_TO,l.x=l.relative?0:g),s&&l.type&m.CLOSE_PATH&&(l.type=m.LINE_TO,l.x=l.relative?f-g:f,l.y=l.relative?d-c:d),l.type&m.ARC&&(l.rX===0||l.rY===0)&&(l.type=m.LINE_TO,delete l.rX,delete l.rY,delete l.xRot,delete l.lArcFlag,delete l.sweepFlag),l}))},o.NORMALIZE_ST=t,o.QT_TO_C=r,o.INFO=i,o.SANITIZE=function(s){s===void 0&&(s=0),J(s);var h=NaN,u=NaN,l=NaN,g=NaN;return i((function(c,f,d,v,p){var y=Math.abs,T=!1,b=0,x=0;if(c.type&m.SMOOTH_CURVE_TO&&(b=isNaN(h)?0:f-h,x=isNaN(u)?0:d-u),c.type&(m.CURVE_TO|m.SMOOTH_CURVE_TO)?(h=c.relative?f+c.x2:c.x2,u=c.relative?d+c.y2:c.y2):(h=NaN,u=NaN),c.type&m.SMOOTH_QUAD_TO?(l=isNaN(l)?f:2*f-l,g=isNaN(g)?d:2*d-g):c.type&m.QUAD_TO?(l=c.relative?f+c.x1:c.x1,g=c.relative?d+c.y1:c.y2):(l=NaN,g=NaN),c.type&m.LINE_COMMANDS||c.type&m.ARC&&(c.rX===0||c.rY===0||!c.lArcFlag)||c.type&m.CURVE_TO||c.type&m.SMOOTH_CURVE_TO||c.type&m.QUAD_TO||c.type&m.SMOOTH_QUAD_TO){var O=c.x===void 0?0:c.relative?c.x:c.x-f,E=c.y===void 0?0:c.relative?c.y:c.y-d;b=isNaN(l)?c.x1===void 0?b:c.relative?c.x:c.x1-f:l-f,x=isNaN(g)?c.y1===void 0?x:c.relative?c.y:c.y1-d:g-d;var w=c.x2===void 0?0:c.relative?c.x:c.x2-f,S=c.y2===void 0?0:c.relative?c.y:c.y2-d;y(O)<=s&&y(E)<=s&&y(b)<=s&&y(x)<=s&&y(w)<=s&&y(S)<=s&&(T=!0)}return c.type&m.CLOSE_PATH&&y(f-v)<=s&&y(d-p)<=s&&(T=!0),T?[]:c}))},o.MATRIX=a,o.ROTATE=function(s,h,u){h===void 0&&(h=0),u===void 0&&(u=0),J(s,h,u);var l=Math.sin(s),g=Math.cos(s);return a(g,l,-l,g,h-h*g+u*l,u-h*l-u*g)},o.TRANSLATE=function(s,h){return h===void 0&&(h=0),J(s,h),a(1,0,0,1,s,h)},o.SCALE=function(s,h){return h===void 0&&(h=s),J(s,h),a(s,0,0,h,0,0)},o.SKEW_X=function(s){return J(s),a(1,0,Math.atan(s),1,0,0)},o.SKEW_Y=function(s){return J(s),a(1,Math.atan(s),0,1,0,0)},o.X_AXIS_SYMMETRY=function(s){return s===void 0&&(s=0),J(s),a(-1,0,0,1,s,0)},o.Y_AXIS_SYMMETRY=function(s){return s===void 0&&(s=0),J(s),a(1,0,0,-1,0,s)},o.A_TO_C=function(){return i((function(s,h,u){return m.ARC===s.type?(function(l,g,c){var f,d,v,p;l.cX||tt(l,g,c);for(var y=Math.min(l.phi1,l.phi2),T=Math.max(l.phi1,l.phi2)-y,b=Math.ceil(T/90),x=new Array(b),O=g,E=c,w=0;wg.maxX&&(g.maxX=k),kg.maxY&&(g.maxY=k),kP&&p(Nt(f,v.x1,v.x2,v.x,P));for(var x=0,O=St(d,v.y1,v.y2,v.y);xP&&y(Nt(d,v.y1,v.y2,v.y,P))}if(v.type&m.ARC){p(v.x),y(v.y),tt(v,f,d);for(var E=v.xRot/180*Math.PI,w=Math.cos(E)*v.rX,S=Math.sin(E)*v.rX,R=-Math.sin(E)*v.rY,D=Math.cos(E)*v.rY,_=v.phi1v.phi2?[v.phi2+360,v.phi1+360]:[v.phi2,v.phi1],M=_[0],U=_[1],H=function(k){var q=k[0],G=k[1],ee=180*Math.atan2(G,q)/Math.PI;return eeM&&PM&&Pl)throw new SyntaxError('Expected positive number, got "'+l+'" at index "'+n+'"')}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 "'+n+'"')}this.curArgs.push(l),this.curArgs.length===Vr[this.curCommandType]&&(m.HORIZ_LINE_TO===this.curCommandType?a({type:m.HORIZ_LINE_TO,relative:this.curCommandRelative,x:l}):m.VERT_LINE_TO===this.curCommandType?a({type:m.VERT_LINE_TO,relative:this.curCommandRelative,y:l}):this.curCommandType===m.MOVE_TO||this.curCommandType===m.LINE_TO||this.curCommandType===m.SMOOTH_QUAD_TO?(a({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?a({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?a({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?a({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&&a({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(!Mr(s))if(s===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(s!=="+"&&s!=="-"&&s!==".")if(u)this.curNumber=s,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+n+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+s+'" at index '+n+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,s!=="z"&&s!=="Z")if(s==="h"||s==="H")this.curCommandType=m.HORIZ_LINE_TO,this.curCommandRelative=s==="h";else if(s==="v"||s==="V")this.curCommandType=m.VERT_LINE_TO,this.curCommandRelative=s==="v";else if(s==="m"||s==="M")this.curCommandType=m.MOVE_TO,this.curCommandRelative=s==="m";else if(s==="l"||s==="L")this.curCommandType=m.LINE_TO,this.curCommandRelative=s==="l";else if(s==="c"||s==="C")this.curCommandType=m.CURVE_TO,this.curCommandRelative=s==="c";else if(s==="s"||s==="S")this.curCommandType=m.SMOOTH_CURVE_TO,this.curCommandRelative=s==="s";else if(s==="q"||s==="Q")this.curCommandType=m.QUAD_TO,this.curCommandRelative=s==="q";else if(s==="t"||s==="T")this.curCommandType=m.SMOOTH_QUAD_TO,this.curCommandRelative=s==="t";else{if(s!=="a"&&s!=="A")throw new SyntaxError('Unexpected character "'+s+'" at index '+n+".");this.curCommandType=m.ARC,this.curCommandRelative=s==="a"}else r.push({type:m.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=s,this.curNumberHasDecimal=s==="."}else this.curNumber+=s,this.curNumberHasDecimal=!0;else this.curNumber+=s;else this.curNumber+=s,this.curNumberHasExp=!0;else this.curNumber+=s,this.curNumberHasExpDigits=this.curNumberHasExp}return r},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(r,i){i===void 0&&(i=[]);for(var a=0,n=Object.getPrototypeOf(this).parse.call(this,r);a>>O;if(n[b+3]=He,He!==0){var Xe=255/He;n[b]=(k*x>>>O)*Xe,n[b+1]=(q*x>>>O)*Xe,n[b+2]=(G*x>>>O)*Xe}else n[b]=n[b+1]=n[b+2]=0;k-=X,q-=F,G-=Y,ee-=P,X-=p.r,F-=p.g,Y-=p.b,P-=p.a;var oe=Ue+a+1;oe=T+(oe>>O,W>0?(W=255/W,n[Q]=(Se*x>>>O)*W,n[Q+1]=(Ne*x>>>O)*W,n[Q+2]=(Me*x>>>O)*W):n[Q]=n[Q+1]=n[Q+2]=0,Se-=Ye,Ne-=qe,Me-=je,Pe-=We,Ye-=p.r,qe-=p.g,je-=p.b,We-=p.a,Q=ye+((Q=Je+l)0&&arguments[0]!==void 0?arguments[0]:{},e={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:o,createCanvas(t,r){return new OffscreenCanvas(t,r)},createImage(t){return ie(function*(){var r=yield fetch(t),i=yield r.blob(),a=yield createImageBitmap(i);return a})()}};return(typeof DOMParser<"u"||typeof o>"u")&&Reflect.deleteProperty(e,"DOMParser"),e}function zr(o){var{DOMParser:e,canvas:t,fetch:r}=o;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,fetch:r,createCanvas:t.createCanvas,createImage:t.loadImage}}var Ki=Object.freeze({__proto__:null,offscreen:Br,node:zr});function xe(o){return o.replace(/(?!\u3000)\s+/gm," ")}function Fr(o){return o.replace(/^[\n \t]+/,"")}function Ur(o){return o.replace(/[\n \t]+$/,"")}function $(o){var e=(o||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[];return e.map(parseFloat)}var Hr=/^[A-Z-]+$/;function Xr(o){return Hr.test(o)?o.toLowerCase():o}function Qt(o){var e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(o)||[];return e[2]||e[3]||e[4]}function Yr(o){if(!o.startsWith("rgb"))return o;var e=3,t=o.replace(/\d+(\.\d+)?/g,(r,i)=>e--&&i?String(Math.round(parseFloat(r))):r);return t}var qr=/(\[[^\]]+\])/g,jr=/(#[^\s+>~.[:]+)/g,Wr=/(\.[^\s+>~.[:]+)/g,Qr=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,$r=/(:[\w-]+\([^)]*\))/gi,Gr=/(:[^\s+>~.[:]+)/g,Zr=/([^\s+>~.[:]+)/g;function ge(o,e){var t=e.exec(o);return t?[o.replace(e," "),t.length]:[o,0]}function Jr(o){var e=[0,0,0],t=o.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[t,r]=ge(t,qr),e[1]+=r,[t,r]=ge(t,jr),e[0]+=r,[t,r]=ge(t,Wr),e[1]+=r,[t,r]=ge(t,Qr),e[2]+=r,[t,r]=ge(t,$r),e[1]+=r,[t,r]=ge(t,Gr),e[1]+=r,t=t.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[t,r]=ge(t,Zr),e[2]+=r,e.join("")}var be=1e-8;function Vt(o){return Math.sqrt(Math.pow(o[0],2)+Math.pow(o[1],2))}function nt(o,e){return(o[0]*e[0]+o[1]*e[1])/(Vt(o)*Vt(e))}function Rt(o,e){return(o[0]*e[1]0&&arguments[0]!==void 0?arguments[0]:" ",{document:t,name:r}=this;return xe(this.getString()).trim().split(e).map(i=>new A(t,r,i))}hasValue(e){var{value:t}=this;return t!==null&&t!==""&&(e||t!==0)&&typeof t<"u"}isString(e){var{value:t}=this,r=typeof t=="string";return!r||!e?r:e.test(t)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;var e=this.getString();switch(!0){case e.endsWith("px"):case/^[0-9]+$/.test(e):return!0;default:return!1}}setValue(e){return this.value=e,this}getValue(e){return typeof e>"u"||this.hasValue()?this.value:e}getNumber(e){if(!this.hasValue())return typeof e>"u"?0:parseFloat(e);var{value:t}=this,r=parseFloat(t);return this.isString(/%$/)&&(r/=100),r}getString(e){return typeof e>"u"||this.hasValue()?typeof this.value>"u"?"":String(this.value):String(e)}getColor(e){var t=this.getString(e);return this.isNormalizedColor||(this.isNormalizedColor=!0,t=Yr(t),this.value=t),t}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;var[r,i]=typeof e=="boolean"?[void 0,e]:[e],{viewPort:a}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(a.computeSize("x"),a.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(a.computeSize("x"),a.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*a.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*a.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()*a.computeSize(r);default:{var n=this.getNumber();return t&&n<1?n*a.computeSize(r):n}}}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(){var e=this.getString(),t=/#([^)'"]+)/.exec(e);return t&&(t=t[1]),t||(t=e),this.document.definitions[t]}getFillStyleDefinition(e,t){var r=this.getDefinition();if(!r)return null;if(typeof r.createGradient=="function")return r.createGradient(this.document.ctx,e,t);if(typeof r.createPattern=="function"){if(r.getHrefAttribute().hasValue()){var i=r.getAttribute("patternTransform");r=r.getHrefAttribute().getDefinition(),i.hasValue()&&r.getAttribute("patternTransform",!0).setValue(i.value)}return r.createPattern(this.document.ctx,e,t)}return null}getTextBaseline(){return this.hasValue()?A.textBaselineMapping[this.getString()]:null}addOpacity(e){for(var t=this.getColor(),r=t.length,i=0,a=0;a1&&arguments[1]!==void 0?arguments[1]:0,[r=t,i=t]=$(e);return new L(r,i)}static parseScale(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,[r=t,i=r]=$(e);return new L(r,i)}static parsePath(e){for(var t=$(e),r=t.length,i=[],a=0;a0}runEvents(){if(this.working){var{screen:e,events:t,eventElements:r}=this,{style:i}=e.ctx.canvas;i&&(i.cursor=""),t.forEach((a,n)=>{for(var{run:s}=a,h=r[n];h;)s(h),h=h.parent}),this.events=[],this.eventElements=[]}}checkPath(e,t){if(!(!this.working||!t)){var{events:r,eventElements:i}=this;r.forEach((a,n)=>{var{x:s,y:h}=a;!i[n]&&t.isPointInPath&&t.isPointInPath(s,h)&&(i[n]=e)})}}checkBoundingBox(e,t){if(!(!this.working||!t)){var{events:r,eventElements:i}=this;r.forEach((a,n)=>{var{x:s,y:h}=a;!i[n]&&t.isPointInBox(s,h)&&(i[n]=e)})}}mapXY(e,t){for(var{window:r,ctx:i}=this.screen,a=new L(e,t),n=i.canvas;n;)a.x-=n.offsetLeft,a.y-=n.offsetTop,n=n.offsetParent;return r.scrollX&&(a.x+=r.scrollX),r.scrollY&&(a.y+=r.scrollY),a}onClick(e){var{x:t,y:r}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onclick",x:t,y:r,run(i){i.onClick&&i.onClick()}})}onMouseMove(e){var{x:t,y:r}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onmousemove",x:t,y:r,run(i){i.onMouseMove&&i.onMouseMove()}})}}var $t=typeof window<"u"?window:null,Gt=typeof fetch<"u"?fetch.bind(void 0):null;class Ie{constructor(e){var{fetch:t=Gt,window:r=$t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.ctx=e,this.FRAMERATE=30,this.MAX_VIRTUAL_PIXELS=3e4,this.CLIENT_WIDTH=800,this.CLIENT_HEIGHT=600,this.viewPort=new Kr,this.mouse=new ei(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=r,this.fetch=t}wait(e){this.waits.push(e)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;var e=this.waits.every(t=>t());return e&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=e,e}setDefaults(e){e.strokeStyle="rgba(0,0,0,0)",e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4}setViewBox(e){var{document:t,ctx:r,aspectRatio:i,width:a,desiredWidth:n,height:s,desiredHeight:h,minX:u=0,minY:l=0,refX:g,refY:c,clip:f=!1,clipX:d=0,clipY:v=0}=e,p=xe(i).replace(/^defer\s/,""),[y,T]=p.split(" "),b=y||"xMidYMid",x=T||"meet",O=a/n,E=s/h,w=Math.min(O,E),S=Math.max(O,E),R=n,D=h;x==="meet"&&(R*=w,D*=w),x==="slice"&&(R*=S,D*=S);var _=new A(t,"refX",g),M=new A(t,"refY",c),U=_.hasValue()&&M.hasValue();if(U&&r.translate(-w*_.getPixels("x"),-w*M.getPixels("y")),f){var H=w*d,z=w*v;r.beginPath(),r.moveTo(H,z),r.lineTo(a,z),r.lineTo(a,s),r.lineTo(H,s),r.closePath(),r.clip()}if(!U){var X=x==="meet"&&w===E,F=x==="slice"&&S===E,Y=x==="meet"&&w===O,P=x==="slice"&&S===O;b.startsWith("xMid")&&(X||F)&&r.translate(a/2-R/2,0),b.endsWith("YMid")&&(Y||P)&&r.translate(0,s/2-D/2),b.startsWith("xMax")&&(X||F)&&r.translate(a-R,0),b.endsWith("YMax")&&(Y||P)&&r.translate(0,s-D)}switch(!0){case b==="none":r.scale(O,E);break;case x==="meet":r.scale(w,w);break;case x==="slice":r.scale(S,S);break}r.translate(-u,-l)}start(e){var{enableRedraw:t=!1,ignoreMouse:r=!1,ignoreAnimation:i=!1,ignoreDimensions:a=!1,ignoreClear:n=!1,forceRedraw:s,scaleWidth:h,scaleHeight:u,offsetX:l,offsetY:g}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{FRAMERATE:c,mouse:f}=this,d=1e3/c;if(this.frameDuration=d,this.readyPromise=new Promise(b=>{this.resolveReady=b}),this.isReady()&&this.render(e,a,n,h,u,l,g),!!t){var v=Date.now(),p=v,y=0,T=()=>{v=Date.now(),y=v-p,y>=d&&(p=v-y%d,this.shouldUpdate(i,s)&&(this.render(e,a,n,h,u,l,g),f.runEvents())),this.intervalId=Ke(T)};r||f.start(),this.intervalId=Ke(T)}}stop(){this.intervalId&&(Ke.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(e,t){if(!e){var{frameDuration:r}=this,i=this.animations.reduce((a,n)=>n.update(r)||a,!1);if(i)return!0}return!!(typeof t=="function"&&t()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(e,t,r,i,a,n,s){var{CLIENT_WIDTH:h,CLIENT_HEIGHT:u,viewPort:l,ctx:g,isFirstRender:c}=this,f=g.canvas;l.clear(),f.width&&f.height?l.setCurrent(f.width,f.height):l.setCurrent(h,u);var d=e.getStyle("width"),v=e.getStyle("height");!t&&(c||typeof i!="number"&&typeof a!="number")&&(d.hasValue()&&(f.width=d.getPixels("x"),f.style&&(f.style.width="".concat(f.width,"px"))),v.hasValue()&&(f.height=v.getPixels("y"),f.style&&(f.style.height="".concat(f.height,"px"))));var p=f.clientWidth||f.width,y=f.clientHeight||f.height;if(t&&d.hasValue()&&v.hasValue()&&(p=d.getPixels("x"),y=v.getPixels("y")),l.setCurrent(p,y),typeof n=="number"&&e.getAttribute("x",!0).setValue(n),typeof s=="number"&&e.getAttribute("y",!0).setValue(s),typeof i=="number"||typeof a=="number"){var T=$(e.getAttribute("viewBox").getString()),b=0,x=0;if(typeof i=="number"){var O=e.getStyle("width");O.hasValue()?b=O.getPixels("x")/i:isNaN(T[2])||(b=T[2]/i)}if(typeof a=="number"){var E=e.getStyle("height");E.hasValue()?x=E.getPixels("y")/a:isNaN(T[3])||(x=T[3]/a)}b||(b=x),x||(x=b),e.getAttribute("width",!0).setValue(i),e.getAttribute("height",!0).setValue(a);var w=e.getStyle("transform",!0,!0);w.setValue("".concat(w.getString()," scale(").concat(1/b,", ").concat(1/x,")"))}r||g.clearRect(0,0,p,y),e.render(g),c&&(this.isFirstRender=!1)}}Ie.defaultWindow=$t;Ie.defaultFetch=Gt;var{defaultFetch:ti}=Ie,ri=typeof DOMParser<"u"?DOMParser:null;class rt{constructor(){var{fetch:e=ti,DOMParser:t=ri}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.fetch=e,this.DOMParser=t}parse(e){var t=this;return ie(function*(){return e.startsWith("<")?t.parseFromString(e):t.load(e)})()}parseFromString(e){var t=new this.DOMParser;try{return this.checkDocument(t.parseFromString(e,"image/svg+xml"))}catch{return this.checkDocument(t.parseFromString(e,"text/xml"))}}checkDocument(e){var t=e.getElementsByTagName("parsererror")[0];if(t)throw new Error(t.textContent);return e}load(e){var t=this;return ie(function*(){var r=yield t.fetch(e),i=yield r.text();return t.parseFromString(i)})()}}class ii{constructor(e,t){this.type="translate",this.point=null,this.point=L.parse(t)}apply(e){var{x:t,y:r}=this.point;e.translate(t||0,r||0)}unapply(e){var{x:t,y:r}=this.point;e.translate(-1*t||0,-1*r||0)}applyToPoint(e){var{x:t,y:r}=this.point;e.applyTransform([1,0,0,1,t||0,r||0])}}class ai{constructor(e,t,r){this.type="rotate",this.angle=null,this.originX=null,this.originY=null,this.cx=0,this.cy=0;var i=$(t);this.angle=new A(e,"angle",i[0]),this.originX=r[0],this.originY=r[1],this.cx=i[1]||0,this.cy=i[2]||0}apply(e){var{cx:t,cy:r,originX:i,originY:a,angle:n}=this,s=t+i.getPixels("x"),h=r+a.getPixels("y");e.translate(s,h),e.rotate(n.getRadians()),e.translate(-s,-h)}unapply(e){var{cx:t,cy:r,originX:i,originY:a,angle:n}=this,s=t+i.getPixels("x"),h=r+a.getPixels("y");e.translate(s,h),e.rotate(-1*n.getRadians()),e.translate(-s,-h)}applyToPoint(e){var{cx:t,cy:r,angle:i}=this,a=i.getRadians();e.applyTransform([1,0,0,1,t||0,r||0]),e.applyTransform([Math.cos(a),Math.sin(a),-Math.sin(a),Math.cos(a),0,0]),e.applyTransform([1,0,0,1,-t||0,-r||0])}}class si{constructor(e,t,r){this.type="scale",this.scale=null,this.originX=null,this.originY=null;var i=L.parseScale(t);(i.x===0||i.y===0)&&(i.x=be,i.y=be),this.scale=i,this.originX=r[0],this.originY=r[1]}apply(e){var{scale:{x:t,y:r},originX:i,originY:a}=this,n=i.getPixels("x"),s=a.getPixels("y");e.translate(n,s),e.scale(t,r||t),e.translate(-n,-s)}unapply(e){var{scale:{x:t,y:r},originX:i,originY:a}=this,n=i.getPixels("x"),s=a.getPixels("y");e.translate(n,s),e.scale(1/t,1/r||t),e.translate(-n,-s)}applyToPoint(e){var{x:t,y:r}=this.scale;e.applyTransform([t||0,0,0,r||0,0,0])}}class Zt{constructor(e,t,r){this.type="matrix",this.matrix=[],this.originX=null,this.originY=null,this.matrix=$(t),this.originX=r[0],this.originY=r[1]}apply(e){var{originX:t,originY:r,matrix:i}=this,a=t.getPixels("x"),n=r.getPixels("y");e.translate(a,n),e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e.translate(-a,-n)}unapply(e){var{originX:t,originY:r,matrix:i}=this,a=i[0],n=i[2],s=i[4],h=i[1],u=i[3],l=i[5],g=0,c=0,f=1,d=1/(a*(u*f-l*c)-n*(h*f-l*g)+s*(h*c-u*g)),v=t.getPixels("x"),p=r.getPixels("y");e.translate(v,p),e.transform(d*(u*f-l*c),d*(l*g-h*f),d*(s*c-n*f),d*(a*f-s*g),d*(n*l-s*u),d*(s*h-a*l)),e.translate(-v,-p)}applyToPoint(e){e.applyTransform(this.matrix)}}class Jt extends Zt{constructor(e,t,r){super(e,t,r),this.type="skew",this.angle=null,this.angle=new A(e,"angle",t)}}class ni extends Jt{constructor(e,t,r){super(e,t,r),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class hi extends Jt{constructor(e,t,r){super(e,t,r),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function oi(o){return xe(o).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function ui(o){var[e,t]=o.split("(");return[e.trim(),t.trim().replace(")","")]}class de{constructor(e,t,r){this.document=e,this.transforms=[];var i=oi(t);i.forEach(a=>{if(a!=="none"){var[n,s]=ui(a),h=de.transformTypes[n];typeof h<"u"&&this.transforms.push(new h(this.document,s,r))}})}static fromElement(e,t){var r=t.getStyle("transform",!1,!0),[i,a=i]=t.getStyle("transform-origin",!1,!0).split(),n=[i,a];return r.hasValue()?new de(e,r.getString(),n):null}apply(e){for(var{transforms:t}=this,r=t.length,i=0;i=0;i--)t[i].unapply(e)}applyToPoint(e){for(var{transforms:t}=this,r=t.length,i=0;i2&&arguments[2]!==void 0?arguments[2]:!1;if(this.document=e,this.node=t,this.captureTextNodes=r,this.attributes=Object.create(null),this.styles=Object.create(null),this.stylesSpecificity=Object.create(null),this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!(!t||t.nodeType!==1)){if(Array.from(t.attributes).forEach(s=>{var h=Xr(s.nodeName);this.attributes[h]=new A(e,h,s.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){var i=this.getAttribute("style").getString().split(";").map(s=>s.trim());i.forEach(s=>{if(s){var[h,u]=s.split(":").map(l=>l.trim());this.styles[h]=new A(e,h,u)}})}var{definitions:a}=e,n=this.getAttribute("id");n.hasValue()&&(a[n.getString()]||(a[n.getString()]=this)),Array.from(t.childNodes).forEach(s=>{if(s.nodeType===1)this.addChild(s);else if(r&&(s.nodeType===3||s.nodeType===4)){var h=e.createTextNode(s);h.getText().length>0&&this.addChild(h)}})}}getAttribute(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.attributes[e];if(!r&&t){var i=new A(this.document,e,"");return this.attributes[e]=i,i}return r||A.empty(this.document)}getHrefAttribute(){for(var e in this.attributes)if(e==="href"||e.endsWith(":href"))return this.attributes[e];return A.empty(this.document)}getStyle(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=this.styles[e];if(i)return i;var a=this.getAttribute(e);if(a!=null&&a.hasValue())return this.styles[e]=a,a;if(!r){var{parent:n}=this;if(n){var s=n.getStyle(e);if(s!=null&&s.hasValue())return s}}if(t){var h=new A(this.document,e,"");return this.styles[e]=h,h}return i||A.empty(this.document)}render(e){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(e.save(),this.getStyle("mask").hasValue()){var t=this.getStyle("mask").getDefinition();t&&(this.applyEffects(e),t.apply(e,this))}else if(this.getStyle("filter").getValue("none")!=="none"){var r=this.getStyle("filter").getDefinition();r&&(this.applyEffects(e),r.apply(e,this))}else this.setContext(e),this.renderChildren(e),this.clearContext(e);e.restore()}}setContext(e){}applyEffects(e){var t=de.fromElement(this.document,this);t&&t.apply(e);var r=this.getStyle("clip-path",!1,!0);if(r.hasValue()){var i=r.getDefinition();i&&i.apply(e)}}clearContext(e){}renderChildren(e){this.children.forEach(t=>{t.render(e)})}addChild(e){var t=e instanceof V?e:this.document.createElement(e);t.parent=this,V.ignoreChildTypes.includes(t.type)||this.children.push(t)}matchesSelector(e){var t,{node:r}=this;if(typeof r.matches=="function")return r.matches(e);var i=(t=r.getAttribute)===null||t===void 0?void 0:t.call(r,"class");return!i||i===""?!1:i.split(" ").some(a=>".".concat(a)===e)}addStylesFromStyleDefinition(){var{styles:e,stylesSpecificity:t}=this.document;for(var r in e)if(!r.startsWith("@")&&this.matchesSelector(r)){var i=e[r],a=t[r];if(i)for(var n in i){var s=this.stylesSpecificity[n];typeof s>"u"&&(s="000"),a>=s&&(this.styles[n]=i[n],this.stylesSpecificity[n]=a)}}}removeStyles(e,t){var r=t.reduce((i,a)=>{var n=e.getStyle(a);if(!n.hasValue())return i;var s=n.getString();return n.setValue(""),[...i,[a,s]]},[]);return r}restoreStyles(e,t){t.forEach(r=>{var[i,a]=r;e.getStyle(i,!0).setValue(a)})}isFirstChild(){var e;return((e=this.parent)===null||e===void 0?void 0:e.children.indexOf(this))===0}}V.ignoreChildTypes=["title"];class li extends V{constructor(e,t,r){super(e,t,r)}}function fi(o){var e=o.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function gi(o){return typeof process>"u"?o:o.trim().split(",").map(fi).join(",")}function ci(o){if(!o)return"";var e=o.trim().toLowerCase();switch(e){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return e;default:return/^oblique\s+(-|)\d+deg$/.test(e)?e:""}}function vi(o){if(!o)return"";var e=o.trim().toLowerCase();switch(e){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return e;default:return/^[\d.]+$/.test(e)?e:""}}class j{constructor(e,t,r,i,a,n){var s=n?typeof n=="string"?j.parse(n):n:{};this.fontFamily=a||s.fontFamily,this.fontSize=i||s.fontSize,this.fontStyle=e||s.fontStyle,this.fontWeight=r||s.fontWeight,this.fontVariant=t||s.fontVariant}static parse(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r="",i="",a="",n="",s="",h=xe(e).trim().split(" "),u={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return h.forEach(l=>{switch(!0){case(!u.fontStyle&&j.styles.includes(l)):l!=="inherit"&&(r=l),u.fontStyle=!0;break;case(!u.fontVariant&&j.variants.includes(l)):l!=="inherit"&&(i=l),u.fontStyle=!0,u.fontVariant=!0;break;case(!u.fontWeight&&j.weights.includes(l)):l!=="inherit"&&(a=l),u.fontStyle=!0,u.fontVariant=!0,u.fontWeight=!0;break;case!u.fontSize:l!=="inherit"&&([n]=l.split("/")),u.fontStyle=!0,u.fontVariant=!0,u.fontWeight=!0,u.fontSize=!0;break;default:l!=="inherit"&&(s+=l)}}),new j(r,i,a,n,s,t)}toString(){return[ci(this.fontStyle),this.fontVariant,vi(this.fontWeight),this.fontSize,gi(this.fontFamily)].join(" ").trim()}}j.styles="normal|italic|oblique|inherit";j.variants="normal|small-caps|inherit";j.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class K{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number.NaN,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.NaN,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Number.NaN,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Number.NaN;this.x1=e,this.y1=t,this.x2=r,this.y2=i,this.addPoint(e,t),this.addPoint(r,i)}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(e,t){typeof e<"u"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),ethis.x2&&(this.x2=e)),typeof t<"u"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addBoundingBox(e){if(e){var{x1:t,y1:r,x2:i,y2:a}=e;this.addPoint(t,r),this.addPoint(i,a)}}sumCubic(e,t,r,i,a){return Math.pow(1-e,3)*t+3*Math.pow(1-e,2)*e*r+3*(1-e)*Math.pow(e,2)*i+Math.pow(e,3)*a}bezierCurveAdd(e,t,r,i,a){var n=6*t-12*r+6*i,s=-3*t+9*r-9*i+3*a,h=3*r-3*t;if(s===0){if(n===0)return;var u=-h/n;0=t.length-1}next(){var e=this.commands[++this.i];return this.previousCommand=this.command,this.command=e,e}getPoint(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y",r=new L(this.command[e],this.command[t]);return this.makeAbsolute(r)}getAsControlPoint(e,t){var r=this.getPoint(e,t);return this.control=r,r}getAsCurrentPoint(e,t){var r=this.getPoint(e,t);return this.current=r,r}getReflectedControlPoint(){var e=this.previousCommand.type;if(e!==m.CURVE_TO&&e!==m.SMOOTH_CURVE_TO&&e!==m.QUAD_TO&&e!==m.SMOOTH_QUAD_TO)return this.current;var{current:{x:t,y:r},control:{x:i,y:a}}=this,n=new L(2*t-i,2*r-a);return n}makeAbsolute(e){if(this.command.relative){var{x:t,y:r}=this.current;e.x+=t,e.y+=r}return e}addMarker(e,t,r){var{points:i,angles:a}=this;r&&a.length>0&&!a[a.length-1]&&(a[a.length-1]=i[i.length-1].angleTo(r)),this.addMarkerAngle(e,t?t.angleTo(e):null)}addMarkerAngle(e,t){this.points.push(e),this.angles.push(t)}getMarkerPoints(){return this.points}getMarkerAngles(){for(var{angles:e}=this,t=e.length,r=0;r1&&arguments[1]!==void 0?arguments[1]:!1;if(!t){var r=this.getStyle("fill"),i=this.getStyle("fill-opacity"),a=this.getStyle("stroke"),n=this.getStyle("stroke-opacity");if(r.isUrlDefinition()){var s=r.getFillStyleDefinition(this,i);s&&(e.fillStyle=s)}else if(r.hasValue()){r.getString()==="currentColor"&&r.setValue(this.getStyle("color").getColor());var h=r.getColor();h!=="inherit"&&(e.fillStyle=h==="none"?"rgba(0,0,0,0)":h)}if(i.hasValue()){var u=new A(this.document,"fill",e.fillStyle).addOpacity(i).getColor();e.fillStyle=u}if(a.isUrlDefinition()){var l=a.getFillStyleDefinition(this,n);l&&(e.strokeStyle=l)}else if(a.hasValue()){a.getString()==="currentColor"&&a.setValue(this.getStyle("color").getColor());var g=a.getString();g!=="inherit"&&(e.strokeStyle=g==="none"?"rgba(0,0,0,0)":g)}if(n.hasValue()){var c=new A(this.document,"stroke",e.strokeStyle).addOpacity(n).getString();e.strokeStyle=c}var f=this.getStyle("stroke-width");if(f.hasValue()){var d=f.getPixels();e.lineWidth=d||be}var v=this.getStyle("stroke-linecap"),p=this.getStyle("stroke-linejoin"),y=this.getStyle("stroke-miterlimit"),T=this.getStyle("stroke-dasharray"),b=this.getStyle("stroke-dashoffset");if(v.hasValue()&&(e.lineCap=v.getString()),p.hasValue()&&(e.lineJoin=p.getString()),y.hasValue()&&(e.miterLimit=y.getNumber()),T.hasValue()&&T.getString()!=="none"){var x=$(T.getString());typeof e.setLineDash<"u"?e.setLineDash(x):typeof e.webkitLineDash<"u"?e.webkitLineDash=x:typeof e.mozDash<"u"&&!(x.length===1&&x[0]===0)&&(e.mozDash=x);var O=b.getPixels();typeof e.lineDashOffset<"u"?e.lineDashOffset=O:typeof e.webkitLineDashOffset<"u"?e.webkitLineDashOffset=O:typeof e.mozDashOffset<"u"&&(e.mozDashOffset=O)}}if(this.modifiedEmSizeStack=!1,typeof e.font<"u"){var E=this.getStyle("font"),w=this.getStyle("font-style"),S=this.getStyle("font-variant"),R=this.getStyle("font-weight"),D=this.getStyle("font-size"),_=this.getStyle("font-family"),M=new j(w.getString(),S.getString(),R.getString(),D.hasValue()?"".concat(D.getPixels(!0),"px"):"",_.getString(),j.parse(E.getString(),e.font));w.setValue(M.fontStyle),S.setValue(M.fontVariant),R.setValue(M.fontWeight),D.setValue(M.fontSize),_.setValue(M.fontFamily),e.font=M.toString(),D.isPixels()&&(this.document.emSize=D.getPixels(),this.modifiedEmSizeStack=!0)}t||(this.applyEffects(e),e.globalAlpha=this.calculateOpacity())}clearContext(e){super.clearContext(e),this.modifiedEmSizeStack&&this.document.popEmSize()}}class N extends pe{constructor(e,t,r){super(e,t,r),this.type="path",this.pathParser=null,this.pathParser=new C(this.getAttribute("d").getString())}path(e){var{pathParser:t}=this,r=new K;for(t.reset(),e&&e.beginPath();!t.isEnd();)switch(t.next().type){case C.MOVE_TO:this.pathM(e,r);break;case C.LINE_TO:this.pathL(e,r);break;case C.HORIZ_LINE_TO:this.pathH(e,r);break;case C.VERT_LINE_TO:this.pathV(e,r);break;case C.CURVE_TO:this.pathC(e,r);break;case C.SMOOTH_CURVE_TO:this.pathS(e,r);break;case C.QUAD_TO:this.pathQ(e,r);break;case C.SMOOTH_QUAD_TO:this.pathT(e,r);break;case C.ARC:this.pathA(e,r);break;case C.CLOSE_PATH:this.pathZ(e,r);break}return r}getBoundingBox(e){return this.path()}getMarkers(){var{pathParser:e}=this,t=e.getMarkerPoints(),r=e.getMarkerAngles(),i=t.map((a,n)=>[a,r[n]]);return i}renderChildren(e){this.path(e),this.document.screen.mouse.checkPath(this,e);var t=this.getStyle("fill-rule");e.fillStyle!==""&&(t.getString("inherit")!=="inherit"?e.fill(t.getString()):e.fill()),e.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(e.save(),e.setTransform(1,0,0,1,0,0),e.stroke(),e.restore()):e.stroke());var r=this.getMarkers();if(r){var i=r.length-1,a=this.getStyle("marker-start"),n=this.getStyle("marker-mid"),s=this.getStyle("marker-end");if(a.isUrlDefinition()){var h=a.getDefinition(),[u,l]=r[0];h.render(e,u,l)}if(n.isUrlDefinition())for(var g=n.getDefinition(),c=1;c1&&(i*=Math.sqrt(c),a*=Math.sqrt(c));var f=(s===h?-1:1)*Math.sqrt((Math.pow(i,2)*Math.pow(a,2)-Math.pow(i,2)*Math.pow(g.y,2)-Math.pow(a,2)*Math.pow(g.x,2))/(Math.pow(i,2)*Math.pow(g.y,2)+Math.pow(a,2)*Math.pow(g.x,2)));isNaN(f)&&(f=0);var d=new L(f*i*g.y/a,f*-a*g.x/i),v=new L((t.x+l.x)/2+Math.cos(u)*d.x-Math.sin(u)*d.y,(t.y+l.y)/2+Math.sin(u)*d.x+Math.cos(u)*d.y),p=Rt([1,0],[(g.x-d.x)/i,(g.y-d.y)/a]),y=[(g.x-d.x)/i,(g.y-d.y)/a],T=[(-g.x-d.x)/i,(-g.y-d.y)/a],b=Rt(y,T);return nt(y,T)<=-1&&(b=Math.PI),nt(y,T)>=1&&(b=0),{currentPoint:l,rX:i,rY:a,sweepFlag:h,xAxisRotation:u,centp:v,a1:p,ad:b}}pathA(e,t){var{pathParser:r}=this,{currentPoint:i,rX:a,rY:n,sweepFlag:s,xAxisRotation:h,centp:u,a1:l,ad:g}=N.pathA(r),c=1-s?1:-1,f=l+c*(g/2),d=new L(u.x+a*Math.cos(f),u.y+n*Math.sin(f));if(r.addMarkerAngle(d,f-c*Math.PI/2),r.addMarkerAngle(i,f-c*Math.PI),t.addPoint(i.x,i.y),e&&!isNaN(l)&&!isNaN(g)){var v=a>n?a:n,p=a>n?1:a/n,y=a>n?n/a:1;e.translate(u.x,u.y),e.rotate(h),e.scale(p,y),e.arc(0,0,v,l,l+g,!!(1-s)),e.scale(1/p,1/y),e.rotate(-h),e.translate(-u.x,-u.y)}}static pathZ(e){e.current=e.start}pathZ(e,t){N.pathZ(this.pathParser),e&&t.x1!==t.x2&&t.y1!==t.y2&&e.closePath()}}class Kt extends N{constructor(e,t,r){super(e,t,r),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 he extends pe{constructor(e,t,r){super(e,t,new.target===he?!0:r),this.type="text",this.x=0,this.y=0,this.measureCache=-1}setContext(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(e,t);var r=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();r&&(e.textBaseline=r)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(e){if(this.type!=="text")return this.getTElementBoundingBox(e);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e);var t=null;return this.children.forEach((r,i)=>{var a=this.getChildBoundingBox(e,this,this,i);t?t.addBoundingBox(a):t=a}),t}getFontSize(){var{document:e,parent:t}=this,r=j.parse(e.ctx.font).fontSize,i=t.getStyle("font-size").getNumber(r);return i}getTElementBoundingBox(e){var t=this.getFontSize();return new K(this.x,this.y-t,this.x+this.measureText(e),this.y)}getGlyph(e,t,r){var i=t[r],a=null;if(e.isArabic){var n=t.length,s=t[r-1],h=t[r+1],u="isolated";if((r===0||s===" ")&&r0&&s!==" "&&r0&&s!==" "&&(r===n-1||h===" ")&&(u="initial"),typeof e.glyphs[i]<"u"){var l=e.glyphs[i];a=l instanceof Kt?l:l[u]}}else a=e.glyphs[i];return a||(a=e.missingGlyph),a}getText(){return""}getTextFromNode(e){var t=e||this.node,r=Array.from(t.parentNode.childNodes),i=r.indexOf(t),a=r.length-1,n=xe(t.textContent||"");return i===0&&(n=Fr(n)),i===a&&(n=Ur(n)),n}renderChildren(e){if(this.type!=="text"){this.renderTElementChildren(e);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e),this.children.forEach((r,i)=>{this.renderChild(e,this,this,i)});var{mouse:t}=this.document.screen;t.isWorking()&&t.checkBoundingBox(this,this.getBoundingBox(e))}renderTElementChildren(e){var{document:t,parent:r}=this,i=this.getText(),a=r.getStyle("font-family").getDefinition();if(a){for(var{unitsPerEm:n}=a.fontFace,s=j.parse(t.ctx.font),h=r.getStyle("font-size").getNumber(s.fontSize),u=r.getStyle("font-style").getString(s.fontStyle),l=h/n,g=a.isRTL?i.split("").reverse().join(""):i,c=$(r.getAttribute("dx").getString()),f=g.length,d=0;d=this.leafTexts.length)){var e=this.leafTexts[this.textChunkStart],t=e.getStyle("text-anchor").getString("start"),r=!1,i=0;t==="start"&&!r||t==="end"&&r?i=e.x-this.minX:t==="end"&&!r||t==="start"&&r?i=e.x-this.maxX:i=e.x-(this.minX+this.maxX)/2;for(var a=this.textChunkStart;a{this.adjustChildCoordinatesRecursiveCore(e,this,this,r)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(e,t,r,i){var a=r.children[i];a.children.length>0?a.children.forEach((n,s)=>{t.adjustChildCoordinatesRecursiveCore(e,t,a,s)}):this.adjustChildCoordinates(e,t,r,i)}adjustChildCoordinates(e,t,r,i){var a=r.children[i];if(typeof a.measureText!="function")return a;e.save(),a.setContext(e,!0);var n=a.getAttribute("x"),s=a.getAttribute("y"),h=a.getAttribute("dx"),u=a.getAttribute("dy"),l=a.getStyle("font-family").getDefinition(),g=!!l&&l.isRTL;i===0&&(n.hasValue()||n.setValue(a.getInheritedAttribute("x")),s.hasValue()||s.setValue(a.getInheritedAttribute("y")),h.hasValue()||h.setValue(a.getInheritedAttribute("dx")),u.hasValue()||u.setValue(a.getInheritedAttribute("dy")));var c=a.measureText(e);return g&&(t.x-=c),n.hasValue()?(t.applyAnchoring(),a.x=n.getPixels("x"),h.hasValue()&&(a.x+=h.getPixels("x"))):(h.hasValue()&&(t.x+=h.getPixels("x")),a.x=t.x),t.x=a.x,g||(t.x+=c),s.hasValue()?(a.y=s.getPixels("y"),u.hasValue()&&(a.y+=u.getPixels("y"))):(u.hasValue()&&(t.y+=u.getPixels("y")),a.y=t.y),t.y=a.y,t.leafTexts.push(a),t.minX=Math.min(t.minX,a.x,a.x+c),t.maxX=Math.max(t.maxX,a.x,a.x+c),a.clearContext(e),e.restore(),a}getChildBoundingBox(e,t,r,i){var a=r.children[i];if(typeof a.getBoundingBox!="function")return null;var n=a.getBoundingBox(e);return n?(a.children.forEach((s,h)=>{var u=t.getChildBoundingBox(e,t,a,h);n.addBoundingBox(u)}),n):null}renderChild(e,t,r,i){var a=r.children[i];a.render(e),a.children.forEach((n,s)=>{t.renderChild(e,t,a,s)})}measureText(e){var{measureCache:t}=this;if(~t)return t;var r=this.getText(),i=this.measureTargetText(e,r);return this.measureCache=i,i}measureTargetText(e,t){if(!t.length)return 0;var{parent:r}=this,i=r.getStyle("font-family").getDefinition();if(i){for(var a=this.getFontSize(),n=i.isRTL?t.split("").reverse().join(""):t,s=$(r.getAttribute("dx").getString()),h=n.length,u=0,l=0;l0?"":this.getTextFromNode()}getText(){return this.text}}class di extends Be{constructor(){super(...arguments),this.type="textNode"}}class Te extends pe{constructor(){super(...arguments),this.type="svg",this.root=!1}setContext(e){var t,{document:r}=this,{screen:i,window:a}=r,n=e.canvas;if(i.setDefaults(e),n.style&&typeof e.font<"u"&&a&&typeof a.getComputedStyle<"u"){e.font=a.getComputedStyle(n).getPropertyValue("font");var s=new A(r,"fontSize",j.parse(e.font).fontSize);s.hasValue()&&(r.rootEmSize=s.getPixels("y"),r.emSize=r.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);var{width:h,height:u}=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");var l=this.getAttribute("refX"),g=this.getAttribute("refY"),c=this.getAttribute("viewBox"),f=c.hasValue()?$(c.getString()):null,d=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible",v=0,p=0,y=0,T=0;f&&(v=f[0],p=f[1]),this.root||(h=this.getStyle("width").getPixels("x"),u=this.getStyle("height").getPixels("y"),this.type==="marker"&&(y=v,T=p,v=0,p=0)),i.viewPort.setCurrent(h,u),this.node&&(!this.parent||((t=this.node.parentNode)===null||t===void 0?void 0:t.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(e),e.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),f&&(h=f[2],u=f[3]),r.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:i.viewPort.width,desiredWidth:h,height:i.viewPort.height,desiredHeight:u,minX:v,minY:p,refX:l.getValue(),refY:g.getValue(),clip:d,clipX:y,clipY:T}),f&&(i.viewPort.removeCurrent(),i.viewPort.setCurrent(h,u))}clearContext(e){super.clearContext(e),this.document.screen.viewPort.removeCurrent()}resize(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=this.getAttribute("width",!0),a=this.getAttribute("height",!0),n=this.getAttribute("viewBox"),s=this.getAttribute("style"),h=i.getNumber(0),u=a.getNumber(0);if(r)if(typeof r=="string")this.getAttribute("preserveAspectRatio",!0).setValue(r);else{var l=this.getAttribute("preserveAspectRatio");l.hasValue()&&l.setValue(l.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(i.setValue(e),a.setValue(t),n.hasValue()||n.setValue("0 0 ".concat(h||e," ").concat(u||t)),s.hasValue()){var g=this.getStyle("width"),c=this.getStyle("height");g.hasValue()&&g.setValue("".concat(e,"px")),c.hasValue()&&c.setValue("".concat(t,"px"))}}}class er extends N{constructor(){super(...arguments),this.type="rect"}path(e){var t=this.getAttribute("x").getPixels("x"),r=this.getAttribute("y").getPixels("y"),i=this.getStyle("width",!1,!0).getPixels("x"),a=this.getStyle("height",!1,!0).getPixels("y"),n=this.getAttribute("rx"),s=this.getAttribute("ry"),h=n.getPixels("x"),u=s.getPixels("y");if(n.hasValue()&&!s.hasValue()&&(u=h),s.hasValue()&&!n.hasValue()&&(h=u),h=Math.min(h,i/2),u=Math.min(u,a/2),e){var l=4*((Math.sqrt(2)-1)/3);e.beginPath(),a>0&&i>0&&(e.moveTo(t+h,r),e.lineTo(t+i-h,r),e.bezierCurveTo(t+i-h+l*h,r,t+i,r+u-l*u,t+i,r+u),e.lineTo(t+i,r+a-u),e.bezierCurveTo(t+i,r+a-u+l*u,t+i-h+l*h,r+a,t+i-h,r+a),e.lineTo(t+h,r+a),e.bezierCurveTo(t+h-l*h,r+a,t,r+a-u+l*u,t,r+a-u),e.lineTo(t,r+u),e.bezierCurveTo(t,r+u-l*u,t+h-l*h,r,t+h,r),e.closePath())}return new K(t,r,t+i,r+a)}getMarkers(){return null}}class pi extends N{constructor(){super(...arguments),this.type="circle"}path(e){var t=this.getAttribute("cx").getPixels("x"),r=this.getAttribute("cy").getPixels("y"),i=this.getAttribute("r").getPixels();return e&&i>0&&(e.beginPath(),e.arc(t,r,i,0,Math.PI*2,!1),e.closePath()),new K(t-i,r-i,t+i,r+i)}getMarkers(){return null}}class mi extends N{constructor(){super(...arguments),this.type="ellipse"}path(e){var t=4*((Math.sqrt(2)-1)/3),r=this.getAttribute("rx").getPixels("x"),i=this.getAttribute("ry").getPixels("y"),a=this.getAttribute("cx").getPixels("x"),n=this.getAttribute("cy").getPixels("y");return e&&r>0&&i>0&&(e.beginPath(),e.moveTo(a+r,n),e.bezierCurveTo(a+r,n+t*i,a+t*r,n+i,a,n+i),e.bezierCurveTo(a-t*r,n+i,a-r,n+t*i,a-r,n),e.bezierCurveTo(a-r,n-t*i,a-t*r,n-i,a,n-i),e.bezierCurveTo(a+t*r,n-i,a+r,n-t*i,a+r,n),e.closePath()),new K(a-r,n-i,a+r,n+i)}getMarkers(){return null}}class yi extends N{constructor(){super(...arguments),this.type="line"}getPoints(){return[new L(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new L(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(e){var[{x:t,y:r},{x:i,y:a}]=this.getPoints();return e&&(e.beginPath(),e.moveTo(t,r),e.lineTo(i,a)),new K(t,r,i,a)}getMarkers(){var[e,t]=this.getPoints(),r=e.angleTo(t);return[[e,r],[t,r]]}}class tr extends N{constructor(e,t,r){super(e,t,r),this.type="polyline",this.points=[],this.points=L.parsePath(this.getAttribute("points").getString())}path(e){var{points:t}=this,[{x:r,y:i}]=t,a=new K(r,i);return e&&(e.beginPath(),e.moveTo(r,i)),t.forEach(n=>{var{x:s,y:h}=n;a.addPoint(s,h),e&&e.lineTo(s,h)}),a}getMarkers(){var{points:e}=this,t=e.length-1,r=[];return e.forEach((i,a)=>{a!==t&&r.push([i,i.angleTo(e[a+1])])}),r.length>0&&r.push([e[e.length-1],r[r.length-1][1]]),r}}class bi extends tr{constructor(){super(...arguments),this.type="polygon"}path(e){var t=super.path(e),[{x:r,y:i}]=this.points;return e&&(e.lineTo(r,i),e.closePath()),t}}class xi extends V{constructor(){super(...arguments),this.type="pattern"}createPattern(e,t,r){var i=this.getStyle("width").getPixels("x",!0),a=this.getStyle("height").getPixels("y",!0),n=new Te(this.document,null);n.attributes.viewBox=new A(this.document,"viewBox",this.getAttribute("viewBox").getValue()),n.attributes.width=new A(this.document,"width","".concat(i,"px")),n.attributes.height=new A(this.document,"height","".concat(a,"px")),n.attributes.transform=new A(this.document,"transform",this.getAttribute("patternTransform").getValue()),n.children=this.children;var s=this.document.createCanvas(i,a),h=s.getContext("2d"),u=this.getAttribute("x"),l=this.getAttribute("y");u.hasValue()&&l.hasValue()&&h.translate(u.getPixels("x",!0),l.getPixels("y",!0)),r.hasValue()?this.styles["fill-opacity"]=r:Reflect.deleteProperty(this.styles,"fill-opacity");for(var g=-1;g<=1;g++)for(var c=-1;c<=1;c++)h.save(),n.attributes.x=new A(this.document,"x",g*s.width),n.attributes.y=new A(this.document,"y",c*s.height),n.render(h),h.restore();var f=e.createPattern(s,"repeat");return f}}class wi extends V{constructor(){super(...arguments),this.type="marker"}render(e,t,r){if(t){var{x:i,y:a}=t,n=this.getAttribute("orient").getString("auto"),s=this.getAttribute("markerUnits").getString("strokeWidth");e.translate(i,a),n==="auto"&&e.rotate(r),s==="strokeWidth"&&e.scale(e.lineWidth,e.lineWidth),e.save();var h=new Te(this.document,null);h.type=this.type,h.attributes.viewBox=new A(this.document,"viewBox",this.getAttribute("viewBox").getValue()),h.attributes.refX=new A(this.document,"refX",this.getAttribute("refX").getValue()),h.attributes.refY=new A(this.document,"refY",this.getAttribute("refY").getValue()),h.attributes.width=new A(this.document,"width",this.getAttribute("markerWidth").getValue()),h.attributes.height=new A(this.document,"height",this.getAttribute("markerHeight").getValue()),h.attributes.overflow=new A(this.document,"overflow",this.getAttribute("overflow").getValue()),h.attributes.fill=new A(this.document,"fill",this.getAttribute("fill").getColor("black")),h.attributes.stroke=new A(this.document,"stroke",this.getAttribute("stroke").getValue("none")),h.children=this.children,h.render(e),e.restore(),s==="strokeWidth"&&e.scale(1/e.lineWidth,1/e.lineWidth),n==="auto"&&e.rotate(-r),e.translate(-i,-a)}}}class Ai extends V{constructor(){super(...arguments),this.type="defs"}render(){}}class ut extends pe{constructor(){super(...arguments),this.type="g"}getBoundingBox(e){var t=new K;return this.children.forEach(r=>{t.addBoundingBox(r.getBoundingBox(e))}),t}}class rr extends V{constructor(e,t,r){super(e,t,r),this.attributesToInherit=["gradientUnits"],this.stops=[];var{stops:i,children:a}=this;a.forEach(n=>{n.type==="stop"&&i.push(n)})}getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(e,t,r){var i=this;this.getHrefAttribute().hasValue()&&(i=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(i));var{stops:a}=i,n=this.getGradient(e,t);if(!n)return this.addParentOpacity(r,a[a.length-1].color);if(a.forEach(p=>{n.addColorStop(p.offset,this.addParentOpacity(r,p.color))}),this.getAttribute("gradientTransform").hasValue()){var{document:s}=this,{MAX_VIRTUAL_PIXELS:h,viewPort:u}=s.screen,[l]=u.viewPorts,g=new er(s,null);g.attributes.x=new A(s,"x",-h/3),g.attributes.y=new A(s,"y",-h/3),g.attributes.width=new A(s,"width",h),g.attributes.height=new A(s,"height",h);var c=new ut(s,null);c.attributes.transform=new A(s,"transform",this.getAttribute("gradientTransform").getValue()),c.children=[g];var f=new Te(s,null);f.attributes.x=new A(s,"x",0),f.attributes.y=new A(s,"y",0),f.attributes.width=new A(s,"width",l.width),f.attributes.height=new A(s,"height",l.height),f.children=[c];var d=s.createCanvas(l.width,l.height),v=d.getContext("2d");return v.fillStyle=n,f.render(v),v.createPattern(d,"no-repeat")}return n}inheritStopContainer(e){this.attributesToInherit.forEach(t=>{!this.getAttribute(t).hasValue()&&e.getAttribute(t).hasValue()&&this.getAttribute(t,!0).setValue(e.getAttribute(t).getValue())})}addParentOpacity(e,t){if(e.hasValue()){var r=new A(this.document,"color",t);return r.addOpacity(e).getColor()}return t}}class Ti extends rr{constructor(e,t,r){super(e,t,r),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}getGradient(e,t){var r=this.getGradientUnits()==="objectBoundingBox",i=r?t.getBoundingBox(e):null;if(r&&!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));var a=r?i.x+i.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),n=r?i.y+i.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),s=r?i.x+i.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),h=r?i.y+i.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return a===s&&n===h?null:e.createLinearGradient(a,n,s,h)}}class Ci extends rr{constructor(e,t,r){super(e,t,r),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}getGradient(e,t){var r=this.getGradientUnits()==="objectBoundingBox",i=t.getBoundingBox(e);if(r&&!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%");var a=r?i.x+i.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),n=r?i.y+i.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y"),s=a,h=n;this.getAttribute("fx").hasValue()&&(s=r?i.x+i.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(h=r?i.y+i.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));var u=r?(i.width+i.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return e.createRadialGradient(s,h,l,a,n,u)}}class Ei extends V{constructor(e,t,r){super(e,t,r),this.type="stop";var i=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),a=this.getStyle("stop-opacity"),n=this.getStyle("stop-color",!0);n.getString()===""&&n.setValue("#000"),a.hasValue()&&(n=n.addOpacity(a)),this.offset=i,this.color=n.getColor()}}class lt extends V{constructor(e,t,r){super(e,t,r),this.type="animate",this.duration=0,this.initialValue=null,this.initialUnits="",this.removed=!1,this.frozen=!1,e.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(e,"values",null);var i=this.getAttribute("values");i.hasValue()&&this.values.setValue(i.getString().split(";"))}getProperty(){var e=this.getAttribute("attributeType").getString(),t=this.getAttribute("attributeName").getString();return e==="CSS"?this.parent.getStyle(t,!0):this.parent.getAttribute(t,!0)}calcValue(){var{initialUnits:e}=this,{progress:t,from:r,to:i}=this.getProgress(),a=r.getNumber()+(i.getNumber()-r.getNumber())*t;return e==="%"&&(a*=100),"".concat(a).concat(e)}update(e){var{parent:t}=this,r=this.getProperty();if(this.initialValue||(this.initialValue=r.getString(),this.initialUnits=r.getUnits()),this.duration>this.maxDuration){var i=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(i==="freeze"&&!this.frozen)this.frozen=!0,t.animationFrozen=!0,t.animationFrozenValue=r.getString();else if(i==="remove"&&!this.removed)return this.removed=!0,r.setValue(t.animationFrozen?t.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=e;var a=!1;if(this.begin{var u=a[h];return s+(u-s)*e}).join(" ");return n}}class Ni extends V{constructor(e,t,r){super(e,t,r),this.type="font",this.glyphs=Object.create(null),this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();var{definitions:i}=e,{children:a}=this;for(var n of a)switch(n.type){case"font-face":{this.fontFace=n;var s=n.getStyle("font-family");s.hasValue()&&(i[s.getString()]=this);break}case"missing-glyph":this.missingGlyph=n;break;case"glyph":{var h=n;h.arabicForm?(this.isRTL=!0,this.isArabic=!0,typeof this.glyphs[h.unicode]>"u"&&(this.glyphs[h.unicode]=Object.create(null)),this.glyphs[h.unicode][h.arabicForm]=h):this.glyphs[h.unicode]=h;break}}}render(){}}class Mi extends V{constructor(e,t,r){super(e,t,r),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 Pi extends N{constructor(){super(...arguments),this.type="missing-glyph",this.horizAdvX=0}}class Vi extends he{constructor(){super(...arguments),this.type="tref"}getText(){var e=this.getHrefAttribute().getDefinition();if(e){var t=e.children[0];if(t)return t.getText()}return""}}class Ri extends he{constructor(e,t,r){super(e,t,r),this.type="a";var{childNodes:i}=t,a=i[0],n=i.length>0&&Array.from(i).every(s=>s.nodeType===3);this.hasText=n,this.text=n?this.getTextFromNode(a):""}getText(){return this.text}renderChildren(e){if(this.hasText){super.renderChildren(e);var{document:t,x:r,y:i}=this,{mouse:a}=t.screen,n=new A(t,"fontSize",j.parse(t.ctx.font).fontSize);a.isWorking()&&a.checkBoundingBox(this,new K(r,i-n.getPixels("y"),r+this.measureText(e),i))}else if(this.children.length>0){var s=new ut(this.document,null);s.children=this.children,s.parent=this,s.render(e)}}onClick(){var{window:e}=this.document;e&&e.open(this.getHrefAttribute().getString())}onMouseMove(){var e=this.document.ctx;e.canvas.style.cursor="pointer"}}function Ft(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),t.push.apply(t,r)}return t}function ke(o){for(var e=1;e{var{type:i,points:a}=r;switch(i){case C.LINE_TO:e&&e.lineTo(a[0],a[1]);break;case C.MOVE_TO:e&&e.moveTo(a[0],a[1]);break;case C.CURVE_TO:e&&e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case C.QUAD_TO:e&&e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case C.ARC:{var[n,s,h,u,l,g,c,f]=a,d=h>u?h:u,v=h>u?1:h/u,p=h>u?u/h:1;e&&(e.translate(n,s),e.rotate(c),e.scale(v,p),e.arc(0,0,d,l,l+g,!!(1-f)),e.scale(1/v,1/p),e.rotate(-c),e.translate(-n,-s));break}case C.CLOSE_PATH:e&&e.closePath();break}})}renderChildren(e){this.setTextData(e),e.save();var t=this.parent.getStyle("text-decoration").getString(),r=this.getFontSize(),{glyphInfo:i}=this,a=e.fillStyle;t==="underline"&&e.beginPath(),i.forEach((n,s)=>{var{p0:h,p1:u,rotation:l,text:g}=n;e.save(),e.translate(h.x,h.y),e.rotate(l),e.fillStyle&&e.fillText(g,0,0),e.strokeStyle&&e.strokeText(g,0,0),e.restore(),t==="underline"&&(s===0&&e.moveTo(h.x,h.y+r/8),e.lineTo(u.x,u.y+r/5))}),t==="underline"&&(e.lineWidth=r/20,e.strokeStyle=a,e.stroke(),e.closePath()),e.restore()}getLetterSpacingAt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[e]||0}findSegmentToFitChar(e,t,r,i,a,n,s,h,u){var l=n,g=this.measureText(e,h);h===" "&&t==="justify"&&r-1&&(l+=this.getLetterSpacingAt(u));var c=this.textHeight/20,f=this.getEquidistantPointOnPath(l,c,0),d=this.getEquidistantPointOnPath(l+g,c,0),v={p0:f,p1:d},p=f&&d?Math.atan2(d.y-f.y,d.x-f.x):0;if(s){var y=Math.cos(Math.PI/2+p)*s,T=Math.cos(-p)*s;v.p0=ke(ke({},f),{},{x:f.x+y,y:f.y+T}),v.p1=ke(ke({},d),{},{x:d.x+y,y:d.y+T})}return l+=g,{offset:l,segment:v,rotation:p}}measureText(e,t){var{measuresCache:r}=this,i=t||this.getText();if(r.has(i))return r.get(i);var a=this.measureTargetText(e,i);return r.set(i,a),a}setTextData(e){if(!this.glyphInfo){var t=this.getText(),r=t.split(""),i=t.split(" ").length-1,a=this.parent.getAttribute("dx").split().map(x=>x.getPixels("x")),n=this.parent.getAttribute("dy").getPixels("y"),s=this.parent.getStyle("text-anchor").getString("start"),h=this.getStyle("letter-spacing"),u=this.parent.getStyle("letter-spacing"),l=0;!h.hasValue()||h.getValue()==="inherit"?l=u.getPixels():h.hasValue()&&h.getValue()!=="initial"&&h.getValue()!=="unset"&&(l=h.getPixels());var g=[],c=t.length;this.letterSpacingCache=g;for(var f=0;fE===0?0:x+O||0,0),v=this.measureText(e),p=Math.max(v+d,0);this.textWidth=v,this.textHeight=this.getFontSize(),this.glyphInfo=[];var y=this.getPathLength(),T=this.getStyle("startOffset").getNumber(0)*y,b=0;(s==="middle"||s==="center")&&(b=-p/2),(s==="end"||s==="right")&&(b=-p),b+=T,r.forEach((x,O)=>{var{offset:E,segment:w,rotation:S}=this.findSegmentToFitChar(e,s,p,y,i,b,n,x,O);b=E,!(!w.p0||!w.p1)&&this.glyphInfo.push({text:r[O],p0:w.p0,p1:w.p1,rotation:S})})}}parsePathData(e){if(this.pathLength=-1,!e)return[];var t=[],{pathParser:r}=e;for(r.reset();!r.isEnd();){var{current:i}=r,a=i?i.x:0,n=i?i.y:0,s=r.next(),h=s.type,u=[];switch(s.type){case C.MOVE_TO:this.pathM(r,u);break;case C.LINE_TO:h=this.pathL(r,u);break;case C.HORIZ_LINE_TO:h=this.pathH(r,u);break;case C.VERT_LINE_TO:h=this.pathV(r,u);break;case C.CURVE_TO:this.pathC(r,u);break;case C.SMOOTH_CURVE_TO:h=this.pathS(r,u);break;case C.QUAD_TO:this.pathQ(r,u);break;case C.SMOOTH_QUAD_TO:h=this.pathT(r,u);break;case C.ARC:u=this.pathA(r);break;case C.CLOSE_PATH:N.pathZ(r);break}s.type!==C.CLOSE_PATH?t.push({type:h,points:u,start:{x:a,y:n},pathLength:this.calcLength(a,n,h,u)}):t.push({type:C.CLOSE_PATH,points:[],pathLength:0})}return t}pathM(e,t){var{x:r,y:i}=N.pathM(e).point;t.push(r,i)}pathL(e,t){var{x:r,y:i}=N.pathL(e).point;return t.push(r,i),C.LINE_TO}pathH(e,t){var{x:r,y:i}=N.pathH(e).point;return t.push(r,i),C.LINE_TO}pathV(e,t){var{x:r,y:i}=N.pathV(e).point;return t.push(r,i),C.LINE_TO}pathC(e,t){var{point:r,controlPoint:i,currentPoint:a}=N.pathC(e);t.push(r.x,r.y,i.x,i.y,a.x,a.y)}pathS(e,t){var{point:r,controlPoint:i,currentPoint:a}=N.pathS(e);return t.push(r.x,r.y,i.x,i.y,a.x,a.y),C.CURVE_TO}pathQ(e,t){var{controlPoint:r,currentPoint:i}=N.pathQ(e);t.push(r.x,r.y,i.x,i.y)}pathT(e,t){var{controlPoint:r,currentPoint:i}=N.pathT(e);return t.push(r.x,r.y,i.x,i.y),C.QUAD_TO}pathA(e){var{rX:t,rY:r,sweepFlag:i,xAxisRotation:a,centp:n,a1:s,ad:h}=N.pathA(e);return i===0&&h>0&&(h-=2*Math.PI),i===1&&h<0&&(h+=2*Math.PI),[n.x,n.y,t,r,s,h,a,i]}calcLength(e,t,r,i){var a=0,n=null,s=null,h=0;switch(r){case C.LINE_TO:return this.getLineLength(e,t,i[0],i[1]);case C.CURVE_TO:for(a=0,n=this.getPointOnCubicBezier(0,e,t,i[0],i[1],i[2],i[3],i[4],i[5]),h=.01;h<=1;h+=.01)s=this.getPointOnCubicBezier(h,e,t,i[0],i[1],i[2],i[3],i[4],i[5]),a+=this.getLineLength(n.x,n.y,s.x,s.y),n=s;return a;case C.QUAD_TO:for(a=0,n=this.getPointOnQuadraticBezier(0,e,t,i[0],i[1],i[2],i[3]),h=.01;h<=1;h+=.01)s=this.getPointOnQuadraticBezier(h,e,t,i[0],i[1],i[2],i[3]),a+=this.getLineLength(n.x,n.y,s.x,s.y),n=s;return a;case C.ARC:{a=0;var u=i[4],l=i[5],g=i[4]+l,c=Math.PI/180;if(Math.abs(u-g)g;h-=c)s=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),a+=this.getLineLength(n.x,n.y,s.x,s.y),n=s;else for(h=u+c;h5&&arguments[5]!==void 0?arguments[5]:t,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:r,h=(a-r)/(i-t+be),u=Math.sqrt(e*e/(1+h*h));it)return null;var{dataArray:a}=this;for(var n of a){if(n&&(n.pathLength<5e-5||r+n.pathLength+5e-5=0&&h>g)break;i=this.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],h,n.points[6]);break}case C.CURVE_TO:h=s/n.pathLength,h>1&&(h=1),i=this.getPointOnCubicBezier(h,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);break;case C.QUAD_TO:h=s/n.pathLength,h>1&&(h=1),i=this.getPointOnQuadraticBezier(h,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3]);break}if(i)return i;break}return null}getLineLength(e,t,r,i){return Math.sqrt((r-e)*(r-e)+(i-t)*(i-t))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((e,t)=>t.pathLength>0?e+t.pathLength:e,0)),this.pathLength}getPointOnCubicBezier(e,t,r,i,a,n,s,h,u){var l=h*kt(e)+n*Dt(e)+i*Lt(e)+t*_t(e),g=u*kt(e)+s*Dt(e)+a*Lt(e)+r*_t(e);return{x:l,y:g}}getPointOnQuadraticBezier(e,t,r,i,a,n,s){var h=n*It(e)+i*Bt(e)+t*zt(e),u=s*It(e)+a*Bt(e)+r*zt(e);return{x:h,y:u}}getPointOnEllipticalArc(e,t,r,i,a,n){var s=Math.cos(n),h=Math.sin(n),u={x:r*Math.cos(a),y:i*Math.sin(a)};return{x:e+(u.x*s-u.y*h),y:t+(u.x*h+u.y*s)}}buildEquidistantCache(e,t){var r=this.getPathLength(),i=t||.25,a=e||r/100;if(!this.equidistantCache||this.equidistantCache.step!==a||this.equidistantCache.precision!==i){this.equidistantCache={step:a,precision:i,points:[]};for(var n=0,s=0;s<=r;s+=i){var h=this.getPointOnPath(s),u=this.getPointOnPath(s+i);!h||!u||(n+=this.getLineLength(h.x,h.y,u.x,u.y),n>=a&&(this.equidistantCache.points.push({x:h.x,y:h.y,distance:s}),n-=a))}}}getEquidistantPointOnPath(e,t,r){if(this.buildEquidistantCache(t,r),e<0||e-this.getPathLength()>5e-5)return null;var i=Math.round(e/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[i]||null}}var Di=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class Li extends pe{constructor(e,t,r){super(e,t,r),this.type="image",this.loaded=!1;var i=this.getHrefAttribute().getString();if(i){var a=i.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(i);e.images.push(this),a?this.loadSvg(i):this.loadImage(i),this.isSvg=a}}loadImage(e){var t=this;return ie(function*(){try{var r=yield t.document.createImage(e);t.image=r}catch(i){console.error('Error while loading image "'.concat(e,'":'),i)}t.loaded=!0})()}loadSvg(e){var t=this;return ie(function*(){var r=Di.exec(e);if(r){var i=r[5];r[4]==="base64"?t.image=atob(i):t.image=decodeURIComponent(i)}else try{var a=yield t.document.fetch(e),n=yield a.text();t.image=n}catch(s){console.error('Error while loading image "'.concat(e,'":'),s)}t.loaded=!0})()}renderChildren(e){var{document:t,image:r,loaded:i}=this,a=this.getAttribute("x").getPixels("x"),n=this.getAttribute("y").getPixels("y"),s=this.getStyle("width").getPixels("x"),h=this.getStyle("height").getPixels("y");if(!(!i||!r||!s||!h)){if(e.save(),e.translate(a,n),this.isSvg){var u=t.canvg.forkString(e,this.image,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:s,scaleHeight:h});u.document.documentElement.parent=this,u.render()}else{var l=this.image;t.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:s,desiredWidth:l.width,height:h,desiredHeight:l.height}),this.loaded&&(typeof l.complete>"u"||l.complete)&&e.drawImage(l,0,0)}e.restore()}}getBoundingBox(){var e=this.getAttribute("x").getPixels("x"),t=this.getAttribute("y").getPixels("y"),r=this.getStyle("width").getPixels("x"),i=this.getStyle("height").getPixels("y");return new K(e,t,e+r,t+i)}}class _i extends pe{constructor(){super(...arguments),this.type="symbol"}render(e){}}class Ii{constructor(e){this.document=e,this.loaded=!1,e.fonts.push(this)}load(e,t){var r=this;return ie(function*(){try{var{document:i}=r,a=yield i.canvg.parser.load(t),n=a.getElementsByTagName("font");Array.from(n).forEach(s=>{var h=i.createElement(s);i.definitions[e]=h})}catch(s){console.error('Error while loading font "'.concat(t,'":'),s)}r.loaded=!0})()}}class ir extends V{constructor(e,t,r){super(e,t,r),this.type="style";var i=xe(Array.from(t.childNodes).map(n=>n.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")),a=i.split("}");a.forEach(n=>{var s=n.trim();if(s){var h=s.split("{"),u=h[0].split(","),l=h[1].split(";");u.forEach(g=>{var c=g.trim();if(c){var f=e.styles[c]||{};if(l.forEach(p=>{var y=p.indexOf(":"),T=p.substr(0,y).trim(),b=p.substr(y+1,p.length-y).trim();T&&b&&(f[T]=new A(e,T,b))}),e.styles[c]=f,e.stylesSpecificity[c]=Jr(c),c==="@font-face"){var d=f["font-family"].getString().replace(/"|'/g,""),v=f.src.getString().split(",");v.forEach(p=>{if(p.indexOf('format("svg")')>0){var y=Qt(p);y&&new Ii(e).load(d,y)}})}}})}})}}ir.parseExternalUrl=Qt;class Bi extends pe{constructor(){super(...arguments),this.type="use"}setContext(e){super.setContext(e);var t=this.getAttribute("x"),r=this.getAttribute("y");t.hasValue()&&e.translate(t.getPixels("x"),0),r.hasValue()&&e.translate(0,r.getPixels("y"))}path(e){var{element:t}=this;t&&t.path(e)}renderChildren(e){var{document:t,element:r}=this;if(r){var i=r;if(r.type==="symbol"&&(i=new Te(t,null),i.attributes.viewBox=new A(t,"viewBox",r.getAttribute("viewBox").getString()),i.attributes.preserveAspectRatio=new A(t,"preserveAspectRatio",r.getAttribute("preserveAspectRatio").getString()),i.attributes.overflow=new A(t,"overflow",r.getAttribute("overflow").getString()),i.children=r.children,r.styles.opacity=new A(t,"opacity",this.calculateOpacity())),i.type==="svg"){var a=this.getStyle("width",!1,!0),n=this.getStyle("height",!1,!0);a.hasValue()&&(i.attributes.width=new A(t,"width",a.getString())),n.hasValue()&&(i.attributes.height=new A(t,"height",n.getString()))}var s=i.parent;i.parent=this,i.render(e),i.parent=s}}getBoundingBox(e){var{element:t}=this;return t?t.getBoundingBox(e):null}elementTransform(){var{document:e,element:t}=this;return de.fromElement(e,t)}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}function De(o,e,t,r,i,a){return o[t*r*4+e*4+a]}function Le(o,e,t,r,i,a,n){o[t*r*4+e*4+a]=n}function I(o,e,t){var r=o[e];return r*t}function re(o,e,t,r){return e+Math.cos(o)*t+Math.sin(o)*r}class ar extends V{constructor(e,t,r){super(e,t,r),this.type="feColorMatrix";var i=$(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":{var a=i[0];i=[.213+.787*a,.715-.715*a,.072-.072*a,0,0,.213-.213*a,.715+.285*a,.072-.072*a,0,0,.213-.213*a,.715-.715*a,.072+.928*a,0,0,0,0,0,1,0,0,0,0,0,1];break}case"hueRotate":{var n=i[0]*Math.PI/180;i=[re(n,.213,.787,-.213),re(n,.715,-.715,-.715),re(n,.072,-.072,.928),0,0,re(n,.213,-.213,.143),re(n,.715,.285,.14),re(n,.072,-.072,-.283),0,0,re(n,.213,-.213,-.787),re(n,.715,-.715,.715),re(n,.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()}apply(e,t,r,i,a){for(var{includeOpacity:n,matrix:s}=this,h=e.getImageData(0,0,i,a),u=0;u{h.addBoundingBox(d.getBoundingBox(e))}),i=Math.floor(h.x1),a=Math.floor(h.y1),n=Math.floor(h.width),s=Math.floor(h.height)}var u=this.removeStyles(t,ze.ignoreStyles),l=r.createCanvas(i+n,a+s),g=l.getContext("2d");r.screen.setDefaults(g),this.renderChildren(g),new ar(r,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(g,0,0,i+n,a+s);var c=r.createCanvas(i+n,a+s),f=c.getContext("2d");r.screen.setDefaults(f),t.render(f),f.globalCompositeOperation="destination-in",f.fillStyle=g.createPattern(l,"no-repeat"),f.fillRect(0,0,i+n,a+s),e.fillStyle=f.createPattern(c,"no-repeat"),e.fillRect(0,0,i+n,a+s),this.restoreStyles(t,u)}render(e){}}ze.ignoreStyles=["mask","transform","clip-path"];var Ut=()=>{};class zi extends V{constructor(){super(...arguments),this.type="clipPath"}apply(e){var{document:t}=this,r=Reflect.getPrototypeOf(e),{beginPath:i,closePath:a}=e;r&&(r.beginPath=Ut,r.closePath=Ut),Reflect.apply(i,e,[]),this.children.forEach(n=>{if(!(typeof n.path>"u")){var s=typeof n.elementTransform<"u"?n.elementTransform():null;s||(s=de.fromElement(t,n)),s&&s.apply(e),n.path(e),r&&(r.closePath=a),s&&s.unapply(e)}}),Reflect.apply(a,e,[]),e.clip(),r&&(r.beginPath=i,r.closePath=a)}render(e){}}class Fe extends V{constructor(){super(...arguments),this.type="filter"}apply(e,t){var{document:r,children:i}=this,a=t.getBoundingBox(e);if(a){var n=0,s=0;i.forEach(y=>{var T=y.extraFilterDistance||0;n=Math.max(n,T),s=Math.max(s,T)});var h=Math.floor(a.width),u=Math.floor(a.height),l=h+2*n,g=u+2*s;if(!(l<1||g<1)){var c=Math.floor(a.x),f=Math.floor(a.y),d=this.removeStyles(t,Fe.ignoreStyles),v=r.createCanvas(l,g),p=v.getContext("2d");r.screen.setDefaults(p),p.translate(-c+n,-f+s),t.render(p),i.forEach(y=>{typeof y.apply=="function"&&y.apply(p,0,0,l,g)}),e.drawImage(v,0,0,l,g,c-n,f-s,l,g),this.restoreStyles(t,d)}}}render(e){}}Fe.ignoreStyles=["filter","transform","clip-path"];class Fi extends V{constructor(e,t,r){super(e,t,r),this.type="feDropShadow",this.addStylesFromStyleDefinition()}apply(e,t,r,i,a){}}class Ui extends V{constructor(){super(...arguments),this.type="feMorphology"}apply(e,t,r,i,a){}}class Hi extends V{constructor(){super(...arguments),this.type="feComposite"}apply(e,t,r,i,a){}}class Xi extends V{constructor(e,t,r){super(e,t,r),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}apply(e,t,r,i,a){var{document:n,blurRadius:s}=this,h=n.window?n.window.document.body:null,u=e.canvas;u.id=n.getUniqueId(),h&&(u.style.display="none",h.appendChild(u)),_r(u,t,r,i,a,s),h&&h.removeChild(u)}}class Yi extends V{constructor(){super(...arguments),this.type="title"}}class qi extends V{constructor(){super(...arguments),this.type="desc"}}var ji={svg:Te,rect:er,circle:pi,ellipse:mi,line:yi,polyline:tr,polygon:bi,path:N,pattern:xi,marker:wi,defs:Ai,linearGradient:Ti,radialGradient:Ci,stop:Ei,animate:lt,animateColor:Oi,animateTransform:Si,font:Ni,"font-face":Mi,"missing-glyph":Pi,glyph:Kt,text:he,tspan:Be,tref:Vi,a:Ri,textPath:ki,image:Li,g:ut,symbol:_i,style:ir,use:Bi,mask:ze,clipPath:zi,filter:Fe,feDropShadow:Fi,feMorphology:Ui,feComposite:Hi,feColorMatrix:ar,feGaussianBlur:Xi,title:Yi,desc:qi};function Ht(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),t.push.apply(t,r)}return t}function Wi(o){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:!1,t=document.createElement("img");return e&&(t.crossOrigin="Anonymous"),new Promise((r,i)=>{t.onload=()=>{r(t)},t.onerror=(a,n,s,h,u)=>{i(u)},t.src=o})}),ht.apply(this,arguments)}class ne{constructor(e){var{rootEmSize:t=12,emSize:r=12,createCanvas:i=ne.createCanvas,createImage:a=ne.createImage,anonymousCrossOrigin:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.canvg=e,this.definitions=Object.create(null),this.styles=Object.create(null),this.stylesSpecificity=Object.create(null),this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=t,this.emSize=r,this.createCanvas=i,this.createImage=this.bindCreateImage(a,n),this.screen.wait(this.isImagesLoaded.bind(this)),this.screen.wait(this.isFontsLoaded.bind(this))}bindCreateImage(e,t){return typeof t=="boolean"?(r,i)=>e(r,typeof i=="boolean"?i:t):e}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){var{emSizeStack:e}=this;return e[e.length-1]}set emSize(e){var{emSizeStack:t}=this;t.push(e)}popEmSize(){var{emSizeStack:e}=this;e.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(e=>e.loaded)}isFontsLoaded(){return this.fonts.every(e=>e.loaded)}createDocumentElement(e){var t=this.createElement(e.documentElement);return t.root=!0,t.addStylesFromStyleDefinition(),this.documentElement=t,t}createElement(e){var t=e.nodeName.replace(/^[^:]+:/,""),r=ne.elementTypes[t];return typeof r<"u"?new r(this,e):new li(this,e)}createTextNode(e){return new di(this,e)}setViewBox(e){this.screen.setViewBox(Wi({document:this},e))}}ne.createCanvas=Qi;ne.createImage=$i;ne.elementTypes=ji;function Xt(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),t.push.apply(t,r)}return t}function ce(o){for(var e=1;e2&&arguments[2]!==void 0?arguments[2]:{};this.parser=new rt(r),this.screen=new Ie(e,r),this.options=r;var i=new ne(this,r),a=i.createDocumentElement(t);this.document=i,this.documentElement=a}static from(e,t){var r=arguments;return ie(function*(){var i=r.length>2&&r[2]!==void 0?r[2]:{},a=new rt(i),n=yield a.parse(t);return new Ae(e,n,i)})()}static fromString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=new rt(r),a=i.parseFromString(t);return new Ae(e,a,r)}fork(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ae.from(e,t,ce(ce({},this.options),r))}forkString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ae.fromString(e,t,ce(ce({},this.options),r))}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}render(){var e=arguments,t=this;return ie(function*(){var r=e.length>0&&e[0]!==void 0?e[0]:{};t.start(ce({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},r)),yield t.ready(),t.stop()})()}start(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{documentElement:t,screen:r,options:i}=this;r.start(t,ce(ce({enableRedraw:!0},i),e))}stop(){this.screen.stop()}resize(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(e,t,r)}}export{Ri as AElement,Oi as AnimateColorElement,lt as AnimateElement,Si as AnimateTransformElement,K as BoundingBox,kt as CB1,Dt as CB2,Lt as CB3,_t as CB4,Ae as Canvg,pi as CircleElement,zi as ClipPathElement,Ai as DefsElement,qi as DescElement,ne as Document,V as Element,mi as EllipseElement,ar as FeColorMatrixElement,Hi as FeCompositeElement,Fi as FeDropShadowElement,Xi as FeGaussianBlurElement,Ui as FeMorphologyElement,Fe as FilterElement,j as Font,Ni as FontElement,Mi as FontFaceElement,ut as GElement,Kt as GlyphElement,rr as GradientElement,Li as ImageElement,yi as LineElement,Ti as LinearGradientElement,wi as MarkerElement,ze as MaskElement,Zt as Matrix,Pi as MissingGlyphElement,ei as Mouse,be as PSEUDO_ZERO,rt as Parser,N as PathElement,C as PathParser,xi as PatternElement,L as Point,bi as PolygonElement,tr as PolylineElement,A as Property,It as QB1,Bt as QB2,zt as QB3,Ci as RadialGradientElement,er as RectElement,pe as RenderedElement,ai as Rotate,Te as SVGElement,Ii as SVGFontLoader,si as Scale,Ie as Screen,Jt as Skew,ni as SkewX,hi as SkewY,Ei as StopElement,ir as StyleElement,_i as SymbolElement,Vi as TRefElement,Be as TSpanElement,he as TextElement,ki as TextPathElement,Yi as TitleElement,de as Transform,ii as Translate,li as UnknownElement,Bi as UseElement,Kr as ViewPort,xe as compressSpaces,Ae as default,Jr as getSelectorSpecificity,Xr as normalizeAttributeName,Yr as normalizeColor,Qt as parseExternalUrl,Ki as presets,$ as toNumbers,Fr as trimLeft,Ur as trimRight,Vt as vectorMagnitude,Rt as vectorsAngle,nt as vectorsRatio};