/* 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 pt=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var Mi=Object.getOwnPropertyNames;var Oi=Object.prototype.hasOwnProperty;var gt=(t,e)=>{for(var i in e)pt(t,i,{get:e[i],enumerable:!0})},Pi=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Mi(e))!Oi.call(t,r)&&r!==i&&pt(t,r,{get:()=>e[r],enumerable:!(s=Ei(e,r))||s.enumerable});return t};var Ci=t=>Pi(pt({},"__esModule",{value:!0}),t);var Ms={};gt(Ms,{default:()=>ze});var re={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(i){return this[i]},t.setAttribute=function(i,s){return this[i]=s,this},t},polyfill:function(t,e){return re.shim(t),typeof e<"u"&&(re.Image=e),re.isHeadless=!0,t}};var Rt={};gt(Rt,{Curve:()=>Pe,getAnchorsFromArcData:()=>Ii,getComponentOnCubicBezier:()=>je,getControlPoints:()=>Gt,getCurveBoundingBox:()=>kt,getCurveFromPoints:()=>vt,getCurveLength:()=>wt,getReflection:()=>st,integrate:()=>Ht,subdivide:()=>Je});var bt={};gt(bt,{HALF_PI:()=>$,NumArray:()=>ye,TWO_PI:()=>K,decomposeMatrix:()=>be,getComputedMatrix:()=>it,getEffectiveStrokeWidth:()=>ge,getPoT:()=>xt,lerp:()=>ne,mod:()=>te,setMatrix:()=>yt,toFixed:()=>z});var X;typeof window<"u"?X=window:typeof global<"u"?X=global:typeof self<"u"&&(X=self);var Wt,K=Math.PI*2,$=Math.PI*.5;function be(t,e,i,s,r,n){let o;return arguments.length<=1?(o=t.a,e=t.b,i=t.c,s=t.d,r=t.e,n=t.f):o=t,{translateX:r,translateY:n,scaleX:Math.sqrt(o*o+e*e),scaleY:Math.sqrt(i*i+s*s),rotation:180*Math.atan2(e,o)/Math.PI}}function yt(t){Wt=t}function it(t,e){e=e&&e.identity()||new Wt;let i=t,s=[];for(;i&&i._matrix;)s.push(i._matrix),i=i.parent;s.reverse();for(let r=0;r0?i/r:i}var k={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var m=class{_events={};_bound=!1;constructor(){}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;let s=e?[e]: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=e.x-i.x,r=e.y-i.y;return Math.atan2(r,s)}static distanceBetween(e,i){return Math.sqrt(t.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){let s=e.x-i.x,r=e.y-i.y;return s*s+r*r}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new t(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let i=this.x-e.x,s=this.y-e.y;return i*i+s*s}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)"u"?1e-4:e,this.length()>1,f=s&1?n[h++]*t(a):0;for(;h=0&&e<4294967296}var b={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){let e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){let e=qt.call(arguments,1);for(let i=0;i0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}pop(){let e=super.pop.apply(this,arguments);return this.trigger(m.Types.remove,[e]),e}shift(){let e=super.shift.apply(this,arguments);return this.trigger(m.Types.remove,[e]),e}push(){let e=super.push.apply(this,arguments);return this.trigger(m.Types.insert,arguments),e}unshift(){let e=super.unshift.apply(this,arguments);return this.trigger(m.Types.insert,arguments),e}splice(){let e=super.splice.apply(this,arguments);if(this.trigger(m.Types.remove,e),arguments.length>2){let i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(m.Types.insert,i),this.trigger(m.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(m.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(m.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){let s=[];for(let r=0;r0&&typeof s.height=="number"&&s.height>0?r():!re.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),e._src=t.getAbsoluteURL(e._src),!(!re.isHeadless&&s&&s.getAttribute("two-src"))&&(re.isHeadless||s.setAttribute("two-src",e.src),t.ImageRegistry.add(e.src,s),re.isHeadless?t.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,i){if(re.isHeadless)throw new Z("video textures are not implemented in headless environments.");let s=function(n){e.image.removeEventListener("canplaythrough",s,!1),e.image.removeEventListener("error",r,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,typeof i=="function"&&i()},r=function(n){throw e.image.removeEventListener("canplaythrough",s,!1),e.image.removeEventListener("error",r,!1),new Z("unable to load "+e.src)};e._src=t.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),t.ImageRegistry.add(e.src,e.image)),e.image.readyState>=4?s():(e.image.addEventListener("canplaythrough",s,!1),e.image.addEventListener("error",r,!1),e.image.src=e.src,e.image.load())}};static load(e,i){let s=e.image,r=t.getTag(s);e._flagImage&&(/canvas/i.test(r)?t.Register.canvas(e,i):(e._src=!re.isHeadless&&s.getAttribute("two-src")||s.src,t.Register[r](e,i))),e._flagSrc&&(s||(s=t.getImage(e.src),e.image=s),r=t.getTag(s),t.Register[r](e,i))}clone(){let e=new t(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof w?e.offset:new w().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof w?e.scale:new w().copy(e.scale),this}toObject(){let e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(m.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,t.load(this,function(){this.loaded=!0,this.trigger(m.Types.change).trigger(m.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 e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},Jt={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){let e=N.getTag(t),i;switch(e){case"canvas":i="#"+t.id;break;default:i=t.src}N.ImageRegistry.contains(i)?this._image=N.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(m.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(m.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof w&&this._scale.unbind(m.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof w&&this._scale.bind(m.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function ji(){this._flagOffset=!0}function Ui(){this._flagScale=!0}var fe=class t extends _e{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";constructor(e,i,s){super();for(let r in Zt)Object.defineProperty(this,r,Zt[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:t.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof i=="string"?i:t.Index<=0?"#fff":"#000",t.Index=(t.Index+1)%2}static Index=0;static Properties=["offset","opacity","color"];static fromObject(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},Zt={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}};var H=class t extends _e{_flagStops=!1;_flagSpread=!1;_flagUnits=!1;_spread="";_units="";constructor(e){super();for(let i in Qt)Object.defineProperty(this,i,Qt[i]);this._renderer.type="gradient",this._renderer.flagStops=Di.bind(this),this._renderer.bindStops=Wi.bind(this),this._renderer.unbindStops=Xi.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static Stop=fe;static Properties=["spread","stops","units"];static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(r=>r instanceof fe?r:new fe().copy(r)));let s=new t(i).copy(e);return"id"in e&&(s.id=e.id),s}clone(e){let i=this.stops.map(r=>r.clone()),s=new t(i);return b.each(t.Properties,r=>{s[r]=this[r]},this),e&&e.add(s),s}copy(e){super.copy.call(this,e);for(let i=0;ii.toObject())};return b.each(t.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(m.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){let e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},Qt={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){let e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(m.Types.insert,e).unbind(m.Types.remove,i),this._stops=new oe((t||[]).slice(0)),this._stops.bind(m.Types.insert,e).bind(m.Types.remove,i),e(this._stops)}}};function Di(){this._flagStops=!0}function Wi(t){let e=t.length;for(;e--;)t[e].bind(m.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Xi(t){let e=t.length;for(;e--;)t[e].unbind(m.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var D=class t extends H{_flagEndPoints=!1;_left=null;_right=null;constructor(e,i,s,r,n){super(n);for(let o in ei)Object.defineProperty(this,o,ei[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Yi.bind(this),this.left=new w,this.right=new w,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof s=="number"&&(this.right.x=s),typeof r=="number"&&(this.right.y=r)}static Stop=fe;static Properties=["left","right"];static fromObject(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i=s)return s-r>=0;r+=o}return!1}function We(t,e){let i=t._length;if(e<=0)return 0;if(e>=i)return t._lengths.length-1;for(let s=0,r=0;s=e)return e-=r,Math.max(s-1,0)+e/t._lengths[s];r+=t._lengths[s]}return-1}function Ft(t,e,i){let s,r,n,o,a,h,l,f,c=e.controls&&e.controls.right,u=t.controls&&t.controls.left;return s=e.x,a=e.y,r=(c||e).x,h=(c||e).y,n=(u||t).x,l=(u||t).y,o=t.x,f=t.y,c&&e._relative&&(r+=e.x,h+=e.y),u&&t._relative&&(n+=t.x,l+=t.y),wt(s,a,r,h,n,l,o,f,i)}function Tt(t,e,i){let s,r,n,o,a,h,l,f,c=e.controls&&e.controls.right,u=t.controls&&t.controls.left;return s=e.x,a=e.y,r=(c||e).x,h=(c||e).y,n=(u||t).x,l=(u||t).y,o=t.x,f=t.y,c&&e._relative&&(r+=e.x,h+=e.y),u&&t._relative&&(n+=t.x,l+=t.y),Je(s,a,r,h,n,l,o,f,i)}function we(t){switch(t.renderer.type){case"texture":return N.fromObject(t);case"gradient":return H.fromObject(t);case"linear-gradient":return D.fromObject(t);case"radial-gradient":return W.fromObject(t)}return t}var qi=Math.cos,Ki=Math.sin,ii=Math.tan,St=[],ke=class t extends m{elements=new ye(9);manual=!1;constructor(e,i,s,r,n,o){super();let a=e;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(e,i,s){if(i.length<=3){let F=e,S,L,O,M=i[0]||0,V=i[1]||0,B=i[2]||0;return S=F[0]*M+F[1]*V+F[2]*B,L=F[3]*M+F[4]*V+F[5]*B,O=F[6]*M+F[7]*V+F[8]*B,[S,L,O]}let r=e[0],n=e[1],o=e[2],a=e[3],h=e[4],l=e[5],f=e[6],c=e[7],u=e[8],_=i[0],d=i[1],y=i[2],x=i[3],g=i[4],p=i[5],R=i[6],A=i[7],v=i[8];return s=s||new ye(9),s[0]=r*_+n*x+o*R,s[1]=r*d+n*g+o*A,s[2]=r*y+n*p+o*v,s[3]=a*_+h*x+l*R,s[4]=a*d+h*g+l*A,s[5]=a*y+h*p+l*v,s[6]=f*_+c*x+u*R,s[7]=f*d+c*g+u*A,s[8]=f*y+c*p+u*v,s}static fromObject(e){return new t().copy(e)}set(e,i,s,r,n,o,a,h,l){if(typeof i>"u"){let f=e;e=f[0],i=f[1],s=f[2],r=f[3],n=f[4],o=f[5],a=f[6],h=f[7],l=f[8]}return this.elements[0]=e,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]=h,this.elements[8]=l,this.trigger(m.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(m.Types.change)}identity(){return this.elements[0]=t.Identity[0],this.elements[1]=t.Identity[1],this.elements[2]=t.Identity[2],this.elements[3]=t.Identity[3],this.elements[4]=t.Identity[4],this.elements[5]=t.Identity[5],this.elements[6]=t.Identity[6],this.elements[7]=t.Identity[7],this.elements[8]=t.Identity[8],this.trigger(m.Types.change)}multiply(e,i,s,r,n,o,a,h,l){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(m.Types.change);if(typeof s>"u"&&(s=1),typeof r>"u"){e=e||0,i=i||0,s=s||0,n=this.elements;let I=n[0]*e+n[1]*i+n[2]*s,ee=n[3]*e+n[4]*i+n[5]*s,le=n[6]*e+n[7]*i+n[8]*s;return[I,ee,le]}let f=this.elements,c=[e,i,s,r,n,o,a,h,l],u=f[0],_=f[1],d=f[2],y=f[3],x=f[4],g=f[5],p=f[6],R=f[7],A=f[8],v=c[0],F=c[1],S=c[2],L=c[3],O=c[4],M=c[5],V=c[6],B=c[7],Y=c[8];return this.elements[0]=u*v+_*L+d*V,this.elements[1]=u*F+_*O+d*B,this.elements[2]=u*S+_*M+d*Y,this.elements[3]=y*v+x*L+g*V,this.elements[4]=y*F+x*O+g*B,this.elements[5]=y*S+x*M+g*Y,this.elements[6]=p*v+R*L+A*V,this.elements[7]=p*F+R*O+A*B,this.elements[8]=p*S+R*M+A*Y,this.trigger(m.Types.change)}inverse(e){let i=this.elements;e=e||new t;let s=i[0],r=i[1],n=i[2],o=i[3],a=i[4],h=i[5],l=i[6],f=i[7],c=i[8],u=c*a-h*f,_=-c*o+h*l,d=f*o-a*l,y=s*u+r*_+n*d;return y?(y=1/y,e.elements[0]=u*y,e.elements[1]=(-c*r+n*f)*y,e.elements[2]=(h*r-n*a)*y,e.elements[3]=_*y,e.elements[4]=(c*s-n*l)*y,e.elements[5]=(-h*s+n*o)*y,e.elements[6]=d*y,e.elements[7]=(-f*s+r*l)*y,e.elements[8]=(a*s-r*o)*y,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){let i=qi(e),s=Ki(e);return this.multiply(i,-s,0,s,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){let i=ii(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){let i=ii(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return St.length=0,this.toTransformArray(e,St),St.map(z).join(" ")}toTransformArray(e,i){let s=this.elements,r=!!i,n=s[0],o=s[1],a=s[2],h=s[3],l=s[4],f=s[5];if(e){let c=s[6],u=s[7],_=s[8];if(r){i[0]=n,i[1]=h,i[2]=c,i[3]=o,i[4]=l,i[5]=u,i[6]=a,i[7]=f,i[8]=_;return}return[n,h,c,o,l,u,a,f,_]}if(r){i[0]=n,i[1]=h,i[2]=o,i[3]=l,i[4]=a,i[5]=f;return}return[n,h,o,l,a,f]}toArray(e,i){let s=this.elements,r=!!i,n=s[0],o=s[1],a=s[2],h=s[3],l=s[4],f=s[5];if(e){let c=s[6],u=s[7],_=s[8];if(r){i[0]=n,i[1]=o,i[2]=a,i[3]=h,i[4]=l,i[5]=f,i[6]=c,i[7]=u,i[8]=_;return}return[n,o,a,h,l,f,c,u,_]}if(r){i[0]=n,i[1]=o,i[2]=a,i[3]=h,i[4]=l,i[5]=f;return}return[n,o,a,h,l,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new t().copy(this)}};yt(ke);var ce=class t extends _e{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let e in nt)Object.defineProperty(this,e,nt[e]);this._renderer.flagMatrix=si.bind(this),this.isShape=!0,this.matrix=new ke,this.worldMatrix=new ke,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(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return nt.position.get.apply(this,arguments)}set translation(e){nt.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof w?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof w?e.scale:new w(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){let i=new t;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),e&&e.add(i),i._update()}toObject(){let e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof w?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}_update(e){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)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}},nt={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(m.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(m.Types.change,this._renderer.flagMatrix),si.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof w&&this._scale.unbind(m.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof w&&this._scale.bind(m.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return it(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function si(){this._flagMatrix=!0}var Xe=Math.min,Ye=Math.max,$i=Math.ceil,Ji=Math.floor,Zi=new w,P=class t extends ce{_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(e,i,s,r){super();for(let n in ri)Object.defineProperty(this,n,ri[n]);this._renderer.type="path",this._renderer.flagVertices=Et.bind(this),this._renderer.bindVertices=Mt.bind(this),this._renderer.unbindVertices=Ot.bind(this),this._renderer.flagFill=Pt.bind(this),this._renderer.flagStroke=Ct.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=e,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:Ft};static fromObject(e){let i=typeof e.fill=="string"?e.fill:we(e.fill),s=typeof e.stroke=="string"?e.stroke:we(e.stroke),r=new t().copy({...e,fill:i,stroke:s});return"id"in e&&(r.id=e.id),r}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;ii.toObject()),b.each(t.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){let{scaleX:u,scaleY:_}=be(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof u=="number"&&typeof _=="number"&&(s=Math.max(u,_)*(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;n=p){this._closed?(s=te(Q,R),r=te(Q-1,R),Q===0&&(s=r,r=Q)):(s=Q,r=Math.min(Math.max(Q-1,0),A)),v=this.vertices[s],F=this.vertices[r],p-=se,this._lengths[Q]!==0?e=p/this._lengths[Q]:e=0;break}se+=this._lengths[Q]}if(v===null||F===null)return null;if(v){if(!F)return v}else return F;g=F.controls&&F.controls.right,x=v.controls&&v.controls.left,a=F.x,u=F.y,h=(g||F).x,_=(g||F).y,l=(x||v).x,d=(x||v).y,f=v.x,y=v.y,g&&F.relative&&(h+=F.x,_+=F.y),x&&v.relative&&(l+=v.x,d+=v.y),o=je(e,a,h,l,f),c=je(e,u,_,d,y);let S=ne(a,h,e),L=ne(u,_,e),O=ne(h,l,e),M=ne(_,d,e),V=ne(l,f,e),B=ne(d,y,e),Y=ne(S,O,e),I=ne(L,M,e),ee=ne(O,V,e),le=ne(M,B,e);return b.isObject(i)?(i.x=o,i.y=c,i instanceof E&&(i.controls.left.x=Y,i.controls.left.y=I,i.controls.right.x=ee,i.controls.right.y=le,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=o,i.controls.left.y-=c,i.controls.right.x-=o,i.controls.right.y-=c)),i.t=e,i):(n=new E(o,c,Y-o,I-c,ee-o,le-c,this._curved?k.curve:k.line),n.t=e,n)}plot(){if(this.curved)return vt(this._collection,this.closed),this;for(let e=0;e0&&(n[n.length-1].command=k.line),r=a;return}o=Tt(a,r,e),n=n.concat(o),b.each(o,function(l,f){f<=0&&r.command===k.move?l.command=k.move:l.command=k.line}),h>=i&&(this._closed&&this._automatic&&(r=a,o=Tt(a,r,e),n=n.concat(o),b.each(o,function(l,f){f<=0&&r.command===k.move?l.command=k.move:l.command=k.line})),n.push(new E(a.x,a.y)),n[n.length-1].command=s?k.close:k.line),r=a},this),this._automatic=!1,this._curved=!1,this.vertices=n,this}_updateLength(e,i){i||this._update();let r=this.vertices.length-1,n=!1,o=this.vertices[r],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),b.each(this.vertices,function(h,l){if(l<=0&&!n||h.command===k.move){o=h,this._lengths[l]=0;return}this._lengths[l]=Ft(h,o,e),a+=this._lengths[l],o=h},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);let e=this._collection.length,i=this._closed,s=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),n=We(this,s*this._length),o=We(this,r*this._length),a=$i(n),h=Ji(o),l,f,c,u,_,d;for(this._renderer.vertices.length=0,d=0;dh&&!f?(_=this._renderer.collection[d].copy(this._collection[d]),this.getPointAt(r,_),_.command=this._renderer.collection[d].command,this._renderer.vertices.push(_),f=_,c=this._collection[d-1],c&&c.controls&&(_.relative?_.controls.right.clear():_.controls.right.copy(_),c.relative?this._renderer.collection[d-1].controls.right.copy(c.controls.right).lerp(w.zero,1-_.t):this._renderer.collection[d-1].controls.right.copy(c.controls.right).lerp(c,1-_.t))):d>=a&&d<=h&&(_=this._renderer.collection[d].copy(this._collection[d]),this._renderer.vertices.push(_),d===h&&At(this,r)?(f=_,!i&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):d===a&&At(this,s)&&(l=_,l.command=k.move,!i&&l.controls&&(l.relative?l.controls.left.clear():l.controls.left.copy(l))));a>0&&!l&&(d=a-1,_=this._renderer.collection[d].copy(this._collection[d]),this.getPointAt(s,_),_.command=k.move,this._renderer.vertices.unshift(_),u=this._collection[d+1],u&&u.controls&&(_.controls.left.clear(),u.relative?this._renderer.collection[d+1].controls.left.copy(u.controls.left).lerp(w.zero,_.t):(Zi.copy(u),this._renderer.collection[d+1].controls.left.copy(u.controls.left).lerp(u,_.t))))}return ce.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,ce.prototype.flagReset.call(this),this}},ri={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof H||this._fill instanceof D||this._fill instanceof W||this._fill instanceof N)&&this._fill.unbind(m.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof H||this._fill instanceof D||this._fill instanceof W||this._fill instanceof N)&&this._fill.bind(m.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof H||this._stroke instanceof D||this._stroke instanceof W||this._stroke instanceof N)&&this._stroke.unbind(m.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof H||this._stroke instanceof D||this._stroke instanceof W||this._stroke instanceof N)&&this._stroke.bind(m.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(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;let e=this._automatic?"ignore":"listen";b.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){let e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(m.Types.insert,e).unbind(m.Types.remove,i),t instanceof oe?this._collection=t:this._collection=new oe(t||[]),this._collection.bind(m.Types.insert,e).bind(m.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,b.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Et(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Mt(t){let e=t.length;for(;e--;)t[e].bind(m.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Ot(t){let e=t.length;for(;e--;)t[e].unbind(m.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Pt(){this._flagFill=!0}function Ct(){this._flagStroke=!0}var ae=class t extends P{constructor(e,i,s,r){let n=[new E,new E,new E,new E];super(n,!0,!1,!0),this._renderer.type="rectangle";for(let o in ni)Object.defineProperty(this,o,ni[o]);this.width=typeof s=="number"?s:1,this.height=typeof r=="number"?r:1,this.origin=new w,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static Properties=["width","height","origin"];static fromObject(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i0&&(b.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=b.performance.now()-this._startTime,u=this._lastFrame+1,h=1e3*(u-this._firstFrame)/this._frameRate,this._loop?o=o%h:o=Math.min(o,h),l=ne(this._firstFrame,u,o/h),l=Math.floor(l),l!==this._index&&(this._index=l,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));let _=this._index%i,d=Math.floor(this._index/i),y=-r*_+(f-r)/2,x=-n*d+(c-n)/2;y!==e.offset.x&&(e.offset.x=y),x!==e.offset.y&&(e.offset.y=x)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},oi={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};var Ze=class extends oe{#e={};get ids(){return this.#e}constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),this.attach(e),this.on(m.Types.insert,this.attach),this.on(m.Types.remove,this.detach)}attach(e){for(let i=0;i0,a=this.vertices,h=o?a.length/2:a.length,l,f=0,c,u,_,d,y,x,g,p,R;for(n?h--:o||(h-=2),c=0,u=h-1;c2&&(e-=1);let i=4/3*Math.tan(Math.PI/(e*2)),s=this._radius,r=s*i;for(let n=0;n2&&(e-=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()),b.each(t.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e=n&&l<=o&&(h=this._collection[l],this._renderer.collection.push(h),this._renderer.vertices[a*2+0]=h.x,this._renderer.vertices[a*2+1]=h.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}},fi={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof H||this._fill instanceof D||this._fill instanceof W||this._fill instanceof N)&&this._fill.unbind(m.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof H||this._fill instanceof D||this._fill instanceof W||this._fill instanceof N)&&this._fill.bind(m.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof H||this._stroke instanceof D||this._stroke instanceof W||this._stroke instanceof N)&&this._stroke.unbind(m.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof H||this._stroke instanceof D||this._stroke instanceof W||this._stroke instanceof N)&&this._stroke.bind(m.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(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){let e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(m.Types.insert,e).unbind(m.Types.remove,i),t instanceof oe?this._collection=t:this._collection=new oe(t||[]),this._collection.bind(m.Types.insert,e).bind(m.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};var ts=Math.cos,is=Math.sin,Be=class t extends P{_flagWidth=!1;_flagHeight=!1;_flagSides=!1;_radius=0;_width=0;_height=0;_sides=0;constructor(e,i,s,r){r=Math.max(r||0,3),super(),this._renderer.type="polygon";for(let n in ci)Object.defineProperty(this,n,ci[n]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof r=="number"&&(this.sides=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static Properties=["width","height","sides"];static fromObject(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;ie&&(this.vertices.splice(e-1,s-e),s=e);for(let r=0;r=s?this.vertices.push(new E(a,h)):this.vertices[r].set(a,h),this.vertices[r].command=r===0?k.move:k.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){let i=new t(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 E(0,0,0,0,0,0,a===0?k.move:k.curve));super(o),this._renderer.type="rounded-rectangle";for(let a in di)Object.defineProperty(this,a,di[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ss.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 e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static Properties=["width","height","radius"];static fromObject(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;ie&&(this.vertices.splice(e-1,s-e),s=e);for(let r=0;r=s?this.vertices.push(new E(h,l)):this.vertices[r].set(h,l),this.vertices[r].command=r===0?k.move:k.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){let i=this.innerRadius,s=this.outerRadius,r=this.sides,n=new t(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,b.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=b.performance.now()-this._startTime,l=this._lastFrame+1,o=1e3*(l-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),h=ne(this._firstFrame,l,r/o),h=Math.floor(h),h!==this._index&&(this._index=h,a=e[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,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof N))&&(a=e[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}},mi={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){let e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(m.Types.insert,e).unbind(m.Types.remove,i),this._textures=new oe((t||[]).slice(0)),this._textures.bind(m.Types.insert,e).bind(m.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function ls(){this._flagTextures=!0}function hs(t){let e=t.length;for(;e--;)t[e].bind(m.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function fs(t){let e=t.length;for(;e--;)t[e].unbind(m.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function yi(t){if(t instanceof N)return t;if(typeof t=="string")return new N(t)}var ot=Math.min,at=Math.max,G=class t extends ce{_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(e){super();for(let i in xi)Object.defineProperty(this,i,xi[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static Children=Ze;static InsertChildren(e){for(let i=0;i{e.children[s]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e=0&&i.push(r),r.children)for(let n=0;n=0&&this.children.splice(r,1),this.children.push(s)}return this}remove(e){let i=arguments.length,s=this.parent;if(i<=0&&s)return s.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let r=0;r=0&&this.children.splice(o,1)}return this}getBoundingClientRect(e){let i,s,r,n,o,a;this._update(!0);let h=1/0,l=-1/0,f=1/0,c=-1/0,u=/texture|gradient/i;s=e?this.matrix:this.worldMatrix;for(let _=0;_a+i?(s.beginning=1,s.ending=1):la&&ha&&l0&&i(this._children)),this._children=new Ze(t),this._children.bind(m.Types.insert,e),this._children.bind(m.Types.remove,i),this._children.bind(m.Types.order,s),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,b.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e0&&(s=Array.prototype.indexOf.call(e.subtractions,t),s>=0&&e.subtractions.splice(s,1)),e.additions.length>0&&(s=Array.prototype.indexOf.call(e.additions,t),s>=0&&e.additions.splice(s,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function n(){s=Array.prototype.indexOf.call(i.additions,t),s>=0&&i.additions.splice(s,1),s=Array.prototype.indexOf.call(i.subtractions,t),s<0&&(i.subtractions.push(t),i._flagSubtractions=!0)}}var Ve=class extends P{constructor(e,i,s,r){let n=[new E(e,i),new E(s,r)];super(n);for(let o in wi)Object.defineProperty(this,o,wi[o]);this.vertices[0].command=k.move,this.vertices[1].command=k.line,this.automatic=!1}static Properties=["left","right"]},wi={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(b.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=k.move;else{let e=new Z("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(b.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=k.line;else{let e=new Z("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};var Re={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},cs={start:"left",middle:"center",end:"right"},ki=["id","class","transform","xmlns","viewBox"],ds=["x","y","width","height","href","xlink:href"];function us(t){return cs[t]}function _s(t){let e=t.getAttribute("dominant-baseline"),i=t.getAttribute("alignment-baseline");return e||i}function Qe(t){return t.replace(/svg:/gi,"").toLowerCase()}function vi(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){let i=e.length();e.x=i*Math.cos(t.rotation),e.y=i*Math.sin(t.rotation)}}function ps(t,e){e||(e={});let i=t.split(";");for(let s=0;s"u"||typeof o>"u")continue;let a=n.replace(/\s/g,""),h=o.replace(/\s/g,"");e[a]=h}return e}function gs(t){let e={},i=ms(t),s=Math.max(i.length,t.style.length);for(let r=0;r=0&&e.splice(r,1)}return e}function ys(t,e){let i=e.split(/[\s,]/),s=-parseFloat(i[0]),r=-parseFloat(i[1]),n=parseFloat(i[2]),o=parseFloat(i[3]);if(s&&r)for(let c=0;c"u"&&/none/i.test(s.display))||typeof s.visibility>"u"&&/hidden/i.test(s.visibility);for(h in s)switch(l=s[h],h){case"gradientTransform":if(/none/i.test(l)||(a=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,a===null))break;switch(u=be(a),e._renderer.type){case"linear-gradient":vi(u,e.left),vi(u,e.right);break;case"radial-gradient":e.center.x+=u.translateX,e.center.y+=u.translateY,e.focal.x+=u.translateX,e.focal.y+=u.translateY,e.radius*=Math.max(u.scaleX,u.scaleY);break}break;case"transform":if(/none/i.test(l)||(a=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,a===null))break;J.AutoCalculateImportedMatrices?(u=be(a),e.translation.set(u.translateX,u.translateY),e.rotation=Math.PI*(u.rotation/180),e.scale=new w(u.scaleX,u.scaleY),_=parseFloat((s.x+"").replace("px")),d=parseFloat((s.y+"").replace("px")),_&&(e.translation.x=_),d&&(e.translation.y=d)):(a=t.getCTM(),e._matrix.manual=!0,e._matrix.set(a.a,a.b,a.c,a.d,a.e,a.f));break;case"visible":if(e instanceof G){e._visible=l;break}e.visible=l;break;case"stroke-linecap":if(e instanceof G){e._cap=l;break}e.cap=l;break;case"stroke-linejoin":if(e instanceof G){e._join=l;break}e.join=l;break;case"stroke-miterlimit":if(e instanceof G){e._miter=l;break}e.miter=l;break;case"stroke-width":if(e instanceof G){e._linewidth=parseFloat(l);break}e.linewidth=parseFloat(l);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof G){e._opacity=parseFloat(l);break}e.opacity=parseFloat(l);break;case"clip-path":if(Re.cssBackgroundImage.test(l)&&(y=l.replace(Re.cssBackgroundImage,"$1"),q.defs.current&&q.defs.current.contains(y)&&(g=q.defs.current.get(y),g&&g.childNodes.length>0)))switch(g=g.childNodes[0],p=Qe(g.nodeName),e.mask=q[p].call(this,g,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":f=(e instanceof G?"_":"")+h,Re.cssBackgroundImage.test(l)?(y=l.replace(Re.cssBackgroundImage,"$1"),q.defs.current&&q.defs.current.contains(y)?(g=q.defs.current.get(y),g.object||(p=Qe(g.nodeName),g.object=q[p].call(this,g,{})),g=g.object):(x=bs(this),g=x.getById(y)),e[f]=g):e[f]=l;break;case"id":e.id=l;break;case"class":case"className":e.classList=l.split(" "),e._flagClassName=!0;break;case"x":case"y":if(R=e instanceof H,A=e instanceof D,v=e instanceof W,R||A||v)break;l.match("[a-z%]$")&&!l.endsWith("px")&&(F=new Z("only pixel values are supported with the "+h+" attribute."),console.warn(F.name,F.message)),e.translation[h]=parseFloat(l);break;case"font-family":e instanceof de&&(e.family=l);break;case"font-size":e instanceof de&&(l.match("[a-z%]$")&&!l.endsWith("px")&&(F=new Z("only pixel values are supported with the "+h+" attribute."),console.warn(F.name,F.message)),e.size=parseFloat(l));break;case"font-weight":e instanceof de&&(e.weight=l);break;case"font-style":e instanceof de&&(e.style=l);break;case"text-decoration":e instanceof de&&(e.decoration=l);break;case"line-height":e instanceof de&&(e.leading=l);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),s}function xs(t,e){for(let i=0,s=t.childNodes.length;i with no href."),console.warn(i.name,i.message),null;let r=s.slice(1);if(!q.defs.current.contains(r))return i=new Z("unable to find element for reference "+s+"."),console.warn(i.name,i.message),null;let o=q.defs.current.get(r).cloneNode(!0);for(let h=0;h1&&(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(p=0,R=d.length,v=0;p0)switch(y){case"m":A="l";break;case"M":A="L";break}F.push(A+d.slice(p,p+g).join(" ")),v++}f=Array.prototype.concat.apply(f,F)}else f.push(u)}),b.each(f,function(u,_){let d,y,x,g=u[0],p=g.toLowerCase();l=u.slice(1).trim().match(Re.path),n=g===p;let R,A,v,F,S,L,O,M,V,B,Y,I,ee,le,Q,pe,se;switch(p){case"z":if(_>=c)r=!0;else{y=a.x,x=a.y,d=new E(y,x,void 0,void 0,void 0,void 0,k.close);for(let Ae=s.length-1;Ae>=0;Ae--){let Me=s[Ae];if(/m/i.test(Me.command)){a=Me;break}}}break;case"m":case"l":h=void 0,y=parseFloat(l[0]),x=parseFloat(l[1]),d=new E(y,x,void 0,void 0,void 0,void 0,/m/i.test(p)?k.move:k.line),n&&d.addSelf(a),a=d;break;case"h":case"v":B=/h/i.test(p)?"x":"y",Y=/x/i.test(B)?"y":"x",d=new E(void 0,void 0,void 0,void 0,void 0,void 0,k.line),d[B]=parseFloat(l[0]),d[Y]=a[Y],n&&(d[B]+=a[B]),a=d;break;case"c":case"s":R=a.x,A=a.y,h||(h=new w),/c/i.test(p)?(v=parseFloat(l[0]),F=parseFloat(l[1]),S=parseFloat(l[2]),L=parseFloat(l[3]),O=parseFloat(l[4]),M=parseFloat(l[5])):(V=st(a,h,n),v=V.x,F=V.y,S=parseFloat(l[0]),L=parseFloat(l[1]),O=parseFloat(l[2]),M=parseFloat(l[3])),n&&(v+=R,F+=A,S+=R,L+=A,O+=R,M+=A),a.controls.right.set(v-a.x,F-a.y),d=new E(O,M,S-O,L-M,void 0,void 0,k.curve),a=d,h=d.controls.left;break;case"t":case"q":R=a.x,A=a.y,h||(h=new w),/q/i.test(p)?(v=parseFloat(l[0]),F=parseFloat(l[1]),S=parseFloat(l[0]),L=parseFloat(l[1]),O=parseFloat(l[2]),M=parseFloat(l[3])):(V=st(a,h,n),v=V.x,F=V.y,S=V.x,L=V.y,O=parseFloat(l[0]),M=parseFloat(l[1])),n&&(v+=R,F+=A,S+=R,L+=A,O+=R,M+=A),a.controls.right.set((v-a.x)*.33,(F-a.y)*.33),d=new E(O,M,S-O,L-M,void 0,void 0,k.curve),a=d,h=d.controls.left;break;case"a":R=a.x,A=a.y,ee=parseFloat(l[0]),le=parseFloat(l[1]),Q=parseFloat(l[2]),pe=parseFloat(l[3]),se=parseFloat(l[4]),O=parseFloat(l[5]),M=parseFloat(l[6]),n&&(O+=R,M+=A),I=new E(O,M),I.command=k.arc,I.rx=ee,I.ry=le,I.xAxisRotation=Q,I.largeArcFlag=pe,I.sweepFlag=se,d=I,a=I,h=void 0;break}d&&(Array.isArray(d)?s=s.concat(d):s.push(d))})}i=new P(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},b.each(i.vertices,function(a){a.subSelf(o.centroid)}),xe.call(this,t,i,e),i.translation.addSelf(o.centroid),i},circle:function(t,e){let i=parseFloat(t.getAttribute("cx")),s=parseFloat(t.getAttribute("cy")),r=parseFloat(t.getAttribute("r")),n=new Te(0,0,r);return n.stroke="none",n.fill="black",xe.call(this,t,n,e),n.translation.x=i,n.translation.y=s,n},ellipse:function(t,e){let i=parseFloat(t.getAttribute("cx")),s=parseFloat(t.getAttribute("cy")),r=parseFloat(t.getAttribute("rx")),n=parseFloat(t.getAttribute("ry")),o=new Se(0,0,r,n);return o.stroke="none",o.fill="black",xe.call(this,t,o,e),o.translation.x=i,o.translation.y=s,o},rect:function(t,e){let i=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry"));if(!b.isNaN(i)||!b.isNaN(s))return q["rounded-rect"](t);let r=parseFloat(t.getAttribute("width")),n=parseFloat(t.getAttribute("height")),o=r/2,a=n/2,h=new ae(0,0,r,n);return h.stroke="none",h.fill="black",xe.call(this,t,h,e),h.translation.x+=o,h.translation.y+=a,h},"rounded-rect":function(t,e){let i=parseFloat(t.getAttribute("rx"))||0,s=parseFloat(t.getAttribute("ry"))||0,r=parseFloat(t.getAttribute("width")),n=parseFloat(t.getAttribute("height")),o=r/2,a=n/2,h=new w(i,s),l=new Ee(0,0,r,n,h);return l.stroke="none",l.fill="black",xe.call(this,t,l,e),l.translation.x+=o,l.translation.y+=a,l},line:function(t,e){let i=parseFloat(t.getAttribute("x1")),s=parseFloat(t.getAttribute("y1")),r=parseFloat(t.getAttribute("x2")),n=parseFloat(t.getAttribute("y2")),o=new Ve(i,s,r,n).noFill();return xe.call(this,t,o,e),o},lineargradient:function(t,e){let i=t.getAttribute("gradientUnits"),s=t.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(t.getAttribute("x1")||0),n=parseFloat(t.getAttribute("y1")||0),o=parseFloat(t.getAttribute("x2")||0),a=parseFloat(t.getAttribute("y2")||0),h=(o+r)/2,l=(a+n)/2;/userSpaceOnUse/i.test(i)&&(r-=h,n-=l,o-=h,a-=l);let f=[];for(let u=0;u1?p[1]:void 0),x===null?(p=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,x=p&&p.length>1?parseFloat(p[1]):1):x=parseFloat(x),f.push(new fe(d,y,x))}let c=new D(r,n,o,a,f);return c.spread=s,c.units=i,xe.call(this,t,c,e),c},radialgradient:function(t,e){let i=t.getAttribute("gradientUnits"),s=t.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(t.getAttribute("cx"))||0,n=parseFloat(t.getAttribute("cy"))||0,o=parseFloat(t.getAttribute("r")),a=parseFloat(t.getAttribute("fx")),h=parseFloat(t.getAttribute("fy"));b.isNaN(a)&&(a=r),b.isNaN(h)&&(h=n);let l=Math.abs(r+a)/2,f=Math.abs(n+h)/2;/userSpaceOnUse/i.test(i)&&(r-=l,n-=f,a-=l,h-=f);let c=[];for(let _=0;_1?R[1]:void 0),g===null?(R=p?p.match(/stop-opacity:\s?([0-9.-]*)/):!1,g=R&&R.length>1?parseFloat(R[1]):1):g=parseFloat(g),c.push(new fe(y,x,g))}let u=new W(r,n,o,c,a,h);return u.spread=s,u.units=i,xe.call(this,t,u,e),u},text:function(t,e){let i=us(t.getAttribute("text-anchor"))||"left",s=_s(t)||"baseline",r="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?r=t.childNodes[0].textContent:r=t.textContent;let n=new de(r);return xe.call(this,t,n,e),n.alignment=i,n.baseline=s,n},clippath:function(t,e){return q.defs.current&&!q.defs.current.contains(t.id)&&q.defs.current.add(t.id,t),null},image:function(t,e){let i,s=t.getAttribute("href")||t.getAttribute("xlink:href");if(!s)return i=new Z("encountered with no href."),console.warn(i.name,i.message),null;let r=parseFloat(t.getAttribute("x"))||0,n=parseFloat(t.getAttribute("y"))||0,o=parseFloat(t.getAttribute("width")),a=parseFloat(t.getAttribute("height")),h=new Fe(s,r,n);return b.isNaN(o)||(h.width=o),b.isNaN(a)||(h.height=a),xe.call(this,t,h,e),h}};function zt(t,e){let i=new XMLHttpRequest;return i.open("GET",t),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var et=class t extends ae{_flagTexture=!1;_flagMode=!1;_texture=null;_mode="fill";constructor(e,i,s,r,n,o){super(i,s,r||1,n||1),this._renderer.type="image";for(let a in Ri)Object.defineProperty(this,a,Ri[a]);this.noStroke(),this.noFill(),e instanceof N?this.texture=e:typeof e=="string"&&(this.texture=new N(e)),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(e){let i=new t().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i0&&this._scale!==0)for(let o=0;o0&&(t.lineDashOffset=se.offset||0,t.setLineDash(se)),t.beginPath();let Me,He,Ge,qe,Ke,$e,he;for(let j=0;j=y&&u&&(R=A,V=p.controls&&p.controls.right||w.zero,B=R.controls&&R.controls.left||w.zero,p._relative?(S=V.x+p.x,L=V.y+p.y):(S=V.x,L=V.y),R._relative?(v=B.x+R.x,F=B.y+R.y):(v=B.x,F=B.y),Y=R.x,I=R.y,t.bezierCurveTo(S,L,v,F,Y,I));break;case k.line:t.lineTo(Y,I);break;case k.move:A=p,t.moveTo(Y,I);break}return u&&t.closePath(),!le&&!i&&(U.isHidden.test(o)||(pe=o._renderer&&o._renderer.offset,pe&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y)),t.fill(),pe&&t.restore()),U.isHidden.test(r)||(pe=r._renderer&&r._renderer.offset,pe&&(t.save(),t.translate(-r._renderer.offset.x,-r._renderer.offset.y),t.scale(r._renderer.scale.x,r._renderer.scale.y),t.lineWidth=n/r._renderer.scale.x),t.stroke(),pe&&t.restore())),Q||t.restore(),le&&!i&&t.clip(),se&&se.length>0&&t.setLineDash(jt),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,i){let s,r,n,o,a,h,l,f,c,u,_,d,y,x,g,p;if(p=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,a=this._opacity*(p||1),h=this._visible,!e&&(!h||a===0))return this;if(b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,o=this._fill,f=this._renderer.collection,c=f.length,y=ft(s),g=this.dashes,l=this._size,y||(t.save(),t.transform(s[0],s[3],s[1],s[4],s[2],s[5])),o)if(typeof o=="string")t.fillStyle=o;else{let v=U.getRendererType(o._renderer.type);U[v].render.call(o,t,this),t.fillStyle=o._renderer.effect}if(r){if(typeof r=="string")t.strokeStyle=r;else{let v=U.getRendererType(r._renderer.type);U[v].render.call(r,t,this),t.strokeStyle=r._renderer.effect}n&&(t.lineWidth=ge(this))}typeof a=="number"&&(t.globalAlpha=a),g&&g.length>0&&(t.lineDashOffset=g.offset||0,t.setLineDash(g)),t.beginPath();let R=l*.5,A;this._sizeAttenuation||(A=this.worldMatrix.elements,A=be(A[0],A[3],A[1],A[4],A[2],A[5]),R/=Math.max(A.scaleX,A.scaleY));for(let v=0;v0&&t.setLineDash(jt),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,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(!e&&(!n||a||r===0))return this;b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let h=this._matrix.elements,l=this._stroke,f=this._linewidth,c=this._fill,u=this._decoration,_=this._direction,d=ft(h),y=c._renderer&&c._renderer.offset&&l._renderer&&l._renderer.offset,x=this.dashes,g=U.alignments[this._alignment]||this._alignment,p=U.baselines[this._baseline]||this._baseline,R,A,v,F,S,L,O,M,V,B,Y;if(d||(t.save(),t.transform(h[0],h[3],h[1],h[4],h[2],h[5])),o){let I=U.getRendererType(o._renderer.type);U[I].render.call(o,t,!0)}if(y||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=g,t.textBaseline=p,t.direction=_,c)if(typeof c=="string")t.fillStyle=c;else{let I=U.getRendererType(c._renderer.type);U[I].render.call(c,t,this),t.fillStyle=c._renderer.effect}if(l){if(typeof l=="string")t.strokeStyle=l;else{let I=U.getRendererType(l._renderer.type);U[I].render.call(l,t,this),t.strokeStyle=l._renderer.effect}f&&(t.lineWidth=ge(this))}if(typeof r=="number"&&(t.globalAlpha=r),x&&x.length>0&&(t.lineDashOffset=x.offset||0,t.setLineDash(x)),!a&&!i&&(U.isHidden.test(c)||(c._renderer&&c._renderer.offset?(L=c._renderer.scale.x,O=c._renderer.scale.y,t.save(),t.translate(-c._renderer.offset.x,-c._renderer.offset.y),t.scale(L,O),R=this._size/c._renderer.scale.y,A=this._leading/c._renderer.scale.y,t.font=[this._style,this._weight,R+"px/",A+"px",this._family].join(" "),v=c._renderer.offset.x/c._renderer.scale.x,F=c._renderer.offset.y/c._renderer.scale.y,t.fillText(this.value,v,F),t.restore()):t.fillText(this.value,0,0)),U.isHidden.test(l)||(l._renderer&&l._renderer.offset?(L=l._renderer.scale.x,O=l._renderer.scale.y,t.save(),t.translate(-l._renderer.offset.x,-l._renderer.offset.y),t.scale(L,O),R=this._size/l._renderer.scale.y,A=this._leading/l._renderer.scale.y,t.font=[this._style,this._weight,R+"px/",A+"px",this._family].join(" "),v=l._renderer.offset.x/l._renderer.scale.x,F=l._renderer.offset.y/l._renderer.scale.y,S=f/l._renderer.scale.x,t.lineWidth=S,t.strokeText(this.value,v,F),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(u)){let I=t.measureText(this.value),ee=1;switch(u){case"underline":V=I.actualBoundingBoxDescent,Y=I.actualBoundingBoxDescent;break;case"strikethrough":V=0,Y=0,ee=.5;break}switch(p){case"top":V+=this._size*ee,Y+=this._size*ee;break;case"baseline":case"bottom":V-=this._size*ee,Y-=this._size*ee;break}switch(g){case"left":case"start":M=0,B=I.width;break;case"right":case"end":M=-I.width,B=0;break;default:M=-I.width/2,B=I.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo(M,V),t.lineTo(B,Y),t.stroke()}return d||t.restore(),a&&!i&&t.clip(),x&&x.length>0&&t.setLineDash(jt),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(b.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=e.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=t.createLinearGradient(s,r,n,o);for(let a=0;a1){let I=ct(p);s=I*s,r=I*r,x=s*s,g=r*r}let R=x*y+g*d,A=(x*g-R)/R,v=ct(Ut(0,A));n===o&&(v=-v);let F=v*s*_/r,S=-v*r*u/s,L=ht(a)*F-lt(a)*S+(e+h)/2,O=lt(a)*F+ht(a)*S+(i+l)/2,M=Fi(1,0,(u-F)/s,(_-S)/r),V=Fi((u-F)/s,(_-S)/r,(-u-F)/s,(-_-S)/r)%K,B=M+V;vs(t,L,O,s,r,M,B,o===0,a)}},ie=class extends m{constructor(e){super();let i=e.smoothing!==!1;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=i),this.scene=new G,this.scene.parent=this}static Utils=U;setSize(e,i,s){return this.width=e,this.height=i,this.ratio=typeof s>"u"?De(this.ctx):s,this.domElement.width=e*this.ratio,this.domElement.height=i*this.ratio,this.domElement.style&&b.extend(this.domElement.style,{width:e+"px",height:i+"px"}),this.trigger(m.Types.resize,e,i,s)}render(){let e=this.ratio===1;return e||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),U.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};function vs(t,e,i,s,r,n,o,a,h){let l=o-n,f=Pe.Tolerance.epsilon,c=Math.abs(l)0&&T.setAttributes(s,e),s},setAttributes:function(t,e){let i=Object.keys(e);for(let s=0;s=s&&e&&(a.command===k.curve&&(c=r,p=a.controls&&a.controls.right||a,R=c.controls&&c.controls.left||c,a.relative?(u=z(p.x+a.x),_=z(p.y+a.y)):(u=z(p.x),_=z(p.y)),c.relative?(d=z(R.x+c.x),y=z(R.y+c.y)):(d=z(R.x),y=z(R.y)),O=z(c.x),M=z(c.y),f+=" C "+u+" "+_+" "+d+" "+y+" "+O+" "+M),a.command!==k.close&&(f+=" Z")),n+=f+" "}return n},pointsToString:function(t,e){let i="",s=e*.5;for(let r=0;r"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();let s=T.getRendererType(this._stroke._renderer.type);T[s].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=ge(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?T.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=T.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){let s=T.getClip(this,t),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=T.getRendererType(this._mask._renderer.type);T[s].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let s=this._size;if(!this._sizeAttenuation){let n=this.worldMatrix.elements,o=be(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(o.scaleX,o.scaleY)}let r=T.pointsToString(this._renderer.collection,s);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=T.getRendererType(this._fill._renderer.type);T[s].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();let s=T.getRendererType(this._stroke._renderer.type);T[s].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=ge(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?T.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=T.createElement("path",e),t.appendChild(this._renderer.elem)),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();let e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=T.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=T.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();let s=T.getRendererType(this._fill._renderer.type);T[s].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();let s=T.getRendererType(this._stroke._renderer.type);T[s].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=ge(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?T.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=T.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){let s=T.getClip(this,t),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=T.getRendererType(this._mask._renderer.type);T[s].render.call(this._mask,t),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(t,e){b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||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?T.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=T.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&t.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?T.setAttributes(this._renderer.image,s):this._renderer.image=T.createElement("image",s)),this._renderer.elem?Object.keys(i).length!==0&&T.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=T.createElement("pattern",i)),this._renderer.elem.parentNode===null&&t.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),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},dt=class extends m{constructor(e){super(),this.domElement=e.domElement||T.createElement("svg"),this.scene=new G,this.scene.parent=this,this.defs=T.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}static Utils=T;setSize(e,i){return this.width=e,this.height=i,T.setAttributes(this.domElement,{width:e,height:i}),this.trigger(m.Types.resize,e,i)}render(){return T.group.render.call(this.scene,this.domElement),T.defs.update(this.domElement),this}};var me={create:function(t,e,i){let s=t.createShader(t[i]);if(t.shaderSource(s,e),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS)){let n=t.getShaderInfoLog(s);throw t.deleteShader(s),new Z("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 ut=ke.Multiply,Rs=[1,0,0,0,1,0,0,0,1],Oe=new ye(9),As=ie.Utils,Ti=new w,Dt=new ye([0,0,1,0,0,1,0,1,1,0,1,1]),C={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 ke,group:{removeChild:function(t,e){if(t.children)for(let i=0;i0&&(p.lineDashOffset=Y.offset||0,p.setLineDash(Y));let se,Ae,Me,He,Ge,qe,Ke,$e;p.save(),p.scale(A.x,A.y),p.translate(Q,pe),p.beginPath();for(let he=0;he=ee&&B&&(r=se,c=j.controls&&j.controls.right||w.zero,u=r.controls&&r.controls.left||w.zero,j._relative?(a=c.x+j.x,h=c.y+j.y):(a=c.x,h=c.y),r._relative?(n=u.x+r.x,o=u.y+r.y):(n=u.x,o=u.y),_=r.x,d=r.y,p.bezierCurveTo(a,h,n,o,_,d));break;case k.line:p.lineTo(_,d);break;case k.move:se=j,p.moveTo(_,d);break}}B&&p.closePath(),C.isHidden.test(S)||(y=S._renderer&&S._renderer.offset,y&&(p.save(),p.translate(-S._renderer.offset.x,-S._renderer.offset.y),p.scale(S._renderer.scale.x,S._renderer.scale.y)),p.fill(),y&&p.restore()),C.isHidden.test(v)||(y=v._renderer&&v._renderer.offset,y&&(p.save(),p.translate(-v._renderer.offset.x,-v._renderer.offset.y),p.scale(v._renderer.scale.x,v._renderer.scale.y),p.lineWidth=F/v._renderer.scale.x),p.stroke(),y&&p.restore()),p.restore()},getBoundingClientRect:function(t,e,i){let s=1/0,r=-1/0,n=1/0,o=-1/0,a,h;t.forEach(function(l){let f=l.x,c=l.y,u=l.controls,_,d,y,x,g,p;n=Math.min(c,n),s=Math.min(f,s),r=Math.max(f,r),o=Math.max(c,o),l.controls&&(g=u.left,p=u.right,!(!g||!p)&&(_=l._relative?g.x+f:g.x,d=l._relative?g.y+c:g.y,y=l._relative?p.x+f:p.x,x=l._relative?p.y+c:p.y,!(!_||!d||!y||!x)&&(n=Math.min(d,x,n),s=Math.min(_,y,s),r=Math.max(_,y,r),o=Math.max(d,x,o))))}),typeof e=="number"&&(n-=e,s-=e,r+=e,o+=e),a=r-s,h=o-n,i.top=n,i.left=s,i.right=r,i.bottom=o,i.width=a,i.height=h,i.centroid||(i.centroid={}),i.centroid.x=-s,i.centroid.y=-n},render:function(t,e,i){if(!this._visible||!this._opacity)return this;b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let s=i||this.parent,r=ie.Utils.getRendererType(this._renderer.type),n=e[r],o=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,h=this._renderer.parent!==s,l=this._flagVertices||this._flagFill||this._fill instanceof D&&(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 N&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof D&&(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 N&&(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||h){this._renderer.matrix||(this._renderer.matrix=new ye(9)),this._matrix.toTransformArray(!0,Oe),ut(Oe,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w);let c,u;this._scale instanceof w?(c=this._scale.x*s._renderer.scale.x,u=this._scale.y*s._renderer.scale.y):(c=this._scale*s._renderer.scale.x,u=this._scale*s._renderer.scale.y),this._renderer.scale.x=c<0?-c:c,this._renderer.scale.y=u<0?-u:u,h&&(this._renderer.parent=s)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);let c=ie.Utils.getRendererType(this._mask._renderer.type);C[c].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(l?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,C.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),C.updateTexture.call(C,t,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;e.current!==n&&(t.useProgram(n),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n.position),t.bufferData(t.ARRAY_BUFFER,Dt,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(n,"u_resolution"),e.resolution.width,e.resolution.height),e.current=n),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(n,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);let f=this._renderer.rect;return t.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),t.uniform4f(n.rect,f.left,f.top,f.right,f.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let i,s=this.canvas,r=this.ctx,n=t.renderer.ratio,o=e._stroke,a=e._linewidth,h=e._fill,l=e._renderer.opacity||e._opacity,f=e.dashes,c=e._size*n,u=c;C.isHidden.test(o)||(u+=a),s.width=xt(u),s.height=s.width;let _=u/s.width,d=s.width/2,y=s.height/2;if(r.clearRect(0,0,s.width,s.height),h)if(typeof h=="string")r.fillStyle=h;else{let x=ie.Utils.getRendererType(h._renderer.type);C[x].render.call(h,r,e),r.fillStyle=h._renderer.effect}if(o){if(typeof o=="string")r.strokeStyle=o;else{let x=ie.Utils.getRendererType(o._renderer.type);C[x].render.call(o,r,e),r.strokeStyle=o._renderer.effect}a&&(r.lineWidth=ge(e)/_)}typeof l=="number"&&(r.globalAlpha=l),f&&f.length>0&&(r.lineDashOffset=f.offset||0,r.setLineDash(f)),r.save(),r.translate(d,y),r.scale(C.precision,C.precision),r.beginPath(),r.arc(0,0,c/_*.5,0,K),r.restore(),closed&&r.closePath(),C.isHidden.test(h)||(i=h._renderer&&h._renderer.offset,i&&(r.save(),r.translate(-h._renderer.offset.x,-h._renderer.offset.y),r.scale(h._renderer.scale.x,h._renderer.scale.y)),r.fill(),i&&r.restore()),C.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(t,e,i){if(!this._visible||!this._opacity)return this;b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let s=this._size,r=i||this.parent,n=e[this._renderer.type],o=this._sizeAttenuation,a=this._stroke,h=this._linewidth,l=r._matrix.manual||r._flagMatrix,f=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,u=this._renderer.vertices,_=this._renderer.collection.length,d=this._flagVertices,y=this._flagFill||this._fill instanceof D&&(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 N&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof D&&(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 N&&(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(l||f||c){this._renderer.matrix||(this._renderer.matrix=new ye(9)),this._matrix.toTransformArray(!0,Oe),ut(Oe,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w);let x,g;this._scale instanceof w?(x=this._scale.x*r._renderer.scale.x,g=this._scale.y*r._renderer.scale.y):(x=this._scale*r._renderer.scale.x,g=this._scale*r._renderer.scale.y),this._renderer.scale.x=x<0?-x:x,this._renderer.scale.y=g<0?-g:g,c&&(this._renderer.parent=r)}if(d){let x=this._renderer.positionBuffer;x&&t.deleteBuffer(x),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n.position),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW)}return y?(this._renderer.opacity=this._opacity*r._renderer.opacity,C.updateTexture.call(C,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(C.isHidden.test(a)||(s+=h),s/=C.precision,o&&(s*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==n&&(t.useProgram(n),e.resolution.flagged||t.uniform2f(t.getUniformLocation(n,"u_resolution"),e.resolution.width,e.resolution.height),e.current=n),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(n,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),t.uniform1f(n.size,s*e.resolution.ratio),t.drawArrays(t.POINTS,0,_),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){let i=this.canvas,s=this.ctx,r=t.renderer.ratio,n=Ti.copy(e._renderer.scale).multiply(r),o=e._stroke,a=e._linewidth,h=e._fill,l=e._renderer.opacity||e._opacity,f=e.dashes,c=e._decoration,u=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*n.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*n.y),1);let _=e._renderer.rect.centroid,d=_.x,y=_.y,x,g,p,R,A,v,F,S,L,O,M,V=h._renderer&&h._renderer.offset&&o._renderer&&o._renderer.offset;if(s.clearRect(0,0,i.width,i.height),V||(s.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),s.textAlign="center",s.textBaseline="middle",s.textDirection=u,h)if(typeof h=="string")s.fillStyle=h;else{let B=ie.Utils.getRendererType(h._renderer.type);C[B].render.call(h,s,e),s.fillStyle=h._renderer.effect}if(o){if(typeof o=="string")s.strokeStyle=o;else{let B=ie.Utils.getRendererType(o._renderer.type);C[B].render.call(o,s,e),s.strokeStyle=o._renderer.effect}a&&(s.lineWidth=ge(e))}if(typeof l=="number"&&(s.globalAlpha=l),f&&f.length>0&&(s.lineDashOffset=f.offset||0,s.setLineDash(f)),s.save(),s.scale(n.x,n.y),s.translate(d,y),C.isHidden.test(h)||(h._renderer&&h._renderer.offset?(v=h._renderer.scale.x,F=h._renderer.scale.y,s.save(),s.translate(-h._renderer.offset.x,-h._renderer.offset.y),s.scale(v,F),x=e._size/h._renderer.scale.y,g=e._leading/h._renderer.scale.y,s.font=[e._style,e._weight,x+"px/",g+"px",e._family].join(" "),p=h._renderer.offset.x/h._renderer.scale.x,R=h._renderer.offset.y/h._renderer.scale.y,s.fillText(e.value,p,R),s.restore()):s.fillText(e.value,0,0)),C.isHidden.test(o)||(o._renderer&&o._renderer.offset?(v=o._renderer.scale.x,F=o._renderer.scale.y,s.save(),s.translate(-o._renderer.offset.x,-o._renderer.offset.y),s.scale(v,F),x=e._size/o._renderer.scale.y,g=e._leading/o._renderer.scale.y,s.font=[e._style,e._weight,x+"px/",g+"px",e._family].join(" "),p=o._renderer.offset.x/o._renderer.scale.x,R=o._renderer.offset.y/o._renderer.scale.y,A=a/o._renderer.scale.x,s.lineWidth=A,s.strokeText(e.value,p,R),s.restore()):s.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(c)){let B=s.measureText(e.value);switch(c){case"underline":L=B.actualBoundingBoxDescent,M=B.actualBoundingBoxDescent;break;case"strikethrough":L=0,M=0;break}S=-B.width/2,O=B.width/2,s.lineWidth=Math.max(Math.floor(e._size/15),1),s.strokeStyle=s.fillStyle,s.beginPath(),s.moveTo(S,L),s.lineTo(O,M),s.stroke()}s.restore()},getBoundingClientRect:function(t,e){let i=C.ctx;i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),i.textAlign="center",i.textBaseline=ie.Utils.baselines[t._baseline]||t._baseline;let s=i.measureText(t._value),r=s.width,n=1.15*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent);this._linewidth&&!C.isHidden.test(this._stroke)&&(r+=this._linewidth*2,n+=this._linewidth*2);let o=r/2,a=n/2;switch(C.alignments[t._alignment]||t._alignment){case C.alignments.left:t.direction==="ltr"?(e.left=0,e.right=r):(e.left=-r,e.right=0);break;case C.alignments.right:t.direction==="ltr"?(e.left=-r,e.right=0):(e.left=0,e.right=r);break;default:e.left=-o,e.right=o}switch(t._baseline){case"bottom":e.top=-n,e.bottom=0;break;case"top":e.top=0,e.bottom=n;break;case"baseline":e.top=-a*1.5,e.bottom=a*.5;break;default:e.top=-a,e.bottom=a}e.width=r,e.height=n,e.centroid||(e.centroid={}),e.centroid.x=o,e.centroid.y=a},render:function(t,e,i){if(!this._visible||!this._opacity)return this;b.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let s=i||this.parent,r=e[this._renderer.type],n=s._matrix.manual||s._flagMatrix,o=this._matrix.manual||this._flagMatrix,a=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof D&&(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 N&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof D&&(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 N&&(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 ye(9)),this._matrix.toTransformArray(!0,Oe),ut(Oe,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w);let f,c;this._scale instanceof w?(f=this._scale.x*s._renderer.scale.x,c=this._scale.y*s._renderer.scale.y):(f=this._scale*s._renderer.scale.x,c=this._scale*s._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=c<0?-c:c,a&&(this._renderer.parent=s)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);let f=ie.Utils.getRendererType(this._mask._renderer.type);C[f].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,C.text.getBoundingClientRect(this,this._renderer.rect),C.updateTexture.call(C,t,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;e.current!==r&&(t.useProgram(r),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(r.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(r.position),t.bufferData(t.ARRAY_BUFFER,Dt,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(r,"u_resolution"),e.resolution.width,e.resolution.height),e.current=r),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(r,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);let l=this._renderer.rect;return t.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),t.uniform4f(r.rect,l.left,l.top,l.right,l.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),b.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(b.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=e.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=t.createLinearGradient(s,r,n,o);for(let a=0;a"u"?De(o):s,this.domElement.width=e*this.ratio,this.domElement.height=i*this.ratio,b.isObject(this.domElement.style)&&b.extend(this.domElement.style,{width:e+"px",height:i+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=e*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(m.Types.resize,e,i,s)}render(){let e=this.ctx;return this.overdraw||e.clear(e.COLOR_BUFFER_BIT),C.group.render.call(this.scene,e,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};var Fs=b.extend({Error:Z,getRatio:De,read:q,xhr:zt},b,re,Rt,bt),ze=class t{_events=new m;get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}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(e){let i=b.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:t.Types.svg,autostart:!1});if(b.each(i,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),b.isElement(i.domElement)){let s=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+s)||(this.type=t.Types[s])}this.renderer=new t[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=Ts.bind(this),this.fit.domElement=window,this.fit.attached=!0,b.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),b.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),ue.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=Ss.bind(this),b.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(m.Types.resize,Es.bind(this)),this.scene=this.renderer.scene,t.Instances.push(this),i.autostart&&tt.init()}static NextFrameId=J.NextFrameId;static Types=J.Types;static Version=J.Version;static PublishDate=J.PublishDate;static Identifier=J.Identifier;static Resolution=J.Resolution;static AutoCalculateImportedMatrices=J.AutoCalculateImportedMatrices;static Instances=J.Instances;static uniqueId=J.uniqueId;static Anchor=E;static Collection=oe;static Events=m;static Group=G;static Matrix=ke;static Path=P;static Registry=ve;static Element=_e;static Shape=ce;static Text=de;static Vector=w;static Gradient=H;static Image=et;static ImageSequence=Ne;static LinearGradient=D;static RadialGradient=W;static Sprite=Fe;static Stop=fe;static Texture=N;static ArcSegment=Ce;static Circle=Te;static Ellipse=Se;static Line=Ve;static Points=Le;static Polygon=Be;static Rectangle=ae;static RoundedRectangle=Ee;static Star=Ie;static CanvasRenderer=ie;static SVGRenderer=dt;static WebGLRenderer=_t;static Commands=k;static Utils=Fs;appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,tt.init(),this.trigger(m.Types.play)}pause(){return this.playing=!1,this.trigger(m.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,s,r;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i