From b200eec167852120bea0444da69927d70e8b3d3e Mon Sep 17 00:00:00 2001 From: Jono Brandel Date: Thu, 9 Jun 2022 09:09:51 -0700 Subject: [PATCH] Updated Builds for Hot Publishing --- build/two.js | 4 +++- build/two.min.js | 4 +++- build/two.module.js | 2 +- wiki/changelog/README.md | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build/two.js b/build/two.js index cb69ac51..54fd1421 100644 --- a/build/two.js +++ b/build/two.js @@ -732,7 +732,7 @@ var Two = (() => { canvas: "CanvasRenderer" }, Version: "v0.8.10", - PublishDate: "2022-06-04T04:53:21.949Z", + PublishDate: "2022-06-09T16:09:22.888Z", Identifier: "two-", Resolution: 12, AutoCalculateImportedMatrices: true, @@ -10304,3 +10304,5 @@ var Two = (() => { }; return __toCommonJS(two_exports); })().default; + +(function(){if(typeof exports==='object'&&typeof module!=='undefined'){module.exports=Two}})() \ No newline at end of file diff --git a/build/two.min.js b/build/two.min.js index 77a7de01..0496956d 100644 --- a/build/two.min.js +++ b/build/two.min.js @@ -21,7 +21,7 @@ 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 ge=Object.defineProperty;var Gi=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var Ki=Object.prototype.hasOwnProperty;var Ji=(e,t,i)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var $i=e=>ge(e,"__esModule",{value:!0});var Ce=(e,t)=>{for(var i in t)ge(e,i,{get:t[i],enumerable:!0})},Zi=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qi(t))!Ki.call(e,r)&&(i||r!=="default")&&ge(e,r,{get:()=>t[r],enumerable:!(s=Gi(t,r))||s.enumerable});return e};var Qi=(e=>(t,i)=>e&&e.get(t)||(i=Zi($i({}),t,1),e&&e.set(t,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var v=(e,t,i)=>(Ji(e,typeof t!="symbol"?t+"":t,i),i);var Js={};Ce(Js,{default:()=>I});var w={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var Ie={};Ce(Ie,{HALF_PI:()=>$,NumArray:()=>xt,TWO_PI:()=>J,decomposeMatrix:()=>Ot,getComputedMatrix:()=>pt,getPoT:()=>Pe,lerp:()=>nt,mod:()=>it,setMatrix:()=>Oe,toFixed:()=>K});var H;typeof window<"u"?H=window:typeof global<"u"?H=global:typeof self<"u"&&(H=self);var oi,J=Math.PI*2,$=Math.PI*.5;function Ot(e,t,i,s,r,n){let a;return arguments.length<=1?(a=e.a,t=e.b,i=e.c,s=e.d,r=e.e,n=e.f):a=e,{translateX:r,translateY:n,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(i*i+s*s),rotation:180*Math.atan2(t,a)/Math.PI}}function Oe(e){oi=e}function pt(e,t){t=t&&t.identity()||new oi;let i=e,s=[];for(;i&&i._matrix;)s.push(i._matrix),i=i.parent;s.reverse();for(let r=0;rjt,getAnchorsFromArcData:()=>is,getComponentOnCubicBezier:()=>Dt,getControlPoints:()=>ci,getCurveBoundingBox:()=>je,getCurveFromPoints:()=>Ne,getCurveLength:()=>Be,getReflection:()=>pe,integrate:()=>fi,subdivide:()=>te});var m=class{_events={};_bound=!1;constructor(){}addEventListener(t,i){return(this._events[t]||(this._events[t]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,i){if(!this._events)return this;if(!t&&!i)return this._events={},this._bound=!1,this;let s=t?[t]:Object.keys(this._events);for(let r=0,n=s.length;r=4){let n=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,n)}let s=t.x-i.x,r=t.y-i.y;return Math.atan2(r,s)}static distanceBetween(t,i){return Math.sqrt(bt.distanceBetweenSquared(t,i))}static distanceBetweenSquared(t,i){let s=t.x-i.x,r=t.y-i.y;return s*s+r*r}set(t,i){return this.x=t,this.y=i,this}copy(t){return this.x=t.x,this.y=t.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new bt(this.x,this.y)}add(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x+=t,this.y+=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x+=t.x,this.y+=t.y):(this.x+=t,this.y+=i),this)}addSelf(t){return this.add.apply(this,arguments)}sub(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x-=t,this.y-=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x-=t.x,this.y-=t.y):(this.x-=t,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(t){return this.sub.apply(this,arguments)}subtractSelf(t){return this.sub.apply(this,arguments)}multiply(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x*=t,this.y*=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x*=t.x,this.y*=t.y):(this.x*=t,this.y*=i),this)}multiplySelf(t){return this.multiply.apply(this,arguments)}multiplyScalar(t){return this.multiply(t)}divide(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x/=t,this.y/=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x/=t.x,this.y/=t.y):(this.x/=t,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(t){return this.divide.apply(this,arguments)}divideScalar(t){return this.divide(t)}negate(){return this.multiply(-1)}dot(t){return this.x*t.x+this.y*t.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let i=this.x-t.x,s=this.y-t.y;return i*i+s*s}setLength(t){return this.normalize().multiplyScalar(t)}equals(t,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(t)"u"?1e-4:t,this.length()>1,f=s&1?n[h++]*e(o):0;for(;h=0&&t<4294967296}var S={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){let t=typeof e;return t==="function"||t==="object"&&!!e},extend:function(e){let t=ui.call(arguments,1);for(let i=0;i0&&this.set(o)}static Multiply(t,i,s){if(i.length<=3){let E=t,C,j,M,T=i[0]||0,N=i[1]||0,z=i[2]||0;return C=E[0]*T+E[1]*N+E[2]*z,j=E[3]*T+E[4]*N+E[5]*z,M=E[6]*T+E[7]*N+E[8]*z,{x:C,y:j,z:M}}let r=t[0],n=t[1],a=t[2],o=t[3],h=t[4],l=t[5],f=t[6],u=t[7],_=t[8],d=i[0],c=i[1],p=i[2],b=i[3],g=i[4],y=i[5],x=i[6],R=i[7],A=i[8];return s=s||new xt(9),s[0]=r*d+n*b+a*x,s[1]=r*c+n*g+a*R,s[2]=r*p+n*y+a*A,s[3]=o*d+h*b+l*x,s[4]=o*c+h*g+l*R,s[5]=o*p+h*y+l*A,s[6]=f*d+u*b+_*x,s[7]=f*c+u*g+_*R,s[8]=f*p+u*y+_*A,s}set(t,i,s,r,n,a,o,h,l){if(typeof i>"u"){let f=t;t=f[0],i=f[1],s=f[2],r=f[3],n=f[4],a=f[5],o=f[6],h=f[7],l=f[8]}return this.elements[0]=t,this.elements[1]=i,this.elements[2]=s,this.elements[3]=r,this.elements[4]=n,this.elements[5]=a,this.elements[6]=o,this.elements[7]=h,this.elements[8]=l,this.trigger(m.Types.change)}copy(t){return this.elements[0]=t.elements[0],this.elements[1]=t.elements[1],this.elements[2]=t.elements[2],this.elements[3]=t.elements[3],this.elements[4]=t.elements[4],this.elements[5]=t.elements[5],this.elements[6]=t.elements[6],this.elements[7]=t.elements[7],this.elements[8]=t.elements[8],this.manual=t.manual,this.trigger(m.Types.change)}identity(){return this.elements[0]=mt.Identity[0],this.elements[1]=mt.Identity[1],this.elements[2]=mt.Identity[2],this.elements[3]=mt.Identity[3],this.elements[4]=mt.Identity[4],this.elements[5]=mt.Identity[5],this.elements[6]=mt.Identity[6],this.elements[7]=mt.Identity[7],this.elements[8]=mt.Identity[8],this.trigger(m.Types.change)}multiply(t,i,s,r,n,a,o,h,l){if(typeof i>"u")return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.trigger(m.Types.change);if(typeof r>"u"){t=t||0,i=i||0,s=s||0,n=this.elements;let V=n[0]*t+n[1]*i+n[2]*s,ft=n[3]*t+n[4]*i+n[5]*s,ct=n[6]*t+n[7]*i+n[8]*s;return{x:V,y:ft,z:ct}}let f=this.elements,u=[t,i,s,r,n,a,o,h,l],_=f[0],d=f[1],c=f[2],p=f[3],b=f[4],g=f[5],y=f[6],x=f[7],R=f[8],A=u[0],E=u[1],C=u[2],j=u[3],M=u[4],T=u[5],N=u[6],z=u[7],W=u[8];return this.elements[0]=_*A+d*j+c*N,this.elements[1]=_*E+d*M+c*z,this.elements[2]=_*C+d*T+c*W,this.elements[3]=p*A+b*j+g*N,this.elements[4]=p*E+b*M+g*z,this.elements[5]=p*C+b*T+g*W,this.elements[6]=y*A+x*j+R*N,this.elements[7]=y*E+x*M+R*z,this.elements[8]=y*C+x*T+R*W,this.trigger(m.Types.change)}inverse(t){let i=this.elements;t=t||new mt;let s=i[0],r=i[1],n=i[2],a=i[3],o=i[4],h=i[5],l=i[6],f=i[7],u=i[8],_=u*o-h*f,d=-u*a+h*l,c=f*a-o*l,p=s*_+r*d+n*c;return p?(p=1/p,t.elements[0]=_*p,t.elements[1]=(-u*r+n*f)*p,t.elements[2]=(h*r-n*o)*p,t.elements[3]=d*p,t.elements[4]=(u*s-n*l)*p,t.elements[5]=(-h*s+n*a)*p,t.elements[6]=c*p,t.elements[7]=(-f*s+r*l)*p,t.elements[8]=(o*s-r*a)*p,t):null}scale(t,i){return arguments.length<=1&&(i=t),this.multiply(t,0,0,0,i,0,0,0,1)}rotate(t){let i=as(t),s=os(t);return this.multiply(i,-s,0,s,i,0,0,0,1)}translate(t,i){return this.multiply(1,0,t,0,1,i,0,0,1)}skewX(t){let i=_i(t);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(t){let i=_i(t);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(t){return ze.length=0,this.toTransformArray(t,ze),ze.map(K).join(" ")}toTransformArray(t,i){let s=this.elements,r=!!i,n=s[0],a=s[1],o=s[2],h=s[3],l=s[4],f=s[5];if(t){let u=s[6],_=s[7],d=s[8];if(r){i[0]=n,i[1]=h,i[2]=u,i[3]=a,i[4]=l,i[5]=_,i[6]=o,i[7]=f,i[8]=d;return}return[n,h,u,a,l,_,o,f,d]}if(r){i[0]=n,i[1]=h,i[2]=a,i[3]=l,i[4]=o,i[5]=f;return}return[n,h,a,l,o,f]}toArray(t,i){let s=this.elements,r=!!i,n=s[0],a=s[1],o=s[2],h=s[3],l=s[4],f=s[5];if(t){let u=s[6],_=s[7],d=s[8];if(r){i[0]=n,i[1]=a,i[2]=o,i[3]=h,i[4]=l,i[5]=f,i[6]=u,i[7]=_,i[8]=d;return}return[n,a,o,h,l,f,u,_,d]}if(r){i[0]=n,i[1]=a,i[2]=o,i[3]=h,i[4]=l,i[5]=f;return}return[n,a,o,h,l,f]}toObject(){return{elements:this.toArray(!0),manual:!!this.manual}}clone(){return new mt().copy(this)}},at=mt;v(at,"Identity",[1,0,0,0,1,0,0,0,1]);Oe(at);var ot=class extends Ft{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let t in me)Object.defineProperty(this,t,me[t]);this._renderer.flagMatrix=gi.bind(this),this.isShape=!0,this.id=X.Identifier+X.uniqueId(),this.matrix=new at,this.worldMatrix=new at,this.position=new k,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get translation(){return me.position.get.apply(this,arguments)}set translation(t){me.position.set.apply(this,arguments)}addTo(t){return t.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}clone(t){let i=new ot;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),t&&t.add(i),i._update()}_update(t){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._scale instanceof k?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),t&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}},me={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(m.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(m.Types.change,this._renderer.flagMatrix),gi.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof k&&this._scale.unbind(m.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof k&&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(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return pt(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function gi(){this._flagMatrix=!0}var lt=class extends Array{_events=new m;get _bound(){return this._events._bound}set _bound(t){this._events._bound=t}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.on.apply(this,arguments)}bind(){return this._events.bind.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.off.apply(this,arguments)}unbind(){return this._events.unbind.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.trigger.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}constructor(){super();arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}pop(){let t=super.pop.apply(this,arguments);return this.trigger(m.Types.remove,[t]),t}shift(){let t=super.shift.apply(this,arguments);return this.trigger(m.Types.remove,[t]),t}push(){let t=super.push.apply(this,arguments);return this.trigger(m.Types.insert,arguments),t}unshift(){let t=super.unshift.apply(this,arguments);return this.trigger(m.Types.insert,arguments),t}splice(){let t=super.splice.apply(this,arguments);if(this.trigger(m.Types.remove,t),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 t}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)}};var ye=class extends lt{ids={};constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments);super(t);this.attach(t),this.on(m.Types.insert,this.attach),this.on(m.Types.remove,this.detach)}attach(t){for(let i=0;i=0&&i.push(r),r.children)for(let n=0;n=0&&this.children.splice(r,1),this.children.push(s)}return this}remove(t){let i=arguments.length,s=this.parent;if(i<=0&&s)return s.remove(this),this;t instanceof Array?t=t.slice():t=Array.prototype.slice.call(arguments);for(let r=0;r=0&&this.children.splice(a,1)}return this}getBoundingClientRect(t){let i,s,r,n,a,o,h,l,f,u;this._update(!0);let _=1/0,d=-1/0,c=1/0,p=-1/0,b=/texture|gradient/i;s=t?this._matrix:pt(this);for(let g=0;go+i?(s.beginning=1,s.ending=1):lo&&ho&&l0&&i(this._children)),this._children=new ye(e),this._children.bind(m.Types.insert,t),this._children.bind(m.Types.remove,i),this._children.bind(m.Types.order,s),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,S.isObject(e)&&!e.clip&&(e.clip=!0)}}};function mi(e,t){let i=e.parent,s;if(i===t){r();return}if(i&&i.children.ids[e.id]&&(s=Array.prototype.indexOf.call(i.children,e),i.children.splice(s,1),n()),t){r();return}n(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete e.parent;function r(){t.subtractions.length>0&&(s=Array.prototype.indexOf.call(t.subtractions,e),s>=0&&t.subtractions.splice(s,1)),t.additions.length>0&&(s=Array.prototype.indexOf.call(t.additions,e),s>=0&&t.additions.splice(s,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function n(){s=Array.prototype.indexOf.call(i.additions,e),s>=0&&i.additions.splice(s,1),s=Array.prototype.indexOf.call(i.subtractions,e),s<0&&(i.subtractions.push(e),i._flagSubtractions=!0)}}var yi=new at,De=[],He=Math.max,ls=Math.min,xi=Math.abs,ve=Math.sin,we=Math.cos,hs=Math.acos,Ae=Math.sqrt,tt={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(i){return this[i]},e.setAttribute=function(i,s){return this[i]=s,this},e},group:{renderChild:function(e){tt[e._renderer.type].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();let t=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s=this._mask,r=ke(t),n=!r||!!s;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,n&&(e.save(),r||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),s&&tt[s._renderer.type].render.call(s,e,!0),this._opacity>0&&this._scale!==0)for(let a=0;a0&&(e.lineDashOffset=rt.offset||0,e.setLineDash(rt)),e.beginPath();let Ct,$t,Zt,Qt,kt,Q,ai;for(let Lt=0;Lt=p&&_&&(x=R,N=y.controls&&y.controls.right||k.zero,z=x.controls&&x.controls.left||k.zero,y._relative?(C=N.x+y.x,j=N.y+y.y):(C=N.x,j=N.y),x._relative?(A=z.x+x.x,E=z.y+x.y):(A=z.x,E=z.y),W=x.x,V=x.y,e.bezierCurveTo(C,j,A,E,W,V));break;case w.line:e.lineTo(W,V);break;case w.move:R=y,e.moveTo(W,V);break}return _&&e.closePath(),!ct&&!i&&(tt.isHidden.test(a)||(ut=a._renderer&&a._renderer.offset,ut&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),ut&&e.restore()),tt.isHidden.test(r)||(ut=r._renderer&&r._renderer.offset,ut&&(e.save(),e.translate(-r._renderer.offset.x,-r._renderer.offset.y),e.scale(r._renderer.scale.x,r._renderer.scale.y),e.lineWidth=n/r._renderer.scale.x),e.stroke(),ut&&e.restore())),Z||e.restore(),ct&&!i&&e.clip(),rt&&rt.length>0&&e.setLineDash(De),this.flagReset()}},points:{render:function(e,t,i){let s,r,n,a,o,h,l,f,u,_,d,c,p,b,g,y;if(y=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*(y||1),h=this._visible,!t&&(!h||o===0))return this;this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,a=this._fill,f=this._renderer.collection,u=f.length,p=ke(s),g=this.dashes,l=this._size,p||(e.save(),e.transform(s[0],s[3],s[1],s[4],s[2],s[5])),a&&(typeof a=="string"?e.fillStyle=a:(tt[a._renderer.type].render.call(a,e,this),e.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?e.strokeStyle=r:(tt[r._renderer.type].render.call(r,e,this),e.strokeStyle=r._renderer.effect),n&&(e.lineWidth=n)),typeof o=="number"&&(e.globalAlpha=o),g&&g.length>0&&(e.lineDashOffset=g.offset||0,e.setLineDash(g)),e.beginPath();let x=l*.5,R;this._sizeAttenuation||(pt(this,yi),R=yi.elements,R=Ot(R[0],R[3],R[1],R[4],R[2],R[5]),x/=Math.max(R.scaleX,R.scaleY));for(let A=0;A0&&e.setLineDash(De),this.flagReset()}},text:{render:function(e,t,i){let s=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,r=this._opacity*s,n=this._visible,a=this._mask,o=this._clip;if(!t&&(!n||o||r===0))return this;this._update();let h=this._matrix.elements,l=this._stroke,f=this._linewidth,u=this._fill,_=this._decoration,d=ke(h),c=u._renderer&&u._renderer.offset&&l._renderer&&l._renderer.offset,p=this.dashes,b=tt.alignments[this._alignment]||this._alignment,g=this._baseline,y,x,R,A,E,C,j,M,T,N,z;if(d||(e.save(),e.transform(h[0],h[3],h[1],h[4],h[2],h[5])),a&&tt[a._renderer.type].render.call(a,e,!0),c||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=b,e.textBaseline=g,u&&(typeof u=="string"?e.fillStyle=u:(tt[u._renderer.type].render.call(u,e,this),e.fillStyle=u._renderer.effect)),l&&(typeof l=="string"?e.strokeStyle=l:(tt[l._renderer.type].render.call(l,e,this),e.strokeStyle=l._renderer.effect),f&&(e.lineWidth=f)),typeof r=="number"&&(e.globalAlpha=r),p&&p.length>0&&(e.lineDashOffset=p.offset||0,e.setLineDash(p)),!o&&!i&&(tt.isHidden.test(u)||(u._renderer&&u._renderer.offset?(C=u._renderer.scale.x,j=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale(C,j),y=this._size/u._renderer.scale.y,x=this._leading/u._renderer.scale.y,e.font=[this._style,this._weight,y+"px/",x+"px",this._family].join(" "),R=u._renderer.offset.x/u._renderer.scale.x,A=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,R,A),e.restore()):e.fillText(this.value,0,0)),tt.isHidden.test(l)||(l._renderer&&l._renderer.offset?(C=l._renderer.scale.x,j=l._renderer.scale.y,e.save(),e.translate(-l._renderer.offset.x,-l._renderer.offset.y),e.scale(C,j),y=this._size/l._renderer.scale.y,x=this._leading/l._renderer.scale.y,e.font=[this._style,this._weight,y+"px/",x+"px",this._family].join(" "),R=l._renderer.offset.x/l._renderer.scale.x,A=l._renderer.offset.y/l._renderer.scale.y,E=f/l._renderer.scale.x,e.lineWidth=E,e.strokeText(this.value,R,A),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(_)){let W=e.measureText(this.value),V=1;switch(_){case"underline":T=W.actualBoundingBoxAscent,z=W.actualBoundingBoxAscent;break;case"strikethrough":T=0,z=0,V=.5;break}switch(g){case"top":T+=this._size*V,z+=this._size*V;break;case"baseline":case"bottom":T-=this._size*V,z-=this._size*V;break}switch(b){case"left":case"start":M=0,N=W.width;break;case"right":case"end":M=-W.width,N=0;break;default:M=-W.width/2,N=W.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(M,T),e.lineTo(N,z),e.stroke()}return d||e.restore(),o&&!i&&e.clip(),p&&p.length>0&&e.setLineDash(De),this.flagReset()}},"linear-gradient":{render:function(e,t){if(!!t){if(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,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=t.getBoundingClientRect(!0),s=(s-.5)*i.width,r=(r-.5)*i.height,n=(n-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=e.createLinearGradient(s,r,n,a);for(let o=0;o1){let V=Ae(y);s=V*s,r=V*r,b=s*s,g=r*r}let x=b*p+g*c,R=(b*g-x)/x,A=Ae(He(0,R));n===a&&(A=-A);let E=A*s*d/r,C=-A*r*_/s,j=we(o)*E-ve(o)*C+(t+h)/2,M=ve(o)*E+we(o)*C+(i+l)/2,T=bi(1,0,(_-E)/s,(d-C)/r),N=bi((_-E)/s,(d-C)/r,(-_-E)/s,(-d-C)/r)%J,z=T+N;fs(e,j,M,s,r,T,z,a===0,o)}},At=class extends m{constructor(t){super();let i=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=i),this.scene=new G,this.scene.parent=this}setSize(t,i,s){return this.width=t,this.height=i,this.ratio=typeof s>"u"?Ht(this.ctx):s,this.domElement.width=t*this.ratio,this.domElement.height=i*this.ratio,this.domElement.style&&S.extend(this.domElement.style,{width:t+"px",height:i+"px"}),this.trigger(m.Types.resize,t,i,s)}render(){let t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),tt.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};v(At,"Utils",tt);function fs(e,t,i,s,r,n,a,o,h){let l=a-n,f=jt.Tolerance.epsilon,u=Math.abs(l)=s)return s-r>=0;r+=a}return!1}function Xt(e,t){let i=e._length;if(t<=0)return 0;if(t>=i)return e._lengths.length-1;for(let s=0,r=0;s=t)return t-=r,Math.max(s-1,0)+t/e._lengths[s];r+=e._lengths[s]}return-1}function Re(e,t,i){let s,r,n,a,o,h,l,f,u=t.controls&&t.controls.right,_=e.controls&&e.controls.left;return s=t.x,o=t.y,r=(u||t).x,h=(u||t).y,n=(_||e).x,l=(_||e).y,a=e.x,f=e.y,u&&t._relative&&(r+=t.x,h+=t.y),_&&e._relative&&(n+=e.x,l+=e.y),Be(s,o,r,h,n,l,a,f,i)}function Xe(e,t,i){let s,r,n,a,o,h,l,f,u=t.controls&&t.controls.right,_=e.controls&&e.controls.left;return s=t.x,o=t.y,r=(u||t).x,h=(u||t).y,n=(_||e).x,l=(_||e).y,a=e.x,f=e.y,u&&t._relative&&(r+=t.x,h+=t.y),_&&e._relative&&(n+=e.x,l+=e.y),te(s,o,r,h,n,l,a,f,i)}var Mt=class extends Ft{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";constructor(t,i,s){super();for(let r in vi)Object.defineProperty(this,r,vi[r]);this._renderer.type="stop",this.offset=typeof t=="number"?t:Mt.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof i=="string"?i:Mt.Index<=0?"#fff":"#000",Mt.Index=(Mt.Index+1)%2}clone(t){let i=new Mt;return S.each(Mt.Properties,function(s){i[s]=this[s]},this),t&&t.stops&&t.stops.push(i),i}toObject(){let t={};return S.each(Mt.Properties,function(i){t[i]=this[i]},this),t}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},_t=Mt;v(_t,"Index",0),v(_t,"Properties",["offset","opacity","color"]);var vi={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}};var ee=class extends Ft{_flagStops=!1;_flagSpread=!1;_flagUnits=!1;_spread="";_units="";constructor(t){super();for(let i in wi)Object.defineProperty(this,i,wi[i]);this._renderer.type="gradient",this.id=X.Identifier+X.uniqueId(),this.classList=[],this._renderer.flagStops=cs.bind(this),this._renderer.bindStops=us.bind(this),this._renderer.unbindStops=ds.bind(this),this.spread="pad",this.units="objectBoundingBox",t&&(this.stops=t)}clone(t){let i=this.stops.map(function(r){return r.clone()}),s=new ee(i);return S.each(ee.Properties,function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t={stops:this.stops.map(function(i){return i.toObject()})};return S.each(ee.Properties,function(i){t[i]=this[i]},this),t}_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}},Y=ee;v(Y,"Stop",_t),v(Y,"Properties",["spread","stops","renderer","units"]);var wi={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){let t=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(m.Types.insert,t).unbind(m.Types.remove,i),this._stops=new lt((e||[]).slice(0)),this._stops.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._stops)}}};function cs(){this._flagStops=!0}function us(e){let t=e.length;for(;t--;)e[t].bind(m.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function ds(e){let t=e.length;for(;t--;)e[t].unbind(m.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ye=class extends Y{_flagEndPoints=!1;_left=null;_right=null;constructor(t,i,s,r,n){super(n);for(let a in ki)Object.defineProperty(this,a,ki[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=_s.bind(this),this.left=new k,this.right=new k,typeof t=="number"&&(this.left.x=t),typeof i=="number"&&(this.left.y=i),typeof s=="number"&&(this.right.x=s),typeof r=="number"&&(this.right.y=r)}clone(t){let i=this.stops.map(function(r){return r.clone()}),s=new Ye(this.left._x,this.left._y,this.right._x,this.right._y,i);return S.each(Y.Properties,function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return t.left=this.left.toObject(),t.right=this.right.toObject(),t}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(m.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},U=Ye;v(U,"Properties",["left","right"]),v(U,"Stop",_t);var ki={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof k&&this._left.unbind(m.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(m.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof k&&this._right.unbind(m.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(m.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function _s(){this._flagEndPoints=!0}var ie=class extends Y{_flagRadius=!1;_flagCenter=!1;_flagFocal=!1;_radius=0;_center=null;_focal=null;constructor(t,i,s,r,n,a){super(r);for(let o in Ai)Object.defineProperty(this,o,Ai[o]);this._renderer.type="radial-gradient",this._renderer.flagCenter=gs.bind(this),this._renderer.flagFocal=ps.bind(this),this.center=new k,this.radius=typeof s=="number"?s:1,this.focal=new k,typeof t=="number"&&(this.center.x=t),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof n=="number"&&(this.focal.x=n),typeof a=="number"&&(this.focal.y=a)}clone(t){let i=this.stops.map(function(r){return r.clone()}),s=new ie(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return S.each(Y.Properties.concat(ie.Properties),function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return S.each(ie.Properties,function(i){t[i]=this[i]},this),t.center=this.center.toObject(),t.focal=this.focal.toObject(),t}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(m.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},D=ie;v(D,"Stop",_t),v(D,"Properties",["center","radius","focal"]);var Ai={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(e){this._center&&this._center.unbind(m.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(m.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(m.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(m.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function gs(){this._flagCenter=!0}function ps(){this._flagFocal=!0}var Se,Ri={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};H.document&&(Se=document.createElement("a"));var st=class extends Ft{_flagSrc=!1;_flagImage=!1;_flagVideo=!1;_flagLoaded=!1;_flagRepeat=!1;_flagOffset=!1;_flagScale=!1;_src="";_image=null;_loaded=!1;_repeat="no-repeat";_scale=1;_offset=null;constructor(t,i){super();this._renderer={};for(let s in Si)Object.defineProperty(this,s,Si[s]);if(this._renderer.type="texture",this._renderer.flagOffset=ms.bind(this),this._renderer.flagScale=ys.bind(this),this.id=X.Identifier+X.uniqueId(),this.classList=[],this.loaded=!1,this.repeat="no-repeat",this.offset=new k,typeof i=="function"){let s=function(){this.unbind(m.Types.load,s),typeof i=="function"&&i()}.bind(this);this.bind(m.Types.load,s)}if(typeof t=="string")this.src=t;else if(typeof t=="object"){let s=Object.prototype.toString.call(t);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=t)}this._update()}static getAbsoluteURL(t){return Se?(Se.href=t,Se.href):t}static loadHeadlessBuffer(t,i){t.image.onload=i,t.image.src=t.src}static getTag(t){return t&&t.nodeName&&t.nodeName.toLowerCase()||"img"}static getImage(t){let i=st.getAbsoluteURL(t);if(st.ImageRegistry.contains(i))return st.ImageRegistry.get(i);let s;return ht.Image?(s=new ht.Image,At.Utils.shim(s,"img")):H.document?Ri.video.test(i)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s}static load(t,i){let s=t.image,r=st.getTag(s);t._flagImage&&(/canvas/i.test(r)?st.Register.canvas(t,i):(t._src=!ht.isHeadless&&s.getAttribute("two-src")||s.src,st.Register[r](t,i))),t._flagSrc&&(s||(s=st.getImage(t.src),t.image=s),r=st.getTag(s),st.Register[r](t,i))}clone(){let t=new st(this.src);return t.repeat=this.repeat,t.offset.copy(this.origin),t.scale=this.scale,t}toObject(){return{src:this.src,repeat:this.repeat,origin:this.origin.toObject(),scale:typeof this.scale=="number"?this.scale:this.scale.toObject()}}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(m.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,st.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}},B=st;v(B,"Properties",["src","loaded","repeat","scale","offset","image"]),v(B,"RegularExpressions",Ri),v(B,"ImageRegistry",new Tt),v(B,"Register",{canvas:function(t,i){t._src="#"+t.id,st.ImageRegistry.add(t.src,t.image),typeof i=="function"&&i()},img:function(t,i){let s=t.image,r=function(a){!ht.isHeadless&&s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),typeof i=="function"&&i()},n=function(a){throw!ht.isHeadless&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),new et("unable to load "+t.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?r():!ht.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=st.getAbsoluteURL(t._src),!(!ht.isHeadless&&s&&s.getAttribute("two-src"))&&(ht.isHeadless||s.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,s),ht.isHeadless?st.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,i){if(ht.isHeadless)throw new et("video textures are not implemented in headless environments.");let s=function(n){t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof i=="function"&&i()},r=function(n){throw t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),new et("unable to load "+t.src)};t._src=st.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?s():(t.image.addEventListener("canplaythrough",s,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Si={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){let t=B.getTag(e),i;switch(t){case"canvas":i="#"+e.id;break;default:i=e.src}B.ImageRegistry.contains(i)?this._image=B.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(m.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(m.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof k&&this._scale.unbind(m.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof k&&this._scale.bind(m.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function ms(){this._flagOffset=!0}function ys(){this._flagScale=!0}var Pt=Math.min,It=Math.max,xs=Math.ceil,bs=Math.floor,vs=new k,Yt=class extends ot{_flagVertices=!0;_flagLength=!0;_flagFill=!0;_flagStroke=!0;_flagLinewidth=!0;_flagOpacity=!0;_flagVisible=!0;_flagCap=!0;_flagJoin=!0;_flagMiter=!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;constructor(t,i,s,r){super();for(let n in Ei)Object.defineProperty(this,n,Ei[n]);this._renderer.type="path",this._renderer.flagVertices=Ge.bind(this),this._renderer.bindVertices=qe.bind(this),this._renderer.unbindVertices=Ke.bind(this),this._renderer.flagFill=Je.bind(this),this._renderer.flagStroke=$e.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!s,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=t,this.automatic=!r,this.dashes=[],this.dashes.offset=0}clone(t){let i=new Yt;for(let s=0;s=y){this._closed?(s=it(Z,x),r=it(Z-1,x),Z===0&&(s=r,r=Z)):(s=Z,r=Math.min(Math.max(Z-1,0),R)),A=this.vertices[s],E=this.vertices[r],y-=rt,this._lengths[Z]!==0?t=y/this._lengths[Z]:t=0;break}rt+=this._lengths[Z]}if(A===null||E===null)return null;if(A){if(!E)return A}else return E;g=E.controls&&E.controls.right,b=A.controls&&A.controls.left,o=E.x,_=E.y,h=(g||E).x,d=(g||E).y,l=(b||A).x,c=(b||A).y,f=A.x,p=A.y,g&&E.relative&&(h+=E.x,d+=E.y),b&&A.relative&&(l+=A.x,c+=A.y),a=Dt(t,o,h,l,f),u=Dt(t,_,d,c,p);let C=nt(o,h,t),j=nt(_,d,t),M=nt(h,l,t),T=nt(d,c,t),N=nt(l,f,t),z=nt(c,p,t),W=nt(C,M,t),V=nt(j,T,t),ft=nt(M,N,t),ct=nt(T,z,t);return S.isObject(i)?(i.x=a,i.y=u,i instanceof F&&(i.controls.left.x=W,i.controls.left.y=V,i.controls.right.x=ft,i.controls.right.y=ct,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=u,i.controls.right.x-=a,i.controls.right.y-=u)),i.t=t,i):(n=new F(a,u,W-a,V-u,ft-a,ct-u,this._curved?w.curve:w.line),n.t=t,n)}plot(){if(this.curved)return Ne(this._collection,this.closed),this;for(let t=0;t0&&(n[n.length-1].command=w.line),r=o;return}a=Xe(o,r,t),n=n.concat(a),S.each(a,function(l,f){f<=0&&r.command===w.move?l.command=w.move:l.command=w.line}),h>=i&&(this._closed&&this._automatic?(r=o,a=Xe(o,r,t),n=n.concat(a),S.each(a,function(l,f){f<=0&&r.command===w.move?l.command=w.move:l.command=w.line})):s&&n.push(new F(o.x,o.y)),n[n.length-1].command=s?w.close:w.line),r=o},this),this._automatic=!1,this._curved=!1,this.vertices=n,this}_updateLength(t,i){i||this._update();let s=this.vertices.length,r=s-1,n=!1,a=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),S.each(this.vertices,function(h,l){if(l<=0&&!n||h.command===w.move){a=h,this._lengths[l]=0;return}this._lengths[l]=Re(h,a,t),o+=this._lengths[l],l>=r&&n&&(a=this.vertices[(l+1)%s],this._lengths[l+1]=Re(h,a,t),o+=this._lengths[l+1]),a=h},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);let t=this._collection.length,i=this._closed,s=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),n=Xt(this,s*this._length),a=Xt(this,r*this._length),o=xs(n),h=bs(a),l,f,u,_,d,c;for(this._renderer.vertices.length=0,c=0;ch&&!f?(d=this._renderer.collection[c].copy(this._collection[c]),this.getPointAt(r,d),d.command=this._renderer.collection[c].command,this._renderer.vertices.push(d),f=d,u=this._collection[c-1],u&&u.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d),u.relative?this._renderer.collection[c-1].controls.right.copy(u.controls.right).lerp(k.zero,1-d.t):this._renderer.collection[c-1].controls.right.copy(u.controls.right).lerp(u,1-d.t))):c>=o&&c<=h&&(d=this._renderer.collection[c].copy(this._collection[c]),this._renderer.vertices.push(d),c===h&&We(this,r)?(f=d,!i&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):c===o&&We(this,s)&&(l=d,l.command=w.move,!i&&l.controls&&(l.relative?l.controls.left.clear():l.controls.left.copy(l))));o>0&&!l&&(c=o-1,d=this._renderer.collection[c].copy(this._collection[c]),this.getPointAt(s,d),d.command=w.move,this._renderer.vertices.unshift(d),_=this._collection[c+1],_&&_.controls&&(d.controls.left.clear(),_.relative?this._renderer.collection[c+1].controls.left.copy(_.controls.left).lerp(k.zero,d.t):(vs.copy(_),this._renderer.collection[c+1].controls.left.copy(_.controls.left).lerp(_,d.t))))}return ot.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=!1,ot.prototype.flagReset.call(this),this}},L=Yt;v(L,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending"]),v(L,"Utils",{getCurveLength:Re});var Ei={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.unbind(m.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.bind(m.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&this._stroke.unbind(m.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&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(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;let t=this._automatic?"ignore":"listen";S.each(this.vertices,function(i){i[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){let t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(m.Types.insert,t).unbind(m.Types.remove,i),e instanceof lt?this._collection=e:this._collection=new lt(e||[]),this._collection.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,S.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function Ge(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function qe(e){let t=e.length;for(;t--;)e[t].bind(m.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Ke(e){let t=e.length;for(;t--;)e[t].unbind(m.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Je(){this._flagFill=!0}function $e(){this._flagStroke=!0}var Ze=class extends L{constructor(t,i,s,r){let n=[new F,new F,new F,new F];super(n,!0,!1,!0);for(let a in Fi)Object.defineProperty(this,a,Fi[a]);this.width=typeof s=="number"?s:1,this.height=typeof r=="number"?r:1,this.origin=new k,typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i),this._update()}_flagWidth=0;_flagHeight=0;_width=0;_height=0;_origin=null;_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let t=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new F),this.vertices[0].set(-t,-i).sub(this._origin).command=w.move,this.vertices[1].set(t,-i).sub(this._origin).command=w.line,this.vertices[2].set(t,i).sub(this._origin).command=w.line,this.vertices[3].set(-t,i).sub(this._origin).command=w.line,this.vertices[4]&&(this.vertices[4].set(-t,-i).sub(this._origin).command=w.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(t){let i=new Ze(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let s=0;s0&&(S.isNaN(this._lastFrame)&&(this._lastFrame=o-1),a=S.performance.now()-this._startTime,_=this._lastFrame+1,h=1e3*(_-this._firstFrame)/this._frameRate,this._loop?a=a%h:a=Math.min(a,h),l=nt(this._firstFrame,_,a/h),l=Math.floor(l),l!==this._index&&(this._index=l,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));let d=this._index%i,c=Math.floor(this._index/i),p=-r*d+(f-r)/2,b=-n*c+(u-n)/2;p!==t.offset.x&&(t.offset.x=p),b!==t.offset.y&&(t.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Nt=Qe;v(Nt,"Properties",["texture","columns","rows","frameRate","index"]);var Ti={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}}};var ti=Math.cos,ei=Math.sin,se=class extends L{_flagRadius=!1;_radius=0;constructor(t,i,s,r){let n=r?Math.max(r,2):4,a=[];for(let o=0;o2&&(t-=1);let i=4/3*Math.tan(Math.PI/(t*2)),s=this._radius,r=s*i;for(let n=0;n2&&(t-=1);let i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,r=this._height/2;for(let n=0;n"u"&&typeof s=="number"&&typeof r=="number"&&(n=Math.floor(Math.min(s,r)/12));let a=[];for(let o=0;o<10;o++)a.push(new F(0,0,0,0,0,0,o===0?w.move:w.curve));super(a);for(let o in Oi)Object.defineProperty(this,o,Oi[o]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ws.bind(this),typeof s=="number"&&(this.width=s),typeof r=="number"&&(this.height=r),typeof n=="number"&&(this.radius=n),this._update(),typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i)}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){let t=this._width,i=this._height,s,r;this._radius instanceof k?(s=this._radius.x,r=this._radius.y):(s=this._radius,r=this._radius);let n,a=t/2,o=i/2;n=this.vertices[0],n.x=-(a-s),n.y=-o,n=this.vertices[1],n.x=a-s,n.y=-o,n.controls.left.clear(),n.controls.right.x=s,n.controls.right.y=0,n=this.vertices[2],n.x=a,n.y=-(o-r),n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[3],n.x=a,n.y=o-r,n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=r,n=this.vertices[4],n.x=a-s,n.y=o,n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[5],n.x=-(a-s),n.y=o,n.controls.left.clear(),n.controls.right.x=-s,n.controls.right.y=0,n=this.vertices[6],n.x=-a,n.y=o-r,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[7],n.x=-a,n.y=-(o-r),n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=-r,n=this.vertices[8],n.x=-(a-s),n.y=-o,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[9],n.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(t){let i=this.width,s=this.height,r=this.radius,n=new ne(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 a=0;a"u"||typeof a>"u"||(t[n]=a.replace(/\s/,""))}return t}function Ms(e){let t={},i=Cs(e),s=Math.max(i.length,e.style.length);for(let r=0;r=0&&t.splice(r,1)}return t}function Ls(e,t){let i=t.split(/[\s,]/),s=-parseFloat(i[0]),r=-parseFloat(i[1]),n=parseFloat(i[2]),a=parseFloat(i[3]);if(s&&r)for(let u=0;u"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)||(o=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,o===null))break;switch(_=Ot(o),t._renderer.type){case"linear-gradient":Ni(_,t.left),Ni(_,t.right);break;case"radial-gradient":t.center.x+=_.translateX,t.center.y+=_.translateY,t.focal.x+=_.translateX,t.focal.y+=_.translateY,t.radius*=Math.max(_.scaleX,_.scaleY);break}break;case"transform":if(/none/i.test(l)||(o=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,o===null))break;X.AutoCalculateImportedMatrices?(_=Ot(o),t.translation.set(_.translateX,_.translateY),t.rotation=Math.PI*(_.rotation/180),t.scale=new k(_.scaleX,_.scaleY),d=parseFloat((s.x+"").replace("px")),c=parseFloat((s.y+"").replace("px")),d&&(t.translation.x=d),c&&(t.translation.y=c)):(o=e.getCTM(),t._matrix.manual=!0,t._matrix.set(o.a,o.b,o.c,o.d,o.e,o.f));break;case"visible":if(t instanceof G){t._visible=l;break}t.visible=l;break;case"stroke-linecap":if(t instanceof G){t._cap=l;break}t.cap=l;break;case"stroke-linejoin":if(t instanceof G){t._join=l;break}t.join=l;break;case"stroke-miterlimit":if(t instanceof G){t._miter=l;break}t.miter=l;break;case"stroke-width":if(t instanceof G){t._linewidth=parseFloat(l);break}t.linewidth=parseFloat(l);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof G){t._opacity=parseFloat(l);break}t.opacity=parseFloat(l);break;case"clip-path":if(St.cssBackgroundImage.test(l)&&(p=l.replace(St.cssBackgroundImage,"$1"),q.defs.current&&q.defs.current.contains(p)&&(g=q.defs.current.get(p),g&&g.childNodes.length>0)))switch(g=g.childNodes[0],y=ae(g.nodeName),t.mask=q[y].call(this,g,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":f=(t instanceof G?"_":"")+h,St.cssBackgroundImage.test(l)?(p=l.replace(St.cssBackgroundImage,"$1"),q.defs.current&&q.defs.current.contains(p)?(g=q.defs.current.get(p),g.object||(y=ae(g.nodeName),g.object=q[y].call(this,g,{})),g=g.object):(b=Ps(this),g=b.getById(p)),t[f]=g):t[f]=/none/i.test(l)?"transparent":l;break;case"id":t.id=l;break;case"class":case"className":t.classList=l.split(" "),t._flagClassName=!0;break;case"x":case"y":if(x=t instanceof Y,R=t instanceof U,A=t instanceof D,x||R||A)break;l.match("[a-z%]$")&&!l.endsWith("px")&&(E=new et("only pixel values are supported with the "+h+" attribute."),console.warn(E.name,E.message)),t.translation[h]=parseFloat(l);break;case"font-family":t instanceof gt&&(t.family=l);break;case"font-size":t instanceof gt&&(t.size=l);break;case"font-weight":t instanceof gt&&(t.weight=l);break;case"font-style":t instanceof gt&&(t.style=l);break;case"text-decoration":t instanceof gt&&(t.decoration=l);break;case"line-height":t instanceof gt&&(t.leading=l);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),s}function Os(e,t){for(let i=0,s=e.childNodes.length;i with no href."),console.warn(i.name,i.message),null;let r=s.slice(1);if(!q.defs.current.contains(r))return i=new et("unable to find element for reference "+s+"."),console.warn(i.name,i.message),null;let a=q.defs.current.get(r).cloneNode(!0);for(let h=0;h1&&(g=1);break;case"m":case"l":case"t":c.length>2&&(g=2);break;case"s":case"q":c.length>4&&(g=4);break;case"c":c.length>6&&(g=6);break;case"a":c.length>7&&(g=7);break}if(g){for(y=0,x=c.length,A=0;y0)switch(p){case"m":R="l";break;case"M":R="L";break}E.push(R+c.slice(y,y+g).join(" ")),A++}f=Array.prototype.concat.apply(f,E)}else f.push(_)}),S.each(f,function(_,d){let c,p,b,g=_[0],y=g.toLowerCase();l=_.slice(1).trim().match(St.path),n=g===y;let x,R,A,E,C,j,M,T,N,z,W,V,ft,ct,Z,ut,rt;switch(y){case"z":if(d>=u)r=!0;else{p=o.x,b=o.y,c=new F(p,b,void 0,void 0,void 0,void 0,w.close);for(let Et=s.length-1;Et>=0;Et--){let Ct=s[Et];if(/m/i.test(Ct.command)){o=Ct;break}}}break;case"m":case"l":h=void 0,p=parseFloat(l[0]),b=parseFloat(l[1]),c=new F(p,b,void 0,void 0,void 0,void 0,/m/i.test(y)?w.move:w.line),n&&c.addSelf(o),o=c;break;case"h":case"v":z=/h/i.test(y)?"x":"y",W=/x/i.test(z)?"y":"x",c=new F(void 0,void 0,void 0,void 0,void 0,void 0,w.line),c[z]=parseFloat(l[0]),c[W]=o[W],n&&(c[z]+=o[z]),o=c;break;case"c":case"s":x=o.x,R=o.y,h||(h=new k),/c/i.test(y)?(A=parseFloat(l[0]),E=parseFloat(l[1]),C=parseFloat(l[2]),j=parseFloat(l[3]),M=parseFloat(l[4]),T=parseFloat(l[5])):(N=pe(o,h,n),A=N.x,E=N.y,C=parseFloat(l[0]),j=parseFloat(l[1]),M=parseFloat(l[2]),T=parseFloat(l[3])),n&&(A+=x,E+=R,C+=x,j+=R,M+=x,T+=R),o.controls.right.set(A-o.x,E-o.y),c=new F(M,T,C-M,j-T,void 0,void 0,w.curve),o=c,h=c.controls.left;break;case"t":case"q":x=o.x,R=o.y,h||(h=new k),/q/i.test(y)?(A=parseFloat(l[0]),E=parseFloat(l[1]),C=parseFloat(l[0]),j=parseFloat(l[1]),M=parseFloat(l[2]),T=parseFloat(l[3])):(N=pe(o,h,n),A=N.x,E=N.y,C=N.x,j=N.y,M=parseFloat(l[0]),T=parseFloat(l[1])),n&&(A+=x,E+=R,C+=x,j+=R,M+=x,T+=R),o.controls.right.set((A-o.x)*.33,(E-o.y)*.33),c=new F(M,T,C-M,j-T,void 0,void 0,w.curve),o=c,h=c.controls.left;break;case"a":x=o.x,R=o.y,ft=parseFloat(l[0]),ct=parseFloat(l[1]),Z=parseFloat(l[2]),ut=parseFloat(l[3]),rt=parseFloat(l[4]),M=parseFloat(l[5]),T=parseFloat(l[6]),n&&(M+=x,T+=R),V=new F(M,T),V.command=w.arc,V.rx=ft,V.ry=ct,V.xAxisRotation=Z,V.largeArcFlag=ut,V.sweepFlag=rt,c=V,o=V,h=void 0;break}c&&(Array.isArray(c)?s=s.concat(c):s.push(c))})}i=new L(s,r,void 0,!0).noStroke(),i.fill="black";let a=i.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},S.each(i.vertices,function(o){o.subSelf(a.centroid)}),wt.call(this,e,i,t),i.translation.addSelf(a.centroid),i},circle:function(e,t){let i=parseFloat(e.getAttribute("cx")),s=parseFloat(e.getAttribute("cy")),r=parseFloat(e.getAttribute("r")),n=new Vt(0,0,r).noStroke();return n.fill="black",wt.call(this,e,n,t),n.translation.x=i,n.translation.y=s,n},ellipse:function(e,t){let i=parseFloat(e.getAttribute("cx")),s=parseFloat(e.getAttribute("cy")),r=parseFloat(e.getAttribute("rx")),n=parseFloat(e.getAttribute("ry")),a=new zt(0,0,r,n).noStroke();return a.fill="black",wt.call(this,e,a,t),a.translation.x=i,a.translation.y=s,a},rect:function(e,t){let i=parseFloat(e.getAttribute("rx")),s=parseFloat(e.getAttribute("ry"));if(!S.isNaN(i)||!S.isNaN(s))return q["rounded-rect"](e);let r=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),a=r/2,o=n/2,h=new vt(0,0,r,n).noStroke();return h.fill="black",wt.call(this,e,h,t),h.translation.x+=a,h.translation.y+=o,h},"rounded-rect":function(e,t){let i=parseFloat(e.getAttribute("rx"))||0,s=parseFloat(e.getAttribute("ry"))||0,r=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),a=r/2,o=n/2,h=new k(i,s),l=new Ut(0,0,r,n,h).noStroke();return l.fill="black",wt.call(this,e,l,t),l.translation.x+=a,l.translation.y+=o,l},line:function(e,t){let i=parseFloat(e.getAttribute("x1")),s=parseFloat(e.getAttribute("y1")),r=parseFloat(e.getAttribute("x2")),n=parseFloat(e.getAttribute("y2")),a=new Gt(i,s,r,n).noFill();return wt.call(this,e,a,t),a},lineargradient:function(e,t){let i=e.getAttribute("gradientUnits"),s=e.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(e.getAttribute("x1")||0),n=parseFloat(e.getAttribute("y1")||0),a=parseFloat(e.getAttribute("x2")||0),o=parseFloat(e.getAttribute("y2")||0),h=(a+r)/2,l=(o+n)/2;/userSpaceOnUse/i.test(i)&&(r-=h,n-=l,a-=h,o-=l);let f=[];for(let _=0;_1?y[1]:void 0),b===null?(y=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=y&&y.length>1?parseFloat(y[1]):1):b=parseFloat(b),f.push(new _t(c,p,b))}let u=new U(r,n,a,o,f);return u.spread=s,u.units=i,wt.call(this,e,u,t),u},radialgradient:function(e,t){let i=e.getAttribute("gradientUnits"),s=e.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(e.getAttribute("cx"))||0,n=parseFloat(e.getAttribute("cy"))||0,a=parseFloat(e.getAttribute("r")),o=parseFloat(e.getAttribute("fx")),h=parseFloat(e.getAttribute("fy"));S.isNaN(o)&&(o=r),S.isNaN(h)&&(h=n);let l=Math.abs(r+o)/2,f=Math.abs(n+h)/2;/userSpaceOnUse/i.test(i)&&(r-=l,n-=f,o-=l,h-=f);let u=[];for(let d=0;d1?x[1]:void 0),g===null?(x=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,g=x&&x.length>1?parseFloat(x[1]):1):g=parseFloat(g),u.push(new _t(p,b,g))}let _=new D(r,n,a,u,o,h);return _.spread=s,_.units=i,wt.call(this,e,_,t),_},text:function(e,t){let i=Es(e.getAttribute("text-anchor"))||"left",s=Fs(e)||"baseline",r=e.textContent,n=new gt(r);return wt.call(this,e,n,t),n.alignment=i,n.baseline=s,n},clippath:function(e,t){return q.defs.current&&!q.defs.current.contains(e.id)&&q.defs.current.add(e.id,e),null},image:function(e,t){let i,s=e.getAttribute("href")||e.getAttribute("xlink:href");if(!s)return i=new et("encountered with no href."),console.warn(i.name,i.message),null;let r=parseFloat(e.getAttribute("x"))||0,n=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),h=new Nt(s,r,n);return S.isNaN(a)||(h.width=a),S.isNaN(o)||(h.height=o),wt.call(this,e,h,t),h}};function ri(e,t){let i=new XMLHttpRequest;return i.open("GET",e),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&t(i.responseText)},i.send(),i}var Ee=class extends vt{_flagTextures=!1;_flagFrameRate=!1;_flagIndex=!1;_amount=1;_duration=0;_index=0;_startTime=0;_playing=!1;_firstFrame=0;_lastFrame=0;_loop=!0;_textures=null;_frameRate=0;_origin=null;constructor(t,i,s,r){super(i,s,0,0);for(let n in Vi)Object.defineProperty(this,n,Vi[n]);this._renderer.flagTextures=Is.bind(this),this._renderer.bindTextures=Bs.bind(this),this._renderer.unbindTextures=js.bind(this),this.noStroke(),this.noFill(),Array.isArray(t)?this.textures=t.map(zi.bind(this)):this.textures=[zi(t)],this.origin=new k,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Ee.DefaultFrameRate,this.index=0}play(t,i,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=S.performance.now(),typeof t=="number"&&(this._firstFrame=t),typeof i=="number"&&(this._lastFrame=i),typeof s=="function"?this._onLastFrame=s:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(t){let i=new Ee(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),t&&t.add(i),i}toObject(){let t=super.toObject.call(this);return t.textures=this.textures.map(function(i){return i.toObject()}),t.frameRate=this.frameRate,t.index=this.index,t._firstFrame=this._firstFrame,t._lastFrame=this._lastFrame,t._loop=this._loop,t}_update(){let t=this._textures,i,s,r,n,a,o,h,l;return t&&(this._flagTextures&&(this._amount=t.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(n=this._amount,S.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=S.performance.now()-this._startTime,l=this._lastFrame+1,a=1e3*(l-this._firstFrame)/this._frameRate,this._loop?r=r%a:r=Math.min(r,a),h=nt(this._firstFrame,l,r/a),h=Math.floor(h),h!==this._index&&(this._index=h,o=t[this._index],o.loaded&&(i=o.image.width,s=o.image.height,this.width!==i&&(this.width=i),this.height!==s&&(this.height=s),this.fill=o,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof B))&&(o=t[this._index],o.loaded&&(i=o.image.width,s=o.image.height,this.width!==i&&(this.width=i),this.height!==s&&(this.height=s)),this.fill=o)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},qt=Ee;v(qt,"Properties",["textures","frameRate","index"]),v(qt,"DefaultFrameRate",30);var Vi={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){let t=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(m.Types.insert,t).unbind(m.Types.remove,i),this._textures=new lt((e||[]).slice(0)),this._textures.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._textures)}}};function Is(){this._flagTextures=!0}function Bs(e){let t=e.length;for(;t--;)e[t].bind(m.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function js(e){let t=e.length;for(;t--;)e[t].unbind(m.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function zi(e){if(e instanceof B)return e;if(typeof e=="string")return new B(e)}var oe=class extends L{_flagStartAngle=!1;_flagEndAngle=!1;_flagInnerRadius=!1;_flagOuterRadius=!1;_startAngle=0;_endAngle=J;_innerRadius=0;_outerRadius=0;constructor(t,i,s,r,n,a,o){let h=o||X.Resolution*3,l=[];for(let f=0;f0,o=this.vertices,h=a?o.length/2:o.length,l,f=0,u,_,d,c,p,b,g,y,x;for(n?h--:a||(h-=2),u=0,_=h-1;u=n&&l<=a&&(h=this._collection[l],this._renderer.collection.push(h),this._renderer.vertices[o*2+0]=h.x,this._renderer.vertices[o*2+1]=h.y,o++)}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}},he=Kt;v(he,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending"]);var Di={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.unbind(m.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.bind(m.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&this._stroke.unbind(m.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&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(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){let t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(m.Types.insert,t).unbind(m.Types.remove,i),e instanceof lt?this._collection=e:this._collection=new lt(e||[]),this._collection.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};var zs=Math.cos,Us=Math.sin,fe=class extends L{_flagWidth=!1;_flagHeight=!1;_flagSides=!1;_radius=0;_width=0;_height=0;_sides=0;constructor(t,i,s,r){r=Math.max(r||0,3);super();for(let n in Hi)Object.defineProperty(this,n,Hi[n]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof r=="number"&&(this.sides=r),this._update(),typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i)}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){let t=this._sides,i=t+1,s=this.vertices.length;s>t&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new F(o,h)):this.vertices[r].set(o,h),this.vertices[r].command=r===0?w.move:w.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let i=new fe(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;st&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new F(h,l)):this.vertices[r].set(h,l),this.vertices[r].command=r===0?w.move:w.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let i=this.innerRadius,s=this.outerRadius,r=this.sides,n=new ue(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 a=0;a0&&O.setAttributes(s,t),s},setAttributes:function(e,t){let i=Object.keys(t);for(let s=0;s=s&&t&&(o.command===w.curve&&(u=r,y=o.controls&&o.controls.right||o,x=u.controls&&u.controls.left||u,o.relative?(_=K(y.x+o.x),d=K(y.y+o.y)):(_=K(y.x),d=K(y.y)),u.relative?(c=K(x.x+u.x),p=K(x.y+u.y)):(c=K(x.x),p=K(x.y)),M=K(u.x),T=K(u.y),f+=" C "+_+" "+d+" "+c+" "+p+" "+M+" "+T),o.command!==w.close&&(f+=" Z")),n+=f+" "}return n},pointsToString:function(e,t){let i="",s=t*.5;for(let r=0;r0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?O.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=O.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){let s=O.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(O[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let s=this._size;if(!this._sizeAttenuation){pt(this,Xi);let n=Xi.elements,a=Ot(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(a.scaleX,a.scaleY)}let r=O.pointsToString(this._renderer.collection,s);t.d=r}return this._fill&&this._fill._renderer&&(this._fill._update(),O[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),O[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?O.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=O.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=O.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["alignment-baseline"]=t["dominant-baseline"]=this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),O[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),O[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?O.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=O.createElement("text",t),e.defs.appendChild(this._renderer.elem)),this._flagClip){let s=O.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(O[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(e,t){t||this._update();let i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?O.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=O.createElement("linearGradient",i),e.defs.appendChild(this._renderer.elem)),this._flagStops){let s=this._renderer.elem.childNodes.length!==this.stops.length;if(s)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let r=0;r0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,r)){switch(s.width=i.width=r.width,s.height=i.height=r.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof k?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?O.setAttributes(this._renderer.image,s):this._renderer.image=O.createElement("image",s)),this._renderer.elem?Object.keys(i).length!==0&&O.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=O.createElement("pattern",i),e.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},Fe=class extends m{constructor(t){super();this.domElement=t.domElement||O.createElement("svg"),this.scene=new G,this.scene.parent=this,this.defs=O.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,i){return this.width=t,this.height=i,O.setAttributes(this.domElement,{width:t,height:i}),this.trigger(m.Types.resize,t,i)}render(){return O.group.render.call(this.scene,this.domElement),this}};v(Fe,"Utils",O);var yt={create:function(e,t,i){let s=e.createShader(e[i]);if(e.shaderSource(s,t),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS)){let n=e.getShaderInfoLog(s);throw e.deleteShader(s),new et("unable to compile shader "+s+": "+n)}return s},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:` +var Two=(()=>{var ge=Object.defineProperty;var Gi=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var Ki=Object.prototype.hasOwnProperty;var Ji=(e,t,i)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var $i=e=>ge(e,"__esModule",{value:!0});var Ce=(e,t)=>{for(var i in t)ge(e,i,{get:t[i],enumerable:!0})},Zi=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qi(t))!Ki.call(e,r)&&(i||r!=="default")&&ge(e,r,{get:()=>t[r],enumerable:!(s=Gi(t,r))||s.enumerable});return e};var Qi=(e=>(t,i)=>e&&e.get(t)||(i=Zi($i({}),t,1),e&&e.set(t,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var v=(e,t,i)=>(Ji(e,typeof t!="symbol"?t+"":t,i),i);var Js={};Ce(Js,{default:()=>I});var w={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};var Ie={};Ce(Ie,{HALF_PI:()=>$,NumArray:()=>xt,TWO_PI:()=>J,decomposeMatrix:()=>Ot,getComputedMatrix:()=>pt,getPoT:()=>Pe,lerp:()=>nt,mod:()=>it,setMatrix:()=>Oe,toFixed:()=>K});var H;typeof window<"u"?H=window:typeof global<"u"?H=global:typeof self<"u"&&(H=self);var oi,J=Math.PI*2,$=Math.PI*.5;function Ot(e,t,i,s,r,n){let a;return arguments.length<=1?(a=e.a,t=e.b,i=e.c,s=e.d,r=e.e,n=e.f):a=e,{translateX:r,translateY:n,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(i*i+s*s),rotation:180*Math.atan2(t,a)/Math.PI}}function Oe(e){oi=e}function pt(e,t){t=t&&t.identity()||new oi;let i=e,s=[];for(;i&&i._matrix;)s.push(i._matrix),i=i.parent;s.reverse();for(let r=0;rjt,getAnchorsFromArcData:()=>is,getComponentOnCubicBezier:()=>Dt,getControlPoints:()=>ci,getCurveBoundingBox:()=>je,getCurveFromPoints:()=>Ne,getCurveLength:()=>Be,getReflection:()=>pe,integrate:()=>fi,subdivide:()=>te});var m=class{_events={};_bound=!1;constructor(){}addEventListener(t,i){return(this._events[t]||(this._events[t]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,i){if(!this._events)return this;if(!t&&!i)return this._events={},this._bound=!1,this;let s=t?[t]:Object.keys(this._events);for(let r=0,n=s.length;r=4){let n=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,n)}let s=t.x-i.x,r=t.y-i.y;return Math.atan2(r,s)}static distanceBetween(t,i){return Math.sqrt(bt.distanceBetweenSquared(t,i))}static distanceBetweenSquared(t,i){let s=t.x-i.x,r=t.y-i.y;return s*s+r*r}set(t,i){return this.x=t,this.y=i,this}copy(t){return this.x=t.x,this.y=t.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new bt(this.x,this.y)}add(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x+=t,this.y+=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x+=t.x,this.y+=t.y):(this.x+=t,this.y+=i),this)}addSelf(t){return this.add.apply(this,arguments)}sub(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x-=t,this.y-=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x-=t.x,this.y-=t.y):(this.x-=t,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(t){return this.sub.apply(this,arguments)}subtractSelf(t){return this.sub.apply(this,arguments)}multiply(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x*=t,this.y*=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x*=t.x,this.y*=t.y):(this.x*=t,this.y*=i),this)}multiplySelf(t){return this.multiply.apply(this,arguments)}multiplyScalar(t){return this.multiply(t)}divide(t,i){return arguments.length<=0?this:(arguments.length<=1?typeof t=="number"?(this.x/=t,this.y/=t):t&&typeof t.x=="number"&&typeof t.y=="number"&&(this.x/=t.x,this.y/=t.y):(this.x/=t,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(t){return this.divide.apply(this,arguments)}divideScalar(t){return this.divide(t)}negate(){return this.multiply(-1)}dot(t){return this.x*t.x+this.y*t.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let i=this.x-t.x,s=this.y-t.y;return i*i+s*s}setLength(t){return this.normalize().multiplyScalar(t)}equals(t,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(t)"u"?1e-4:t,this.length()>1,f=s&1?n[h++]*e(o):0;for(;h=0&&t<4294967296}var S={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){let t=typeof e;return t==="function"||t==="object"&&!!e},extend:function(e){let t=ui.call(arguments,1);for(let i=0;i0&&this.set(o)}static Multiply(t,i,s){if(i.length<=3){let E=t,C,j,M,T=i[0]||0,N=i[1]||0,z=i[2]||0;return C=E[0]*T+E[1]*N+E[2]*z,j=E[3]*T+E[4]*N+E[5]*z,M=E[6]*T+E[7]*N+E[8]*z,{x:C,y:j,z:M}}let r=t[0],n=t[1],a=t[2],o=t[3],h=t[4],l=t[5],f=t[6],u=t[7],_=t[8],d=i[0],c=i[1],p=i[2],b=i[3],g=i[4],y=i[5],x=i[6],R=i[7],A=i[8];return s=s||new xt(9),s[0]=r*d+n*b+a*x,s[1]=r*c+n*g+a*R,s[2]=r*p+n*y+a*A,s[3]=o*d+h*b+l*x,s[4]=o*c+h*g+l*R,s[5]=o*p+h*y+l*A,s[6]=f*d+u*b+_*x,s[7]=f*c+u*g+_*R,s[8]=f*p+u*y+_*A,s}set(t,i,s,r,n,a,o,h,l){if(typeof i>"u"){let f=t;t=f[0],i=f[1],s=f[2],r=f[3],n=f[4],a=f[5],o=f[6],h=f[7],l=f[8]}return this.elements[0]=t,this.elements[1]=i,this.elements[2]=s,this.elements[3]=r,this.elements[4]=n,this.elements[5]=a,this.elements[6]=o,this.elements[7]=h,this.elements[8]=l,this.trigger(m.Types.change)}copy(t){return this.elements[0]=t.elements[0],this.elements[1]=t.elements[1],this.elements[2]=t.elements[2],this.elements[3]=t.elements[3],this.elements[4]=t.elements[4],this.elements[5]=t.elements[5],this.elements[6]=t.elements[6],this.elements[7]=t.elements[7],this.elements[8]=t.elements[8],this.manual=t.manual,this.trigger(m.Types.change)}identity(){return this.elements[0]=mt.Identity[0],this.elements[1]=mt.Identity[1],this.elements[2]=mt.Identity[2],this.elements[3]=mt.Identity[3],this.elements[4]=mt.Identity[4],this.elements[5]=mt.Identity[5],this.elements[6]=mt.Identity[6],this.elements[7]=mt.Identity[7],this.elements[8]=mt.Identity[8],this.trigger(m.Types.change)}multiply(t,i,s,r,n,a,o,h,l){if(typeof i>"u")return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.trigger(m.Types.change);if(typeof r>"u"){t=t||0,i=i||0,s=s||0,n=this.elements;let V=n[0]*t+n[1]*i+n[2]*s,ft=n[3]*t+n[4]*i+n[5]*s,ct=n[6]*t+n[7]*i+n[8]*s;return{x:V,y:ft,z:ct}}let f=this.elements,u=[t,i,s,r,n,a,o,h,l],_=f[0],d=f[1],c=f[2],p=f[3],b=f[4],g=f[5],y=f[6],x=f[7],R=f[8],A=u[0],E=u[1],C=u[2],j=u[3],M=u[4],T=u[5],N=u[6],z=u[7],W=u[8];return this.elements[0]=_*A+d*j+c*N,this.elements[1]=_*E+d*M+c*z,this.elements[2]=_*C+d*T+c*W,this.elements[3]=p*A+b*j+g*N,this.elements[4]=p*E+b*M+g*z,this.elements[5]=p*C+b*T+g*W,this.elements[6]=y*A+x*j+R*N,this.elements[7]=y*E+x*M+R*z,this.elements[8]=y*C+x*T+R*W,this.trigger(m.Types.change)}inverse(t){let i=this.elements;t=t||new mt;let s=i[0],r=i[1],n=i[2],a=i[3],o=i[4],h=i[5],l=i[6],f=i[7],u=i[8],_=u*o-h*f,d=-u*a+h*l,c=f*a-o*l,p=s*_+r*d+n*c;return p?(p=1/p,t.elements[0]=_*p,t.elements[1]=(-u*r+n*f)*p,t.elements[2]=(h*r-n*o)*p,t.elements[3]=d*p,t.elements[4]=(u*s-n*l)*p,t.elements[5]=(-h*s+n*a)*p,t.elements[6]=c*p,t.elements[7]=(-f*s+r*l)*p,t.elements[8]=(o*s-r*a)*p,t):null}scale(t,i){return arguments.length<=1&&(i=t),this.multiply(t,0,0,0,i,0,0,0,1)}rotate(t){let i=as(t),s=os(t);return this.multiply(i,-s,0,s,i,0,0,0,1)}translate(t,i){return this.multiply(1,0,t,0,1,i,0,0,1)}skewX(t){let i=_i(t);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(t){let i=_i(t);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(t){return ze.length=0,this.toTransformArray(t,ze),ze.map(K).join(" ")}toTransformArray(t,i){let s=this.elements,r=!!i,n=s[0],a=s[1],o=s[2],h=s[3],l=s[4],f=s[5];if(t){let u=s[6],_=s[7],d=s[8];if(r){i[0]=n,i[1]=h,i[2]=u,i[3]=a,i[4]=l,i[5]=_,i[6]=o,i[7]=f,i[8]=d;return}return[n,h,u,a,l,_,o,f,d]}if(r){i[0]=n,i[1]=h,i[2]=a,i[3]=l,i[4]=o,i[5]=f;return}return[n,h,a,l,o,f]}toArray(t,i){let s=this.elements,r=!!i,n=s[0],a=s[1],o=s[2],h=s[3],l=s[4],f=s[5];if(t){let u=s[6],_=s[7],d=s[8];if(r){i[0]=n,i[1]=a,i[2]=o,i[3]=h,i[4]=l,i[5]=f,i[6]=u,i[7]=_,i[8]=d;return}return[n,a,o,h,l,f,u,_,d]}if(r){i[0]=n,i[1]=a,i[2]=o,i[3]=h,i[4]=l,i[5]=f;return}return[n,a,o,h,l,f]}toObject(){return{elements:this.toArray(!0),manual:!!this.manual}}clone(){return new mt().copy(this)}},at=mt;v(at,"Identity",[1,0,0,0,1,0,0,0,1]);Oe(at);var ot=class extends Ft{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;_position=null;_rotation=0;_scale=1;_skewX=0;_skewY=0;constructor(){super();for(let t in me)Object.defineProperty(this,t,me[t]);this._renderer.flagMatrix=gi.bind(this),this.isShape=!0,this.id=X.Identifier+X.uniqueId(),this.matrix=new at,this.worldMatrix=new at,this.position=new k,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get translation(){return me.position.get.apply(this,arguments)}set translation(t){me.position.set.apply(this,arguments)}addTo(t){return t.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}clone(t){let i=new ot;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),t&&t.add(i),i._update()}_update(t){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._scale instanceof k?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),t&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}},me={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(m.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(m.Types.change,this._renderer.flagMatrix),gi.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof k&&this._scale.unbind(m.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof k&&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(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return pt(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function gi(){this._flagMatrix=!0}var lt=class extends Array{_events=new m;get _bound(){return this._events._bound}set _bound(t){this._events._bound=t}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.on.apply(this,arguments)}bind(){return this._events.bind.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.off.apply(this,arguments)}unbind(){return this._events.unbind.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.trigger.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}constructor(){super();arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}pop(){let t=super.pop.apply(this,arguments);return this.trigger(m.Types.remove,[t]),t}shift(){let t=super.shift.apply(this,arguments);return this.trigger(m.Types.remove,[t]),t}push(){let t=super.push.apply(this,arguments);return this.trigger(m.Types.insert,arguments),t}unshift(){let t=super.unshift.apply(this,arguments);return this.trigger(m.Types.insert,arguments),t}splice(){let t=super.splice.apply(this,arguments);if(this.trigger(m.Types.remove,t),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 t}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)}};var ye=class extends lt{ids={};constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments);super(t);this.attach(t),this.on(m.Types.insert,this.attach),this.on(m.Types.remove,this.detach)}attach(t){for(let i=0;i=0&&i.push(r),r.children)for(let n=0;n=0&&this.children.splice(r,1),this.children.push(s)}return this}remove(t){let i=arguments.length,s=this.parent;if(i<=0&&s)return s.remove(this),this;t instanceof Array?t=t.slice():t=Array.prototype.slice.call(arguments);for(let r=0;r=0&&this.children.splice(a,1)}return this}getBoundingClientRect(t){let i,s,r,n,a,o,h,l,f,u;this._update(!0);let _=1/0,d=-1/0,c=1/0,p=-1/0,b=/texture|gradient/i;s=t?this._matrix:pt(this);for(let g=0;go+i?(s.beginning=1,s.ending=1):lo&&ho&&l0&&i(this._children)),this._children=new ye(e),this._children.bind(m.Types.insert,t),this._children.bind(m.Types.remove,i),this._children.bind(m.Types.order,s),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,S.isObject(e)&&!e.clip&&(e.clip=!0)}}};function mi(e,t){let i=e.parent,s;if(i===t){r();return}if(i&&i.children.ids[e.id]&&(s=Array.prototype.indexOf.call(i.children,e),i.children.splice(s,1),n()),t){r();return}n(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete e.parent;function r(){t.subtractions.length>0&&(s=Array.prototype.indexOf.call(t.subtractions,e),s>=0&&t.subtractions.splice(s,1)),t.additions.length>0&&(s=Array.prototype.indexOf.call(t.additions,e),s>=0&&t.additions.splice(s,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function n(){s=Array.prototype.indexOf.call(i.additions,e),s>=0&&i.additions.splice(s,1),s=Array.prototype.indexOf.call(i.subtractions,e),s<0&&(i.subtractions.push(e),i._flagSubtractions=!0)}}var yi=new at,De=[],He=Math.max,ls=Math.min,xi=Math.abs,ve=Math.sin,we=Math.cos,hs=Math.acos,Ae=Math.sqrt,tt={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(i){return this[i]},e.setAttribute=function(i,s){return this[i]=s,this},e},group:{renderChild:function(e){tt[e._renderer.type].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();let t=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s=this._mask,r=ke(t),n=!r||!!s;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,n&&(e.save(),r||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),s&&tt[s._renderer.type].render.call(s,e,!0),this._opacity>0&&this._scale!==0)for(let a=0;a0&&(e.lineDashOffset=rt.offset||0,e.setLineDash(rt)),e.beginPath();let Ct,$t,Zt,Qt,kt,Q,ai;for(let Lt=0;Lt=p&&_&&(x=R,N=y.controls&&y.controls.right||k.zero,z=x.controls&&x.controls.left||k.zero,y._relative?(C=N.x+y.x,j=N.y+y.y):(C=N.x,j=N.y),x._relative?(A=z.x+x.x,E=z.y+x.y):(A=z.x,E=z.y),W=x.x,V=x.y,e.bezierCurveTo(C,j,A,E,W,V));break;case w.line:e.lineTo(W,V);break;case w.move:R=y,e.moveTo(W,V);break}return _&&e.closePath(),!ct&&!i&&(tt.isHidden.test(a)||(ut=a._renderer&&a._renderer.offset,ut&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),ut&&e.restore()),tt.isHidden.test(r)||(ut=r._renderer&&r._renderer.offset,ut&&(e.save(),e.translate(-r._renderer.offset.x,-r._renderer.offset.y),e.scale(r._renderer.scale.x,r._renderer.scale.y),e.lineWidth=n/r._renderer.scale.x),e.stroke(),ut&&e.restore())),Z||e.restore(),ct&&!i&&e.clip(),rt&&rt.length>0&&e.setLineDash(De),this.flagReset()}},points:{render:function(e,t,i){let s,r,n,a,o,h,l,f,u,_,d,c,p,b,g,y;if(y=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*(y||1),h=this._visible,!t&&(!h||o===0))return this;this._update(),s=this._matrix.elements,r=this._stroke,n=this._linewidth,a=this._fill,f=this._renderer.collection,u=f.length,p=ke(s),g=this.dashes,l=this._size,p||(e.save(),e.transform(s[0],s[3],s[1],s[4],s[2],s[5])),a&&(typeof a=="string"?e.fillStyle=a:(tt[a._renderer.type].render.call(a,e,this),e.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?e.strokeStyle=r:(tt[r._renderer.type].render.call(r,e,this),e.strokeStyle=r._renderer.effect),n&&(e.lineWidth=n)),typeof o=="number"&&(e.globalAlpha=o),g&&g.length>0&&(e.lineDashOffset=g.offset||0,e.setLineDash(g)),e.beginPath();let x=l*.5,R;this._sizeAttenuation||(pt(this,yi),R=yi.elements,R=Ot(R[0],R[3],R[1],R[4],R[2],R[5]),x/=Math.max(R.scaleX,R.scaleY));for(let A=0;A0&&e.setLineDash(De),this.flagReset()}},text:{render:function(e,t,i){let s=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,r=this._opacity*s,n=this._visible,a=this._mask,o=this._clip;if(!t&&(!n||o||r===0))return this;this._update();let h=this._matrix.elements,l=this._stroke,f=this._linewidth,u=this._fill,_=this._decoration,d=ke(h),c=u._renderer&&u._renderer.offset&&l._renderer&&l._renderer.offset,p=this.dashes,b=tt.alignments[this._alignment]||this._alignment,g=this._baseline,y,x,R,A,E,C,j,M,T,N,z;if(d||(e.save(),e.transform(h[0],h[3],h[1],h[4],h[2],h[5])),a&&tt[a._renderer.type].render.call(a,e,!0),c||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=b,e.textBaseline=g,u&&(typeof u=="string"?e.fillStyle=u:(tt[u._renderer.type].render.call(u,e,this),e.fillStyle=u._renderer.effect)),l&&(typeof l=="string"?e.strokeStyle=l:(tt[l._renderer.type].render.call(l,e,this),e.strokeStyle=l._renderer.effect),f&&(e.lineWidth=f)),typeof r=="number"&&(e.globalAlpha=r),p&&p.length>0&&(e.lineDashOffset=p.offset||0,e.setLineDash(p)),!o&&!i&&(tt.isHidden.test(u)||(u._renderer&&u._renderer.offset?(C=u._renderer.scale.x,j=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale(C,j),y=this._size/u._renderer.scale.y,x=this._leading/u._renderer.scale.y,e.font=[this._style,this._weight,y+"px/",x+"px",this._family].join(" "),R=u._renderer.offset.x/u._renderer.scale.x,A=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,R,A),e.restore()):e.fillText(this.value,0,0)),tt.isHidden.test(l)||(l._renderer&&l._renderer.offset?(C=l._renderer.scale.x,j=l._renderer.scale.y,e.save(),e.translate(-l._renderer.offset.x,-l._renderer.offset.y),e.scale(C,j),y=this._size/l._renderer.scale.y,x=this._leading/l._renderer.scale.y,e.font=[this._style,this._weight,y+"px/",x+"px",this._family].join(" "),R=l._renderer.offset.x/l._renderer.scale.x,A=l._renderer.offset.y/l._renderer.scale.y,E=f/l._renderer.scale.x,e.lineWidth=E,e.strokeText(this.value,R,A),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(_)){let W=e.measureText(this.value),V=1;switch(_){case"underline":T=W.actualBoundingBoxAscent,z=W.actualBoundingBoxAscent;break;case"strikethrough":T=0,z=0,V=.5;break}switch(g){case"top":T+=this._size*V,z+=this._size*V;break;case"baseline":case"bottom":T-=this._size*V,z-=this._size*V;break}switch(b){case"left":case"start":M=0,N=W.width;break;case"right":case"end":M=-W.width,N=0;break;default:M=-W.width/2,N=W.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(M,T),e.lineTo(N,z),e.stroke()}return d||e.restore(),o&&!i&&e.clip(),p&&p.length>0&&e.setLineDash(De),this.flagReset()}},"linear-gradient":{render:function(e,t){if(!!t){if(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,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=t.getBoundingClientRect(!0),s=(s-.5)*i.width,r=(r-.5)*i.height,n=(n-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=e.createLinearGradient(s,r,n,a);for(let o=0;o1){let V=Ae(y);s=V*s,r=V*r,b=s*s,g=r*r}let x=b*p+g*c,R=(b*g-x)/x,A=Ae(He(0,R));n===a&&(A=-A);let E=A*s*d/r,C=-A*r*_/s,j=we(o)*E-ve(o)*C+(t+h)/2,M=ve(o)*E+we(o)*C+(i+l)/2,T=bi(1,0,(_-E)/s,(d-C)/r),N=bi((_-E)/s,(d-C)/r,(-_-E)/s,(-d-C)/r)%J,z=T+N;fs(e,j,M,s,r,T,z,a===0,o)}},At=class extends m{constructor(t){super();let i=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=i),this.scene=new G,this.scene.parent=this}setSize(t,i,s){return this.width=t,this.height=i,this.ratio=typeof s>"u"?Ht(this.ctx):s,this.domElement.width=t*this.ratio,this.domElement.height=i*this.ratio,this.domElement.style&&S.extend(this.domElement.style,{width:t+"px",height:i+"px"}),this.trigger(m.Types.resize,t,i,s)}render(){let t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),tt.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};v(At,"Utils",tt);function fs(e,t,i,s,r,n,a,o,h){let l=a-n,f=jt.Tolerance.epsilon,u=Math.abs(l)=s)return s-r>=0;r+=a}return!1}function Xt(e,t){let i=e._length;if(t<=0)return 0;if(t>=i)return e._lengths.length-1;for(let s=0,r=0;s=t)return t-=r,Math.max(s-1,0)+t/e._lengths[s];r+=e._lengths[s]}return-1}function Re(e,t,i){let s,r,n,a,o,h,l,f,u=t.controls&&t.controls.right,_=e.controls&&e.controls.left;return s=t.x,o=t.y,r=(u||t).x,h=(u||t).y,n=(_||e).x,l=(_||e).y,a=e.x,f=e.y,u&&t._relative&&(r+=t.x,h+=t.y),_&&e._relative&&(n+=e.x,l+=e.y),Be(s,o,r,h,n,l,a,f,i)}function Xe(e,t,i){let s,r,n,a,o,h,l,f,u=t.controls&&t.controls.right,_=e.controls&&e.controls.left;return s=t.x,o=t.y,r=(u||t).x,h=(u||t).y,n=(_||e).x,l=(_||e).y,a=e.x,f=e.y,u&&t._relative&&(r+=t.x,h+=t.y),_&&e._relative&&(n+=e.x,l+=e.y),te(s,o,r,h,n,l,a,f,i)}var Mt=class extends Ft{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";constructor(t,i,s){super();for(let r in vi)Object.defineProperty(this,r,vi[r]);this._renderer.type="stop",this.offset=typeof t=="number"?t:Mt.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof i=="string"?i:Mt.Index<=0?"#fff":"#000",Mt.Index=(Mt.Index+1)%2}clone(t){let i=new Mt;return S.each(Mt.Properties,function(s){i[s]=this[s]},this),t&&t.stops&&t.stops.push(i),i}toObject(){let t={};return S.each(Mt.Properties,function(i){t[i]=this[i]},this),t}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},_t=Mt;v(_t,"Index",0),v(_t,"Properties",["offset","opacity","color"]);var vi={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}};var ee=class extends Ft{_flagStops=!1;_flagSpread=!1;_flagUnits=!1;_spread="";_units="";constructor(t){super();for(let i in wi)Object.defineProperty(this,i,wi[i]);this._renderer.type="gradient",this.id=X.Identifier+X.uniqueId(),this.classList=[],this._renderer.flagStops=cs.bind(this),this._renderer.bindStops=us.bind(this),this._renderer.unbindStops=ds.bind(this),this.spread="pad",this.units="objectBoundingBox",t&&(this.stops=t)}clone(t){let i=this.stops.map(function(r){return r.clone()}),s=new ee(i);return S.each(ee.Properties,function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t={stops:this.stops.map(function(i){return i.toObject()})};return S.each(ee.Properties,function(i){t[i]=this[i]},this),t}_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}},Y=ee;v(Y,"Stop",_t),v(Y,"Properties",["spread","stops","renderer","units"]);var wi={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){let t=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(m.Types.insert,t).unbind(m.Types.remove,i),this._stops=new lt((e||[]).slice(0)),this._stops.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._stops)}}};function cs(){this._flagStops=!0}function us(e){let t=e.length;for(;t--;)e[t].bind(m.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function ds(e){let t=e.length;for(;t--;)e[t].unbind(m.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ye=class extends Y{_flagEndPoints=!1;_left=null;_right=null;constructor(t,i,s,r,n){super(n);for(let a in ki)Object.defineProperty(this,a,ki[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=_s.bind(this),this.left=new k,this.right=new k,typeof t=="number"&&(this.left.x=t),typeof i=="number"&&(this.left.y=i),typeof s=="number"&&(this.right.x=s),typeof r=="number"&&(this.right.y=r)}clone(t){let i=this.stops.map(function(r){return r.clone()}),s=new Ye(this.left._x,this.left._y,this.right._x,this.right._y,i);return S.each(Y.Properties,function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return t.left=this.left.toObject(),t.right=this.right.toObject(),t}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(m.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},U=Ye;v(U,"Properties",["left","right"]),v(U,"Stop",_t);var ki={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof k&&this._left.unbind(m.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(m.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof k&&this._right.unbind(m.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(m.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function _s(){this._flagEndPoints=!0}var ie=class extends Y{_flagRadius=!1;_flagCenter=!1;_flagFocal=!1;_radius=0;_center=null;_focal=null;constructor(t,i,s,r,n,a){super(r);for(let o in Ai)Object.defineProperty(this,o,Ai[o]);this._renderer.type="radial-gradient",this._renderer.flagCenter=gs.bind(this),this._renderer.flagFocal=ps.bind(this),this.center=new k,this.radius=typeof s=="number"?s:1,this.focal=new k,typeof t=="number"&&(this.center.x=t),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof n=="number"&&(this.focal.x=n),typeof a=="number"&&(this.focal.y=a)}clone(t){let i=this.stops.map(function(r){return r.clone()}),s=new ie(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return S.each(Y.Properties.concat(ie.Properties),function(r){s[r]=this[r]},this),t&&t.add(s),s}toObject(){let t=super.toObject.call(this);return S.each(ie.Properties,function(i){t[i]=this[i]},this),t.center=this.center.toObject(),t.focal=this.focal.toObject(),t}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(m.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},D=ie;v(D,"Stop",_t),v(D,"Properties",["center","radius","focal"]);var Ai={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(e){this._center&&this._center.unbind(m.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(m.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(m.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(m.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function gs(){this._flagCenter=!0}function ps(){this._flagFocal=!0}var Se,Ri={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};H.document&&(Se=document.createElement("a"));var st=class extends Ft{_flagSrc=!1;_flagImage=!1;_flagVideo=!1;_flagLoaded=!1;_flagRepeat=!1;_flagOffset=!1;_flagScale=!1;_src="";_image=null;_loaded=!1;_repeat="no-repeat";_scale=1;_offset=null;constructor(t,i){super();this._renderer={};for(let s in Si)Object.defineProperty(this,s,Si[s]);if(this._renderer.type="texture",this._renderer.flagOffset=ms.bind(this),this._renderer.flagScale=ys.bind(this),this.id=X.Identifier+X.uniqueId(),this.classList=[],this.loaded=!1,this.repeat="no-repeat",this.offset=new k,typeof i=="function"){let s=function(){this.unbind(m.Types.load,s),typeof i=="function"&&i()}.bind(this);this.bind(m.Types.load,s)}if(typeof t=="string")this.src=t;else if(typeof t=="object"){let s=Object.prototype.toString.call(t);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=t)}this._update()}static getAbsoluteURL(t){return Se?(Se.href=t,Se.href):t}static loadHeadlessBuffer(t,i){t.image.onload=i,t.image.src=t.src}static getTag(t){return t&&t.nodeName&&t.nodeName.toLowerCase()||"img"}static getImage(t){let i=st.getAbsoluteURL(t);if(st.ImageRegistry.contains(i))return st.ImageRegistry.get(i);let s;return ht.Image?(s=new ht.Image,At.Utils.shim(s,"img")):H.document?Ri.video.test(i)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s}static load(t,i){let s=t.image,r=st.getTag(s);t._flagImage&&(/canvas/i.test(r)?st.Register.canvas(t,i):(t._src=!ht.isHeadless&&s.getAttribute("two-src")||s.src,st.Register[r](t,i))),t._flagSrc&&(s||(s=st.getImage(t.src),t.image=s),r=st.getTag(s),st.Register[r](t,i))}clone(){let t=new st(this.src);return t.repeat=this.repeat,t.offset.copy(this.origin),t.scale=this.scale,t}toObject(){return{src:this.src,repeat:this.repeat,origin:this.origin.toObject(),scale:typeof this.scale=="number"?this.scale:this.scale.toObject()}}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(m.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,st.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}},B=st;v(B,"Properties",["src","loaded","repeat","scale","offset","image"]),v(B,"RegularExpressions",Ri),v(B,"ImageRegistry",new Tt),v(B,"Register",{canvas:function(t,i){t._src="#"+t.id,st.ImageRegistry.add(t.src,t.image),typeof i=="function"&&i()},img:function(t,i){let s=t.image,r=function(a){!ht.isHeadless&&s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),typeof i=="function"&&i()},n=function(a){throw!ht.isHeadless&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",r,!1),s.removeEventListener("error",n,!1)),new et("unable to load "+t.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?r():!ht.isHeadless&&typeof s.addEventListener=="function"&&(s.addEventListener("load",r,!1),s.addEventListener("error",n,!1)),t._src=st.getAbsoluteURL(t._src),!(!ht.isHeadless&&s&&s.getAttribute("two-src"))&&(ht.isHeadless||s.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,s),ht.isHeadless?st.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,i){if(ht.isHeadless)throw new et("video textures are not implemented in headless environments.");let s=function(n){t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof i=="function"&&i()},r=function(n){throw t.image.removeEventListener("canplaythrough",s,!1),t.image.removeEventListener("error",r,!1),new et("unable to load "+t.src)};t._src=st.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),st.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?s():(t.image.addEventListener("canplaythrough",s,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Si={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){let t=B.getTag(e),i;switch(t){case"canvas":i="#"+e.id;break;default:i=e.src}B.ImageRegistry.contains(i)?this._image=B.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(m.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(m.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof k&&this._scale.unbind(m.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof k&&this._scale.bind(m.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function ms(){this._flagOffset=!0}function ys(){this._flagScale=!0}var Pt=Math.min,It=Math.max,xs=Math.ceil,bs=Math.floor,vs=new k,Yt=class extends ot{_flagVertices=!0;_flagLength=!0;_flagFill=!0;_flagStroke=!0;_flagLinewidth=!0;_flagOpacity=!0;_flagVisible=!0;_flagCap=!0;_flagJoin=!0;_flagMiter=!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;constructor(t,i,s,r){super();for(let n in Ei)Object.defineProperty(this,n,Ei[n]);this._renderer.type="path",this._renderer.flagVertices=Ge.bind(this),this._renderer.bindVertices=qe.bind(this),this._renderer.unbindVertices=Ke.bind(this),this._renderer.flagFill=Je.bind(this),this._renderer.flagStroke=$e.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!s,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=t,this.automatic=!r,this.dashes=[],this.dashes.offset=0}clone(t){let i=new Yt;for(let s=0;s=y){this._closed?(s=it(Z,x),r=it(Z-1,x),Z===0&&(s=r,r=Z)):(s=Z,r=Math.min(Math.max(Z-1,0),R)),A=this.vertices[s],E=this.vertices[r],y-=rt,this._lengths[Z]!==0?t=y/this._lengths[Z]:t=0;break}rt+=this._lengths[Z]}if(A===null||E===null)return null;if(A){if(!E)return A}else return E;g=E.controls&&E.controls.right,b=A.controls&&A.controls.left,o=E.x,_=E.y,h=(g||E).x,d=(g||E).y,l=(b||A).x,c=(b||A).y,f=A.x,p=A.y,g&&E.relative&&(h+=E.x,d+=E.y),b&&A.relative&&(l+=A.x,c+=A.y),a=Dt(t,o,h,l,f),u=Dt(t,_,d,c,p);let C=nt(o,h,t),j=nt(_,d,t),M=nt(h,l,t),T=nt(d,c,t),N=nt(l,f,t),z=nt(c,p,t),W=nt(C,M,t),V=nt(j,T,t),ft=nt(M,N,t),ct=nt(T,z,t);return S.isObject(i)?(i.x=a,i.y=u,i instanceof F&&(i.controls.left.x=W,i.controls.left.y=V,i.controls.right.x=ft,i.controls.right.y=ct,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=u,i.controls.right.x-=a,i.controls.right.y-=u)),i.t=t,i):(n=new F(a,u,W-a,V-u,ft-a,ct-u,this._curved?w.curve:w.line),n.t=t,n)}plot(){if(this.curved)return Ne(this._collection,this.closed),this;for(let t=0;t0&&(n[n.length-1].command=w.line),r=o;return}a=Xe(o,r,t),n=n.concat(a),S.each(a,function(l,f){f<=0&&r.command===w.move?l.command=w.move:l.command=w.line}),h>=i&&(this._closed&&this._automatic?(r=o,a=Xe(o,r,t),n=n.concat(a),S.each(a,function(l,f){f<=0&&r.command===w.move?l.command=w.move:l.command=w.line})):s&&n.push(new F(o.x,o.y)),n[n.length-1].command=s?w.close:w.line),r=o},this),this._automatic=!1,this._curved=!1,this.vertices=n,this}_updateLength(t,i){i||this._update();let s=this.vertices.length,r=s-1,n=!1,a=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),S.each(this.vertices,function(h,l){if(l<=0&&!n||h.command===w.move){a=h,this._lengths[l]=0;return}this._lengths[l]=Re(h,a,t),o+=this._lengths[l],l>=r&&n&&(a=this.vertices[(l+1)%s],this._lengths[l+1]=Re(h,a,t),o+=this._lengths[l+1]),a=h},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);let t=this._collection.length,i=this._closed,s=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),n=Xt(this,s*this._length),a=Xt(this,r*this._length),o=xs(n),h=bs(a),l,f,u,_,d,c;for(this._renderer.vertices.length=0,c=0;ch&&!f?(d=this._renderer.collection[c].copy(this._collection[c]),this.getPointAt(r,d),d.command=this._renderer.collection[c].command,this._renderer.vertices.push(d),f=d,u=this._collection[c-1],u&&u.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d),u.relative?this._renderer.collection[c-1].controls.right.copy(u.controls.right).lerp(k.zero,1-d.t):this._renderer.collection[c-1].controls.right.copy(u.controls.right).lerp(u,1-d.t))):c>=o&&c<=h&&(d=this._renderer.collection[c].copy(this._collection[c]),this._renderer.vertices.push(d),c===h&&We(this,r)?(f=d,!i&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):c===o&&We(this,s)&&(l=d,l.command=w.move,!i&&l.controls&&(l.relative?l.controls.left.clear():l.controls.left.copy(l))));o>0&&!l&&(c=o-1,d=this._renderer.collection[c].copy(this._collection[c]),this.getPointAt(s,d),d.command=w.move,this._renderer.vertices.unshift(d),_=this._collection[c+1],_&&_.controls&&(d.controls.left.clear(),_.relative?this._renderer.collection[c+1].controls.left.copy(_.controls.left).lerp(k.zero,d.t):(vs.copy(_),this._renderer.collection[c+1].controls.left.copy(_.controls.left).lerp(_,d.t))))}return ot.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=!1,ot.prototype.flagReset.call(this),this}},L=Yt;v(L,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending"]),v(L,"Utils",{getCurveLength:Re});var Ei={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.unbind(m.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.bind(m.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&this._stroke.unbind(m.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&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(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;let t=this._automatic?"ignore":"listen";S.each(this.vertices,function(i){i[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){let t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(m.Types.insert,t).unbind(m.Types.remove,i),e instanceof lt?this._collection=e:this._collection=new lt(e||[]),this._collection.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,S.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function Ge(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function qe(e){let t=e.length;for(;t--;)e[t].bind(m.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Ke(e){let t=e.length;for(;t--;)e[t].unbind(m.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Je(){this._flagFill=!0}function $e(){this._flagStroke=!0}var Ze=class extends L{constructor(t,i,s,r){let n=[new F,new F,new F,new F];super(n,!0,!1,!0);for(let a in Fi)Object.defineProperty(this,a,Fi[a]);this.width=typeof s=="number"?s:1,this.height=typeof r=="number"?r:1,this.origin=new k,typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i),this._update()}_flagWidth=0;_flagHeight=0;_width=0;_height=0;_origin=null;_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let t=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new F),this.vertices[0].set(-t,-i).sub(this._origin).command=w.move,this.vertices[1].set(t,-i).sub(this._origin).command=w.line,this.vertices[2].set(t,i).sub(this._origin).command=w.line,this.vertices[3].set(-t,i).sub(this._origin).command=w.line,this.vertices[4]&&(this.vertices[4].set(-t,-i).sub(this._origin).command=w.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(t){let i=new Ze(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let s=0;s0&&(S.isNaN(this._lastFrame)&&(this._lastFrame=o-1),a=S.performance.now()-this._startTime,_=this._lastFrame+1,h=1e3*(_-this._firstFrame)/this._frameRate,this._loop?a=a%h:a=Math.min(a,h),l=nt(this._firstFrame,_,a/h),l=Math.floor(l),l!==this._index&&(this._index=l,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));let d=this._index%i,c=Math.floor(this._index/i),p=-r*d+(f-r)/2,b=-n*c+(u-n)/2;p!==t.offset.x&&(t.offset.x=p),b!==t.offset.y&&(t.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Nt=Qe;v(Nt,"Properties",["texture","columns","rows","frameRate","index"]);var Ti={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}}};var ti=Math.cos,ei=Math.sin,se=class extends L{_flagRadius=!1;_radius=0;constructor(t,i,s,r){let n=r?Math.max(r,2):4,a=[];for(let o=0;o2&&(t-=1);let i=4/3*Math.tan(Math.PI/(t*2)),s=this._radius,r=s*i;for(let n=0;n2&&(t-=1);let i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,r=this._height/2;for(let n=0;n"u"&&typeof s=="number"&&typeof r=="number"&&(n=Math.floor(Math.min(s,r)/12));let a=[];for(let o=0;o<10;o++)a.push(new F(0,0,0,0,0,0,o===0?w.move:w.curve));super(a);for(let o in Oi)Object.defineProperty(this,o,Oi[o]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ws.bind(this),typeof s=="number"&&(this.width=s),typeof r=="number"&&(this.height=r),typeof n=="number"&&(this.radius=n),this._update(),typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i)}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){let t=this._width,i=this._height,s,r;this._radius instanceof k?(s=this._radius.x,r=this._radius.y):(s=this._radius,r=this._radius);let n,a=t/2,o=i/2;n=this.vertices[0],n.x=-(a-s),n.y=-o,n=this.vertices[1],n.x=a-s,n.y=-o,n.controls.left.clear(),n.controls.right.x=s,n.controls.right.y=0,n=this.vertices[2],n.x=a,n.y=-(o-r),n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[3],n.x=a,n.y=o-r,n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=r,n=this.vertices[4],n.x=a-s,n.y=o,n.controls.right.clear(),n.controls.left.clear(),n=this.vertices[5],n.x=-(a-s),n.y=o,n.controls.left.clear(),n.controls.right.x=-s,n.controls.right.y=0,n=this.vertices[6],n.x=-a,n.y=o-r,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[7],n.x=-a,n.y=-(o-r),n.controls.left.clear(),n.controls.right.x=0,n.controls.right.y=-r,n=this.vertices[8],n.x=-(a-s),n.y=-o,n.controls.left.clear(),n.controls.right.clear(),n=this.vertices[9],n.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(t){let i=this.width,s=this.height,r=this.radius,n=new ne(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 a=0;a"u"||typeof a>"u"||(t[n]=a.replace(/\s/,""))}return t}function Ms(e){let t={},i=Cs(e),s=Math.max(i.length,e.style.length);for(let r=0;r=0&&t.splice(r,1)}return t}function Ls(e,t){let i=t.split(/[\s,]/),s=-parseFloat(i[0]),r=-parseFloat(i[1]),n=parseFloat(i[2]),a=parseFloat(i[3]);if(s&&r)for(let u=0;u"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)||(o=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,o===null))break;switch(_=Ot(o),t._renderer.type){case"linear-gradient":Ni(_,t.left),Ni(_,t.right);break;case"radial-gradient":t.center.x+=_.translateX,t.center.y+=_.translateY,t.focal.x+=_.translateX,t.focal.y+=_.translateY,t.radius*=Math.max(_.scaleX,_.scaleY);break}break;case"transform":if(/none/i.test(l)||(o=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,o===null))break;X.AutoCalculateImportedMatrices?(_=Ot(o),t.translation.set(_.translateX,_.translateY),t.rotation=Math.PI*(_.rotation/180),t.scale=new k(_.scaleX,_.scaleY),d=parseFloat((s.x+"").replace("px")),c=parseFloat((s.y+"").replace("px")),d&&(t.translation.x=d),c&&(t.translation.y=c)):(o=e.getCTM(),t._matrix.manual=!0,t._matrix.set(o.a,o.b,o.c,o.d,o.e,o.f));break;case"visible":if(t instanceof G){t._visible=l;break}t.visible=l;break;case"stroke-linecap":if(t instanceof G){t._cap=l;break}t.cap=l;break;case"stroke-linejoin":if(t instanceof G){t._join=l;break}t.join=l;break;case"stroke-miterlimit":if(t instanceof G){t._miter=l;break}t.miter=l;break;case"stroke-width":if(t instanceof G){t._linewidth=parseFloat(l);break}t.linewidth=parseFloat(l);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof G){t._opacity=parseFloat(l);break}t.opacity=parseFloat(l);break;case"clip-path":if(St.cssBackgroundImage.test(l)&&(p=l.replace(St.cssBackgroundImage,"$1"),q.defs.current&&q.defs.current.contains(p)&&(g=q.defs.current.get(p),g&&g.childNodes.length>0)))switch(g=g.childNodes[0],y=ae(g.nodeName),t.mask=q[y].call(this,g,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":f=(t instanceof G?"_":"")+h,St.cssBackgroundImage.test(l)?(p=l.replace(St.cssBackgroundImage,"$1"),q.defs.current&&q.defs.current.contains(p)?(g=q.defs.current.get(p),g.object||(y=ae(g.nodeName),g.object=q[y].call(this,g,{})),g=g.object):(b=Ps(this),g=b.getById(p)),t[f]=g):t[f]=/none/i.test(l)?"transparent":l;break;case"id":t.id=l;break;case"class":case"className":t.classList=l.split(" "),t._flagClassName=!0;break;case"x":case"y":if(x=t instanceof Y,R=t instanceof U,A=t instanceof D,x||R||A)break;l.match("[a-z%]$")&&!l.endsWith("px")&&(E=new et("only pixel values are supported with the "+h+" attribute."),console.warn(E.name,E.message)),t.translation[h]=parseFloat(l);break;case"font-family":t instanceof gt&&(t.family=l);break;case"font-size":t instanceof gt&&(t.size=l);break;case"font-weight":t instanceof gt&&(t.weight=l);break;case"font-style":t instanceof gt&&(t.style=l);break;case"text-decoration":t instanceof gt&&(t.decoration=l);break;case"line-height":t instanceof gt&&(t.leading=l);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),s}function Os(e,t){for(let i=0,s=e.childNodes.length;i with no href."),console.warn(i.name,i.message),null;let r=s.slice(1);if(!q.defs.current.contains(r))return i=new et("unable to find element for reference "+s+"."),console.warn(i.name,i.message),null;let a=q.defs.current.get(r).cloneNode(!0);for(let h=0;h1&&(g=1);break;case"m":case"l":case"t":c.length>2&&(g=2);break;case"s":case"q":c.length>4&&(g=4);break;case"c":c.length>6&&(g=6);break;case"a":c.length>7&&(g=7);break}if(g){for(y=0,x=c.length,A=0;y0)switch(p){case"m":R="l";break;case"M":R="L";break}E.push(R+c.slice(y,y+g).join(" ")),A++}f=Array.prototype.concat.apply(f,E)}else f.push(_)}),S.each(f,function(_,d){let c,p,b,g=_[0],y=g.toLowerCase();l=_.slice(1).trim().match(St.path),n=g===y;let x,R,A,E,C,j,M,T,N,z,W,V,ft,ct,Z,ut,rt;switch(y){case"z":if(d>=u)r=!0;else{p=o.x,b=o.y,c=new F(p,b,void 0,void 0,void 0,void 0,w.close);for(let Et=s.length-1;Et>=0;Et--){let Ct=s[Et];if(/m/i.test(Ct.command)){o=Ct;break}}}break;case"m":case"l":h=void 0,p=parseFloat(l[0]),b=parseFloat(l[1]),c=new F(p,b,void 0,void 0,void 0,void 0,/m/i.test(y)?w.move:w.line),n&&c.addSelf(o),o=c;break;case"h":case"v":z=/h/i.test(y)?"x":"y",W=/x/i.test(z)?"y":"x",c=new F(void 0,void 0,void 0,void 0,void 0,void 0,w.line),c[z]=parseFloat(l[0]),c[W]=o[W],n&&(c[z]+=o[z]),o=c;break;case"c":case"s":x=o.x,R=o.y,h||(h=new k),/c/i.test(y)?(A=parseFloat(l[0]),E=parseFloat(l[1]),C=parseFloat(l[2]),j=parseFloat(l[3]),M=parseFloat(l[4]),T=parseFloat(l[5])):(N=pe(o,h,n),A=N.x,E=N.y,C=parseFloat(l[0]),j=parseFloat(l[1]),M=parseFloat(l[2]),T=parseFloat(l[3])),n&&(A+=x,E+=R,C+=x,j+=R,M+=x,T+=R),o.controls.right.set(A-o.x,E-o.y),c=new F(M,T,C-M,j-T,void 0,void 0,w.curve),o=c,h=c.controls.left;break;case"t":case"q":x=o.x,R=o.y,h||(h=new k),/q/i.test(y)?(A=parseFloat(l[0]),E=parseFloat(l[1]),C=parseFloat(l[0]),j=parseFloat(l[1]),M=parseFloat(l[2]),T=parseFloat(l[3])):(N=pe(o,h,n),A=N.x,E=N.y,C=N.x,j=N.y,M=parseFloat(l[0]),T=parseFloat(l[1])),n&&(A+=x,E+=R,C+=x,j+=R,M+=x,T+=R),o.controls.right.set((A-o.x)*.33,(E-o.y)*.33),c=new F(M,T,C-M,j-T,void 0,void 0,w.curve),o=c,h=c.controls.left;break;case"a":x=o.x,R=o.y,ft=parseFloat(l[0]),ct=parseFloat(l[1]),Z=parseFloat(l[2]),ut=parseFloat(l[3]),rt=parseFloat(l[4]),M=parseFloat(l[5]),T=parseFloat(l[6]),n&&(M+=x,T+=R),V=new F(M,T),V.command=w.arc,V.rx=ft,V.ry=ct,V.xAxisRotation=Z,V.largeArcFlag=ut,V.sweepFlag=rt,c=V,o=V,h=void 0;break}c&&(Array.isArray(c)?s=s.concat(c):s.push(c))})}i=new L(s,r,void 0,!0).noStroke(),i.fill="black";let a=i.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},S.each(i.vertices,function(o){o.subSelf(a.centroid)}),wt.call(this,e,i,t),i.translation.addSelf(a.centroid),i},circle:function(e,t){let i=parseFloat(e.getAttribute("cx")),s=parseFloat(e.getAttribute("cy")),r=parseFloat(e.getAttribute("r")),n=new Vt(0,0,r).noStroke();return n.fill="black",wt.call(this,e,n,t),n.translation.x=i,n.translation.y=s,n},ellipse:function(e,t){let i=parseFloat(e.getAttribute("cx")),s=parseFloat(e.getAttribute("cy")),r=parseFloat(e.getAttribute("rx")),n=parseFloat(e.getAttribute("ry")),a=new zt(0,0,r,n).noStroke();return a.fill="black",wt.call(this,e,a,t),a.translation.x=i,a.translation.y=s,a},rect:function(e,t){let i=parseFloat(e.getAttribute("rx")),s=parseFloat(e.getAttribute("ry"));if(!S.isNaN(i)||!S.isNaN(s))return q["rounded-rect"](e);let r=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),a=r/2,o=n/2,h=new vt(0,0,r,n).noStroke();return h.fill="black",wt.call(this,e,h,t),h.translation.x+=a,h.translation.y+=o,h},"rounded-rect":function(e,t){let i=parseFloat(e.getAttribute("rx"))||0,s=parseFloat(e.getAttribute("ry"))||0,r=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),a=r/2,o=n/2,h=new k(i,s),l=new Ut(0,0,r,n,h).noStroke();return l.fill="black",wt.call(this,e,l,t),l.translation.x+=a,l.translation.y+=o,l},line:function(e,t){let i=parseFloat(e.getAttribute("x1")),s=parseFloat(e.getAttribute("y1")),r=parseFloat(e.getAttribute("x2")),n=parseFloat(e.getAttribute("y2")),a=new Gt(i,s,r,n).noFill();return wt.call(this,e,a,t),a},lineargradient:function(e,t){let i=e.getAttribute("gradientUnits"),s=e.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(e.getAttribute("x1")||0),n=parseFloat(e.getAttribute("y1")||0),a=parseFloat(e.getAttribute("x2")||0),o=parseFloat(e.getAttribute("y2")||0),h=(a+r)/2,l=(o+n)/2;/userSpaceOnUse/i.test(i)&&(r-=h,n-=l,a-=h,o-=l);let f=[];for(let _=0;_1?y[1]:void 0),b===null?(y=g?g.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=y&&y.length>1?parseFloat(y[1]):1):b=parseFloat(b),f.push(new _t(c,p,b))}let u=new U(r,n,a,o,f);return u.spread=s,u.units=i,wt.call(this,e,u,t),u},radialgradient:function(e,t){let i=e.getAttribute("gradientUnits"),s=e.getAttribute("spreadMethod");i||(i="objectBoundingBox"),s||(s="pad");let r=parseFloat(e.getAttribute("cx"))||0,n=parseFloat(e.getAttribute("cy"))||0,a=parseFloat(e.getAttribute("r")),o=parseFloat(e.getAttribute("fx")),h=parseFloat(e.getAttribute("fy"));S.isNaN(o)&&(o=r),S.isNaN(h)&&(h=n);let l=Math.abs(r+o)/2,f=Math.abs(n+h)/2;/userSpaceOnUse/i.test(i)&&(r-=l,n-=f,o-=l,h-=f);let u=[];for(let d=0;d1?x[1]:void 0),g===null?(x=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,g=x&&x.length>1?parseFloat(x[1]):1):g=parseFloat(g),u.push(new _t(p,b,g))}let _=new D(r,n,a,u,o,h);return _.spread=s,_.units=i,wt.call(this,e,_,t),_},text:function(e,t){let i=Es(e.getAttribute("text-anchor"))||"left",s=Fs(e)||"baseline",r=e.textContent,n=new gt(r);return wt.call(this,e,n,t),n.alignment=i,n.baseline=s,n},clippath:function(e,t){return q.defs.current&&!q.defs.current.contains(e.id)&&q.defs.current.add(e.id,e),null},image:function(e,t){let i,s=e.getAttribute("href")||e.getAttribute("xlink:href");if(!s)return i=new et("encountered with no href."),console.warn(i.name,i.message),null;let r=parseFloat(e.getAttribute("x"))||0,n=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),h=new Nt(s,r,n);return S.isNaN(a)||(h.width=a),S.isNaN(o)||(h.height=o),wt.call(this,e,h,t),h}};function ri(e,t){let i=new XMLHttpRequest;return i.open("GET",e),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&t(i.responseText)},i.send(),i}var Ee=class extends vt{_flagTextures=!1;_flagFrameRate=!1;_flagIndex=!1;_amount=1;_duration=0;_index=0;_startTime=0;_playing=!1;_firstFrame=0;_lastFrame=0;_loop=!0;_textures=null;_frameRate=0;_origin=null;constructor(t,i,s,r){super(i,s,0,0);for(let n in Vi)Object.defineProperty(this,n,Vi[n]);this._renderer.flagTextures=Is.bind(this),this._renderer.bindTextures=Bs.bind(this),this._renderer.unbindTextures=js.bind(this),this.noStroke(),this.noFill(),Array.isArray(t)?this.textures=t.map(zi.bind(this)):this.textures=[zi(t)],this.origin=new k,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Ee.DefaultFrameRate,this.index=0}play(t,i,s){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=S.performance.now(),typeof t=="number"&&(this._firstFrame=t),typeof i=="number"&&(this._lastFrame=i),typeof s=="function"?this._onLastFrame=s:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(t){let i=new Ee(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),t&&t.add(i),i}toObject(){let t=super.toObject.call(this);return t.textures=this.textures.map(function(i){return i.toObject()}),t.frameRate=this.frameRate,t.index=this.index,t._firstFrame=this._firstFrame,t._lastFrame=this._lastFrame,t._loop=this._loop,t}_update(){let t=this._textures,i,s,r,n,a,o,h,l;return t&&(this._flagTextures&&(this._amount=t.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(n=this._amount,S.isNaN(this._lastFrame)&&(this._lastFrame=n-1),r=S.performance.now()-this._startTime,l=this._lastFrame+1,a=1e3*(l-this._firstFrame)/this._frameRate,this._loop?r=r%a:r=Math.min(r,a),h=nt(this._firstFrame,l,r/a),h=Math.floor(h),h!==this._index&&(this._index=h,o=t[this._index],o.loaded&&(i=o.image.width,s=o.image.height,this.width!==i&&(this.width=i),this.height!==s&&(this.height=s),this.fill=o,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof B))&&(o=t[this._index],o.loaded&&(i=o.image.width,s=o.image.height,this.width!==i&&(this.width=i),this.height!==s&&(this.height=s)),this.fill=o)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},qt=Ee;v(qt,"Properties",["textures","frameRate","index"]),v(qt,"DefaultFrameRate",30);var Vi={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){let t=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(m.Types.insert,t).unbind(m.Types.remove,i),this._textures=new lt((e||[]).slice(0)),this._textures.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._textures)}}};function Is(){this._flagTextures=!0}function Bs(e){let t=e.length;for(;t--;)e[t].bind(m.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function js(e){let t=e.length;for(;t--;)e[t].unbind(m.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function zi(e){if(e instanceof B)return e;if(typeof e=="string")return new B(e)}var oe=class extends L{_flagStartAngle=!1;_flagEndAngle=!1;_flagInnerRadius=!1;_flagOuterRadius=!1;_startAngle=0;_endAngle=J;_innerRadius=0;_outerRadius=0;constructor(t,i,s,r,n,a,o){let h=o||X.Resolution*3,l=[];for(let f=0;f0,o=this.vertices,h=a?o.length/2:o.length,l,f=0,u,_,d,c,p,b,g,y,x;for(n?h--:a||(h-=2),u=0,_=h-1;u=n&&l<=a&&(h=this._collection[l],this._renderer.collection.push(h),this._renderer.vertices[o*2+0]=h.x,this._renderer.vertices[o*2+1]=h.y,o++)}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}},he=Kt;v(he,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending"]);var Di={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.unbind(m.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Y||this._fill instanceof U||this._fill instanceof D||this._fill instanceof B)&&this._fill.bind(m.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&this._stroke.unbind(m.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Y||this._stroke instanceof U||this._stroke instanceof D||this._stroke instanceof B)&&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(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){let t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(m.Types.insert,t).unbind(m.Types.remove,i),e instanceof lt?this._collection=e:this._collection=new lt(e||[]),this._collection.bind(m.Types.insert,t).bind(m.Types.remove,i),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};var zs=Math.cos,Us=Math.sin,fe=class extends L{_flagWidth=!1;_flagHeight=!1;_flagSides=!1;_radius=0;_width=0;_height=0;_sides=0;constructor(t,i,s,r){r=Math.max(r||0,3);super();for(let n in Hi)Object.defineProperty(this,n,Hi[n]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof r=="number"&&(this.sides=r),this._update(),typeof t=="number"&&(this.translation.x=t),typeof i=="number"&&(this.translation.y=i)}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){let t=this._sides,i=t+1,s=this.vertices.length;s>t&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new F(o,h)):this.vertices[r].set(o,h),this.vertices[r].command=r===0?w.move:w.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let i=new fe(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;st&&(this.vertices.splice(t-1,s-t),s=t);for(let r=0;r=s?this.vertices.push(new F(h,l)):this.vertices[r].set(h,l),this.vertices[r].command=r===0?w.move:w.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(t){let i=this.innerRadius,s=this.outerRadius,r=this.sides,n=new ue(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 a=0;a0&&O.setAttributes(s,t),s},setAttributes:function(e,t){let i=Object.keys(t);for(let s=0;s=s&&t&&(o.command===w.curve&&(u=r,y=o.controls&&o.controls.right||o,x=u.controls&&u.controls.left||u,o.relative?(_=K(y.x+o.x),d=K(y.y+o.y)):(_=K(y.x),d=K(y.y)),u.relative?(c=K(x.x+u.x),p=K(x.y+u.y)):(c=K(x.x),p=K(x.y)),M=K(u.x),T=K(u.y),f+=" C "+_+" "+d+" "+c+" "+p+" "+M+" "+T),o.command!==w.close&&(f+=" Z")),n+=f+" "}return n},pointsToString:function(e,t){let i="",s=t*.5;for(let r=0;r0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?O.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=O.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){let s=O.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(O[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let s=this._size;if(!this._sizeAttenuation){pt(this,Xi);let n=Xi.elements,a=Ot(n[0],n[3],n[1],n[4],n[2],n[5]);s/=Math.max(a.scaleX,a.scaleY)}let r=O.pointsToString(this._renderer.collection,s);t.d=r}return this._fill&&this._fill._renderer&&(this._fill._update(),O[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),O[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?O.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=O.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();let t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=O.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["alignment-baseline"]=t["dominant-baseline"]=this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),O[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),O[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?O.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=O.createElement("text",t),e.defs.appendChild(this._renderer.elem)),this._flagClip){let s=O.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),s.setAttribute("id",this.id),s.appendChild(r)):(s.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(O[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(e,t){t||this._update();let i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?O.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=O.createElement("linearGradient",i),e.defs.appendChild(this._renderer.elem)),this._flagStops){let s=this._renderer.elem.childNodes.length!==this.stops.length;if(s)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let r=0;r0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,r)){switch(s.width=i.width=r.width,s.height=i.height=r.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof k?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?O.setAttributes(this._renderer.image,s):this._renderer.image=O.createElement("image",s)),this._renderer.elem?Object.keys(i).length!==0&&O.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=O.createElement("pattern",i),e.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},Fe=class extends m{constructor(t){super();this.domElement=t.domElement||O.createElement("svg"),this.scene=new G,this.scene.parent=this,this.defs=O.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,i){return this.width=t,this.height=i,O.setAttributes(this.domElement,{width:t,height:i}),this.trigger(m.Types.resize,t,i)}render(){return O.group.render.call(this.scene,this.domElement),this}};v(Fe,"Utils",O);var yt={create:function(e,t,i){let s=e.createShader(e[i]);if(e.shaderSource(s,t),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS)){let n=e.getShaderInfoLog(s);throw e.deleteShader(s),new et("unable to compile shader "+s+": "+n)}return s},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:` precision mediump float; attribute vec2 a_position; @@ -85,3 +85,5 @@ var Two=(()=>{var ge=Object.defineProperty;var Gi=Object.getOwnPropertyDescripto gl_FragColor = texel; } `}};var Te=at.Multiply,Ws=[1,0,0,0,1,0,0,0,1],Bt=new xt(9),Xs=At.Utils,ni=new xt([0,0,1,0,0,1,0,1,1,0,1,1]),P={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:H.document?H.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new at,group:{removeChild:function(e,t){if(e.children)for(let i=0;i0&&(g.lineDashOffset=N.offset||0,g.setLineDash(N));let Z,ut,rt,Et,Ct,$t,Zt,Qt;g.save(),g.scale(y.x,y.y),g.translate(ft,ct),g.beginPath();for(let kt=0;kt=W&&T&&(s=Z,f=Q.controls&&Q.controls.right||k.zero,u=s.controls&&s.controls.left||k.zero,Q._relative?(a=f.x+Q.x,o=f.y+Q.y):(a=f.x,o=f.y),s._relative?(r=u.x+s.x,n=u.y+s.y):(r=u.x,n=u.y),_=s.x,d=s.y,g.bezierCurveTo(a,o,r,n,_,d));break;case w.line:g.lineTo(_,d);break;case w.move:Z=Q,g.moveTo(_,d);break}}T&&g.closePath(),P.isHidden.test(A)||(c=A._renderer&&A._renderer.offset,c&&(g.save(),g.translate(-A._renderer.offset.x,-A._renderer.offset.y),g.scale(A._renderer.scale.x,A._renderer.scale.y)),g.fill(),c&&g.restore()),P.isHidden.test(x)||(c=x._renderer&&x._renderer.offset,c&&(g.save(),g.translate(-x._renderer.offset.x,-x._renderer.offset.y),g.scale(x._renderer.scale.x,x._renderer.scale.y),g.lineWidth=R/x._renderer.scale.x),g.stroke(),c&&g.restore()),g.restore()},getBoundingClientRect:function(e,t,i){let s=1/0,r=-1/0,n=1/0,a=-1/0,o,h;e.forEach(function(l){let f=l.x,u=l.y,_=l.controls,d,c,p,b,g,y;n=Math.min(u,n),s=Math.min(f,s),r=Math.max(f,r),a=Math.max(u,a),l.controls&&(g=_.left,y=_.right,!(!g||!y)&&(d=l._relative?g.x+f:g.x,c=l._relative?g.y+u:g.y,p=l._relative?y.x+f:y.x,b=l._relative?y.y+u:y.y,!(!d||!c||!p||!b)&&(n=Math.min(c,b,n),s=Math.min(d,p,s),r=Math.max(d,p,r),a=Math.max(c,b,a))))}),typeof t=="number"&&(n-=t,s-=t,r+=t,a+=t),o=r-s,h=a-n,i.top=n,i.left=s,i.right=r,i.bottom=a,i.width=o,i.height=h,i.centroid||(i.centroid={}),i.centroid.x=-s,i.centroid.y=-n},render:function(e,t,i){if(!this._visible||!this._opacity)return this;this._update();let s=i||this.parent,r=t[this._renderer.type],n=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,o=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof U&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof D&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof B&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof U&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof D&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof B&&(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((n||a||o)&&(this._renderer.matrix||(this._renderer.matrix=new xt(9)),this._matrix.toTransformArray(!0,Bt),Te(Bt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof k||(this._renderer.scale=new k),this._scale instanceof k?(this._renderer.scale.x=this._scale.x*s._renderer.scale.x,this._renderer.scale.y=this._scale.y*s._renderer.scale.y):(this._renderer.scale.x=this._scale*s._renderer.scale.x,this._renderer.scale.y=this._scale*s._renderer.scale.y),o&&(this._renderer.parent=s)),this._mask&&(e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1),P[this._mask._renderer.type].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,P.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),P.updateTexture.call(P,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;t.current!==r&&(e.useProgram(r),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r.position),e.bufferData(e.ARRAY_BUFFER,ni,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),t.current=r),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);let l=this._renderer.rect;return e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.uniform4f(r.rect,l.left,l.top,l.right,l.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),this.flagReset()}},points:{updateCanvas:function(e){let t,i=this.canvas,s=this.ctx,r=e._stroke,n=e._linewidth,a=e._fill,o=e._renderer.opacity||e._opacity,h=e.dashes,l=e._size,f=l;P.isHidden.test(r)||(f+=n),i.width=Pe(f),i.height=i.width;let u=f/i.width,_=i.width/2,d=i.height/2;s.clearRect(0,0,i.width,i.height),a&&(typeof a=="string"?s.fillStyle=a:(P[a._renderer.type].render.call(a,s,e),s.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?s.strokeStyle=r:(P[r._renderer.type].render.call(r,s,e),s.strokeStyle=r._renderer.effect),n&&(s.lineWidth=n/u)),typeof o=="number"&&(s.globalAlpha=o),h&&h.length>0&&(s.lineDashOffset=h.offset||0,s.setLineDash(h)),s.save(),s.translate(_,d),s.scale(P.precision,P.precision),s.beginPath(),s.arc(0,0,l/u*.5,0,J),s.restore(),closed&&s.closePath(),P.isHidden.test(a)||(t=a._renderer&&a._renderer.offset,t&&(s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(a._renderer.scale.x,a._renderer.scale.y)),s.fill(),t&&s.restore()),P.isHidden.test(r)||(t=r._renderer&&r._renderer.offset,t&&(s.save(),s.translate(-r._renderer.offset.x,-r._renderer.offset.y),s.scale(r._renderer.scale.x,r._renderer.scale.y),s.lineWidth=n/r._renderer.scale.x),s.stroke(),t&&s.restore())},render:function(e,t,i){if(!this._visible||!this._opacity)return this;this._update();let s=this._size,r=i||this.parent,n=t[this._renderer.type],a=this._sizeAttenuation,o=this._stroke,h=this._linewidth,l=r._matrix.manual||r._flagMatrix,f=this._matrix.manual||this._flagMatrix,u=this._renderer.parent!==r,_=this._renderer.vertices,d=this._renderer.collection.length,c=this._flagVertices,p=this._flagFill||this._fill instanceof U&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof D&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof B&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof U&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof D&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof B&&(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||u)&&(this._renderer.matrix||(this._renderer.matrix=new xt(9)),this._matrix.toTransformArray(!0,Bt),Te(Bt,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof k||(this._renderer.scale=new k),this._scale instanceof k?(this._renderer.scale.x=this._scale.x*r._renderer.scale.x,this._renderer.scale.y=this._scale.y*r._renderer.scale.y):(this._renderer.scale.x=this._scale*r._renderer.scale.x,this._renderer.scale.y=this._scale*r._renderer.scale.y),u&&(this._renderer.parent=r)),c){let b=this._renderer.positionBuffer;b&&e.deleteBuffer(b),this._renderer.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.positionBuffer),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,_,e.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*r._renderer.opacity,P.updateTexture.call(P,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(P.isHidden.test(o)||(s+=h),s/=P.precision,a&&(s*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),t.current!==n&&(e.useProgram(n),t.resolution.flagged||e.uniform2f(e.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),t.current=n),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(n,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(n.matrix,!1,this._renderer.matrix),e.uniform1f(n.size,s*t.resolution.ratio),e.drawArrays(e.POINTS,0,d),this.flagReset())}},text:{updateCanvas:function(e){let t=this.canvas,i=this.ctx,s=e._renderer.scale,r=e._stroke,n=e._linewidth*s,a=e._fill,o=e._renderer.opacity||e._opacity,h=e.dashes,l=e._decoration;t.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),t.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);let f=e._renderer.rect.centroid,u=f.x,_=f.y,d,c,p,b,g,y,x,R,A,E,C,j=a._renderer&&a._renderer.offset&&r._renderer&&r._renderer.offset;if(i.clearRect(0,0,t.width,t.height),j||(i.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),i.textAlign="center",i.textBaseline="middle",a&&(typeof a=="string"?i.fillStyle=a:(P[a._renderer.type].render.call(a,i,e),i.fillStyle=a._renderer.effect)),r&&(typeof r=="string"?i.strokeStyle=r:(P[r._renderer.type].render.call(r,i,e),i.strokeStyle=r._renderer.effect),n&&(i.lineWidth=n)),typeof o=="number"&&(i.globalAlpha=o),h&&h.length>0&&(i.lineDashOffset=h.offset||0,i.setLineDash(h)),i.save(),i.scale(s.x,s.y),i.translate(u,_),P.isHidden.test(a)||(a._renderer&&a._renderer.offset?(y=a._renderer.scale.x,x=a._renderer.scale.y,i.save(),i.translate(-a._renderer.offset.x,-a._renderer.offset.y),i.scale(y,x),d=e._size/a._renderer.scale.y,c=e._leading/a._renderer.scale.y,i.font=[e._style,e._weight,d+"px/",c+"px",e._family].join(" "),p=a._renderer.offset.x/a._renderer.scale.x,b=a._renderer.offset.y/a._renderer.scale.y,i.fillText(e.value,p,b),i.restore()):i.fillText(e.value,0,0)),P.isHidden.test(r)||(r._renderer&&r._renderer.offset?(y=r._renderer.scale.x,x=r._renderer.scale.y,i.save(),i.translate(-r._renderer.offset.x,-r._renderer.offset.y),i.scale(y,x),d=e._size/r._renderer.scale.y,c=e._leading/r._renderer.scale.y,i.font=[e._style,e._weight,d+"px/",c+"px",e._family].join(" "),p=r._renderer.offset.x/r._renderer.scale.x,b=r._renderer.offset.y/r._renderer.scale.y,g=n/r._renderer.scale.x,i.lineWidth=g,i.strokeText(e.value,p,b),i.restore()):i.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(l)){let M=i.measureText(e.value);switch(l){case"underline":A=M.actualBoundingBoxAscent,C=M.actualBoundingBoxAscent;break;case"strikethrough":A=0,C=0;break}R=-M.width/2,E=M.width/2,i.lineWidth=Math.max(Math.floor(e._size/15),1),i.strokeStyle=i.fillStyle,i.beginPath(),i.moveTo(R,A),i.lineTo(E,C),i.stroke()}i.restore()},getBoundingClientRect:function(e,t){let i=P.ctx;i.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),i.textAlign="center",i.textBaseline=e._baseline;let s=i.measureText(e._value).width*1.25,r=Math.max(e._size,e._leading)*1.25;this._linewidth&&!P.isHidden.test(this._stroke)&&(s+=this._linewidth*2,r+=this._linewidth*2);let n=s/2,a=r/2;switch(P.alignments[e._alignment]||e._alignment){case P.alignments.left:t.left=0,t.right=s;break;case P.alignments.right:t.left=-s,t.right=0;break;default:t.left=-n,t.right=n}switch(e._baseline){case"bottom":t.top=-r,t.bottom=0;break;case"top":t.top=0,t.bottom=r;break;default:t.top=-a,t.bottom=a}t.width=s,t.height=r,t.centroid||(t.centroid={}),t.centroid.x=n,t.centroid.y=a},render:function(e,t,i){if(!this._visible||!this._opacity)return this;this._update();let s=i||this.parent,r=t[this._renderer.type],n=s._matrix.manual||s._flagMatrix,a=this._matrix.manual||this._flagMatrix,o=this._renderer.parent!==s,h=this._flagVertices||this._flagFill||this._fill instanceof U&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof D&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof B&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof U&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof D&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof B&&(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||a||o)&&(this._renderer.matrix||(this._renderer.matrix=new xt(9)),this._matrix.toTransformArray(!0,Bt),Te(Bt,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof k||(this._renderer.scale=new k),this._scale instanceof k?(this._renderer.scale.x=this._scale.x*s._renderer.scale.x,this._renderer.scale.y=this._scale.y*s._renderer.scale.y):(this._renderer.scale.x=this._scale*s._renderer.scale.x,this._renderer.scale.y=this._scale*s._renderer.scale.y),o&&(this._renderer.parent=s)),this._mask&&(e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1),P[this._mask._renderer.type].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*s._renderer.opacity,P.text.getBoundingClientRect(this,this._renderer.rect),P.updateTexture.call(P,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;t.current!==r&&(e.useProgram(r),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(r.position),e.bufferData(e.ARRAY_BUFFER,ni,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),t.current=r),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(r,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);let l=this._renderer.rect;return e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.uniform4f(r.rect,l.left,l.top,l.right,l.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),this.flagReset()}},"linear-gradient":{render:function(e,t){if(!(!e.canvas.getContext("2d")||!t)){if(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,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=t.getBoundingClientRect(!0),s=(s-.5)*i.width,r=(r-.5)*i.height,n=(n-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=e.createLinearGradient(s,r,n,a);for(let o=0;o"u"?Ht(a):s,this.domElement.width=t*this.ratio,this.domElement.height=i*this.ratio,S.isObject(this.domElement.style)&&S.extend(this.domElement.style,{width:t+"px",height:i+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,n=i*this.ratio,a.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,t,i,s)}render(){let t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),P.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};v(Me,"Utils",P);var Ys=S.extend({Error:et,getRatio:Ht,read:q,xhr:ri},S,ht,Ve,Ie),Jt=class{_events=new m;get _bound(){return this._events._bound}set _bound(t){this._events._bound=t}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}type="";renderer=null;scene=null;width=0;height=0;frameCount=0;timeDelta=0;playing=!1;constructor(t){let i=S.defaults(t||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Jt.Types.svg,autostart:!1});if(S.each(i,function(s,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=s)},this),S.isElement(i.domElement)){let s=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+s)||(this.type=Jt.Types[s])}this.renderer=new Jt[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=Gs.bind(this),this.fit.domElement=window,this.fit.attached=!0,S.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),S.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),dt.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=qs.bind(this),S.extend(this.renderer.domElement.style,{display:"block"})):S.isElement(i.domElement)||(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(m.Types.resize,Ks.bind(this)),this.scene=this.renderer.scene,Jt.Instances.push(this),i.autostart&&_e.init()}appendTo(t){return t.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=t,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,_e.init(),this.trigger(m.Types.play)}pause(){return this.playing=!1,this.trigger(m.Types.pause)}setPlaying(t){this.playing=t}release(t){let i,s,r;if(!S.isObject(t))return this.release(this.scene);if(typeof t.unbind=="function"&&t.unbind(),t.vertices)for(typeof t.vertices.unbind=="function"&&t.vertices.unbind(),i=0;i -## May 31, 2022 v0.8.9 +## May 31, 2022 v0.8.10 -

May 31, 2022

+

June 9, 2022

+ Added `Two.Arc` to `/extras` directory + Made `/extras/js/zui.js` ES6 compliant + Removed `/extras` modules from generated documentation + Added method documentation to `Two.ZUI` + Improved `types.d.ts` ++ Fixed Commonjs imports from `package.json` ## May 9, 2022 v0.8.7