/* MIT License Copyright (c) 2012 - 2025 @jonobr1 / http://jono.fyi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Two=(()=>{var Ae=Object.defineProperty;var Qi=Object.getOwnPropertyDescriptor;var ts=Object.getOwnPropertyNames;var es=Object.prototype.hasOwnProperty;var Se=(e,t)=>{for(var i in t)Ae(e,i,{get:t[i],enumerable:!0})},is=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ts(t))!es.call(e,r)&&r!==i&&Ae(e,r,{get:()=>t[r],enumerable:!(s=Qi(t,r))||s.enumerable});return e};var ss=e=>is(Ae({},"__esModule",{value:!0}),e);var lr={};Se(lr,{default:()=>Yt});var lt={Image:null,isHeadless:!1,shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(i){return this[i]},e.setAttribute=function(i,s){return this[i]=s,this},e},polyfill:function(e,t){return lt.shim(e),typeof t<"u"&&(lt.Image=t),lt.isHeadless=!0,e}};var Le={};Se(Le,{Curve:()=>zt,getAnchorsFromArcData:()=>os,getComponentOnCubicBezier:()=>qt,getControlPoints:()=>ri,getCurveBoundingBox:()=>Oe,getCurveFromPoints:()=>Ce,getCurveLength:()=>Pe,getReflection:()=>he,integrate:()=>si,subdivide:()=>ie});var Me={};Se(Me,{HALF_PI:()=>tt,NumArray:()=>vt,TWO_PI:()=>G,decomposeMatrix:()=>At,getComputedMatrix:()=>le,getEffectiveStrokeWidth:()=>xt,getPoT:()=>Ee,lerp:()=>st,mod:()=>Y,setMatrix:()=>Fe,toFixed:()=>z});var X;typeof window<"u"?X=window:typeof global<"u"?X=global:typeof self<"u"&&(X=self);var ti,G=Math.PI*2,tt=Math.PI*.5;function At(e,t,i,s,r,n){let o;return arguments.length<=1?(o=e.a,t=e.b,i=e.c,s=e.d,r=e.e,n=e.f):o=e,{translateX:r,translateY:n,scaleX:Math.sqrt(o*o+t*t),scaleY:Math.sqrt(i*i+s*s),rotation:180*Math.atan2(t,o)/Math.PI}}function Fe(e){ti=e}function le(e,t){t=t&&t.identity()||new ti;let i=e,s=[];for(;i&&i._matrix;)s.push(i._matrix),i=i.parent;s.reverse();for(let r=0;r0?i/r:i}var b={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var x=class{_events={};_bound=!1;constructor(){}addEventListener(t,i){return(this._events[t]||(this._events[t]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,i){if(!this._events)return this;if(!t&&!i)return this._events={},this._bound=!1,this;let s=t?[t]:Object.keys(this._events);for(let r=0,n=s.length;r=4){let n=arguments[0]-arguments[2],o=arguments[1]-arguments[3];return Math.atan2(o,n)}let s=t.x-i.x,r=t.y-i.y;return Math.atan2(r,s)}static distanceBetween(t,i){return Math.sqrt(e.distanceBetweenSquared(t,i))}static distanceBetweenSquared(t,i){let s=t.x-i.x,r=t.y-i.y;return s*s+r*r}set(t,i){return this.x=t,this.y=i,this}copy(t){return this.x=t.x,this.y=t.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new e(this.x,this.y)}add(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x+=t,this.y+=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x+=t.x,this.y+=t.y):(this.x+=t,this.y+=i),this)}addSelf(t){return this.add.apply(this,arguments)}sub(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x-=t,this.y-=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x-=t.x,this.y-=t.y):(this.x-=t,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(t){return this.sub.apply(this,arguments)}subtractSelf(t){return this.sub.apply(this,arguments)}multiply(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x*=t,this.y*=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x*=t.x,this.y*=t.y):(this.x*=t,this.y*=i),this)}multiplySelf(t){return this.multiply.apply(this,arguments)}multiplyScalar(t){return this.multiply(t)}divide(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x/=t,this.y/=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x/=t.x,this.y/=t.y):(this.x/=t,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(t){return this.divide.apply(this,arguments)}divideScalar(t){return this.divide(t)}negate(){return this.multiply(-1)}dot(t){return this.x*t.x+this.y*t.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let i=this.x-t.x,s=this.y-t.y;return i*i+s*s}setLength(t){return this.normalize().multiplyScalar(t)}equals(t,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(t)"u"?1e-4:t,this.length()>1,c=s&1?n[l++]*e(a):0;for(;l=0&&t<4294967296}var k={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){let t=typeof e;return t==="function"||t==="object"&&!!e},isFunction:function(e){return typeof e=="function"},extend:function(e){let t=ni.call(arguments,1);for(let i=0;i0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}pop(){let t=super.pop.apply(this,arguments);return this.trigger(x.Types.remove,[t]),t}shift(){let t=super.shift.apply(this,arguments);return this.trigger(x.Types.remove,[t]),t}push(){let t=super.push.apply(this,arguments);return this.trigger(x.Types.insert,arguments),t}unshift(){let t=super.unshift.apply(this,arguments);return this.trigger(x.Types.insert,arguments),t}splice(){let t=super.splice.apply(this,arguments);if(this.trigger(x.Types.remove,t),arguments.length>2){let i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(x.Types.insert,i),this.trigger(x.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(x.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(x.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,i){let s=[];for(let r=0;r0&&typeof s.height=="number"&&s.height>0?r():!lt.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=e.getAbsoluteURL(t._src),!(!lt.isHeadless&&s&&s.getAttribute("two-src"))&&(lt.isHeadless||s.setAttribute("two-src",t.src),e.ImageRegistry.add(t.src,s),lt.isHeadless?e.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,i){if(lt.isHeadless)throw new it("video textures are not implemented in headless environments.");let s=function(n){t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof i=="function"&&i()},r=function(n){throw t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),new it("unable to load "+t.src)};t._src=e.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),e.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?s():(t.image.addEventListener("canplaythrough",s,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}};static load(t,i){let s=t.image,r=e.getTag(s);t._flagImage&&(/canvas/i.test(r)?e.Register.canvas(t,i):(t._src=!lt.isHeadless&&s.getAttribute("two-src")||s.src,e.Register[r](t,i))),t._flagSrc&&(s||(s=e.getImage(t.src),t.image=s),r=e.getTag(s),e.Register[r](t,i))}clone(){let t=new e(this.src);return t.repeat=this.repeat,t.offset.copy(this.offset),t.scale=this.scale,t}copy(t){return this.src=t.src,this.repeat=t.repeat,this.offset=typeof t.offset=="number"||t.offset instanceof w?t.offset:new w().copy(t.offset),this.scale=typeof t.scale=="number"||t.scale instanceof w?t.scale:new w().copy(t.scale),this}toObject(){let t=super.toObject.call(this);return t.renderer.type="texture",t.src=this.src,t.repeat=this.repeat,t.offset=this.offset.toObject(),t.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),t}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(x.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,e.load(this,function(){this.loaded=!0,this.trigger(x.Types.change).trigger(x.Types.load)}.bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){let t=this._renderer.elem;t.parentNode.removeChild(t)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},li={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){let t=V.getTag(e),i;switch(t){case"canvas":i="#"+e.id;break;default:i=e.src}V.ImageRegistry.contains(i)?this._image=V.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(x.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(x.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof w&&this._scale.unbind(x.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof w&&this._scale.bind(x.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function fs(){this._flagOffset=!0}function cs(){this._flagScale=!0}var dt=class e extends yt{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";constructor(t,i,s){super();for(let r in hi)Object.defineProperty(this,r,hi[r]);this._renderer.type="stop",this.offset=typeof t=="number"?t:e.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof i=="string"?i:e.Index<=0?"#fff":"#000",e.Index=(e.Index+1)%2}static Index=0;static Properties=["offset","opacity","color"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}copy(t){super.copy.call(this,t);for(let i=0;i{t[i]=this[i]},this),t}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},hi={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}};var q=class e extends yt{_flagStops=!1;_flagSpread=!1;_flagUnits=!1;_spread="";_units="";constructor(t){super();for(let i in fi)Object.defineProperty(this,i,fi[i]);this._renderer.type="gradient",this._renderer.flagStops=us.bind(this),this._renderer.bindStops=ds.bind(this),this._renderer.unbindStops=ps.bind(this),this.spread="pad",this.units="objectBoundingBox",t&&(this.stops=t)}static Stop=dt;static Properties=["spread","stops","units"];static fromObject(t){let i=t.stops;i&&i.length>0&&(i=i.map(r=>r instanceof dt?r:new dt().copy(r)));let s=new e(i).copy(t);return"id"in t&&(s.id=t.id),s}clone(t){let i=this.stops.map(r=>r.clone()),s=new e(i);return k.each(e.Properties,r=>{s[r]=this[r]},this),t&&t.add(s),s}copy(t){super.copy.call(this,t);for(let i=0;ii.toObject())};return k.each(e.Properties,i=>{t[i]=this[i]},this),t}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(x.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){let t=this._renderer.elem;t.parentNode.removeChild(t)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},fi={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){let t=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(x.Types.insert,t).unbind(x.Types.remove,i),this._stops=new ft((e||[]).slice(0)),this._stops.bind(x.Types.insert,t).bind(x.Types.remove,i),t(this._stops)}}};function us(){this._flagStops=!0}function ds(e){let t=e.length;for(;t--;)e[t].bind(x.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function ps(e){let t=e.length;for(;t--;)e[t].unbind(x.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var H=class e extends q{_flagEndPoints=!1;_left=null;_right=null;constructor(t,i,s,r,n){super(n);for(let o in ci)Object.defineProperty(this,o,ci[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=_s.bind(this),this.left=new w,this.right=new w,typeof t=="number"&&(this.left.x=t),typeof i=="number"&&(this.left.y=i),typeof s=="number"&&(this.right.x=s),typeof r=="number"&&(this.right.y=r)}static Stop=dt;static Properties=["left","right"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}copy(t){super.copy.call(this,t);for(let i=0;i=s)return s-r>=0;r+=o}return!1}function Jt(e,t){let i=e._length;if(t<=0)return 0;if(t>=i)return e._lengths.length-1;for(let s=0,r=0;s=t)return t-=r,Math.max(s-1,0)+t/e._lengths[s];r+=e._lengths[s]}return-1}function Ie(e,t,i){let s,r,n,o,a,l,h,c,f=t.controls&&t.controls.right,u=e.controls&&e.controls.left;return s=t.x,a=t.y,r=(f||t).x,l=(f||t).y,n=(u||e).x,h=(u||e).y,o=e.x,c=e.y,f&&t._relative&&(r+=t.x,l+=t.y),u&&e._relative&&(n+=e.x,h+=e.y),Pe(s,a,r,l,n,h,o,c,i)}function se(e,t,i){let s,r,n,o,a,l,h,c,f=t.controls&&t.controls.right,u=e.controls&&e.controls.left;return s=t.x,a=t.y,r=(f||t).x,l=(f||t).y,n=(u||e).x,h=(u||e).y,o=e.x,c=e.y,f&&t._relative&&(r+=t.x,l+=t.y),u&&e._relative&&(n+=e.x,h+=e.y),ie(s,a,r,l,n,h,o,c,i)}function St(e){switch(e.renderer.type){case"texture":return V.fromObject(e);case"gradient":return q.fromObject(e);case"linear-gradient":return H.fromObject(e);case"radial-gradient":return W.fromObject(e)}return e}var ys=Math.cos,xs=Math.sin,di=Math.tan,Ne=[],bt=class e extends x{elements=new vt(9);manual=!1;constructor(t,i,s,r,n,o){super();let a=t;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}static Identity=[1,0,0,0,1,0,0,0,1];static Multiply(t,i,s){if(i.length<=3){let T=t,A,E,P,F=i[0]||0,I=i[1]||0,C=i[2]||0;return A=T[0]*F+T[1]*I+T[2]*C,E=T[3]*F+T[4]*I+T[5]*C,P=T[6]*F+T[7]*I+T[8]*C,[A,E,P]}let r=t[0],n=t[1],o=t[2],a=t[3],l=t[4],h=t[5],c=t[6],f=t[7],u=t[8],p=i[0],d=i[1],_=i[2],m=i[3],g=i[4],y=i[5],v=i[6],S=i[7],R=i[8];return s=s||new vt(9),s[0]=r*p+n*m+o*v,s[1]=r*d+n*g+o*S,s[2]=r*_+n*y+o*R,s[3]=a*p+l*m+h*v,s[4]=a*d+l*g+h*S,s[5]=a*_+l*y+h*R,s[6]=c*p+f*m+u*v,s[7]=c*d+f*g+u*S,s[8]=c*_+f*y+u*R,s}static fromObject(t){return new e().copy(t)}set(t,i,s,r,n,o,a,l,h){if(typeof i>"u"){let c=t;t=c[0],i=c[1],s=c[2],r=c[3],n=c[4],o=c[5],a=c[6],l=c[7],h=c[8]}return this.elements[0]=t,this.elements[1]=i,this.elements[2]=s,this.elements[3]=r,this.elements[4]=n,this.elements[5]=o,this.elements[6]=a,this.elements[7]=l,this.elements[8]=h,this.trigger(x.Types.change)}copy(t){return this.elements[0]=t.elements[0],this.elements[1]=t.elements[1],this.elements[2]=t.elements[2],this.elements[3]=t.elements[3],this.elements[4]=t.elements[4],this.elements[5]=t.elements[5],this.elements[6]=t.elements[6],this.elements[7]=t.elements[7],this.elements[8]=t.elements[8],this.manual=t.manual,this.trigger(x.Types.change)}identity(){return this.elements[0]=e.Identity[0],this.elements[1]=e.Identity[1],this.elements[2]=e.Identity[2],this.elements[3]=e.Identity[3],this.elements[4]=e.Identity[4],this.elements[5]=e.Identity[5],this.elements[6]=e.Identity[6],this.elements[7]=e.Identity[7],this.elements[8]=e.Identity[8],this.trigger(x.Types.change)}multiply(t,i,s,r,n,o,a,l,h){if(typeof i>"u")return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.trigger(x.Types.change);if(typeof s>"u"&&(s=1),typeof r>"u"){t=t||0,i=i||0,s=s||0,n=this.elements;let N=n[0]*t+n[1]*i+n[2]*s,et=n[3]*t+n[4]*i+n[5]*s,at=n[6]*t+n[7]*i+n[8]*s;return[N,et,at]}let c=this.elements,f=[t,i,s,r,n,o,a,l,h],u=c[0],p=c[1],d=c[2],_=c[3],m=c[4],g=c[5],y=c[6],v=c[7],S=c[8],R=f[0],T=f[1],A=f[2],E=f[3],P=f[4],F=f[5],I=f[6],C=f[7],j=f[8];return this.elements[0]=u*R+p*E+d*I,this.elements[1]=u*T+p*P+d*C,this.elements[2]=u*A+p*F+d*j,this.elements[3]=_*R+m*E+g*I,this.elements[4]=_*T+m*P+g*C,this.elements[5]=_*A+m*F+g*j,this.elements[6]=y*R+v*E+S*I,this.elements[7]=y*T+v*P+S*C,this.elements[8]=y*A+v*F+S*j,this.trigger(x.Types.change)}inverse(t){let i=this.elements;t=t||new e;let s=i[0],r=i[1],n=i[2],o=i[3],a=i[4],l=i[5],h=i[6],c=i[7],f=i[8],u=f*a-l*c,p=-f*o+l*h,d=c*o-a*h,_=s*u+r*p+n*d;return _?(_=1/_,t.elements[0]=u*_,t.elements[1]=(-f*r+n*c)*_,t.elements[2]=(l*r-n*a)*_,t.elements[3]=p*_,t.elements[4]=(f*s-n*h)*_,t.elements[5]=(-l*s+n*o)*_,t.elements[6]=d*_,t.elements[7]=(-c*s+r*h)*_,t.elements[8]=(a*s-r*o)*_,t):null}scale(t,i){return arguments.length<=1&&(i=t),this.multiply(t,0,0,0,i,0,0,0,1)}rotate(t){let i=ys(t),s=xs(t);return this.multiply(i,-s,0,s,i,0,0,0,1)}translate(t,i){return this.multiply(1,0,t,0,1,i,0,0,1)}skewX(t){let i=di(t);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(t){let i=di(t);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(t){return Ne.length=0,this.toTransformArray(t,Ne),Ne.map(z).join(" ")}toTransformArray(t,i){let s=this.elements,r=!!i,n=s[0],o=s[1],a=s[2],l=s[3],h=s[4],c=s[5];if(t){let f=s[6],u=s[7],p=s[8];if(r){i[0]=n,i[1]=l,i[2]=f,i[3]=o,i[4]=h,i[5]=u,i[6]=a,i[7]=c,i[8]=p;return}return[n,l,f,o,h,u,a,c,p]}if(r){i[0]=n,i[1]=l,i[2]=o,i[3]=h,i[4]=a,i[5]=c;return}return[n,l,o,h,a,c]}toArray(t,i){let s=this.elements,r=!!i,n=s[0],o=s[1],a=s[2],l=s[3],h=s[4],c=s[5];if(t){let f=s[6],u=s[7],p=s[8];if(r){i[0]=n,i[1]=o,i[2]=a,i[3]=l,i[4]=h,i[5]=c,i[6]=f,i[7]=u,i[8]=p;return}return[n,o,a,l,h,c,f,u,p]}if(r){i[0]=n,i[1]=o,i[2]=a,i[3]=l,i[4]=h,i[5]=c;return}return[n,o,a,l,h,c]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new e().copy(this)}};Fe(bt);var ct=class e extends yt{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let t in ce)Object.defineProperty(this,t,ce[t]);this._renderer.flagMatrix=pi.bind(this),this.isShape=!0,this.matrix=new bt,this.worldMatrix=new bt,this.position=new w,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static Properties=["position","rotation","scale","skewX","skewY","matrix","worldMatrix"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get translation(){return ce.position.get.apply(this,arguments)}set translation(t){ce.position.set.apply(this,arguments)}addTo(t){return t.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(t,i,s){let r=s||{},n=r.ignoreVisibility===!0;if(!n&&"visible"in this&&this.visible===!1||!n&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;let o=typeof r.tolerance=="number"?r.tolerance:0;this._update(!0);let a=this.getBoundingClientRect();return a?t>=a.left-o&&t<=a.right+o&&i>=a.top-o&&i<=a.bottom+o:!1}copy(t){return super.copy.call(this,t),"position"in t&&(t.position instanceof w?this.position=t.position:this.position.copy(t.position)),"rotation"in t&&(this.rotation=t.rotation),"scale"in t&&(this.scale=typeof t.scale=="number"||t.scale instanceof w?t.scale:new w(t.scale.x,t.scale.y)),"skewX"in t&&(this.skewX=t.skewX),"skewY"in t&&(this.skewY=t.skewY),"matrix"in t&&t.matrix.manual&&(this.matrix.copy(t.matrix),this.matrix.manual=!0),this}clone(t){let i=new e;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),t&&t.add(i),i._update()}toObject(){let t=super.toObject.call(this);return t.renderer={type:"shape"},t.isShape=!0,t.translation=this.translation.toObject(),t.rotation=this.translation.rotation,t.scale=this.scale instanceof w?this.scale.toObject():this.scale,t.skewX=this.skewX,t.skewY=this.skewY,t.matrix=this.matrix.toObject(),t}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(t){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof w?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),t&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}},ce={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(x.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(x.Types.change,this._renderer.flagMatrix),pi.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof w&&this._scale.unbind(x.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof w&&this._scale.bind(x.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return le(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function pi(){this._flagMatrix=!0}var gi=/^(?:none|transparent)$/i,bs=8,Ve=Number.EPSILON;function Pt(e,t){return{x:e,y:t}}function ue(e,t,i=Ve){return Math.abs(e.x-t.x)<=i&&Math.abs(e.y-t.y)<=i}function _i(e,t,i,s){let r=e*i+t*s,n=Math.sqrt(e*e+t*t)*Math.sqrt(i*i+s*s)||1e-12,o=Math.acos(Math.max(-1,Math.min(1,r/n)));return e*s-t*i<0&&(o=-o),o}function ws(e,t,i){if(!e)return[Pt(t.x,t.y)];let s=t.rx,r=t.ry;if(!(s&&r))return[Pt(t.x,t.y)];let n=(t.xAxisRotation||0)*Math.PI/180,o=t.largeArcFlag?1:0,a=t.sweepFlag?1:0;s=Math.abs(s),r=Math.abs(r);let l=e.x,h=e.y,c=t.x,f=t.y,u=(l-c)/2,p=(h-f)/2,d=Math.cos(n),_=Math.sin(n),m=d*u+_*p,g=-_*u+d*p,y=s*s,v=r*r,S=m*m/y+g*g/v;if(S>1){let K=Math.sqrt(S);s*=K,r*=K,y=s*s,v=r*r}let R=y*g*g+v*m*m,T=R===0?0:(y*v-R)/R,A=Math.sqrt(Math.max(0,T));o===a&&(A=-A);let E=A*s*g/r,P=-A*r*m/s,F=d*E-_*P+(l+c)/2,I=_*E+d*P+(h+f)/2,C=_i(1,0,(m-E)/s,(g-P)/r),j=_i((m-E)/s,(g-P)/r,(-m-E)/s,(-g-P)/r)%G,N=C+j,et=a===0,at=(()=>{let K=N-C,gt=Math.abs(K)0?e._renderer.vertices:e.vertices;if(!r||r.length===0)return{polygons:i,segments:s};let n=Math.max(1,Math.floor(t)),o=null,a=null,l=null,h=null,c=(u=!1)=>{if(o){if(u&&a&&l&&!ue(a,l)){let p=Pt(a.x,a.y);s.push({a:l,b:p}),o.push(p),l=p}o.length>=3&&a&&l&&ue(a,l)&&i.push(o),o=null,a=null,l=null}},f=u=>{if(!l){l=u,o&&o.push(u);return}ue(l,u)||(s.push({a:l,b:u}),o&&o.push(u),l=u)};for(let u=0;ui!=l.y>i&&t<(l.x-h.x)*(i-h.y)/(l.y-h.y||1e-12)+h.x&&(s=!s),o=a}}return s}function vs(e,t,i,s){let r=s.x-i.x,n=s.y-i.y;if(Math.abs(r)0;if(!(i>0))return!1;let s=e.stroke;return!s&&s!==0?!1:typeof s=="string"?!gi.test(s):!0}function vi(e,t,i,s=0){if(!e)return!1;let r=e.left-s,n=e.right+s,o=e.top-s,a=e.bottom+s;return t>=r&&t<=n&&i>=o&&i<=a}var de=Number.EPSILON;function pe(e){return typeof e.relative!="boolean"||!!e.relative}function kt(e,t,i,s){let r=e.controls;if(!(!r||!r[t])){if(Math.abs(i)de||Math.abs(i.y)>de}function _e(e){e.command===b.move||e.command===b.close||(e.command=Qt(e,"left")||Qt(e,"right")?b.curve:b.line)}function je(e,t){typeof t.relative=="boolean"&&(e.relative=t.relative)}function Ri(e,t){return Qt(t,"right")||Qt(e,"left")||Qt(e,"right")||Qt(t,"left")||e.command===b.curve||t.command===b.curve}function Zt(e,t,i){return{x:st(e.x,t.x,i),y:st(e.y,t.y,i)}}function ki(e,t){let i=e.controls&&e.controls[t];return i?pe(e)?{x:e.x+i.x,y:e.y+i.y}:{x:i.x,y:i.y}:{x:e.x,y:e.y}}function Ai(e,t,i){let s=e.controls&&e.controls.right,r=t.controls&&t.controls.left,n={x:e.x,y:e.y},o=s?ki(e,"right"):{...n},a={x:t.x,y:t.y},l=r?ki(t,"left"):{...a},h=Zt(n,o,i),c=Zt(o,l,i),f=Zt(l,a,i),u=Zt(h,c,i),p=Zt(c,f,i),d=Zt(u,p,i),_=new O(d.x,d.y);return je(_,e),kt(_,"left",u.x-d.x,u.y-d.y),kt(_,"right",p.x-d.x,p.y-d.y),_.command=b.curve,{anchor:_,startOut:h,endIn:f}}function Si(e,t,i,s,r,n){let o=e.length,a=i-t+1,l=a-1,h=r?Math.min(a,4):1,c=h,f=h;if(s||(c=Math.min(1,t),f=Math.min(1,o-i-1)),l+=c+f,l<=1)return;let u=new Array(l+1);for(let A=0,E=t-c;A<=l;A+=1,E+=1){let P=Y(E,o);u[A]=e[P]}let p=u[0].x+2*u[1].x,d=u[0].y+2*u[1].y,_=2,m=l-1,g=[p],y=[d],v=[_],S=new Array(l+1),R=new Array(l+1);for(let A=1;A=0;A-=1)S[A]=(g[A]-S[A+1])/v[A],R[A]=(y[A]-R[A+1])/v[A];S[l]=(3*u[l].x-S[m])/2,R[l]=(3*u[l].y-R[m])/2;let T=l-f;for(let A=c,E=t;A<=T;A+=1,E+=1){let P=Y(E,o),F=e[P],I=S[A]-F.x,C=R[A]-F.y;r||Ac?kt(F,"left",-I,-C):pt(F,"left"),_e(F)}}function Rs(e,t,i,s,r,n){let o=t||e,a=e,l=i||e,h=w.distanceBetween(o,a),c=w.distanceBetween(a,l),f=s===void 0?.5:s,u=Math.pow(h,f),p=Math.pow(c,f),d=u*u,_=p*p;if(!r&&t){let m=2*_+3*p*u+d,g=3*p*(p+u);if(g!==0){let y=(_*o.x+m*a.x-d*l.x)/g-a.x,v=(_*o.y+m*a.y-d*l.y)/g-a.y;kt(e,"left",y,v)}else pt(e,"left")}else pt(e,"left");if(!n&&i){let m=2*d+3*u*p+_,g=3*u*(u+p);if(g!==0){let y=(d*l.x+m*a.x-_*o.x)/g-a.x,v=(d*l.y+m*a.y-_*o.y)/g-a.y;kt(e,"right",y,v)}else pt(e,"right")}else pt(e,"right");_e(e)}function As(e,t,i,s,r,n){if(!(t&&i)){t||pt(e,"left"),i||pt(e,"right"),_e(e);return}let o=t,a=e,l=i,h=w.distanceBetween(o,a),c=w.distanceBetween(a,l),f=h+c,u=s===void 0?.4:s,p={x:o.x-l.x,y:o.y-l.y};if(!r&&f!==0){let d=u*h/f;kt(e,"left",p.x*d,p.y*d)}else pt(e,"left");if(!n&&f!==0){let d=u*h/f-u;kt(e,"right",p.x*d,p.y*d)}else pt(e,"right");_e(e)}function Ti(e,t,i,s,r,n){let o=n.type||"catmull-rom",a=n.factor,l=e.length;for(let h=t;h<=i;h+=1){let c=Y(h,l),f=e[c];if(f.command===b.move){pt(f,"left"),pt(f,"right");continue}let u=h===t&&!r?null:h-1,p=h===i&&!r?null:h+1,d=u===null?null:e[Y(u,l)],_=p===null?null:e[Y(p,l)],m=u===null,g=p===null;o==="geometric"?As(f,d,_,a,m,g):Rs(f,d,_,a,m,g)}}var te=Math.min,ee=Math.max,Ss=Math.ceil,Ts=Math.floor,Fs=new w,Es=new bt,L=class e extends ct{_flagVertices=!0;_flagLength=!0;_flagFill=!0;_flagStroke=!0;_flagLinewidth=!0;_flagOpacity=!0;_flagVisible=!0;_flagCap=!0;_flagJoin=!0;_flagMiter=!0;_flagStrokeAttenuation=!0;_flagMask=!1;_flagClip=!1;_length=0;_fill="#fff";_stroke="#000";_linewidth=1;_opacity=1;_visible=!0;_cap="round";_join="round";_miter=4;_closed=!0;_curved=!1;_automatic=!0;_beginning=0;_ending=1;_mask=null;_clip=!1;_dashes=null;_strokeAttenuation=!0;constructor(t,i,s,r){super();for(let n in Fi)Object.defineProperty(this,n,Fi[n]);this._renderer.type="path",this._renderer.flagVertices=ze.bind(this),this._renderer.bindVertices=Ue.bind(this),this._renderer.unbindVertices=De.bind(this),this._renderer.flagFill=He.bind(this),this._renderer.flagStroke=We.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!s,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=t,this.automatic=!r,this.dashes=[],this.dashes.offset=0}static Properties=["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"];static Utils={getCurveLength:Ie};static fromObject(t){let i=typeof t.fill=="string"?t.fill:St(t.fill),s=typeof t.stroke=="string"?t.stroke:St(t.stroke),r=new e().copy({...t,fill:i,stroke:s});return"id"in t&&(r.id=t.id),r}copy(t){if(super.copy.call(this,t),t.vertices){this.vertices=[];for(let i=0;ii.toObject()),k.each(e.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?t[i]=this[i].toObject():t[i]=this[i])},this),t}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let t=0;t0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){let{scaleX:u,scaleY:p}=At(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof u=="number"&&typeof p=="number"&&(s=Math.max(u,p)*(this.linewidth||0)/2)}else s*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(r<=0)return{width:0,height:0};for(n=0;na.right+o||ia.bottom+o)return!1;let l=this.worldMatrix,h=l&&l.inverse(Es);if(!h)return super.contains(t,i,r);let[c,f]=h.multiply(t,i,1),u=typeof r.precision=="number"&&!Number.isNaN(r.precision)?Math.max(1,Math.floor(r.precision)):8,p=bi(this,r.fill),d=wi(this,r.stroke),{polygons:_,segments:m}=mi(this,u);if(p&&_.length>0&&yi(_,c,f))return!0;if(d&&m.length>0){let g=typeof this.linewidth=="number"?this.linewidth:0;if(g>0&&xi(m,c,f)<=g/2+o)return!0}return!p&&!d?super.contains(t,i,r):p&&_.length===0?super.contains(t,i,r):!1}getPointAt(t,i){let s,r,n,o,a,l,h,c,f,u,p,d,_,m,g,y=this.length*Math.min(Math.max(t,0),1),v=this.vertices.length,S=v-1,R=null,T=null;for(let Z=0,ht=this._lengths.length,K=0;Z=y){this._closed?(s=Y(Z,v),r=Y(Z-1,v),Z===0&&(s=r,r=Z)):(s=Z,r=Math.min(Math.max(Z-1,0),S)),R=this.vertices[s],T=this.vertices[r],y-=K,this._lengths[Z]!==0?t=y/this._lengths[Z]:t=0;break}K+=this._lengths[Z]}if(R===null||T===null)return null;if(R){if(!T)return R}else return T;g=T.controls&&T.controls.right,m=R.controls&&R.controls.left,a=T.x,u=T.y,l=(g||T).x,p=(g||T).y,h=(m||R).x,d=(m||R).y,c=R.x,_=R.y,g&&T.relative&&(l+=T.x,p+=T.y),m&&R.relative&&(h+=R.x,d+=R.y),o=qt(t,a,l,h,c),f=qt(t,u,p,d,_);let A=st(a,l,t),E=st(u,p,t),P=st(l,h,t),F=st(p,d,t),I=st(h,c,t),C=st(d,_,t),j=st(A,P,t),N=st(E,F,t),et=st(P,I,t),at=st(F,C,t);return k.isObject(i)?(i.x=o,i.y=f,i instanceof O&&(i.controls.left.x=j,i.controls.left.y=N,i.controls.right.x=et,i.controls.right.y=at,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=o,i.controls.left.y-=f,i.controls.right.x-=o,i.controls.right.y-=f)),i.t=t,i):(n=new O(o,f,j-o,N-f,et-o,at-f,this._curved?b.curve:b.line),n.t=t,n)}plot(){if(this.curved)return Ce(this._collection,this.closed),this;for(let t=0;t0&&r[n-1]&&r[n-1].command===b.close,a=(u,p)=>{if(u==null)return p;if(typeof u=="number"){if(o)return Y(u,n);let _=u;return _<0&&(_+=n),Math.min(Math.max(_,0),n-1)}let d=r.indexOf(u);return d!==-1?d:p},l=o&&i.from===void 0&&i.to===void 0,h=a(i.from,0),c=a(i.to,n-1);if(h>c)if(o)h-=n;else{let u=h;h=c,c=u}let f=c-h+1;for(let u=0;u"u"&&(this._lengths=[]),k.each(this.vertices,function(l,h){if(h<=0&&!n||l.command===b.move){o=l,this._lengths[h]=0;return}this._lengths[h]=Ie(l,o,t),a+=this._lengths[h],o=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);let t=this._collection.length,i=this._closed,s=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),n=Jt(this,s*this._length),o=Jt(this,r*this._length),a=Ss(n),l=Ts(o),h,c,f,u,p,d;for(this._renderer.vertices.length=0,d=0;dl&&!c?(p=this._renderer.collection[d].copy(this._collection[d]),this.getPointAt(r,p),p.command=this._renderer.collection[d].command,this._renderer.vertices.push(p),c=p,f=this._collection[d-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[d-1].controls.right.copy(f.controls.right).lerp(w.zero,1-p.t):this._renderer.collection[d-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):d>=a&&d<=l&&(p=this._renderer.collection[d].copy(this._collection[d]),this._renderer.vertices.push(p),d===l&&Be(this,r)?(c=p,!i&&c.controls&&(c.relative?c.controls.right.clear():c.controls.right.copy(c))):d===a&&Be(this,s)&&(h=p,h.command=b.move,!i&&h.controls&&(h.relative?h.controls.left.clear():h.controls.left.copy(h))));a>0&&!h&&(d=a-1,p=this._renderer.collection[d].copy(this._collection[d]),this.getPointAt(s,p),p.command=b.move,this._renderer.vertices.unshift(p),u=this._collection[d+1],u&&u.controls&&(p.controls.left.clear(),u.relative?this._renderer.collection[d+1].controls.left.copy(u.controls.left).lerp(w.zero,p.t):(Fs.copy(u),this._renderer.collection[d+1].controls.left.copy(u.controls.left).lerp(u,p.t))))}return ct.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,ct.prototype.flagReset.call(this),this}},Fi={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof q||this._fill instanceof H||this._fill instanceof W||this._fill instanceof V)&&this._fill.unbind(x.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof q||this._fill instanceof H||this._fill instanceof W||this._fill instanceof V)&&this._fill.bind(x.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof q||this._stroke instanceof H||this._stroke instanceof W||this._stroke instanceof V)&&this._stroke.unbind(x.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof q||this._stroke instanceof H||this._stroke instanceof W||this._stroke instanceof V)&&this._stroke.bind(x.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;let t=this._automatic?"ignore":"listen";k.each(this.vertices,function(i){i[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){let t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(x.Types.insert,t).unbind(x.Types.remove,i),e instanceof ft?this._collection=e:this._collection=new ft(e||[]),this._collection.bind(x.Types.insert,t).bind(x.Types.remove,i),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,k.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(e){this._strokeAttenuation=!!e,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ze(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Ue(e){let t=e.length;for(;t--;)e[t].bind(x.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function De(e){let t=e.length;for(;t--;)e[t].unbind(x.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function He(){this._flagFill=!0}function We(){this._flagStroke=!0}var ut=class e extends L{constructor(t,i,s,r){let n=[new O,new O,new O,new O];super(n,!0,!1,!0),this._renderer.type="rectangle";for(let o in Ei)Object.defineProperty(this,o,Ei[o]);this.width=typeof s=="number"?s:1,this.height=typeof r=="number"?r:1,this.origin=new w,typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i),this._update()}static Properties=["width","height","origin"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}copy(t){super.copy.call(this,t);for(let i=0;i0&&(k.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=k.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),h=st(this._firstFrame,u,o/l),h=Math.floor(h),h!==this._index&&(this._index=h,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));let p=this._index%i,d=Math.floor(this._index/i),_=-r*p+(c-r)/2,m=-n*d+(f-n)/2;_!==t.offset.x&&(t.offset.x=_),m!==t.offset.y&&(t.offset.y=m)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Mi={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}};var re=class extends ft{#t={};get ids(){return this.#t}constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),this.attach(t),this.on(x.Types.insert,this.attach),this.on(x.Types.remove,this.detach)}attach(t){for(let i=0;i0,a=this.vertices,l=o?a.length/2:a.length,h,c=0,f,u,p,d,_,m,g,y,v;for(n?l--:o||(l-=2),f=0,u=l-1;f2&&(t-=1);let i=4/3*Math.tan(Math.PI/(t*2)),s=this._radius,r=s*i;for(let n=0;n2&&(t-=1);let i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,r=this._height/2;for(let n=0;ni.toObject()),k.each(e.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?t[i]=this[i].toObject():t[i]=this[i])},this),t}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let t=0;t=n&&h<=o&&(l=this._collection[h],this._renderer.collection.push(l),this._renderer.vertices[a*2+0]=l.x,this._renderer.vertices[a*2+1]=l.y,a++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}},Li={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof q||this._fill instanceof H||this._fill instanceof W||this._fill instanceof V)&&this._fill.unbind(x.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof q||this._fill instanceof H||this._fill instanceof W||this._fill instanceof V)&&this._fill.bind(x.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof q||this._stroke instanceof H||this._stroke instanceof W||this._stroke instanceof V)&&this._stroke.unbind(x.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof q||this._stroke instanceof H||this._stroke instanceof W||this._stroke instanceof V)&&this._stroke.bind(x.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){let t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(x.Types.insert,t).unbind(x.Types.remove,i),e instanceof ft?this._collection=e:this._collection=new ft(e||[]),this._collection.bind(x.Types.insert,t).bind(x.Types.remove,i),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(e){this._strokeAttenuation=!!e,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};var Os=Math.cos,Cs=Math.sin,Ht=class e extends L{_flagWidth=!1;_flagHeight=!1;_flagSides=!1;_radius=0;_width=0;_height=0;_sides=0;constructor(t,i,s,r){r=Math.max(r||0,3),super(),this._renderer.type="polygon";for(let n in Bi)Object.defineProperty(this,n,Bi[n]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof r=="number"&&(this.sides=r),this._update(),typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i)}static Properties=["width","height","sides"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}copy(t){super.copy.call(this,t);for(let i=0;it&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new O(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?b.move:b.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let i=new e(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let s=0;s"u"&&typeof s=="number"&&typeof r=="number"&&(n=Math.floor(Math.min(s,r)/12));let o=[];for(let a=0;a<10;a++)o.push(new O(0,0,0,0,0,0,a===0?b.move:b.curve));super(o),this._renderer.type="rounded-rectangle";for(let a in Ii)Object.defineProperty(this,a,Ii[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Ls.bind(this),typeof s=="number"&&(this.width=s),typeof r=="number"&&(this.height=r),(typeof n=="number"||n instanceof w)&&(this.radius=n),this._update(),typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i)}static Properties=["width","height","radius"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}copy(t){super.copy.call(this,t);for(let i=0;it&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new O(l,h)):this.vertices[r].set(l,h),this.vertices[r].command=r===0?b.move:b.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let i=this.innerRadius,s=this.outerRadius,r=this.sides,n=new e(0,0,i,s,r);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let o=0;o0?(n=this._amount,k.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=k.performance.now()-this._startTime,h=this._lastFrame+1,o=1e3*(h-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),l=st(this._firstFrame,h,r/o),l=Math.floor(l),l!==this._index&&(this._index=l,a=t[this._index],a.loaded&&(i=a.image.width,s=a.image.height,this.width!==i&&(this.width=i),this.height!==s&&(this.height=s),this.fill=a,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof V))&&(a=t[this._index],a.loaded&&(i=a.image.width,s=a.image.height,this.width!==i&&(this.width=i),this.height!==s&&(this.height=s)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},Ui={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){let t=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(x.Types.insert,t).unbind(x.Types.remove,i),this._textures=new ft((e||[]).slice(0)),this._textures.bind(x.Types.insert,t).bind(x.Types.remove,i),t(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}};function js(){this._flagTextures=!0}function zs(e){let t=e.length;for(;t--;)e[t].bind(x.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Us(e){let t=e.length;for(;t--;)e[t].unbind(x.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Di(e){if(e instanceof V)return e;if(typeof e=="string")return new V(e)}var ge=Math.min,me=Math.max,Ds={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],output:[],empty:[]}},$=class e extends ct{_flagAdditions=!1;_flagSubtractions=!1;_flagOrder=!1;_flagOpacity=!0;_flagBeginning=!1;_flagEnding=!1;_flagLength=!1;_flagMask=!1;_fill="#fff";_stroke="#000";_linewidth=1;_opacity=1;_visible=!0;_cap="round";_join="round";_miter=4;_closed=!0;_curved=!1;_automatic=!0;_beginning=0;_ending=1;_length=0;_mask=null;_strokeAttenuation=!0;constructor(t){super();for(let i in Hi)Object.defineProperty(this,i,Hi[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(t)?t:Array.prototype.slice.call(arguments)}static Children=re;static InsertChildren(t){for(let i=0;i=0;c--){let f=l[c];if(!f||!e.IsVisible(f,i.visibleOnly))continue;let u=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(u&&!vi(u,i.x,i.y,o))){if(f instanceof e){if(s&&(!r||r(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,n)&&(h.push(f),a)||e.VisitForHitTest(f,i,s,r,n,o,a))return!0;continue}if(f instanceof ct&&!(r&&!r(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,n)&&(h.push(f),a))return!0}}return!1}copy(t){super.copy.call(this,t),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i{t.children[s]=i.toObject()},this),t}dispose(){if(super.dispose(),this.children)for(let t=0;t0){let g=n[0];return n.length=0,l[0]=g,l.length=1,l}return h.length=0,h}let m=n.slice();return n.length=0,m}corner(){let t=this.getBoundingClientRect(!0);for(let i=0;i=0&&i.push(r),r.children)for(let n=0;n=0&&this.children.splice(r,1),this.children.push(s)}return this}remove(t){let i=arguments.length,s=this.parent;if(i<=0&&s)return s.remove(this),this;t instanceof Array?t=t.slice():t=Array.prototype.slice.call(arguments);for(let r=0;r=0&&this.children.splice(o,1)}return this}getBoundingClientRect(t){let i,s,r,n,o,a;this._update(!0);let l=1/0,h=-1/0,c=1/0,f=-1/0,u=/texture|gradient/i;s=t?this.matrix:this.worldMatrix;for(let p=0;pa+i?(s.beginning=1,s.ending=1):ha&&la&&h0&&i(this._children)),this._children=new re(e),this._children.bind(x.Types.insert,t),this._children.bind(x.Types.remove,i),this._children.bind(x.Types.order,s),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,k.isObject(e)&&!e.clip&&(e.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(e){this._strokeAttenuation=!!e;for(let t=0;t0&&(s=Array.prototype.indexOf.call(t.subtractions,e),s>=0&&t.subtractions.splice(s,1)),t.additions.length>0&&(s=Array.prototype.indexOf.call(t.additions,e),s>=0&&t.additions.splice(s,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function n(){s=Array.prototype.indexOf.call(i.additions,e),s>=0&&i.additions.splice(s,1),s=Array.prototype.indexOf.call(i.subtractions,e),s<0&&(i.subtractions.push(e),i._flagSubtractions=!0)}}var Gt=class extends L{constructor(t,i,s,r){let n=[new O(t,i),new O(s,r)];super(n);for(let o in Xi)Object.defineProperty(this,o,Xi[o]);this.vertices[0].command=b.move,this.vertices[1].command=b.line,this.automatic=!1}static Properties=["left","right"]},Xi={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(k.isObject(e))this.vertices.splice(0,1,e),this.vertices[0].command=b.move;else{let t=new it("Two.Line.left argument is not an object.");console.warn(t.name,t.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(e){if(k.isObject(e))this.vertices.splice(1,1,e),this.vertices[1].command=b.line;else{let t=new it("Two.Line.right argument is not an object.");console.warn(t.name,t.message)}}}};var Ft={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},Hs={start:"left",middle:"center",end:"right"},Gi=["id","class","transform","xmlns","viewBox"],Ws=["x","y","width","height","href","xlink:href"];function Xs(e){return Hs[e]}function Gs(e){let t=e.getAttribute("dominant-baseline"),i=e.getAttribute("alignment-baseline");return t||i}function ne(e){return e.replace(/svg:/gi,"").toLowerCase()}function Yi(e,t){if(t.x+=e.translateX,t.y+=e.translateY,t.x*=e.scaleX,t.y*=e.scaleY,e.rotation!==0){let i=t.length();t.x=i*Math.cos(e.rotation),t.y=i*Math.sin(e.rotation)}}function Ys(e,t){t||(t={});let i=e.split(";");for(let s=0;s"u"||typeof o>"u")continue;let a=n.replace(/\s/g,""),l=o.replace(/\s/g,"");t[a]=l}return t}function qs(e){let t={},i=Ks(e),s=Math.max(i.length,e.style.length);for(let r=0;r=0&&t.splice(r,1)}return t}function $s(e,t){let i=t.split(/[\s,]/),s=-parseFloat(i[0]),r=-parseFloat(i[1]),n=parseFloat(i[2]),o=parseFloat(i[3]);if(s&&r)for(let f=0;f"u"&&/none/i.test(s.display))||typeof s.visibility>"u"&&/hidden/i.test(s.visibility);for(l in s)switch(h=s[l],l){case"gradientTransform":if(/none/i.test(h)||(a=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,a===null))break;switch(u=At(a),t._renderer.type){case"linear-gradient":Yi(u,t.left),Yi(u,t.right);break;case"radial-gradient":t.center.x+=u.translateX,t.center.y+=u.translateY,t.focal.x+=u.translateX,t.focal.y+=u.translateY,t.radius*=Math.max(u.scaleX,u.scaleY);break}break;case"transform":if(/none/i.test(h)||(a=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,a===null))break;Q.AutoCalculateImportedMatrices?(u=At(a),t.translation.set(u.translateX,u.translateY),t.rotation=Math.PI*(u.rotation/180),t.scale=new w(u.scaleX,u.scaleY),p=parseFloat((s.x+"").replace("px")),d=parseFloat((s.y+"").replace("px")),p&&(t.translation.x=p),d&&(t.translation.y=d)):(a=e.getCTM(),t._matrix.manual=!0,t._matrix.set(a.a,a.b,a.c,a.d,a.e,a.f));break;case"visible":if(t instanceof $){t._visible=h;break}t.visible=h;break;case"stroke-linecap":if(t instanceof $){t._cap=h;break}t.cap=h;break;case"stroke-linejoin":if(t instanceof $){t._join=h;break}t.join=h;break;case"stroke-miterlimit":if(t instanceof $){t._miter=h;break}t.miter=h;break;case"stroke-width":if(t instanceof $){t._linewidth=parseFloat(h);break}t.linewidth=parseFloat(h);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof $){t._opacity=parseFloat(h);break}t.opacity=parseFloat(h);break;case"clip-path":if(Ft.cssBackgroundImage.test(h)&&(_=h.replace(Ft.cssBackgroundImage,"$1"),J.defs.current&&J.defs.current.contains(_)&&(g=J.defs.current.get(_),g&&g.childNodes.length>0)))switch(g=g.childNodes[0],y=ne(g.nodeName),t.mask=J[y].call(this,g,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":c=(t instanceof $?"_":"")+l,Ft.cssBackgroundImage.test(h)?(_=h.replace(Ft.cssBackgroundImage,"$1"),J.defs.current&&J.defs.current.contains(_)?(g=J.defs.current.get(_),g.object||(y=ne(g.nodeName),g.object=J[y].call(this,g,{})),g=g.object):(m=Zs(this),g=m.getById(_)),t[c]=g):t[c]=h;break;case"id":t.id=h;break;case"class":case"className":t.classList=h.split(" "),t._flagClassName=!0;break;case"x":case"y":if(v=t instanceof q,S=t instanceof H,R=t instanceof W,v||S||R)break;h.match("[a-z%]$")&&!h.endsWith("px")&&(T=new it("only pixel values are supported with the "+l+" attribute."),console.warn(T.name,T.message)),t.translation[l]=parseFloat(h);break;case"font-family":t instanceof _t&&(t.family=h);break;case"font-size":t instanceof _t&&(h.match("[a-z%]$")&&!h.endsWith("px")&&(T=new it("only pixel values are supported with the "+l+" attribute."),console.warn(T.name,T.message)),t.size=parseFloat(h));break;case"font-weight":t instanceof _t&&(t.weight=h);break;case"font-style":t instanceof _t&&(t.style=h);break;case"text-decoration":t instanceof _t&&(t.decoration=h);break;case"line-height":t instanceof _t&&(t.leading=h);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),s}function Js(e,t){for(let i=0,s=e.childNodes.length;i with no href."),console.warn(i.name,i.message),null;let r=s.slice(1);if(!J.defs.current.contains(r))return i=new it("unable to find element for reference "+s+"."),console.warn(i.name,i.message),null;let o=J.defs.current.get(r).cloneNode(!0);for(let l=0;l1&&(g=1);break;case"m":case"l":case"t":d.length>2&&(g=2);break;case"s":case"q":d.length>4&&(g=4);break;case"c":d.length>6&&(g=6);break;case"a":d.length>7&&(g=7);break}if(g){for(y=0,v=d.length,R=0;y0)switch(_){case"m":S="l";break;case"M":S="L";break}T.push(S+d.slice(y,y+g).join(" ")),R++}c=Array.prototype.concat.apply(c,T)}else c.push(u)}),k.each(c,function(u,p){let d,_,m,g=u[0],y=g.toLowerCase();h=u.slice(1).trim().match(Ft.path),n=g===y;let v,S,R,T,A,E,P,F,I,C,j,N,et,at,Z,ht,K;switch(y){case"z":if(p>=f)r=!0;else{_=a.x,m=a.y,d=new O(_,m,void 0,void 0,void 0,void 0,b.close);for(let gt=s.length-1;gt>=0;gt--){let nt=s[gt];if(/m/i.test(nt.command)){a=nt;break}}}break;case"m":case"l":l=void 0,_=parseFloat(h[0]),m=parseFloat(h[1]),d=new O(_,m,void 0,void 0,void 0,void 0,/m/i.test(y)?b.move:b.line),n&&d.addSelf(a),a=d;break;case"h":case"v":C=/h/i.test(y)?"x":"y",j=/x/i.test(C)?"y":"x",d=new O(void 0,void 0,void 0,void 0,void 0,void 0,b.line),d[C]=parseFloat(h[0]),d[j]=a[j],n&&(d[C]+=a[C]),a=d;break;case"c":case"s":v=a.x,S=a.y,l||(l=new w),/c/i.test(y)?(R=parseFloat(h[0]),T=parseFloat(h[1]),A=parseFloat(h[2]),E=parseFloat(h[3]),P=parseFloat(h[4]),F=parseFloat(h[5])):(I=he(a,l,n),R=I.x,T=I.y,A=parseFloat(h[0]),E=parseFloat(h[1]),P=parseFloat(h[2]),F=parseFloat(h[3])),n&&(R+=v,T+=S,A+=v,E+=S,P+=v,F+=S),a.controls.right.set(R-a.x,T-a.y),d=new O(P,F,A-P,E-F,void 0,void 0,b.curve),a=d,l=d.controls.left;break;case"t":case"q":v=a.x,S=a.y,l||(l=new w),/q/i.test(y)?(R=parseFloat(h[0]),T=parseFloat(h[1]),A=parseFloat(h[0]),E=parseFloat(h[1]),P=parseFloat(h[2]),F=parseFloat(h[3])):(I=he(a,l,n),R=I.x,T=I.y,A=I.x,E=I.y,P=parseFloat(h[0]),F=parseFloat(h[1])),n&&(R+=v,T+=S,A+=v,E+=S,P+=v,F+=S),a.controls.right.set((R-a.x)*.33,(T-a.y)*.33),d=new O(P,F,A-P,E-F,void 0,void 0,b.curve),a=d,l=d.controls.left;break;case"a":v=a.x,S=a.y,et=parseFloat(h[0]),at=parseFloat(h[1]),Z=parseFloat(h[2]),ht=parseFloat(h[3]),K=parseFloat(h[4]),P=parseFloat(h[5]),F=parseFloat(h[6]),n&&(P+=v,F+=S),N=new O(P,F),N.command=b.arc,N.rx=et,N.ry=at,N.xAxisRotation=Z,N.largeArcFlag=ht,N.sweepFlag=K,d=N,a=N,l=void 0;break}d&&(Array.isArray(d)?s=s.concat(d):s.push(d))})}i=new L(s,r,void 0,!0),i.stroke="none",i.fill="black";let o=i.getBoundingClientRect(!0);return o.centroid={x:o.left+o.width/2,y:o.top+o.height/2},k.each(i.vertices,function(a){a.subSelf(o.centroid)}),Rt.call(this,e,i,t),i.translation.addSelf(o.centroid),i},circle:function(e,t){let i=parseFloat(e.getAttribute("cx")),s=parseFloat(e.getAttribute("cy")),r=parseFloat(e.getAttribute("r")),n=new Ct(0,0,r);return n.stroke="none",n.fill="black",Rt.call(this,e,n,t),n.translation.x=i,n.translation.y=s,n},ellipse:function(e,t){let i=parseFloat(e.getAttribute("cx")),s=parseFloat(e.getAttribute("cy")),r=parseFloat(e.getAttribute("rx")),n=parseFloat(e.getAttribute("ry")),o=new Lt(0,0,r,n);return o.stroke="none",o.fill="black",Rt.call(this,e,o,t),o.translation.x=i,o.translation.y=s,o},rect:function(e,t){let i=parseFloat(e.getAttribute("rx")),s=parseFloat(e.getAttribute("ry"));if(!k.isNaN(i)||!k.isNaN(s))return J["rounded-rect"](e);let r=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),o=r/2,a=n/2,l=new ut(0,0,r,n);return l.stroke="none",l.fill="black",Rt.call(this,e,l,t),l.translation.x+=o,l.translation.y+=a,l},"rounded-rect":function(e,t){let i=parseFloat(e.getAttribute("rx"))||0,s=parseFloat(e.getAttribute("ry"))||0,r=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),o=r/2,a=n/2,l=new w(i,s),h=new Bt(0,0,r,n,l);return h.stroke="none",h.fill="black",Rt.call(this,e,h,t),h.translation.x+=o,h.translation.y+=a,h},line:function(e,t){let i=parseFloat(e.getAttribute("x1")),s=parseFloat(e.getAttribute("y1")),r=parseFloat(e.getAttribute("x2")),n=parseFloat(e.getAttribute("y2")),o=new Gt(i,s,r,n).noFill();return Rt.call(this,e,o,t),o},lineargradient:function(e,t){let i=e.getAttribute("gradientUnits"),s=e.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(e.getAttribute("x1")||0),n=parseFloat(e.getAttribute("y1")||0),o=parseFloat(e.getAttribute("x2")||0),a=parseFloat(e.getAttribute("y2")||0),l=(o+r)/2,h=(a+n)/2;/userSpaceOnUse/i.test(i)&&(r-=l,n-=h,o-=l,a-=h);let c=[];for(let u=0;u1?y[1]:void 0),m===null?(y=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,m=y&&y.length>1?parseFloat(y[1]):1):m=parseFloat(m),c.push(new dt(d,_,m))}let f=new H(r,n,o,a,c);return f.spread=s,f.units=i,Rt.call(this,e,f,t),f},radialgradient:function(e,t){let i=e.getAttribute("gradientUnits"),s=e.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(e.getAttribute("cx"))||0,n=parseFloat(e.getAttribute("cy"))||0,o=parseFloat(e.getAttribute("r")),a=parseFloat(e.getAttribute("fx")),l=parseFloat(e.getAttribute("fy"));k.isNaN(a)&&(a=r),k.isNaN(l)&&(l=n);let h=Math.abs(r+a)/2,c=Math.abs(n+l)/2;/userSpaceOnUse/i.test(i)&&(r-=h,n-=c,a-=h,l-=c);let f=[];for(let p=0;p1?v[1]:void 0),g===null?(v=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,g=v&&v.length>1?parseFloat(v[1]):1):g=parseFloat(g),f.push(new dt(_,m,g))}let u=new W(r,n,o,f,a,l);return u.spread=s,u.units=i,Rt.call(this,e,u,t),u},text:function(e,t){let i=Xs(e.getAttribute("text-anchor"))||"left",s=Gs(e)||"baseline",r="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?r=e.childNodes[0].textContent:r=e.textContent;let n=new _t(r);return Rt.call(this,e,n,t),n.alignment=i,n.baseline=s,n},clippath:function(e,t){return J.defs.current&&!J.defs.current.contains(e.id)&&J.defs.current.add(e.id,e),null},image:function(e,t){let i,s=e.getAttribute("href")||e.getAttribute("xlink:href");if(!s)return i=new it("encountered with no href."),console.warn(i.name,i.message),null;let r=parseFloat(e.getAttribute("x"))||0,n=parseFloat(e.getAttribute("y"))||0,o=parseFloat(e.getAttribute("width")),a=parseFloat(e.getAttribute("height")),l=new Ot(s,r,n);return k.isNaN(o)||(l.width=o),k.isNaN(a)||(l.height=a),Rt.call(this,e,l,t),l}};function $e(e,t){let i=new XMLHttpRequest;return i.open("GET",e),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&t(i.responseText)},i.send(),i}var oe=class e extends ut{_flagTexture=!1;_flagMode=!1;_texture=null;_mode="fill";constructor(t,i,s,r,n,o){super(i,s,r||1,n||1),this._renderer.type="image";for(let a in qi)Object.defineProperty(this,a,qi[a]);this.noStroke(),this.noFill(),t instanceof V?this.texture=t:typeof t=="string"&&(this.texture=new V(t)),typeof o=="string"&&(this.mode=o),this._update()}static Modes={fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"};static Properties=["texture","mode"];static fromObject(t){let i=new e().copy(t);return"id"in t&&(i.id=t.id),i}copy(t){super.copy.call(this,t);for(let i=0;i0&&this._scale!==0)for(let o=0;o0&&(e.lineDashOffset=K.offset||0,e.setLineDash(K)),e.beginPath();let nt,Et,Mt,It,Nt,Vt,ot;for(let U=0;U=_&&u&&(v=S,I=y.controls&&y.controls.right||w.zero,C=v.controls&&v.controls.left||w.zero,y._relative?(A=I.x+y.x,E=I.y+y.y):(A=I.x,E=I.y),v._relative?(R=C.x+v.x,T=C.y+v.y):(R=C.x,T=C.y),j=v.x,N=v.y,e.bezierCurveTo(A,E,R,T,j,N));break;case b.line:e.lineTo(j,N);break;case b.move:S=y,e.moveTo(j,N);break}return u&&e.closePath(),!at&&!i&&(D.isHidden.test(o)||(ht=o._renderer&&o._renderer.offset,ht&&(e.save(),e.translate(-o._renderer.offset.x,-o._renderer.offset.y),e.scale(o._renderer.scale.x,o._renderer.scale.y)),e.fill(),ht&&e.restore()),D.isHidden.test(r)||(ht=r._renderer&&r._renderer.offset,ht&&(e.save(),e.translate(-r._renderer.offset.x,-r._renderer.offset.y),e.scale(r._renderer.scale.x,r._renderer.scale.y),e.lineWidth=n/r._renderer.scale.x),e.stroke(),ht&&e.restore())),Z||e.restore(),at&&!i&&e.clip(),K&&K.length>0&&e.setLineDash(Je),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(e,t,i){let s,r,n,o,a,l,h,c,f,u,p,d,_,m,g,y;if(y=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,a=this._opacity*(y||1),l=this._visible,!t&&(!l||a===0))return this;if(k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,o=this._fill,c=this._renderer.collection,f=c.length,_=be(s),g=this.dashes,h=this._size,_||(e.save(),e.transform(s[0],s[3],s[1],s[4],s[2],s[5])),o)if(typeof o=="string")e.fillStyle=o;else{let R=D.getRendererType(o._renderer.type);D[R].render.call(o,e,this),e.fillStyle=o._renderer.effect}if(r){if(typeof r=="string")e.strokeStyle=r;else{let R=D.getRendererType(r._renderer.type);D[R].render.call(r,e,this),e.strokeStyle=r._renderer.effect}n&&(e.lineWidth=xt(this))}typeof a=="number"&&(e.globalAlpha=a),g&&g.length>0&&(e.lineDashOffset=g.offset||0,e.setLineDash(g)),e.beginPath();let v=h*.5,S;this._sizeAttenuation||(S=this.worldMatrix.elements,S=At(S[0],S[3],S[1],S[4],S[2],S[5]),v/=Math.max(S.scaleX,S.scaleY));for(let R=0;R0&&e.setLineDash(Je),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(e,t,i){let s=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,r=this._opacity*s,n=this._visible,o=this._mask,a=this._clip;if(!t&&(!n||a||r===0))return this;k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let l=this._matrix.elements,h=this._stroke,c=this._linewidth,f=this._fill,u=this._decoration,p=this._direction,d=be(l),_=f._renderer&&f._renderer.offset&&h._renderer&&h._renderer.offset,m=this.dashes,g=D.alignments[this._alignment]||this._alignment,y=D.baselines[this._baseline]||this._baseline,v,S,R,T,A,E,P,F,I,C,j;if(d||(e.save(),e.transform(l[0],l[3],l[1],l[4],l[2],l[5])),o){let N=D.getRendererType(o._renderer.type);D[N].render.call(o,e,!0)}if(_||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=g,e.textBaseline=y,e.direction=p,f)if(typeof f=="string")e.fillStyle=f;else{let N=D.getRendererType(f._renderer.type);D[N].render.call(f,e,this),e.fillStyle=f._renderer.effect}if(h){if(typeof h=="string")e.strokeStyle=h;else{let N=D.getRendererType(h._renderer.type);D[N].render.call(h,e,this),e.strokeStyle=h._renderer.effect}c&&(e.lineWidth=xt(this))}if(typeof r=="number"&&(e.globalAlpha=r),m&&m.length>0&&(e.lineDashOffset=m.offset||0,e.setLineDash(m)),!a&&!i&&(D.isHidden.test(f)||(f._renderer&&f._renderer.offset?(E=f._renderer.scale.x,P=f._renderer.scale.y,e.save(),e.translate(-f._renderer.offset.x,-f._renderer.offset.y),e.scale(E,P),v=this._size/f._renderer.scale.y,S=this._leading/f._renderer.scale.y,e.font=[this._style,this._weight,v+"px/",S+"px",this._family].join(" "),R=f._renderer.offset.x/f._renderer.scale.x,T=f._renderer.offset.y/f._renderer.scale.y,e.fillText(this.value,R,T),e.restore()):e.fillText(this.value,0,0)),D.isHidden.test(h)||(h._renderer&&h._renderer.offset?(E=h._renderer.scale.x,P=h._renderer.scale.y,e.save(),e.translate(-h._renderer.offset.x,-h._renderer.offset.y),e.scale(E,P),v=this._size/h._renderer.scale.y,S=this._leading/h._renderer.scale.y,e.font=[this._style,this._weight,v+"px/",S+"px",this._family].join(" "),R=h._renderer.offset.x/h._renderer.scale.x,T=h._renderer.offset.y/h._renderer.scale.y,A=c/h._renderer.scale.x,e.lineWidth=A,e.strokeText(this.value,R,T),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(u)){let N=e.measureText(this.value),et=1;switch(u){case"underline":I=N.actualBoundingBoxDescent,j=N.actualBoundingBoxDescent;break;case"strikethrough":I=0,j=0,et=.5;break}switch(y){case"top":I+=this._size*et,j+=this._size*et;break;case"baseline":case"bottom":I-=this._size*et,j-=this._size*et;break}switch(g){case"left":case"start":F=0,C=N.width;break;case"right":case"end":F=-N.width,C=0;break;default:F=-N.width/2,C=N.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(F,I),e.lineTo(C,j),e.stroke()}return d||e.restore(),a&&!i&&e.clip(),m&&m.length>0&&e.setLineDash(Je),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,s=this.left._x,r=this.left._y,n=this.right._x,o=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=t.getBoundingClientRect(!0),s=(s-.5)*i.width,r=(r-.5)*i.height,n=(n-.5)*i.width,o=(o-.5)*i.height),this._renderer.effect=e.createLinearGradient(s,r,n,o);for(let a=0;a1){let N=we(y);s=N*s,r=N*r,m=s*s,g=r*r}let v=m*_+g*d,S=(m*g-v)/v,R=we(Ze(0,S));n===o&&(R=-R);let T=R*s*p/r,A=-R*r*u/s,E=xe(a)*T-ye(a)*A+(t+l)/2,P=ye(a)*T+xe(a)*A+(i+h)/2,F=$i(1,0,(u-T)/s,(p-A)/r),I=$i((u-T)/s,(p-A)/r,(-u-T)/s,(-p-A)/r)%G,C=F+I;er(e,E,P,s,r,F,C,o===0,a)}},rt=class extends x{constructor(t){super();let i=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=i),this.scene=new $,this.scene.parent=this}static Utils=D;setSize(t,i,s){return this.width=t,this.height=i,this.ratio=typeof s>"u"?$t(this.ctx):s,this.domElement.width=t*this.ratio,this.domElement.height=i*this.ratio,this.domElement.style&&k.extend(this.domElement.style,{width:t+"px",height:i+"px"}),this.trigger(x.Types.resize,t,i,s)}render(){let t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),D.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};function er(e,t,i,s,r,n,o,a,l){let h=o-n,c=zt.Tolerance.epsilon,f=Math.abs(h)0&&M.setAttributes(s,t),s},setAttributes:function(e,t){let i=Object.keys(t);for(let s=0;s=s&&t&&(a.command===b.curve&&(f=r,y=a.controls&&a.controls.right||a,v=f.controls&&f.controls.left||f,a.relative?(u=z(y.x+a.x),p=z(y.y+a.y)):(u=z(y.x),p=z(y.y)),f.relative?(d=z(v.x+f.x),_=z(v.y+f.y)):(d=z(v.x),_=z(v.y)),P=z(f.x),F=z(f.y),c+=" C "+u+" "+p+" "+d+" "+_+" "+P+" "+F),a.command!==b.close&&(c+=" Z")),n+=c+" "}return n},pointsToString:function(e,t){let i="",s=t*.5;for(let r=0;r"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();let s=M.getRendererType(this._stroke._renderer.type);M[s].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=xt(this)),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?M.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=M.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){let s=M.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}if(this._flagMask)if(this._mask){let s=M.getRendererType(this._mask._renderer.type);M[s].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let s=this._size;if(!this._sizeAttenuation){let n=this.worldMatrix.elements,o=At(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(o.scaleX,o.scaleY)}let r=M.pointsToString(this._renderer.collection,s);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=M.getRendererType(this._fill._renderer.type);M[s].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();let s=M.getRendererType(this._stroke._renderer.type);M[s].render.call(this._stroke,e,!0)}return this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=xt(this)),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?M.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=M.createElement("path",t),e.appendChild(this._renderer.elem)),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(e){this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=M.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=M.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=M.getRendererType(this._fill._renderer.type);M[s].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();let s=M.getRendererType(this._stroke._renderer.type);M[s].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=xt(this)),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?M.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=M.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){let s=M.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}if(this._flagMask)if(this._mask){let s=M.getRendererType(this._mask._renderer.type);M[s].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(e,t){k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),t||this._update();let i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?M.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=M.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&e.defs.appendChild(this._renderer.elem),this._flagStops){let s=this._renderer.elem.childNodes.length!==this.stops.length;if(s)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let r=0;r0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,r)){switch(i.width=r.width,i.height=r.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof w?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?s.preserveAspectRatio="xMidYMid":s.preserveAspectRatio="none",s.width=i.width,s.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?M.setAttributes(this._renderer.image,s):this._renderer.image=M.createElement("image",s)),this._renderer.elem?Object.keys(i).length!==0&&M.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=M.createElement("pattern",i)),this._renderer.elem.parentNode===null&&e.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},ve=class extends x{constructor(t){super(),this.domElement=t.domElement||M.createElement("svg"),this.scene=new $,this.scene.parent=this,this.defs=M.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}static Utils=M;setSize(t,i){return this.width=t,this.height=i,M.setAttributes(this.domElement,{width:t,height:i}),this.trigger(x.Types.resize,t,i)}render(){return M.group.render.call(this.scene,this.domElement),M.defs.update(this.domElement),this}};var wt={create:function(e,t,i){let s=e.createShader(e[i]);if(e.shaderSource(s,t),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS)){let n=e.getShaderInfoLog(s);throw e.deleteShader(s),new it("unable to compile shader "+s+": "+n)}return s},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:` precision mediump float; attribute vec2 a_position; uniform mat3 u_matrix; uniform vec2 u_resolution; uniform vec4 u_rect; varying vec2 v_textureCoords; void main() { vec2 rectCoords = (a_position * (u_rect.zw - u_rect.xy)) + u_rect.xy; vec2 projected = (u_matrix * vec3(rectCoords, 1.0)).xy; vec2 normal = projected / u_resolution; vec2 clipspace = (normal * 2.0) - 1.0; gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0); v_textureCoords = a_position; } `,fragment:` precision mediump float; uniform sampler2D u_image; varying vec2 v_textureCoords; void main() { vec4 texel = texture2D(u_image, v_textureCoords); if (texel.a == 0.0) { discard; } gl_FragColor = texel; } `},points:{vertex:` precision mediump float; attribute vec2 a_position; uniform float u_size; uniform mat3 u_matrix; uniform vec2 u_resolution; varying vec2 v_textureCoords; void main() { vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy; vec2 normal = projected / u_resolution; vec2 clipspace = (normal * 2.0) - 1.0; gl_PointSize = u_size; gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0); v_textureCoords = a_position; } `,fragment:` precision mediump float; uniform sampler2D u_image; void main() { vec4 texel = texture2D(u_image, gl_PointCoord); if (texel.a == 0.0) { discard; } gl_FragColor = texel; } `}};var ke=bt.Multiply,ir=[1,0,0,0,1,0,0,0,1],jt=new vt(9),sr=rt.Utils,Ji=new w,Qe=new vt([0,0,1,0,0,1,0,1,1,0,1,1]),B={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:X.document?X.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new bt,group:{removeChild:function(e,t){if(e.children)for(let i=0;i0&&(y.lineDashOffset=j.offset||0,y.setLineDash(j));let K,gt,nt,Et,Mt,It,Nt,Vt;y.save(),y.scale(S.x,S.y),y.translate(Z,ht),y.beginPath();for(let ot=0;ot=et&&C&&(r=K,f=U.controls&&U.controls.right||w.zero,u=r.controls&&r.controls.left||w.zero,U._relative?(a=f.x+U.x,l=f.y+U.y):(a=f.x,l=f.y),r._relative?(n=u.x+r.x,o=u.y+r.y):(n=u.x,o=u.y),p=r.x,d=r.y,y.bezierCurveTo(a,l,n,o,p,d));break;case b.line:y.lineTo(p,d);break;case b.move:K=U,y.moveTo(p,d);break}}C&&y.closePath(),B.isHidden.test(A)||(_=A._renderer&&A._renderer.offset,_&&(y.save(),y.translate(-A._renderer.offset.x,-A._renderer.offset.y),y.scale(A._renderer.scale.x,A._renderer.scale.y)),y.fill(),_&&y.restore()),B.isHidden.test(R)||(_=R._renderer&&R._renderer.offset,_&&(y.save(),y.translate(-R._renderer.offset.x,-R._renderer.offset.y),y.scale(R._renderer.scale.x,R._renderer.scale.y),y.lineWidth=T/R._renderer.scale.x),y.stroke(),_&&y.restore()),y.restore()},getBoundingClientRect:function(e,t,i){let s=1/0,r=-1/0,n=1/0,o=-1/0,a,l;e.forEach(function(h){let c=h.x,f=h.y,u=h.controls,p,d,_,m,g,y;n=Math.min(f,n),s=Math.min(c,s),r=Math.max(c,r),o=Math.max(f,o),h.controls&&(g=u.left,y=u.right,!(!g||!y)&&(p=h._relative?g.x+c:g.x,d=h._relative?g.y+f:g.y,_=h._relative?y.x+c:y.x,m=h._relative?y.y+f:y.y,!(!p||!d||!_||!m)&&(n=Math.min(d,m,n),s=Math.min(p,_,s),r=Math.max(p,_,r),o=Math.max(d,m,o))))}),typeof t=="number"&&(n-=t,s-=t,r+=t,o+=t),a=r-s,l=o-n,i.top=n,i.left=s,i.right=r,i.bottom=o,i.width=a,i.height=l,i.centroid||(i.centroid={}),i.centroid.x=-s,i.centroid.y=-n},render:function(e,t,i){if(!this._visible||!this._opacity)return this;k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let s=i||this.parent,r=rt.Utils.getRendererType(this._renderer.type),n=t[r],o=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof H&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof W&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof V&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof H&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof W&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof V&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(o||a||l){this._renderer.matrix||(this._renderer.matrix=new vt(9)),this._matrix.toTransformArray(!0,jt),ke(jt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w);let f,u;this._scale instanceof w?(f=this._scale.x*s._renderer.scale.x,u=this._scale.y*s._renderer.scale.y):(f=this._scale*s._renderer.scale.x,u=this._scale*s._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=u<0?-u:u,l&&(this._renderer.parent=s)}if(this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);let f=rt.Utils.getRendererType(this._mask._renderer.type);B[f].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}if(h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,B.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),B.updateTexture.call(B,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;t.current!==n&&(e.useProgram(n),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Qe,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),t.current=n),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);let c=this._renderer.rect;return e.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),e.uniform4f(n.rect,c.left,c.top,c.right,c.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(e,t){let i,s=this.canvas,r=this.ctx,n=e.renderer.ratio,o=t._stroke,a=t._linewidth,l=t._fill,h=t._renderer.opacity||t._opacity,c=t.dashes,f=t._size*n,u=f;B.isHidden.test(o)||(u+=a),s.width=Ee(u),s.height=s.width;let p=u/s.width,d=s.width/2,_=s.height/2;if(r.clearRect(0,0,s.width,s.height),l)if(typeof l=="string")r.fillStyle=l;else{let m=rt.Utils.getRendererType(l._renderer.type);B[m].render.call(l,r,t),r.fillStyle=l._renderer.effect}if(o){if(typeof o=="string")r.strokeStyle=o;else{let m=rt.Utils.getRendererType(o._renderer.type);B[m].render.call(o,r,t),r.strokeStyle=o._renderer.effect}a&&(r.lineWidth=xt(t)/p)}typeof h=="number"&&(r.globalAlpha=h),c&&c.length>0&&(r.lineDashOffset=c.offset||0,r.setLineDash(c)),r.save(),r.translate(d,_),r.scale(B.precision,B.precision),r.beginPath(),r.arc(0,0,f/p*.5,0,G),r.restore(),closed&&r.closePath(),B.isHidden.test(l)||(i=l._renderer&&l._renderer.offset,i&&(r.save(),r.translate(-l._renderer.offset.x,-l._renderer.offset.y),r.scale(l._renderer.scale.x,l._renderer.scale.y)),r.fill(),i&&r.restore()),B.isHidden.test(o)||(i=o._renderer&&o._renderer.offset,i&&(r.save(),r.translate(-o._renderer.offset.x,-o._renderer.offset.y),r.scale(o._renderer.scale.x,o._renderer.scale.y),r.lineWidth=a/o._renderer.scale.x),r.stroke(),i&&r.restore())},render:function(e,t,i){if(!this._visible||!this._opacity)return this;k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let s=this._size,r=i||this.parent,n=t[this._renderer.type],o=this._sizeAttenuation,a=this._stroke,l=this._linewidth,h=r._matrix.manual||r._flagMatrix,c=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==r,u=this._renderer.vertices,p=this._renderer.collection.length,d=this._flagVertices,_=this._flagFill||this._fill instanceof H&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof W&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof V&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof H&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof W&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof V&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(h||c||f){this._renderer.matrix||(this._renderer.matrix=new vt(9)),this._matrix.toTransformArray(!0,jt),ke(jt,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w);let m,g;this._scale instanceof w?(m=this._scale.x*r._renderer.scale.x,g=this._scale.y*r._renderer.scale.y):(m=this._scale*r._renderer.scale.x,g=this._scale*r._renderer.scale.y),this._renderer.scale.x=m<0?-m:m,this._renderer.scale.y=g<0?-g:g,f&&(this._renderer.parent=r)}if(d){let m=this._renderer.positionBuffer;m&&e.deleteBuffer(m),this._renderer.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.positionBuffer),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW)}return _?(this._renderer.opacity=this._opacity*r._renderer.opacity,B.updateTexture.call(B,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(B.isHidden.test(a)||(s+=l),s/=B.precision,o&&(s*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),t.current!==n&&(e.useProgram(n),t.resolution.flagged||e.uniform2f(e.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),t.current=n),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),e.uniform1f(n.size,s*t.resolution.ratio),e.drawArrays(e.POINTS,0,p),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(e,t){let i=this.canvas,s=this.ctx,r=e.renderer.ratio,n=Ji.copy(t._renderer.scale).multiply(r),o=t._stroke,a=t._linewidth,l=t._fill,h=t._renderer.opacity||t._opacity,c=t.dashes,f=t._decoration,u=t._direction;i.width=Math.max(Math.ceil(t._renderer.rect.width*n.x),1),i.height=Math.max(Math.ceil(t._renderer.rect.height*n.y),1);let p=t._renderer.rect.centroid,d=p.x,_=p.y,m,g,y,v,S,R,T,A,E,P,F,I=l._renderer&&l._renderer.offset&&o._renderer&&o._renderer.offset;if(s.clearRect(0,0,i.width,i.height),I||(s.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),s.textAlign="center",s.textBaseline="middle",s.textDirection=u,l)if(typeof l=="string")s.fillStyle=l;else{let C=rt.Utils.getRendererType(l._renderer.type);B[C].render.call(l,s,t),s.fillStyle=l._renderer.effect}if(o){if(typeof o=="string")s.strokeStyle=o;else{let C=rt.Utils.getRendererType(o._renderer.type);B[C].render.call(o,s,t),s.strokeStyle=o._renderer.effect}a&&(s.lineWidth=xt(t))}if(typeof h=="number"&&(s.globalAlpha=h),c&&c.length>0&&(s.lineDashOffset=c.offset||0,s.setLineDash(c)),s.save(),s.scale(n.x,n.y),s.translate(d,_),B.isHidden.test(l)||(l._renderer&&l._renderer.offset?(R=l._renderer.scale.x,T=l._renderer.scale.y,s.save(),s.translate(-l._renderer.offset.x,-l._renderer.offset.y),s.scale(R,T),m=t._size/l._renderer.scale.y,g=t._leading/l._renderer.scale.y,s.font=[t._style,t._weight,m+"px/",g+"px",t._family].join(" "),y=l._renderer.offset.x/l._renderer.scale.x,v=l._renderer.offset.y/l._renderer.scale.y,s.fillText(t.value,y,v),s.restore()):s.fillText(t.value,0,0)),B.isHidden.test(o)||(o._renderer&&o._renderer.offset?(R=o._renderer.scale.x,T=o._renderer.scale.y,s.save(),s.translate(-o._renderer.offset.x,-o._renderer.offset.y),s.scale(R,T),m=t._size/o._renderer.scale.y,g=t._leading/o._renderer.scale.y,s.font=[t._style,t._weight,m+"px/",g+"px",t._family].join(" "),y=o._renderer.offset.x/o._renderer.scale.x,v=o._renderer.offset.y/o._renderer.scale.y,S=a/o._renderer.scale.x,s.lineWidth=S,s.strokeText(t.value,y,v),s.restore()):s.strokeText(t.value,0,0)),/(underline|strikethrough)/i.test(f)){let C=s.measureText(t.value);switch(f){case"underline":E=C.actualBoundingBoxDescent,F=C.actualBoundingBoxDescent;break;case"strikethrough":E=0,F=0;break}A=-C.width/2,P=C.width/2,s.lineWidth=Math.max(Math.floor(t._size/15),1),s.strokeStyle=s.fillStyle,s.beginPath(),s.moveTo(A,E),s.lineTo(P,F),s.stroke()}s.restore()},getBoundingClientRect:function(e,t){let i=B.ctx;i.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),i.textAlign="center",i.textBaseline=rt.Utils.baselines[e._baseline]||e._baseline;let s=i.measureText(e._value),r=s.width,n=1.15*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent);this._linewidth&&!B.isHidden.test(this._stroke)&&(r+=this._linewidth*2,n+=this._linewidth*2);let o=r/2,a=n/2;switch(B.alignments[e._alignment]||e._alignment){case B.alignments.left:e.direction==="ltr"?(t.left=0,t.right=r):(t.left=-r,t.right=0);break;case B.alignments.right:e.direction==="ltr"?(t.left=-r,t.right=0):(t.left=0,t.right=r);break;default:t.left=-o,t.right=o}switch(e._baseline){case"bottom":t.top=-n,t.bottom=0;break;case"top":t.top=0,t.bottom=n;break;case"baseline":t.top=-a*1.5,t.bottom=a*.5;break;default:t.top=-a,t.bottom=a}t.width=r,t.height=n,t.centroid||(t.centroid={}),t.centroid.x=o,t.centroid.y=a},render:function(e,t,i){if(!this._visible||!this._opacity)return this;k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let s=i||this.parent,r=t[this._renderer.type],n=s._matrix.manual||s._flagMatrix,o=this._matrix.manual||this._flagMatrix,a=this._renderer.parent!==s,l=this._flagVertices||this._flagFill||this._fill instanceof H&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof W&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof V&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof H&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof W&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof V&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(n||o||a){this._renderer.matrix||(this._renderer.matrix=new vt(9)),this._matrix.toTransformArray(!0,jt),ke(jt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w);let c,f;this._scale instanceof w?(c=this._scale.x*s._renderer.scale.x,f=this._scale.y*s._renderer.scale.y):(c=this._scale*s._renderer.scale.x,f=this._scale*s._renderer.scale.y),this._renderer.scale.x=c<0?-c:c,this._renderer.scale.y=f<0?-f:f,a&&(this._renderer.parent=s)}if(this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);let c=rt.Utils.getRendererType(this._mask._renderer.type);B[c].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}if(l?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,B.text.getBoundingClientRect(this,this._renderer.rect),B.updateTexture.call(B,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;t.current!==r&&(e.useProgram(r),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r.position),e.bufferData(e.ARRAY_BUFFER,Qe,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),t.current=r),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);let h=this._renderer.rect;return e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.uniform4f(r.rect,h.left,h.top,h.right,h.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),k.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(e,t){if(!(!e.canvas.getContext("2d")||!t)){if(k.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,s=this.left._x,r=this.left._y,n=this.right._x,o=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=t.getBoundingClientRect(!0),s=(s-.5)*i.width,r=(r-.5)*i.height,n=(n-.5)*i.width,o=(o-.5)*i.height),this._renderer.effect=e.createLinearGradient(s,r,n,o);for(let a=0;a"u"?$t(o):s,this.domElement.width=t*this.ratio,this.domElement.height=i*this.ratio,k.isObject(this.domElement.style)&&k.extend(this.domElement.style,{width:t+"px",height:i+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,n=i*this.ratio,o.viewport(0,0,r,n),this.programs.resolution.width=r,this.programs.resolution.height=n,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(x.Types.resize,t,i,s)}render(){let t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),B.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};var rr=k.extend({Error:it,getRatio:$t,read:J,xhr:$e},k,lt,Le,Me),Yt=class e{_events=new x;get _bound(){return this._events._bound}set _bound(t){this._events._bound=t}addEventListener(){return this._events.addEventListener?.apply(this,arguments)}on(){return this._events.addEventListener?.apply(this,arguments)}bind(){return this._events.addEventListener?.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener?.apply(this,arguments)}off(){return this._events.removeEventListener?.apply(this,arguments)}unbind(){return this._events.removeEventListener?.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent?.apply(this,arguments)}trigger(){return this._events.dispatchEvent?.apply(this,arguments)}listen(){return this._events.listen?.apply(this,arguments)}ignore(){return this._events.ignore?.apply(this,arguments)}type="";renderer=null;scene=null;width=0;height=0;frameCount=0;timeDelta=0;playing=!1;constructor(t){let i=k.defaults(t||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:e.Types.svg,autostart:!1});if(k.each(i,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),k.isElement(i.domElement)){let s=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+s)||(this.type=e.Types[s])}this.renderer=new e[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=nr.bind(this),this.fit.domElement=window,this.fit.attached=!0,k.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),k.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),mt.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=or.bind(this),k.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(x.Types.resize,ar.bind(this)),this.scene=this.renderer.scene,e.Instances.push(this),i.autostart&&ae.init()}static NextFrameId=Q.NextFrameId;static Types=Q.Types;static Version=Q.Version;static PublishDate=Q.PublishDate;static Identifier=Q.Identifier;static Resolution=Q.Resolution;static AutoCalculateImportedMatrices=Q.AutoCalculateImportedMatrices;static Instances=Q.Instances;static uniqueId=Q.uniqueId;static Anchor=O;static Collection=ft;static Events=x;static Group=$;static Matrix=bt;static Path=L;static Registry=Tt;static Element=yt;static Shape=ct;static Text=_t;static Vector=w;static Gradient=q;static Image=oe;static ImageSequence=Xt;static LinearGradient=H;static RadialGradient=W;static Sprite=Ot;static Stop=dt;static Texture=V;static ArcSegment=Ut;static Circle=Ct;static Ellipse=Lt;static Line=Gt;static Points=Dt;static Polygon=Ht;static Rectangle=ut;static RoundedRectangle=Bt;static Star=Wt;static CanvasRenderer=rt;static SVGRenderer=ve;static WebGLRenderer=Re;static Commands=b;static Utils=rr;appendTo(t){return t.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=t,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,ae.init(),this.trigger(x.Types.play)}pause(){return this.playing=!1,this.trigger(x.Types.pause)}setPlaying(t){this.playing=t}release(t){let i,s,r;if(typeof t>"u")return this.release(this.scene);if(typeof t.unbind=="function"&&t.unbind(),typeof t.fill=="object"&&typeof t.fill.unbind=="function"&&t.fill.unbind(),typeof t.stroke=="object"&&typeof t.stroke.unbind=="function"&&t.stroke.unbind(),t.vertices){if(typeof t.vertices.unbind=="function")try{t.vertices.unbind()}catch{}for(i=0;i