@esotericsoftware/spine-canvas 4.2.80 → 4.2.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Ps=Object.defineProperty,Bs=(e,t,s)=>t in e?Ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,B=(e,t,s)=>(Bs(e,typeof t!="symbol"?t+"":t,s),s),Vs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},st=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new be().setFromString(e)}},D=be;B(D,"WHITE",new be(1,1,1,1)),B(D,"RED",new be(1,0,0,1)),B(D,"GREEN",new be(0,1,0,1)),B(D,"BLUE",new be(0,0,1,1)),B(D,"MAGENTA",new be(1,0,1,1));var ne=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ne.degRad)}static sinDeg(e){return Math.sin(e*ne.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ne.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ne.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},E=ne;B(E,"PI",3.1415927),B(E,"PI2",ne.PI*2),B(E,"invPI2",1/ne.PI2),B(E,"radiansToDegrees",180/ne.PI),B(E,"radDeg",ne.radiansToDegrees),B(E,"degreesToRadians",ne.PI/180),B(E,"degRad",ne.degreesToRadians);var ns=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ls=class extends ns{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Ls=class extends ls{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Se=class{static arrayCopy(e,t,s,i,a){for(let c=t,o=i;c<t+a;c++,o++)s[o]=e[c]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:Se.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return Se.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Se.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=Se;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ns=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Te=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Ve=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},Os=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ds=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},rt=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},os=class extends rt{id=os.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,c){s=a+(s>>1)*c;let o=e.bone.skeleton,r=e.deform,l=this.vertices,n=this.bones;if(!n){r.length>0&&(l=r);let f=e.bone,m=f.worldX,x=f.worldY,p=f.a,w=f.b,g=f.c,b=f.d;for(let v=t,y=a;y<s;v+=2,y+=c){let S=l[v],A=l[v+1];i[y]=S*p+A*w+m,i[y+1]=S*g+A*b+x}return}let h=0,u=0;for(let f=0;f<t;f+=2){let m=n[h];h+=m+1,u+=m}let d=o.bones;if(r.length==0)for(let f=a,m=u*3;f<s;f+=c){let x=0,p=0,w=n[h++];for(w+=h;h<w;h++,m+=3){let g=d[n[h]],b=l[m],v=l[m+1],y=l[m+2];x+=(b*g.a+v*g.b+g.worldX)*y,p+=(b*g.c+v*g.d+g.worldY)*y}i[f]=x,i[f+1]=p}else{let f=r;for(let m=a,x=u*3,p=u<<1;m<s;m+=c){let w=0,g=0,b=n[h++];for(b+=h;h<b;h++,x+=3,p+=2){let v=d[n[h]],y=l[x]+f[p],S=l[x+1]+f[p+1],A=l[x+2];w+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}i[m]=w,i[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},le=os;B(le,"nextID",0);var Le=class{id=Le.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Le(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Le._nextID++}},it=Le;B(it,"_nextID",0);var hs=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(hs||{}),cs=[0,1,2,3,4,5,6],Ne=class{name;timelines=[];timelineIds=new st;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,a,c,o,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(e,t,s,a,c,o,r)}},ds=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(ds||{}),fs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(fs||{}),q={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},oe=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,c,o,r,l,n,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(i-c*2+r)*.03,m=(a-o*2+l)*.03,x=((c-r)*3-i+n)*.006,p=((o-l)*3-a+h)*.006,w=f*2+x,g=m*2+p,b=(c-i)*.3+f+x*.16666667,v=(o-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let l=this.frames[t],n=this.frames[t+s];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}let c=i+18;for(i+=2;i<c;i+=2)if(a[i]>=e){let l=a[i-2],n=a[i-1];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}t+=this.getFrameEntries();let o=a[c-2],r=a[c-1];return r+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-r)}},ae=class extends oe{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],c=t[s+1];return c+(e-a)/(t[s+2]-a)*(t[s+2+1]-c);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);switch(s){case 0:return a+c*t;case 1:case 2:c+=a-i}return i+c*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);return s==0?a+(c-a)*t:i+(c-i)*t}getAbsoluteValue2(e,t,s,i,a,c){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(c-a)*t:i+(c-i)*t}getScaleValue(e,t,s,i,a,c){const o=this.frames;if(e<o[0]){switch(s){case 0:return c;case 1:return a+(c-a)*t}return a}let r=this.getCurveValue(e)*c;if(t==1)return s==3?a+r-c:r;if(i==1)switch(s){case 0:return c+(Math.abs(r)*E.signum(c)-c)*t;case 1:case 2:return a+(Math.abs(r)*E.signum(a)-a)*t}else{let l=0;switch(s){case 0:return l=Math.abs(c)*E.signum(r),l+(r-l)*t;case 1:case 2:return l=Math.abs(a)*E.signum(r),l+(r-l)*t}}return a+(r-c)*t}},Oe=class extends oe{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Me=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,c,r.rotation,r.data.rotation))}},at=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:r.x=r.data.x+n*a,r.y=r.data.y+h*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+h-r.y)*a;break;case 3:r.x+=n*a,r.y+=h*a}}},nt=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,c,r.x,r.data.x))}},lt=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,c,r.y,r.data.y))}},ot=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,h,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}if(n*=r.data.scaleX,h*=r.data.scaleY,a==1)c==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=n,r.scaleY=h);else{let f=0,m=0;if(o==1)switch(c){case 0:f=r.data.scaleX,m=r.data.scaleY,r.scaleX=f+(Math.abs(n)*E.signum(f)-f)*a,r.scaleY=m+(Math.abs(h)*E.signum(m)-m)*a;break;case 1:case 2:f=r.scaleX,m=r.scaleY,r.scaleX=f+(Math.abs(n)*E.signum(f)-f)*a,r.scaleY=m+(Math.abs(h)*E.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}else switch(c){case 0:f=Math.abs(r.data.scaleX)*E.signum(n),m=Math.abs(r.data.scaleY)*E.signum(h),r.scaleX=f+(n-f)*a,r.scaleY=m+(h-m)*a;break;case 1:case 2:f=Math.abs(r.scaleX)*E.signum(n),m=Math.abs(r.scaleY)*E.signum(h),r.scaleX=f+(n-f)*a,r.scaleY=m+(h-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}}}},ht=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,c,o,r.scaleX,r.data.scaleX))}},ct=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,c,o,r.scaleY,r.data.scaleY))}},dt=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+h*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+h-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=h*a}}},ft=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,c,r.shearX,r.data.shearX))}},ut=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,c,r.shearY,r.data.shearY))}},mt=class extends J{boneIndex=0;constructor(e,t){super(e,[q.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;if(o==1){c==0&&(r.inherit=r.data.inherit);return}let l=this.frames;if(s<l[0]){(c==0||c==1)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[J.search(l,s,2)+1]}},gt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,a,c){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let p=r.data.color;switch(c){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let h=0,u=0,d=0,f=0,m=J.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let p=l[m];h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];let w=(s-p)/(l[m+5]-p);h+=(l[m+5+1]-h)*w,u+=(l[m+5+2]-u)*w,d+=(l[m+5+3]-d)*w,f+=(l[m+5+4]-f)*w;break;case 1:h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];break;default:h=this.getBezierValue(s,m,1,x-2),u=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),f=this.getBezierValue(s,m,4,x+18*3-2)}a==1?n.set(h,u,d,f):(c==0&&n.setFromColor(r.data.color),n.add((h-n.r)*a,(u-n.g)*a,(d-n.b)*a,(f-n.a)*a))}},xt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let x=r.data.color;switch(c){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*a,n.g+=(x.g-n.g)*a,n.b+=(x.b-n.b)*a}return}let h=0,u=0,d=0,f=J.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let x=l[f];h=l[f+1],u=l[f+2],d=l[f+3];let p=(s-x)/(l[f+4]-x);h+=(l[f+4+1]-h)*p,u+=(l[f+4+2]-u)*p,d+=(l[f+4+3]-d)*p;break;case 1:h=l[f+1],u=l[f+2],d=l[f+3];break;default:h=this.getBezierValue(s,f,1,m-2),u=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(a==1)n.r=h,n.g=u,n.b=d;else{if(c==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(h-n.r)*a,n.g+=(u-n.g)*a,n.b+=(d-n.b)*a}}},bt=class extends ae{slotIndex=0;constructor(e,t,s){super(e,t,q.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(s<this.frames[0]){let h=r.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*a}return}let n=this.getCurveValue(s);a==1?l.a=n:(c==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*a)}},wt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.alpha+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,a,c,o,r,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.setFromColor(v),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let u=0,d=0,f=0,m=0,x=0,p=0,w=0,g=J.search(l,s,8),b=this.curves[g>>3];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];let y=(s-v)/(l[g+8]-v);u+=(l[g+8+1]-u)*y,d+=(l[g+8+2]-d)*y,f+=(l[g+8+3]-f)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,p+=(l[g+8+6]-p)*y,w+=(l[g+8+7]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),m=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2),w=this.getBezierValue(s,g,7,b+18*6-2)}if(a==1)n.set(u,d,f,m),h.r=x,h.g=p,h.b=w;else{if(c==0){n.setFromColor(r.data.color);let v=r.data.darkColor;h.r=v.r,h.g=v.g,h.b=v.b}n.add((u-n.r)*a,(d-n.g)*a,(f-n.b)*a,(m-n.a)*a),h.r+=(x-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},pt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let u=0,d=0,f=0,m=0,x=0,p=0,w=0,g=J.search(l,s,7),b=this.curves[g/7];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];let y=(s-v)/(l[g+7]-v);u+=(l[g+7+1]-u)*y,d+=(l[g+7+2]-d)*y,f+=(l[g+7+3]-f)*y,x+=(l[g+7+4]-x)*y,p+=(l[g+7+5]-p)*y,w+=(l[g+7+6]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),p=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2)}if(a==1)n.r=u,n.g=d,n.b=f,h.r=x,h.g=p,h.b=w;else{if(c==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b}n.r+=(u-n.r)*a,n.g+=(d-n.g)*a,n.b+=(f-n.b)*a,h.r+=(x-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},we=class extends J{slotIndex=0;attachmentNames;constructor(e,t){super(e,[q.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(r.bone.active){if(o==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},yt=class extends oe{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[q.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,c,o,r,l,n,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(i-c*2+r)*.03,m=l*.03-o*.06,x=((c-r)*3-i+n)*.006,p=(o-l+.33333333)*.018,w=f*2+x,g=m*2+p,b=(c-i)*.3+f+x*.16666667,v=o*.3+m+p*.16666667,y=i+b,S=v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],l=s[i-1];return l+(e-r)/(s[i]-r)*(s[i+1]-l)}let c=s[a-2],o=s[a-1];return o+(1-o)*(e-c)/(this.frames[t+this.getFrameEntries()]-c)}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof le)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(c=0);let h=this.vertices,u=h[0].length,d=this.frames;if(s<d[0]){switch(c){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=u;let g=l;if(g.bones){a=1-a;for(var f=0;f<u;f++)n[f]*=a}else{let b=g.vertices;for(var f=0;f<u;f++)n[f]+=(b[f]-n[f])*a}}return}if(n.length=u,s>=d[d.length-1]){let g=h[d.length-1];if(a==1)if(c==3){let b=l;if(b.bones)for(let v=0;v<u;v++)n[v]+=g[v];else{let v=b.vertices;for(let y=0;y<u;y++)n[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,n,0,u);else switch(c){case 0:{let v=l;if(v.bones)for(let y=0;y<u;y++)n[y]=g[y]*a;else{let y=v.vertices;for(let S=0;S<u;S++){let A=y[S];n[S]=A+(g[S]-A)*a}}break}case 1:case 2:for(let v=0;v<u;v++)n[v]+=(g[v]-n[v])*a;break;case 3:let b=l;if(b.bones)for(let v=0;v<u;v++)n[v]+=g[v]*a;else{let v=b.vertices;for(let y=0;y<u;y++)n[y]+=(g[y]-v[y])*a}}return}let m=J.search1(d,s),x=this.getCurvePercent(s,m),p=h[m],w=h[m+1];if(a==1)if(c==3){let g=l;if(g.bones)for(let b=0;b<u;b++){let v=p[b];n[b]+=v+(w[b]-v)*x}else{let b=g.vertices;for(let v=0;v<u;v++){let y=p[v];n[v]+=y+(w[v]-y)*x-b[v]}}}else for(let g=0;g<u;g++){let b=p[g];n[g]=b+(w[g]-b)*x}else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<u;v++){let y=p[v];n[v]=(y+(w[v]-y)*x)*a}else{let v=b.vertices;for(let y=0;y<u;y++){let S=p[y],A=v[y];n[y]=A+(S+(w[y]-S)*x-A)*a}}break}case 1:case 2:for(let b=0;b<u;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x-n[b])*a}break;case 3:let g=l;if(g.bones)for(let b=0;b<u;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x)*a}else{let b=g.vertices;for(let v=0;v<u;v++){let y=p[v];n[v]+=(y+(w[v]-y)*x-b[v])*a}}}}},us=class extends J{events;constructor(e){super(e,us.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,c,o){if(!i)return;let r=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,c,o),t=-1;else if(t>=r[l-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let h=r[n];for(;n>0&&r[n-1]==h;)n--}for(;n<l&&s>=r[n];n++)i.push(this.events[n])}},Xe=us;B(Xe,"propertyIds",[""+q.event]);var ms=class extends J{drawOrders;constructor(e){super(e,ms.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,c,o){if(o==1){c==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(c==0||c==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),l=this.drawOrders[r];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,h=e.slots;for(let u=0,d=l.length;u<d;u++)n[u]=h[l[u]]}}},pe=ms;B(pe,"propertyIds",[""+q.drawOrder]);var vt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,c,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,a,c,o){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,h=0,u=J.search(l,s,6),d=this.curves[u/6];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+6]-f);n+=(l[u+6+1]-n)*m,h+=(l[u+6+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}c==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(h-r.data.softness)*a,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[u+3],r.compress=l[u+4]!=0,r.stretch=l[u+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(h-r.softness)*a,o==0&&(r.bendDirection=l[u+3],r.compress=l[u+4]!=0,r.stretch=l[u+5]!=0))}},St=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=a,l[e+4]=c,l[e+5]=o,l[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){let w=r.data;switch(c){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,h,u,d,f,m,x=J.search(l,s,7),p=this.curves[x/7];switch(p){case 0:let w=l[x];n=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];let g=(s-w)/(l[x+7]-w);n+=(l[x+7+1]-n)*g,h+=(l[x+7+2]-h)*g,u+=(l[x+7+3]-u)*g,d+=(l[x+7+4]-d)*g,f+=(l[x+7+5]-f)*g,m+=(l[x+7+6]-m)*g;break;case 1:n=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];break;default:n=this.getBezierValue(s,x,1,p-2),h=this.getBezierValue(s,x,2,p+18-2),u=this.getBezierValue(s,x,3,p+18*2-2),d=this.getBezierValue(s,x,4,p+18*3-2),f=this.getBezierValue(s,x,5,p+18*4-2),m=this.getBezierValue(s,x,6,p+18*5-2)}if(c==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(h-w.mixX)*a,r.mixY=w.mixY+(u-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(f-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(u-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(f-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},At=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,c,r.position,r.data.position))}},It=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,c,r.spacing,r.data.spacing))}},Ct=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let c=this.frames;e<<=2,c[e]=t,c[e+1]=s,c[e+2]=i,c[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,h,u,d=J.search(l,s,4),f=this.curves[d>>2];switch(f){case 0:let m=l[d];n=l[d+1],h=l[d+2],u=l[d+3];let x=(s-m)/(l[d+4]-m);n+=(l[d+4+1]-n)*x,h+=(l[d+4+2]-h)*x,u+=(l[d+4+3]-u)*x;break;case 1:n=l[d+1],h=l[d+2],u=l[d+3];break;default:n=this.getBezierValue(s,d,1,f-2),h=this.getBezierValue(s,d,2,f+18-2),u=this.getBezierValue(s,d,3,f+18*2-2)}if(c==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(h-m.mixX)*a,r.mixY=m.mixY+(u-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(u-r.mixY)*a}},ue=class extends ae{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,c,this.get(n),this.setup(n),l))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,c,this.get(r),this.setup(r)))}},kt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Yt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Tt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Mt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Xt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ft=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Et=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},gs=class extends J{constraintIndex;constructor(e,t){super(e,gs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,c,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},De=gs;B(De,"propertyIds",[q.physicsConstraintReset.toString()]);var me=class extends J{slotIndex;attachment;constructor(e,t,s){super(e,[q.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,i,a){let c=this.frames;e*=me.ENTRIES,c[e]=t,c[e+me.MODE]=s|i<<4,c[e+me.DELAY]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof le)||l.timelineAttachment!=n))return;if(o==1){c==0&&(r.sequenceIndex=-1);return}let h=this.frames;if(s<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let u=J.search(h,s,me.ENTRIES),d=h[u],f=h[u+me.MODE],m=h[u+me.DELAY];if(!this.attachment.sequence)return;let x=f>>4,p=this.attachment.sequence.regions.length,w=cs[f&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(p-1,x);break;case 2:x%=p;break;case 3:{let g=(p<<1)-2;x=g==0?0:x%g,x>=p&&(x=g-x);break}case 4:x=Math.max(p-1-x,0);break;case 5:x=p-1-x%p;break;case 6:{let g=(p<<1)-2;x=g==0?0:(x+p-1)%g,x>=p&&(x=g-x)}}r.sequenceIndex=x}},Ae=me;B(Ae,"ENTRIES",3),B(Ae,"MODE",1),B(Ae,"DELAY",2);var qe=class{static emptyAnimation(){return qe._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ws(this);propertyIDs=new st;animationsChanged=!1;trackEntryPool=new Te(()=>new bs);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let c=e*a.timeScale;if(a.delay>0){if(a.delay-=c,a.delay>0)continue;c=-a.delay,a.delay=0}let o=a.next;if(o){let r=a.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*o.timeScale,a.trackTime+=c,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=c}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let u=0,d=s.length;u<d;u++){let f=s[u];if(!f||f.delay>0)continue;i=!0;let m=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,m):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let p=x>=f.alphaAttachmentThreshold,w=f.animationLast,g=f.getAnimationTime(),b=g,v=t;f.reverse&&(b=f.animation.duration-b,v=null);let y=f.animation.timelines,S=y.length;if(u==0&&x==1||m==3){u==0&&(p=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(x,m);var a=y[A];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,x,m,0)}}else{let A=f.timelineMode,k=f.shortestRotation,T=!k&&f.timelinesRotation.length!=S<<1;T&&(f.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let F=y[Y],X=A[Y]==_e?m:0;!k&&F instanceof Me?this.applyRotateTimeline(F,e,b,x,X,f.timelinesRotation,Y<<1,T):F instanceof we?this.applyAttachmentTimeline(F,e,b,m,p):(R.webkit602BugfixHelper(x,m),F.apply(e,w,b,v,x,X,0))}}this.queueEvents(f,g),t.length=0,f.nextAnimationLast=g,f.nextTrackLast=f.trackTime}for(var c=this.unkeyedState+Bt,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==c){var h=n.data.attachmentName;n.setAttachment(h?e.getAttachment(n.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let c=a<i.mixAttachmentThreshold,o=a<i.mixDrawOrderThreshold,r=i.animation.timelines,l=r.length,n=i.alpha*e.interruptAlpha,h=n*(1-a),u=i.animationLast,d=i.getAnimationTime(),f=d,m=null;if(i.reverse?f=i.animation.duration-f:a<i.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)r[x].apply(t,u,f,m,h,s,1);else{let x=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,g=!w&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let b=0;b<l;b++){let v=r[b],y=1,S,A=0;switch(x[b]){case _e:if(!o&&v instanceof pe)continue;S=s,A=h;break;case Rt:S=0,A=h;break;case Pt:S=s,A=n;break;case We:S=0,A=n;break;default:S=0;let k=p[b];A=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=A,!w&&v instanceof Me?this.applyRotateTimeline(v,t,f,A,S,i.timelinesRotation,b<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,f,S,c&&A>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof pe&&S==0&&(y=0),v.apply(t,u,f,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var c=t.slots[e.slotIndex];c.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,c,c.data.attachmentName,a):this.setAttachment(t,c,e.attachmentNames[J.search1(e.frames,s)],a),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+Bt))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+ys)}applyRotateTimeline(e,t,s,i,a,c,o,r){if(r&&(c[o]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let n=e.frames,h=0,u=0;if(s<n[0])switch(a){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,u=l.data.rotation}else h=a==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(s);let d=0,f=u-h;if(f-=Math.ceil(f/360-.5)*360,f==0)d=c[o];else{let m=0,x=0;r?(m=0,x=f):(m=c[o],x=c[o+1]);let p=m-m%360;d=f+p;let w=f>=0,g=m>=0;Math.abs(x)<=90&&E.signum(x)!=E.signum(f)&&(Math.abs(m-p)>180?(d+=360*E.signum(m),g=w):p!=0?d-=360*E.signum(m):g=w),g!=w&&(d+=360*E.signum(m)),c[o]=d}c[o+1]=f,l.rotation=h+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,c=e.trackLast%a,o=this.events,r=0,l=o.length;for(;r<l;r++){let h=o[r];if(h.time<c)break;h.time>i||this.queue.event(e,h)}let n=!1;if(e.loop)if(a==0)n=!0;else{const h=Math.floor(e.trackTime/a);n=h>0&&h>Math.floor(e.trackLast/a)}else n=t>=i&&e.animationLast<i;for(n&&this.queue.complete(e);r<l;r++){let h=o[r];h.time<s||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let c=this.trackEntry(e,t,s,a);return this.setCurrent(e,c,i),this.queue.drain(),c}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let c=this.trackEntry(e,t,s,a);return a?(a.next=c,c.previous=a,i<=0&&(i+=a.getTrackComplete()-c.mixDuration)):(this.setCurrent(e,c,!0),this.queue.drain()),c.delay=i,c}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,qe.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,qe.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-t),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=o.addAll(s[r].getPropertyIds())?We:Pt;return}e:for(let r=0;r<i;r++){let l=s[r],n=l.getPropertyIds();if(!o.addAll(n))a[r]=_e;else if(!t||l instanceof we||l instanceof pe||l instanceof Xe||!t.animation.hasTimeline(n))a[r]=Rt;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=ps,c[r]=h;continue e}break}a[r]=We}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},xs=qe;B(xs,"_emptyAnimation",new Ne("<empty>",[],0));var bs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,this.previous!=null&&t<=0&&(t+=this.previous.getTrackComplete()-e),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ws=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(se.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(se.interrupt),this.objects.push(e)}end(e){this.objects.push(se.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(se.dispose),this.objects.push(e)}complete(e){this.objects.push(se.complete),this.objects.push(e)}event(e,t){this.objects.push(se.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case se.start:a.listener&&a.listener.start&&a.listener.start(a);for(let o=0;o<t.length;o++){let r=t[o];r.start&&r.start(a)}break;case se.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let o=0;o<t.length;o++){let r=t[o];r.interrupt&&r.interrupt(a)}break;case se.end:a.listener&&a.listener.end&&a.listener.end(a);for(let o=0;o<t.length;o++){let r=t[o];r.end&&r.end(a)}case se.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let o=0;o<t.length;o++){let r=t[o];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case se.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let o=0;o<t.length;o++){let r=t[o];r.complete&&r.complete(a)}break;case se.event:let c=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,c);for(let o=0;o<t.length;o++){let r=t[o];r.event&&r.event(a,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},se=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(se||{}),qs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},_e=0,Rt=1,Pt=2,We=3,ps=4,Bt=1,ys=2,_s=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Ue=class extends le{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ue(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},ze=class extends le{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new ze(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Vt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ge=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Ge||{}),vs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(vs||{}),Ss=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ws=class extends Vt{setFilters(e,t){}setWraps(e,t){}dispose(){}},As=class{pages=new Array;regions=new Array;constructor(e){let t=new Us(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(Ge,s[1]),n.magFilter=R.enumValue(Ge,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let h=s[1];h=="true"?n.degrees=90:h!="false"&&(n.degrees=parseInt(h))},a.index=n=>{n.index=parseInt(s[1])};let c=t.readLine();for(;c&&c.trim().length==0;)c=t.readLine();for(;!(!c||c.trim().length==0||t.readEntry(s,c)==0);)c=t.readLine();let o=null,r=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=t.readLine();else if(o){let n=new Lt(o,c);for(;;){let h=t.readEntry(s,c=t.readLine());if(h==0)break;let u=a[s[0]];if(u)u(n);else{r||(r=[]),l||(l=[]),r.push(s[0]);let d=[];for(let f=0;f<h;f++)d.push(parseInt(s[f+1]));l.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&l&&l.length>0&&(n.names=r,n.values=l,r=null,l=null),n.u=n.x/o.width,n.v=n.y/o.height,n.degrees==90?(n.u2=(n.x+n.height)/o.width,n.v2=(n.y+n.width)/o.height):(n.u2=(n.x+n.width)/o.width,n.v2=(n.y+n.height)/o.height),this.regions.push(n)}else{for(o=new Is(c.trim());t.readEntry(s,c=t.readLine())!=0;){let n=i[s[0]];n&&n(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Us=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let c=t.indexOf(",",a);if(c==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,c-a).trim(),a=c+1,i==4)return 4}}},Is=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Lt=class extends Ss{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,c=0,o=0;if(this.region instanceof Lt){let r=this.region,l=r.page,n=l.width,h=l.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=i+e[u+1]*c,t[u+1]=a+(1-e[u])*o;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/h,c=r.originalWidth/n,o=r.originalHeight/h;for(let u=0;u<s;u+=2)t[u]=i+(1-e[u])*c,t[u+1]=a+(1-e[u+1])*o;return;case 270:i-=r.offsetY/n,a-=r.offsetX/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=i+(1-e[u+1])*c,t[u+1]=a+e[u]*o;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/n,o=r.originalHeight/h}else this.region?(c=this.region.u2-i,o=this.region.v2-a):(i=a=0,c=o=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*c,t[r+1]=a+e[r+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,c)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ie=class extends le{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ie(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Nt=class extends le{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*E.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,c=s*e.c+i*e.d;return E.atan2Deg(c,a)}copy(){let e=new Nt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Cs=class extends rt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,c=-this.height/2*this.scaleY+this.region.offsetY*i,o=a+this.region.width*s,r=c+this.region.height*i,l=this.rotation*E.degRad,n=Math.cos(l),h=Math.sin(l),u=this.x,d=this.y,f=a*n+u,m=a*h,x=c*n+d,p=c*h,w=o*n+u,g=o*h,b=r*n+d,v=r*h,y=this.offset;y[0]=f-p,y[1]=x+m,y[2]=f-v,y[3]=b+m,y[4]=w-v,y[5]=b+g,y[6]=w-p,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,c=this.offset,o=a.worldX,r=a.worldY,l=a.a,n=a.b,h=a.c,u=a.d,d=0,f=0;d=c[0],f=c[1],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[2],f=c[3],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[4],f=c[5],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[6],f=c[7],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r}copy(){let e=new Cs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},V=Cs;B(V,"X1",0),B(V,"Y1",1),B(V,"C1R",2),B(V,"C1G",3),B(V,"C1B",4),B(V,"C1A",5),B(V,"U1",6),B(V,"V1",7),B(V,"X2",8),B(V,"Y2",9),B(V,"C2R",10),B(V,"C2G",11),B(V,"C2B",12),B(V,"C2A",13),B(V,"U2",14),B(V,"V2",15),B(V,"X3",16),B(V,"Y3",17),B(V,"C3R",18),B(V,"C3G",19),B(V,"C3B",20),B(V,"C3A",21),B(V,"U3",22),B(V,"V3",23),B(V,"X4",24),B(V,"Y4",25),B(V,"C4R",26),B(V,"C4G",27),B(V,"C4B",28),B(V,"C4A",29),B(V,"U4",30),B(V,"V4",31);var zs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,c=i.length;a<c;a++){let o=s.getPath(t,a),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new V(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=c}return a}newMeshAttachment(e,t,s,i){let a=new ye(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=c}return a}newBoundingBoxAttachment(e,t){return new Ue(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new Nt(t)}newClippingAttachment(e,t){return new ze(t)}},Ot=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Fe.Normal;skinRequired=!1;color=new D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Fe=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Fe||{}),Dt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,c,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=c,this.ashearY=o;let r=this.parent;if(!r){let d=this.skeleton;const f=d.scaleX,m=d.scaleY,x=(s+c)*E.degRad,p=(s+90+o)*E.degRad;this.a=Math.cos(x)*i*f,this.b=Math.cos(p)*a*f,this.c=Math.sin(x)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*f+d.x,this.worldY=t*m+d.y;return}let l=r.a,n=r.b,h=r.c,u=r.d;switch(this.worldX=l*e+n*t+r.worldX,this.worldY=h*e+u*t+r.worldY,this.inherit){case 0:{const d=(s+c)*E.degRad,f=(s+90+o)*E.degRad,m=Math.cos(d)*i,x=Math.cos(f)*a,p=Math.sin(d)*i,w=Math.sin(f)*a;this.a=l*m+n*p,this.b=l*x+n*w,this.c=h*m+u*p,this.d=h*x+u*w;return}case 1:{const d=(s+c)*E.degRad,f=(s+90+o)*E.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(f)*a,this.c=Math.sin(d)*i,this.d=Math.sin(f)*a;break}case 2:{let d=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;l*=d,h*=f;let m=l*l+h*h,x=0;m>1e-4?(m=Math.abs(l*u*f-n*d*h)/m,n=h*m,u=l*m,x=Math.atan2(h,l)*E.radDeg):(l=0,h=0,x=90-Math.atan2(u,n)*E.radDeg);const p=(s+c-x)*E.degRad,w=(s+o-x+90)*E.degRad,g=Math.cos(p)*i,b=Math.cos(w)*a,v=Math.sin(p)*i,y=Math.sin(w)*a;this.a=l*g-n*v,this.b=l*b-n*y,this.c=h*g+u*v,this.d=h*b+u*y;break}case 3:case 4:{s*=E.degRad;const d=Math.cos(s),f=Math.sin(s);let m=(l*d+n*f)/this.skeleton.scaleX,x=(h*d+u*f)/this.skeleton.scaleY,p=Math.sqrt(m*m+x*x);p>1e-5&&(p=1/p),m*=p,x*=p,p=Math.sqrt(m*m+x*x),this.inherit==3&&l*u-n*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*p,g=Math.sin(s)*p;c*=E.degRad,o=(90+o)*E.degRad;const b=Math.cos(c)*i,v=Math.cos(o)*a,y=Math.sin(c)*i,S=Math.sin(o)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=x*b+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let t=e.a,s=e.b,i=e.c,a=e.d,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c,h=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=h*o-u*r,this.ay=u*n-h*l;let d,f,m,x;if(this.inherit==1)d=this.a,f=this.b,m=this.c,x=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,a=t*this.skeleton.scaleY*v/this.skeleton.scaleX,c=1/(t*a-s*i),o=a*c,r=s*c;break}case 3:case 4:let p=E.cosDeg(this.rotation),w=E.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.inherit==3&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=E.PI/2+Math.atan2(i,t);s=Math.cos(b)*g,a=Math.sin(b)*g,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c}d=o*this.a-r*this.c,f=o*this.b-r*this.d,m=n*this.c-l*this.a,x=n*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*x-f*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*f+m*x,p)*E.radDeg,this.arotation=Math.atan2(m,d)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,f)*E.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*E.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*E.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*E.radDeg}rotateWorld(e){e*=E.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Ee=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ks=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new qt){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(t,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(t,e,this.textureLoader(c))},c.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),c=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new As(o),l=r.pages.length,n=!1;for(let h of r.pages)this.loadTexture(i?i[h.name]:c+h.name,(u,d)=>{n||(h.setTexture(d),--l==0&&this.success(t,e,r))},(u,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${u}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
1
|
+
"use strict";var Ps=Object.defineProperty,Bs=(e,t,s)=>t in e?Ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,B=(e,t,s)=>(Bs(e,typeof t!="symbol"?t+"":t,s),s),Vs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},st=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new be().setFromString(e)}},D=be;B(D,"WHITE",new be(1,1,1,1)),B(D,"RED",new be(1,0,0,1)),B(D,"GREEN",new be(0,1,0,1)),B(D,"BLUE",new be(0,0,1,1)),B(D,"MAGENTA",new be(1,0,1,1));var ne=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ne.degRad)}static sinDeg(e){return Math.sin(e*ne.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ne.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ne.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},E=ne;B(E,"PI",3.1415927),B(E,"PI2",ne.PI*2),B(E,"invPI2",1/ne.PI2),B(E,"radiansToDegrees",180/ne.PI),B(E,"radDeg",ne.radiansToDegrees),B(E,"degreesToRadians",ne.PI/180),B(E,"degRad",ne.degreesToRadians);var ns=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ls=class extends ns{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Ls=class extends ls{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Se=class{static arrayCopy(e,t,s,i,a){for(let c=t,o=i;c<t+a;c++,o++)s[o]=e[c]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:Se.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(Se.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return Se.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Se.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=Se;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ns=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Te=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Ve=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},Os=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ds=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},rt=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},os=class extends rt{id=os.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,c){s=a+(s>>1)*c;let o=e.bone.skeleton,r=e.deform,l=this.vertices,n=this.bones;if(!n){r.length>0&&(l=r);let f=e.bone,m=f.worldX,x=f.worldY,p=f.a,w=f.b,g=f.c,b=f.d;for(let v=t,y=a;y<s;v+=2,y+=c){let S=l[v],A=l[v+1];i[y]=S*p+A*w+m,i[y+1]=S*g+A*b+x}return}let h=0,u=0;for(let f=0;f<t;f+=2){let m=n[h];h+=m+1,u+=m}let d=o.bones;if(r.length==0)for(let f=a,m=u*3;f<s;f+=c){let x=0,p=0,w=n[h++];for(w+=h;h<w;h++,m+=3){let g=d[n[h]],b=l[m],v=l[m+1],y=l[m+2];x+=(b*g.a+v*g.b+g.worldX)*y,p+=(b*g.c+v*g.d+g.worldY)*y}i[f]=x,i[f+1]=p}else{let f=r;for(let m=a,x=u*3,p=u<<1;m<s;m+=c){let w=0,g=0,b=n[h++];for(b+=h;h<b;h++,x+=3,p+=2){let v=d[n[h]],y=l[x]+f[p],S=l[x+1]+f[p+1],A=l[x+2];w+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}i[m]=w,i[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},le=os;B(le,"nextID",0);var Le=class{id=Le.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Le(this.regions.length);return R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Le._nextID++}},it=Le;B(it,"_nextID",0);var hs=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(hs||{}),cs=[0,1,2,3,4,5,6],Ne=class{name;timelines=[];timelineIds=new st;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,a,c,o,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(e,t,s,a,c,o,r)}},ds=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(ds||{}),fs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(fs||{}),q={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},oe=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,c,o,r,l,n,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(i-c*2+r)*.03,m=(a-o*2+l)*.03,x=((c-r)*3-i+n)*.006,p=((o-l)*3-a+h)*.006,w=f*2+x,g=m*2+p,b=(c-i)*.3+f+x*.16666667,v=(o-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let l=this.frames[t],n=this.frames[t+s];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}let c=i+18;for(i+=2;i<c;i+=2)if(a[i]>=e){let l=a[i-2],n=a[i-1];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}t+=this.getFrameEntries();let o=a[c-2],r=a[c-1];return r+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-r)}},ae=class extends oe{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],c=t[s+1];return c+(e-a)/(t[s+2]-a)*(t[s+2+1]-c);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);switch(s){case 0:return a+c*t;case 1:case 2:c+=a-i}return i+c*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);return s==0?a+(c-a)*t:i+(c-i)*t}getAbsoluteValue2(e,t,s,i,a,c){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(c-a)*t:i+(c-i)*t}getScaleValue(e,t,s,i,a,c){const o=this.frames;if(e<o[0]){switch(s){case 0:return c;case 1:return a+(c-a)*t}return a}let r=this.getCurveValue(e)*c;if(t==1)return s==3?a+r-c:r;if(i==1)switch(s){case 0:return c+(Math.abs(r)*E.signum(c)-c)*t;case 1:case 2:return a+(Math.abs(r)*E.signum(a)-a)*t}else{let l=0;switch(s){case 0:return l=Math.abs(c)*E.signum(r),l+(r-l)*t;case 1:case 2:return l=Math.abs(a)*E.signum(r),l+(r-l)*t}}return a+(r-c)*t}},Oe=class extends oe{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Me=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,c,r.rotation,r.data.rotation))}},at=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:r.x=r.data.x+n*a,r.y=r.data.y+h*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+h-r.y)*a;break;case 3:r.x+=n*a,r.y+=h*a}}},nt=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,c,r.x,r.data.x))}},lt=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,c,r.y,r.data.y))}},ot=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,h,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}if(n*=r.data.scaleX,h*=r.data.scaleY,a==1)c==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=n,r.scaleY=h);else{let f=0,m=0;if(o==1)switch(c){case 0:f=r.data.scaleX,m=r.data.scaleY,r.scaleX=f+(Math.abs(n)*E.signum(f)-f)*a,r.scaleY=m+(Math.abs(h)*E.signum(m)-m)*a;break;case 1:case 2:f=r.scaleX,m=r.scaleY,r.scaleX=f+(Math.abs(n)*E.signum(f)-f)*a,r.scaleY=m+(Math.abs(h)*E.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}else switch(c){case 0:f=Math.abs(r.data.scaleX)*E.signum(n),m=Math.abs(r.data.scaleY)*E.signum(h),r.scaleX=f+(n-f)*a,r.scaleY=m+(h-m)*a;break;case 1:case 2:f=Math.abs(r.scaleX)*E.signum(n),m=Math.abs(r.scaleY)*E.signum(h),r.scaleX=f+(n-f)*a,r.scaleY=m+(h-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}}}},ht=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,c,o,r.scaleX,r.data.scaleX))}},ct=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,c,o,r.scaleY,r.data.scaleY))}},dt=class extends Oe{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);n+=(l[u+3+1]-n)*m,h+=(l[u+3+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+h*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+h-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=h*a}}},ft=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,c,r.shearX,r.data.shearX))}},ut=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,c,r.shearY,r.data.shearY))}},mt=class extends J{boneIndex=0;constructor(e,t){super(e,[q.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;if(o==1){c==0&&(r.inherit=r.data.inherit);return}let l=this.frames;if(s<l[0]){(c==0||c==1)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[J.search(l,s,2)+1]}},gt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,a,c){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let p=r.data.color;switch(c){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let h=0,u=0,d=0,f=0,m=J.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let p=l[m];h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];let w=(s-p)/(l[m+5]-p);h+=(l[m+5+1]-h)*w,u+=(l[m+5+2]-u)*w,d+=(l[m+5+3]-d)*w,f+=(l[m+5+4]-f)*w;break;case 1:h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];break;default:h=this.getBezierValue(s,m,1,x-2),u=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),f=this.getBezierValue(s,m,4,x+18*3-2)}a==1?n.set(h,u,d,f):(c==0&&n.setFromColor(r.data.color),n.add((h-n.r)*a,(u-n.g)*a,(d-n.b)*a,(f-n.a)*a))}},xt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let x=r.data.color;switch(c){case 0:n.r=x.r,n.g=x.g,n.b=x.b;return;case 1:n.r+=(x.r-n.r)*a,n.g+=(x.g-n.g)*a,n.b+=(x.b-n.b)*a}return}let h=0,u=0,d=0,f=J.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let x=l[f];h=l[f+1],u=l[f+2],d=l[f+3];let p=(s-x)/(l[f+4]-x);h+=(l[f+4+1]-h)*p,u+=(l[f+4+2]-u)*p,d+=(l[f+4+3]-d)*p;break;case 1:h=l[f+1],u=l[f+2],d=l[f+3];break;default:h=this.getBezierValue(s,f,1,m-2),u=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(a==1)n.r=h,n.g=u,n.b=d;else{if(c==0){let x=r.data.color;n.r=x.r,n.g=x.g,n.b=x.b}n.r+=(h-n.r)*a,n.g+=(u-n.g)*a,n.b+=(d-n.b)*a}}},bt=class extends ae{slotIndex=0;constructor(e,t,s){super(e,t,q.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(s<this.frames[0]){let h=r.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*a}return}let n=this.getCurveValue(s);a==1?l.a=n:(c==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*a)}},wt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.alpha+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,a,c,o,r,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.setFromColor(v),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let u=0,d=0,f=0,m=0,x=0,p=0,w=0,g=J.search(l,s,8),b=this.curves[g>>3];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];let y=(s-v)/(l[g+8]-v);u+=(l[g+8+1]-u)*y,d+=(l[g+8+2]-d)*y,f+=(l[g+8+3]-f)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,p+=(l[g+8+6]-p)*y,w+=(l[g+8+7]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],p=l[g+6],w=l[g+7];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),m=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2),w=this.getBezierValue(s,g,7,b+18*6-2)}if(a==1)n.set(u,d,f,m),h.r=x,h.g=p,h.b=w;else{if(c==0){n.setFromColor(r.data.color);let v=r.data.darkColor;h.r=v.r,h.g=v.g,h.b=v.b}n.add((u-n.r)*a,(d-n.g)*a,(f-n.b)*a,(m-n.a)*a),h.r+=(x-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},pt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s,q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let u=0,d=0,f=0,m=0,x=0,p=0,w=0,g=J.search(l,s,7),b=this.curves[g/7];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];let y=(s-v)/(l[g+7]-v);u+=(l[g+7+1]-u)*y,d+=(l[g+7+2]-d)*y,f+=(l[g+7+3]-f)*y,x+=(l[g+7+4]-x)*y,p+=(l[g+7+5]-p)*y,w+=(l[g+7+6]-w)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],p=l[g+5],w=l[g+6];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),p=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2)}if(a==1)n.r=u,n.g=d,n.b=f,h.r=x,h.g=p,h.b=w;else{if(c==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b}n.r+=(u-n.r)*a,n.g+=(d-n.g)*a,n.b+=(f-n.b)*a,h.r+=(x-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},we=class extends J{slotIndex=0;attachmentNames;constructor(e,t){super(e,[q.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(r.bone.active){if(o==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},yt=class extends oe{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[q.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,c,o,r,l,n,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(i-c*2+r)*.03,m=l*.03-o*.06,x=((c-r)*3-i+n)*.006,p=(o-l+.33333333)*.018,w=f*2+x,g=m*2+p,b=(c-i)*.3+f+x*.16666667,v=o*.3+m+p*.16666667,y=i+b,S=v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=w,v+=g,w+=x,g+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],l=s[i-1];return l+(e-r)/(s[i]-r)*(s[i+1]-l)}let c=s[a-2],o=s[a-1];return o+(1-o)*(e-c)/(this.frames[t+this.getFrameEntries()]-c)}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof le)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(c=0);let h=this.vertices,u=h[0].length,d=this.frames;if(s<d[0]){switch(c){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=u;let g=l;if(g.bones){a=1-a;for(var f=0;f<u;f++)n[f]*=a}else{let b=g.vertices;for(var f=0;f<u;f++)n[f]+=(b[f]-n[f])*a}}return}if(n.length=u,s>=d[d.length-1]){let g=h[d.length-1];if(a==1)if(c==3){let b=l;if(b.bones)for(let v=0;v<u;v++)n[v]+=g[v];else{let v=b.vertices;for(let y=0;y<u;y++)n[y]+=g[y]-v[y]}}else R.arrayCopy(g,0,n,0,u);else switch(c){case 0:{let v=l;if(v.bones)for(let y=0;y<u;y++)n[y]=g[y]*a;else{let y=v.vertices;for(let S=0;S<u;S++){let A=y[S];n[S]=A+(g[S]-A)*a}}break}case 1:case 2:for(let v=0;v<u;v++)n[v]+=(g[v]-n[v])*a;break;case 3:let b=l;if(b.bones)for(let v=0;v<u;v++)n[v]+=g[v]*a;else{let v=b.vertices;for(let y=0;y<u;y++)n[y]+=(g[y]-v[y])*a}}return}let m=J.search1(d,s),x=this.getCurvePercent(s,m),p=h[m],w=h[m+1];if(a==1)if(c==3){let g=l;if(g.bones)for(let b=0;b<u;b++){let v=p[b];n[b]+=v+(w[b]-v)*x}else{let b=g.vertices;for(let v=0;v<u;v++){let y=p[v];n[v]+=y+(w[v]-y)*x-b[v]}}}else for(let g=0;g<u;g++){let b=p[g];n[g]=b+(w[g]-b)*x}else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<u;v++){let y=p[v];n[v]=(y+(w[v]-y)*x)*a}else{let v=b.vertices;for(let y=0;y<u;y++){let S=p[y],A=v[y];n[y]=A+(S+(w[y]-S)*x-A)*a}}break}case 1:case 2:for(let b=0;b<u;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x-n[b])*a}break;case 3:let g=l;if(g.bones)for(let b=0;b<u;b++){let v=p[b];n[b]+=(v+(w[b]-v)*x)*a}else{let b=g.vertices;for(let v=0;v<u;v++){let y=p[v];n[v]+=(y+(w[v]-y)*x-b[v])*a}}}}},us=class extends J{events;constructor(e){super(e,us.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,c,o){if(!i)return;let r=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,c,o),t=-1;else if(t>=r[l-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let h=r[n];for(;n>0&&r[n-1]==h;)n--}for(;n<l&&s>=r[n];n++)i.push(this.events[n])}},Xe=us;B(Xe,"propertyIds",[""+q.event]);var ms=class extends J{drawOrders;constructor(e){super(e,ms.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,c,o){if(o==1){c==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(c==0||c==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),l=this.drawOrders[r];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,h=e.slots;for(let u=0,d=l.length;u<d;u++)n[u]=h[l[u]]}}},pe=ms;B(pe,"propertyIds",[""+q.drawOrder]);var vt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,c,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,a,c,o){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,h=0,u=J.search(l,s,6),d=this.curves[u/6];switch(d){case 0:let f=l[u];n=l[u+1],h=l[u+2];let m=(s-f)/(l[u+6]-f);n+=(l[u+6+1]-n)*m,h+=(l[u+6+2]-h)*m;break;case 1:n=l[u+1],h=l[u+2];break;default:n=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}c==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(h-r.data.softness)*a,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[u+3],r.compress=l[u+4]!=0,r.stretch=l[u+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(h-r.softness)*a,o==0&&(r.bendDirection=l[u+3],r.compress=l[u+4]!=0,r.stretch=l[u+5]!=0))}},St=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=a,l[e+4]=c,l[e+5]=o,l[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){let w=r.data;switch(c){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,h,u,d,f,m,x=J.search(l,s,7),p=this.curves[x/7];switch(p){case 0:let w=l[x];n=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];let g=(s-w)/(l[x+7]-w);n+=(l[x+7+1]-n)*g,h+=(l[x+7+2]-h)*g,u+=(l[x+7+3]-u)*g,d+=(l[x+7+4]-d)*g,f+=(l[x+7+5]-f)*g,m+=(l[x+7+6]-m)*g;break;case 1:n=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];break;default:n=this.getBezierValue(s,x,1,p-2),h=this.getBezierValue(s,x,2,p+18-2),u=this.getBezierValue(s,x,3,p+18*2-2),d=this.getBezierValue(s,x,4,p+18*3-2),f=this.getBezierValue(s,x,5,p+18*4-2),m=this.getBezierValue(s,x,6,p+18*5-2)}if(c==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(h-w.mixX)*a,r.mixY=w.mixY+(u-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(f-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(u-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(f-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},At=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,c,r.position,r.data.position))}},It=class extends ae{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,c,r.spacing,r.data.spacing))}},Ct=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let c=this.frames;e<<=2,c[e]=t,c[e+1]=s,c[e+2]=i,c[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,h,u,d=J.search(l,s,4),f=this.curves[d>>2];switch(f){case 0:let m=l[d];n=l[d+1],h=l[d+2],u=l[d+3];let x=(s-m)/(l[d+4]-m);n+=(l[d+4+1]-n)*x,h+=(l[d+4+2]-h)*x,u+=(l[d+4+3]-u)*x;break;case 1:n=l[d+1],h=l[d+2],u=l[d+3];break;default:n=this.getBezierValue(s,d,1,f-2),h=this.getBezierValue(s,d,2,f+18-2),u=this.getBezierValue(s,d,3,f+18*2-2)}if(c==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(h-m.mixX)*a,r.mixY=m.mixY+(u-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(u-r.mixY)*a}},ue=class extends ae{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,c,this.get(n),this.setup(n),l))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,c,this.get(r),this.setup(r)))}},kt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Yt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Tt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Mt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Xt=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ft=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Et=class extends ue{constructor(e,t,s){super(e,t,s,q.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},gs=class extends J{constraintIndex;constructor(e,t){super(e,gs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,c,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},De=gs;B(De,"propertyIds",[q.physicsConstraintReset.toString()]);var me=class extends J{slotIndex;attachment;constructor(e,t,s){super(e,[q.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,i,a){let c=this.frames;e*=me.ENTRIES,c[e]=t,c[e+me.MODE]=s|i<<4,c[e+me.DELAY]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof le)||l.timelineAttachment!=n))return;if(o==1){c==0&&(r.sequenceIndex=-1);return}let h=this.frames;if(s<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let u=J.search(h,s,me.ENTRIES),d=h[u],f=h[u+me.MODE],m=h[u+me.DELAY];if(!this.attachment.sequence)return;let x=f>>4,p=this.attachment.sequence.regions.length,w=cs[f&15];if(w!=0)switch(x+=(s-d)/m+1e-5|0,w){case 1:x=Math.min(p-1,x);break;case 2:x%=p;break;case 3:{let g=(p<<1)-2;x=g==0?0:x%g,x>=p&&(x=g-x);break}case 4:x=Math.max(p-1-x,0);break;case 5:x=p-1-x%p;break;case 6:{let g=(p<<1)-2;x=g==0?0:(x+p-1)%g,x>=p&&(x=g-x)}}r.sequenceIndex=x}},Ae=me;B(Ae,"ENTRIES",3),B(Ae,"MODE",1),B(Ae,"DELAY",2);var qe=class{static emptyAnimation(){return qe._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ws(this);propertyIDs=new st;animationsChanged=!1;trackEntryPool=new Te(()=>new bs);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let c=e*a.timeScale;if(a.delay>0){if(a.delay-=c,a.delay>0)continue;c=-a.delay,a.delay=0}let o=a.next;if(o){let r=a.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*o.timeScale,a.trackTime+=c,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=c}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let u=0,d=s.length;u<d;u++){let f=s[u];if(!f||f.delay>0)continue;i=!0;let m=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,m):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let p=x>=f.alphaAttachmentThreshold,w=f.animationLast,g=f.getAnimationTime(),b=g,v=t;f.reverse&&(b=f.animation.duration-b,v=null);let y=f.animation.timelines,S=y.length;if(u==0&&x==1||m==3){u==0&&(p=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(x,m);var a=y[A];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,x,m,0)}}else{let A=f.timelineMode,k=f.shortestRotation,T=!k&&f.timelinesRotation.length!=S<<1;T&&(f.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let F=y[Y],X=A[Y]==_e?m:0;!k&&F instanceof Me?this.applyRotateTimeline(F,e,b,x,X,f.timelinesRotation,Y<<1,T):F instanceof we?this.applyAttachmentTimeline(F,e,b,m,p):(R.webkit602BugfixHelper(x,m),F.apply(e,w,b,v,x,X,0))}}this.queueEvents(f,g),t.length=0,f.nextAnimationLast=g,f.nextTrackLast=f.trackTime}for(var c=this.unkeyedState+Bt,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==c){var h=n.data.attachmentName;n.setAttachment(h?e.getAttachment(n.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let c=a<i.mixAttachmentThreshold,o=a<i.mixDrawOrderThreshold,r=i.animation.timelines,l=r.length,n=i.alpha*e.interruptAlpha,h=n*(1-a),u=i.animationLast,d=i.getAnimationTime(),f=d,m=null;if(i.reverse?f=i.animation.duration-f:a<i.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)r[x].apply(t,u,f,m,h,s,1);else{let x=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,g=!w&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let b=0;b<l;b++){let v=r[b],y=1,S,A=0;switch(x[b]){case _e:if(!o&&v instanceof pe)continue;S=s,A=h;break;case Rt:S=0,A=h;break;case Pt:S=s,A=n;break;case We:S=0,A=n;break;default:S=0;let k=p[b];A=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=A,!w&&v instanceof Me?this.applyRotateTimeline(v,t,f,A,S,i.timelinesRotation,b<<1,g):v instanceof we?this.applyAttachmentTimeline(v,t,f,S,c&&A>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof pe&&S==0&&(y=0),v.apply(t,u,f,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var c=t.slots[e.slotIndex];c.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,c,c.data.attachmentName,a):this.setAttachment(t,c,e.attachmentNames[J.search1(e.frames,s)],a),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+Bt))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+ys)}applyRotateTimeline(e,t,s,i,a,c,o,r){if(r&&(c[o]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let n=e.frames,h=0,u=0;if(s<n[0])switch(a){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,u=l.data.rotation}else h=a==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(s);let d=0,f=u-h;if(f-=Math.ceil(f/360-.5)*360,f==0)d=c[o];else{let m=0,x=0;r?(m=0,x=f):(m=c[o],x=c[o+1]);let p=m-m%360;d=f+p;let w=f>=0,g=m>=0;Math.abs(x)<=90&&E.signum(x)!=E.signum(f)&&(Math.abs(m-p)>180?(d+=360*E.signum(m),g=w):p!=0?d-=360*E.signum(m):g=w),g!=w&&(d+=360*E.signum(m)),c[o]=d}c[o+1]=f,l.rotation=h+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,c=e.trackLast%a,o=this.events,r=0,l=o.length;for(;r<l;r++){let h=o[r];if(h.time<c)break;h.time>i||this.queue.event(e,h)}let n=!1;if(e.loop)if(a==0)n=!0;else{const h=Math.floor(e.trackTime/a);n=h>0&&h>Math.floor(e.trackLast/a)}else n=t>=i&&e.animationLast<i;for(n&&this.queue.complete(e);r<l;r++){let h=o[r];h.time<s||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let c=this.trackEntry(e,t,s,a);return this.setCurrent(e,c,i),this.queue.drain(),c}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let c=this.trackEntry(e,t,s,a);return a?(a.next=c,c.previous=a,i<=0&&(i=Math.max(i+a.getTrackComplete()-c.mixDuration,0))):(this.setCurrent(e,c,!0),this.queue.drain(),i<0&&(i=0)),c.delay=i,c}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,qe.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,qe.emptyAnimation(),!1,s);return s<=0&&(i.delay=Math.max(i.delay+i.mixDuration-t,0)),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=o.addAll(s[r].getPropertyIds())?We:Pt;return}e:for(let r=0;r<i;r++){let l=s[r],n=l.getPropertyIds();if(!o.addAll(n))a[r]=_e;else if(!t||l instanceof we||l instanceof pe||l instanceof Xe||!t.animation.hasTimeline(n))a[r]=Rt;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=ps,c[r]=h;continue e}break}a[r]=We}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},xs=qe;B(xs,"_emptyAnimation",new Ne("<empty>",[],0));var bs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ws=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(se.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(se.interrupt),this.objects.push(e)}end(e){this.objects.push(se.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(se.dispose),this.objects.push(e)}complete(e){this.objects.push(se.complete),this.objects.push(e)}event(e,t){this.objects.push(se.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case se.start:a.listener&&a.listener.start&&a.listener.start(a);for(let o=0;o<t.length;o++){let r=t[o];r.start&&r.start(a)}break;case se.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let o=0;o<t.length;o++){let r=t[o];r.interrupt&&r.interrupt(a)}break;case se.end:a.listener&&a.listener.end&&a.listener.end(a);for(let o=0;o<t.length;o++){let r=t[o];r.end&&r.end(a)}case se.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let o=0;o<t.length;o++){let r=t[o];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case se.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let o=0;o<t.length;o++){let r=t[o];r.complete&&r.complete(a)}break;case se.event:let c=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,c);for(let o=0;o<t.length;o++){let r=t[o];r.event&&r.event(a,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},se=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(se||{}),qs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},_e=0,Rt=1,Pt=2,We=3,ps=4,Bt=1,ys=2,_s=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Ue=class extends le{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ue(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},ze=class extends le{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new ze(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Vt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ge=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Ge||{}),vs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(vs||{}),Ss=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ws=class extends Vt{setFilters(e,t){}setWraps(e,t){}dispose(){}},As=class{pages=new Array;regions=new Array;constructor(e){let t=new Us(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(Ge,s[1]),n.magFilter=R.enumValue(Ge,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let h=s[1];h=="true"?n.degrees=90:h!="false"&&(n.degrees=parseInt(h))},a.index=n=>{n.index=parseInt(s[1])};let c=t.readLine();for(;c&&c.trim().length==0;)c=t.readLine();for(;!(!c||c.trim().length==0||t.readEntry(s,c)==0);)c=t.readLine();let o=null,r=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=t.readLine();else if(o){let n=new Lt(o,c);for(;;){let h=t.readEntry(s,c=t.readLine());if(h==0)break;let u=a[s[0]];if(u)u(n);else{r||(r=[]),l||(l=[]),r.push(s[0]);let d=[];for(let f=0;f<h;f++)d.push(parseInt(s[f+1]));l.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&l&&l.length>0&&(n.names=r,n.values=l,r=null,l=null),n.u=n.x/o.width,n.v=n.y/o.height,n.degrees==90?(n.u2=(n.x+n.height)/o.width,n.v2=(n.y+n.width)/o.height):(n.u2=(n.x+n.width)/o.width,n.v2=(n.y+n.height)/o.height),this.regions.push(n)}else{for(o=new Is(c.trim());t.readEntry(s,c=t.readLine())!=0;){let n=i[s[0]];n&&n(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Us=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let c=t.indexOf(",",a);if(c==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,c-a).trim(),a=c+1,i==4)return 4}}},Is=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Lt=class extends Ss{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,c=0,o=0;if(this.region instanceof Lt){let r=this.region,l=r.page,n=l.width,h=l.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=i+e[u+1]*c,t[u+1]=a+(1-e[u])*o;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/h,c=r.originalWidth/n,o=r.originalHeight/h;for(let u=0;u<s;u+=2)t[u]=i+(1-e[u])*c,t[u+1]=a+(1-e[u+1])*o;return;case 270:i-=r.offsetY/n,a-=r.offsetX/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=i+(1-e[u+1])*c,t[u+1]=a+e[u]*o;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/n,o=r.originalHeight/h}else this.region?(c=this.region.u2-i,o=this.region.v2-a):(i=a=0,c=o=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*c,t[r+1]=a+e[r+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,c)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ie=class extends le{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ie(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Nt=class extends le{x=0;y=0;rotation=0;color=new D(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*E.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,c=s*e.c+i*e.d;return E.atan2Deg(c,a)}copy(){let e=new Nt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Cs=class extends rt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new D(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,c=-this.height/2*this.scaleY+this.region.offsetY*i,o=a+this.region.width*s,r=c+this.region.height*i,l=this.rotation*E.degRad,n=Math.cos(l),h=Math.sin(l),u=this.x,d=this.y,f=a*n+u,m=a*h,x=c*n+d,p=c*h,w=o*n+u,g=o*h,b=r*n+d,v=r*h,y=this.offset;y[0]=f-p,y[1]=x+m,y[2]=f-v,y[3]=b+m,y[4]=w-v,y[5]=b+g,y[6]=w-p,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,c=this.offset,o=a.worldX,r=a.worldY,l=a.a,n=a.b,h=a.c,u=a.d,d=0,f=0;d=c[0],f=c[1],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[2],f=c[3],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[4],f=c[5],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r,s+=i,d=c[6],f=c[7],t[s]=d*l+f*n+o,t[s+1]=d*h+f*u+r}copy(){let e=new Cs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},V=Cs;B(V,"X1",0),B(V,"Y1",1),B(V,"C1R",2),B(V,"C1G",3),B(V,"C1B",4),B(V,"C1A",5),B(V,"U1",6),B(V,"V1",7),B(V,"X2",8),B(V,"Y2",9),B(V,"C2R",10),B(V,"C2G",11),B(V,"C2B",12),B(V,"C2A",13),B(V,"U2",14),B(V,"V2",15),B(V,"X3",16),B(V,"Y3",17),B(V,"C3R",18),B(V,"C3G",19),B(V,"C3B",20),B(V,"C3A",21),B(V,"U3",22),B(V,"V3",23),B(V,"X4",24),B(V,"Y4",25),B(V,"C4R",26),B(V,"C4G",27),B(V,"C4B",28),B(V,"C4A",29),B(V,"U4",30),B(V,"V4",31);var zs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,c=i.length;a<c;a++){let o=s.getPath(t,a),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new V(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=c}return a}newMeshAttachment(e,t,s,i){let a=new ye(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=c}return a}newBoundingBoxAttachment(e,t){return new Ue(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new Nt(t)}newClippingAttachment(e,t){return new ze(t)}},Ot=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Fe.Normal;skinRequired=!1;color=new D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Fe=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Fe||{}),Dt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,c,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=c,this.ashearY=o;let r=this.parent;if(!r){let d=this.skeleton;const f=d.scaleX,m=d.scaleY,x=(s+c)*E.degRad,p=(s+90+o)*E.degRad;this.a=Math.cos(x)*i*f,this.b=Math.cos(p)*a*f,this.c=Math.sin(x)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*f+d.x,this.worldY=t*m+d.y;return}let l=r.a,n=r.b,h=r.c,u=r.d;switch(this.worldX=l*e+n*t+r.worldX,this.worldY=h*e+u*t+r.worldY,this.inherit){case 0:{const d=(s+c)*E.degRad,f=(s+90+o)*E.degRad,m=Math.cos(d)*i,x=Math.cos(f)*a,p=Math.sin(d)*i,w=Math.sin(f)*a;this.a=l*m+n*p,this.b=l*x+n*w,this.c=h*m+u*p,this.d=h*x+u*w;return}case 1:{const d=(s+c)*E.degRad,f=(s+90+o)*E.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(f)*a,this.c=Math.sin(d)*i,this.d=Math.sin(f)*a;break}case 2:{let d=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;l*=d,h*=f;let m=l*l+h*h,x=0;m>1e-4?(m=Math.abs(l*u*f-n*d*h)/m,n=h*m,u=l*m,x=Math.atan2(h,l)*E.radDeg):(l=0,h=0,x=90-Math.atan2(u,n)*E.radDeg);const p=(s+c-x)*E.degRad,w=(s+o-x+90)*E.degRad,g=Math.cos(p)*i,b=Math.cos(w)*a,v=Math.sin(p)*i,y=Math.sin(w)*a;this.a=l*g-n*v,this.b=l*b-n*y,this.c=h*g+u*v,this.d=h*b+u*y;break}case 3:case 4:{s*=E.degRad;const d=Math.cos(s),f=Math.sin(s);let m=(l*d+n*f)/this.skeleton.scaleX,x=(h*d+u*f)/this.skeleton.scaleY,p=Math.sqrt(m*m+x*x);p>1e-5&&(p=1/p),m*=p,x*=p,p=Math.sqrt(m*m+x*x),this.inherit==3&&l*u-n*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(x,m);const w=Math.cos(s)*p,g=Math.sin(s)*p;c*=E.degRad,o=(90+o)*E.degRad;const b=Math.cos(c)*i,v=Math.cos(o)*a,y=Math.sin(c)*i,S=Math.sin(o)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=x*b+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let t=e.a,s=e.b,i=e.c,a=e.d,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c,h=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=h*o-u*r,this.ay=u*n-h*l;let d,f,m,x;if(this.inherit==1)d=this.a,f=this.b,m=this.c,x=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,a=t*this.skeleton.scaleY*v/this.skeleton.scaleX,c=1/(t*a-s*i),o=a*c,r=s*c;break}case 3:case 4:let p=E.cosDeg(this.rotation),w=E.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.inherit==3&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=E.PI/2+Math.atan2(i,t);s=Math.cos(b)*g,a=Math.sin(b)*g,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c}d=o*this.a-r*this.c,f=o*this.b-r*this.d,m=n*this.c-l*this.a,x=n*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*x-f*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*f+m*x,p)*E.radDeg,this.arotation=Math.atan2(m,d)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,f)*E.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*E.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*E.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*E.radDeg}rotateWorld(e){e*=E.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Ee=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ks=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new qt){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(t,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(t,e,this.textureLoader(c))},c.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),c=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new As(o),l=r.pages.length,n=!1;for(let h of r.pages)this.loadTexture(i?i[h.name]:c+h.name,(u,d)=>{n||(h.setTexture(d),--l==0&&this.success(t,e,r))},(u,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${u}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
2
|
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},qt=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=t.charCodeAt(a);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let a=()=>{this.finish(e,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let a=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let a=t==200||t==0?[s]:[t,s];for(let c=a.length-1,o=i.length;c<o;c+=2)i[c].apply(null,a)}},_t=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Wt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Ys=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,a,c,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,h=r.c,u=r.d,d=-e.ashearX-e.arotation,f=0,m=0;switch(e.inherit){case 1:f=(t-e.worldX)*E.signum(e.skeleton.scaleX),m=(s-e.worldY)*E.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(l*u-n*h)/Math.max(1e-4,l*l+h*h),g=l/e.skeleton.scaleX,b=h/e.skeleton.scaleY;n=-b*w*e.skeleton.scaleX,u=g*w*e.skeleton.scaleY,d+=Math.atan2(b,g)*E.radDeg;default:let v=t-r.worldX,y=s-r.worldY,S=l*u-n*h;Math.abs(S)<=1e-4?(f=0,m=0):(f=(v*u-y*n)/S-e.ax,m=(y*l-v*h)/S-e.ay)}d+=Math.atan2(m,f)*E.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,p=e.ascaleY;if(i||a){switch(e.inherit){case 3:case 4:f=t-e.worldX,m=s-e.worldY}const w=e.data.length*x;if(w>1e-4){const g=f*f+m*m;if(i&&g<w*w||a&&g>w*w){const b=(Math.sqrt(g)/w-1)*o+1;x*=b,c&&(p*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,x,p,e.ashearX,e.ashearY)}apply2(e,t,s,i,a,c,o,r,l){if(e.inherit!=0||t.inherit!=0)return;let n=e.ax,h=e.ay,u=e.ascaleX,d=e.ascaleY,f=u,m=d,x=t.ascaleX,p=0,w=0,g=0;u<0?(u=-u,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),x<0?(x=-x,w=180):w=0;let b=t.ax,v=0,y=0,S=0,A=e.a,k=e.b,T=e.c,Y=e.d,F=Math.abs(u-d)<=1e-4;!F||c?(v=0,y=A*b+e.worldX,S=T*b+e.worldY):(v=t.ay,y=A*b+k*v+e.worldX,S=T*b+Y*v+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,k=X.b,T=X.c,Y=X.d;let C=A*Y-k*T,M=y-X.worldX,P=S-X.worldY;C=Math.abs(C)<=1e-4?0:1/C;let O=(M*Y-P*k)*C-n,_=(P*A-M*T)*C-h,N=Math.sqrt(O*O+_*_),G=t.data.length*x,$,j;if(N<1e-4){this.apply1(e,s,i,!1,c,!1,l),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}M=s-X.worldX,P=i-X.worldY;let L=(M*Y-P*k)*C-n,W=(P*A-M*T)*C-h,U=L*L+W*W;if(r!=0){r*=u*(x+1)*.5;let K=Math.sqrt(U),Q=K-N-G*u+r;if(Q>0){let Z=Math.min(1,Q/(r*2))-1;Z=(Q-r*(1-Z*Z))/K,L-=Z*L,W-=Z*W,U=L*L+W*W}}e:if(F){G*=u;let K=(U-N*N-G*G)/(2*N*G);K<-1?(K=-1,j=Math.PI*a):K>1?(K=1,j=0,c&&(A=(Math.sqrt(U)/(N+G)-1)*l+1,f*=A,o&&(m*=A))):j=Math.acos(K)*a,A=N+G*K,k=G*Math.sin(j),$=Math.atan2(W*A-L*k,L*A+W*k)}else{A=u*G,k=d*G;let K=A*A,Q=k*k,Z=Math.atan2(W,L);T=Q*N*N+K*U-K*Q;let fe=-2*Q*N,ke=Q-K;if(Y=fe*fe-4*ke*T,Y>=0){let ve=Math.sqrt(Y);fe<0&&(ve=-ve),ve=-(fe+ve)*.5;let Ye=ve/ke,as=T/ve,Be=Math.abs(Ye)<Math.abs(as)?Ye:as;if(Ye=U-Be*Be,Ye>=0){P=Math.sqrt(Ye)*a,$=Z-Math.atan2(P,Be),j=Math.atan2(P/d,(Be-N)/u);break e}}let ts=E.PI,Re=N-A,et=Re*Re,ss=0,rs=0,Pe=N+A,tt=Pe*Pe,is=0;T=-A*N/(K-Q),T>=-1&&T<=1&&(T=Math.acos(T),M=A*Math.cos(T)+N,P=k*Math.sin(T),Y=M*M+P*P,Y<et&&(ts=T,et=Y,Re=M,ss=P),Y>tt&&(rs=T,tt=Y,Pe=M,is=P)),U<=(et+tt)*.5?($=Z-Math.atan2(ss*a,Re),j=ts*a):($=Z-Math.atan2(is*a,Pe),j=rs*a)}let ie=Math.atan2(v,b)*g,te=e.arotation;$=($-ie)*E.radDeg+p-te,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(n,h,te+$*l,f,m,0,0),te=t.arotation,j=((j+ie)*E.radDeg-t.ashearX)*g+w-te,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(b,v,te+j*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ut=class extends Ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},zt=class extends Ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=He.Fixed;spacingMode=$e.Fixed;rotateMode=je.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},He=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(He||{}),$e=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))($e||{}),je=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(je||{}),ge=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,a=e.bones.length;i<a;i++){let c=t.findBone(e.bones[i].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(c)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ie))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(s==0&&i==0&&a==0)return;let c=this.data,o=c.rotateMode==0,r=c.rotateMode==2,l=this.bones,n=l.length,h=o?n:n+1,u=R.setArraySize(this.spaces,h),d=r?this.lengths=R.setArraySize(this.lengths,n):[],f=this.spacing;switch(c.spacingMode){case 2:if(r)for(let y=0,S=h-1;y<S;y++){let A=l[y],k=A.data.length,T=k*A.a,Y=k*A.c;d[y]=Math.sqrt(T*T+Y*Y)}R.arrayFill(u,1,h,f);break;case 3:let b=0;for(let y=0,S=h-1;y<S;){let A=l[y],k=A.data.length;if(k<ge.epsilon)r&&(d[y]=0),u[++y]=f;else{let T=k*A.a,Y=k*A.c,F=Math.sqrt(T*T+Y*Y);r&&(d[y]=F),u[++y]=F,b+=F}}if(b>0){b=h/b*f;for(let y=1;y<h;y++)u[y]*=b}break;default:let v=c.spacingMode==0;for(let y=0,S=h-1;y<S;){let A=l[y],k=A.data.length;if(k<ge.epsilon)r&&(d[y]=0),u[++y]=f;else{let T=k*A.a,Y=k*A.c,F=Math.sqrt(T*T+Y*Y);r&&(d[y]=F),u[++y]=(v?k+f:f)*F/k}}}let m=this.computeWorldPositions(t,h,o),x=m[0],p=m[1],w=c.offsetRotation,g=!1;if(w==0)g=c.rotateMode==1;else{g=!1;let b=this.target.bone;w*=b.a*b.d-b.b*b.c>0?E.degRad:-E.degRad}for(let b=0,v=3;b<n;b++,v+=3){let y=l[b];y.worldX+=(x-y.worldX)*i,y.worldY+=(p-y.worldY)*a;let S=m[v],A=m[v+1],k=S-x,T=A-p;if(r){let Y=d[b];if(Y!=0){let F=(Math.sqrt(k*k+T*T)/Y-1)*s+1;y.a*=F,y.c*=F}}if(x=S,p=A,s>0){let Y=y.a,F=y.b,X=y.c,C=y.d,M=0,P=0,O=0;if(o?M=m[v-1]:u[b+1]==0?M=m[v+2]:M=Math.atan2(T,k),M-=Math.atan2(X,Y),g){P=Math.cos(M),O=Math.sin(M);let _=y.data.length;x+=(_*(P*Y-O*X)-k)*s,p+=(_*(O*Y+P*X)-T)*s}else M+=w;M>E.PI?M-=E.PI2:M<-E.PI&&(M+=E.PI2),M*=s,P=Math.cos(M),O=Math.sin(M),y.a=P*Y-O*X,y.b=P*F-O*C,y.c=O*Y+P*X,y.d=O*F+P*C}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,a=this.position,c=this.spaces,o=R.setArraySize(this.positions,t*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,h=n/6,u=ge.NONE;if(!e.constantSpeed){let _=e.lengths;h-=l?1:2;let N=_[h];this.data.positionMode==1&&(a*=N);let G;switch(this.data.spacingMode){case 2:G=N;break;case 3:G=N/t;break;default:G=1}r=R.setArraySize(this.world,8);for(let $=0,j=0,L=0;$<t;$++,j+=3){let W=c[$]*G;a+=W;let U=a;if(l)U%=N,U<0&&(U+=N),L=0;else if(U<0){u!=ge.BEFORE&&(u=ge.BEFORE,e.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(U,r,0,o,j);continue}else if(U>N){u!=ge.AFTER&&(u=ge.AFTER,e.computeWorldVertices(i,n-6,4,r,0,2)),this.addAfterPosition(U-N,r,0,o,j);continue}for(;;L++){let ie=_[L];if(!(U>ie)){if(L==0)U/=ie;else{let te=_[L-1];U=(U-te)/(ie-te)}break}}L!=u&&(u=L,l&&L==h?(e.computeWorldVertices(i,n-4,4,r,0,2),e.computeWorldVertices(i,0,4,r,4,2)):e.computeWorldVertices(i,L*6+2,8,r,0,2)),this.addCurvePosition(U,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],o,j,s||$>0&&W==0)}return o}l?(n+=2,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n-4,r,0,2),e.computeWorldVertices(i,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(h--,n-=4,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n,r,0,2));let d=R.setArraySize(this.curves,h),f=0,m=r[0],x=r[1],p=0,w=0,g=0,b=0,v=0,y=0,S=0,A=0,k=0,T=0,Y=0,F=0,X=0,C=0;for(let _=0,N=2;_<h;_++,N+=6)p=r[N],w=r[N+1],g=r[N+2],b=r[N+3],v=r[N+4],y=r[N+5],S=(m-p*2+g)*.1875,A=(x-w*2+b)*.1875,k=((p-g)*3-m+v)*.09375,T=((w-b)*3-x+y)*.09375,Y=S*2+k,F=A*2+T,X=(p-m)*.75+S+k*.16666667,C=(w-x)*.75+A+T*.16666667,f+=Math.sqrt(X*X+C*C),X+=Y,C+=F,Y+=k,F+=T,f+=Math.sqrt(X*X+C*C),X+=Y,C+=F,f+=Math.sqrt(X*X+C*C),X+=Y+k,C+=F+T,f+=Math.sqrt(X*X+C*C),d[_]=f,m=v,x=y;this.data.positionMode==1&&(a*=f);let M;switch(this.data.spacingMode){case 2:M=f;break;case 3:M=f/t;break;default:M=1}let P=this.segments,O=0;for(let _=0,N=0,G=0,$=0;_<t;_++,N+=3){let j=c[_]*M;a+=j;let L=a;if(l)L%=f,L<0&&(L+=f),G=0;else if(L<0){this.addBeforePosition(L,r,0,o,N);continue}else if(L>f){this.addAfterPosition(L-f,r,n-4,o,N);continue}for(;;G++){let W=d[G];if(!(L>W)){if(G==0)L/=W;else{let U=d[G-1];L=(L-U)/(W-U)}break}}if(G!=u){u=G;let W=G*6;for(m=r[W],x=r[W+1],p=r[W+2],w=r[W+3],g=r[W+4],b=r[W+5],v=r[W+6],y=r[W+7],S=(m-p*2+g)*.03,A=(x-w*2+b)*.03,k=((p-g)*3-m+v)*.006,T=((w-b)*3-x+y)*.006,Y=S*2+k,F=A*2+T,X=(p-m)*.3+S+k*.16666667,C=(w-x)*.3+A+T*.16666667,O=Math.sqrt(X*X+C*C),P[0]=O,W=1;W<8;W++)X+=Y,C+=F,Y+=k,F+=T,O+=Math.sqrt(X*X+C*C),P[W]=O;X+=Y,C+=F,O+=Math.sqrt(X*X+C*C),P[8]=O,X+=Y+k,C+=F+T,O+=Math.sqrt(X*X+C*C),P[9]=O,$=0}for(L*=O;;$++){let W=P[$];if(!(L>W)){if($==0)L/=W;else{let U=P[$-1];L=$+(L-U)/(W-U)}break}}this.addCurvePosition(L*.1,m,x,p,w,g,b,v,y,o,N,s||_>0&&j==0)}return o}addBeforePosition(e,t,s,i,a){let c=t[s],o=t[s+1],r=t[s+2]-c,l=t[s+3]-o,n=Math.atan2(l,r);i[a]=c+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addAfterPosition(e,t,s,i,a){let c=t[s+2],o=t[s+3],r=c-t[s],l=o-t[s+1],n=Math.atan2(l,r);i[a]=c+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addCurvePosition(e,t,s,i,a,c,o,r,l,n,h,u){if(e==0||isNaN(e)){n[h]=t,n[h+1]=s,n[h+2]=Math.atan2(a-s,i-t);return}let d=e*e,f=d*e,m=1-e,x=m*m,p=x*m,w=m*e,g=w*3,b=m*g,v=g*e,y=t*p+i*b+c*v+r*f,S=s*p+a*b+o*v+l*f;n[h]=y,n[h+1]=S,u&&(e<.001?n[h+2]=Math.atan2(a-s,i-t):n[h+2]=Math.atan2(S-(s*x+a*w*2+o*d),y-(t*x+i*w*2+c*d)))}},Ce=ge;B(Ce,"NONE",-1),B(Ce,"BEFORE",-2),B(Ce,"AFTER",-3),B(Ce,"epsilon",1e-5);var Gs=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,c=this.data.scaleX>0,o=this.bone,r=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const l=this.skeleton,n=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=n,this.lastTime=l.time;const h=o.worldX,u=o.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=u;else{let d=this.remaining,f=this.inertia,m=this.data.step,x=this.skeleton.data.referenceScale,p=-1,w=this.data.limit*n,g=w*Math.abs(l.scaleY);if(w*=Math.abs(l.scaleX),s||i){if(s){const b=(this.ux-h)*f;this.xOffset+=b>w?w:b<-w?-w:b,this.ux=h}if(i){const b=(this.uy-u)*f;this.yOffset+=b>g?g:b<-g?-g:b,this.uy=u}if(d>=m){p=Math.pow(this.damping,60*m);const b=this.massInverse*m,v=this.strength,y=this.wind*x*l.scaleX,S=this.gravity*x*l.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*b,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),i&&(this.yVelocity-=(S+this.yOffset*v)*b,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m;while(d>=m)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a||c){let b=Math.atan2(o.c,o.a),v=0,y=0,S=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),a){S=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(k+this.ty,A+this.tx)-b-this.rotateOffset*S;this.rotateOffset+=(T-Math.ceil(T*E.invPI2-.5)*E.PI2)*f,T=this.rotateOffset*S+b,v=Math.cos(T),y=Math.sin(T),c&&(T=r*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(A*v+k*y)*f/T))}else{v=Math.cos(b),y=Math.sin(b);const T=r*o.getWorldScaleX();T>0&&(this.scaleOffset+=(A*v+k*y)*f/T)}if(d=this.remaining,d>=m){p==-1&&(p=Math.pow(this.damping,60*m));const T=this.massInverse*m,Y=this.strength,F=this.wind,X=Je.yDown?-this.gravity:this.gravity,C=r/x;for(;;)if(d-=m,c&&(this.scaleVelocity+=(F*v-X*y-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),a){if(this.rotateVelocity-=((F*y+X*v)*C+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const M=this.rotateOffset*S+b;v=Math.cos(M),y=Math.sin(M)}else if(d<m)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a){let l=this.rotateOffset*t,n=0,h=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,n=Math.sin(d),h=Math.cos(d),u=o.b,o.b=h*u-n*o.d,o.d=n*u+h*o.d),d+=l*this.data.shearX,n=Math.sin(d),h=Math.cos(d),u=o.a,o.a=h*u-n*o.c,o.c=n*u+h*o.c}else l*=this.data.rotate,n=Math.sin(l),h=Math.cos(l),u=o.a,o.a=h*u-n*o.c,o.c=n*u+h*o.c,u=o.b,o.b=h*u-n*o.d,o.d=n*u+h*o.d}if(c){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=r*o.a,this.ty=r*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*E.degRad,a=Math.cos(i),c=Math.sin(i),o=this.cx-e,r=this.cy-t;this.translate(o*a-r*c-o,o*c+r*a-r)}},Ts=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof le)||!(this.attachment instanceof le)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Ms=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ve;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,h=r.c,u=r.d,d=l*u-n*h>0?E.degRad:-E.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(h,l)-Math.atan2(y,b)+f;A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*t,g.worldY+=(b.y-g.worldY)*s}if(i!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(l*l+h*h)-b+this.data.offsetScaleX)*i)/b),g.a*=b,g.c*=b}if(a!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(n*n+u*u)-b+this.data.offsetScaleY)*a)/b),g.b*=b,g.d*=b}if(c>0){let b=g.b,v=g.d,y=Math.atan2(v,b),S=Math.atan2(u,n)-Math.atan2(h,l)-(y-Math.atan2(g.c,g.a));S>E.PI?S-=E.PI2:S<-E.PI&&(S+=E.PI2),S=y+(S+m)*c;let A=Math.sqrt(b*b+v*v);g.b=Math.cos(S)*A,g.d=Math.sin(S)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,h=r.c,u=r.d,d=l*u-n*h>0?E.degRad:-E.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let p=0,w=x.length;p<w;p++){let g=x[p];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(h,l)+f;A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);g.a=k*b-T*y,g.b=k*v-T*S,g.c=T*b+k*y,g.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*t,g.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*i+1;g.a*=b,g.c*=b}if(a!=0){let b=(Math.sqrt(n*n+u*u)-1+this.data.offsetScaleY)*a+1;g.b*=b,g.d*=b}if(c>0){let b=Math.atan2(u,n)-Math.atan2(h,l);b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2);let v=g.b,y=g.d;b=Math.atan2(y,v)+(b-E.PI/2+m)*c;let S=Math.sqrt(v*v+y*y);g.b=Math.cos(b)*S,g.d=Math.sin(b)*S}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],u=h.arotation;e!=0&&(u+=(o.arotation-u+this.data.offsetRotation)*e);let d=h.ax,f=h.ay;d+=(o.ax-d+this.data.offsetX)*t,f+=(o.ay-f+this.data.offsetY)*s;let m=h.ascaleX,x=h.ascaleY;i!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*i)/m),a!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*a)/x);let p=h.ashearY;c!=0&&(p+=(o.ashearY-p+this.data.offsetShearY)*c),h.updateWorldTransformWith(d,f,u,m,x,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],u=h.arotation+(o.arotation+this.data.offsetRotation)*e,d=h.ax+(o.ax+this.data.offsetX)*t,f=h.ay+(o.ay+this.data.offsetY)*s,m=h.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),x=h.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*a+1),p=h.ashearY+(o.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(d,f,u,m,x,h.ashearX,p)}}},Gt=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Gt.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Dt(s,this,null);else{let a=this.bones[s.parent.index];i=new Dt(s,this,a),a.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],a=new Ts(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new Ys(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new Ms(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ce(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new Gs(s,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let u=0,d=t.length;u<d;u++){let f=t[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let d=0,f=this.skin.bones.length;d<f;d++){let m=this.bones[u[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,a=this.pathConstraints,c=this.physicsConstraints,o=s.length,r=i.length,l=a.length,n=this.physicsConstraints.length,h=o+r+l+n;e:for(let u=0;u<h;u++){for(let d=0;d<o;d++){let f=s[d];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let d=0;d<r;d++){let f=i[d];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let d=0;d<l;d++){let f=a[d];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let d=0;d<n;d++){const f=c[d];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,d=t.length;u<d;u++)this.sortBone(t[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let a=s[s.length-1];this.sortBone(a),this._updateCache.push(e),this.sortReset(i.children),a.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let a=t.getAttachment();a instanceof Ie&&this.sortPathConstraintAttachmentWith(a,i);let c=e.bones,o=c.length;for(let r=0;r<o;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(c[r].children);for(let r=0;r<o;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let a=t[i];this.sortBone(a.parent),this.sortBone(a)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let a in i)this.sortPathConstraintAttachmentWith(i[a],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ie))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let a=0,c=s.length;a<c;){let o=s[a++];for(o+=a;a<o;)this.sortBone(i[s[a++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let i=0,a=t.length;i<a;i++){let c=t[i];c.ax=c.x,c.ay=c.y,c.arotation=c.rotation,c.ascaleX=c.scaleX,c.ascaleY=c.scaleY,c.ashearX=c.shearX,c.ashearY=c.shearY}let s=this._updateCache;for(let i=0,a=s.length;i<a;i++)s[i].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let s=this.bones;for(let x=1,p=s.length;x<p;x++){let w=s[x];w.ax=w.x,w.ay=w.y,w.arotation=w.rotation,w.ascaleX=w.scaleX,w.ascaleY=w.scaleY,w.ashearX=w.shearX,w.ashearY=w.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let a=t.a,c=t.b,o=t.c,r=t.d;i.worldX=a*this.x+c*this.y+t.worldX,i.worldY=o*this.x+r*this.y+t.worldY;const l=(i.rotation+i.shearX)*E.degRad,n=(i.rotation+90+i.shearY)*E.degRad,h=Math.cos(l)*i.scaleX,u=Math.cos(n)*i.scaleY,d=Math.sin(l)*i.scaleX,f=Math.sin(n)*i.scaleY;i.a=(a*h+c*d)*this.scaleX,i.b=(a*u+c*f)*this.scaleX,i.c=(o*h+r*d)*this.scaleY,i.d=(o*u+r*f)*this.scaleY;let m=this._updateCache;for(let x=0,p=m.length;x<p;x++){let w=m[x];w!=i&&w.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s],c=a.data.attachmentName;if(c){let o=e.getAttachment(s,c);o&&a.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let c=s[i];if(c.data.name==e){let o=null;if(t&&(o=this.getAttachment(i,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);c.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new Ve,s=new Ve;return this.getBounds(t,s,void 0,e),{x:t.x,y:t.y,width:s.x,height:s.y}}getBounds(e,t,s=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let a=this.drawOrder,c=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let n=0,h=a.length;n<h;n++){let u=a[n];if(!u.bone.active)continue;let d=0,f=null,m=null,x=u.getAttachment();if(x instanceof V)d=8,f=R.setArraySize(s,d,0),x.computeWorldVertices(u,f,0,2),m=Gt.quadTriangles;else if(x instanceof ye){let p=x;d=p.worldVerticesLength,f=R.setArraySize(s,d,0),p.computeWorldVertices(u,0,d,f,0,2),m=p.triangles}else if(x instanceof ze&&i!=null){i.clipStart(u,x);continue}if(f&&m){i!=null&&i.isClipping()&&(i.clipTriangles(f,m,m.length),f=i.clippedVertices,d=i.clippedVertices.length);for(let p=0,w=f.length;p<w;p+=2){let g=f[p],b=f[p+1];c=Math.min(c,g),o=Math.min(o,b),r=Math.max(r,g),l=Math.max(l,b)}}i?.clipEndWithSlot(u)}i?.clipEnd(),e.set(c,o),t.set(r-c,l-o)}update(e){this.time+=e}physicsTranslate(e,t){const s=this.physicsConstraints;for(let i=0,a=s.length;i<a;i++)s[i].translate(e,t)}physicsRotate(e,t,s){const i=this.physicsConstraints;for(let a=0,c=i.length;a<c;a++)i[a].rotate(e,t,s)}},Je=Gt;B(Je,"quadTriangles",[0,1,2,2,3,0]),B(Je,"yDown",!1);var Xs=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Xs||{}),Fs=class extends Ee{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Ht=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}},$t=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Ke=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new D(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){c=!0;break}c||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){c=!0;break}c||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){c=!0;break}c||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){c=!0;break}c||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof ye?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new $t(t,i,a))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new $t(e,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let a=e.slots[i],c=a.getAttachment();if(c&&s<t.attachments.length){let o=t.attachments[s];for(let r in o){let l=o[r];if(c==l){let n=this.getAttachment(s,r);n&&a.setAttachment(n);break}}}s++}}},jt=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Qe.Normal;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Qe=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Qe||{}),Jt=class extends Ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ht;s.name="";let i=new Es(e),a=i.readInt32(),c=i.readInt32();s.hash=c==0&&a==0?null:c.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("String in string table must not be null.");i.strings.push(h)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Bone name must not be null.");let u=n==0?null:s.bones[i.readInt(!0)],d=new Ot(n,h,u);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.inherit=i.readByte(),d.skinRequired=i.readBoolean(),o&&(D.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Slot name must not be null.");let u=s.bones[i.readInt(!0)],d=new jt(n,h,u);D.rgba8888ToColor(d.color,i.readInt32());let f=i.readInt32();f!=-1&&D.rgb888ToColor(d.darkColor=new D,f),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let u=i.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new Ut(u);d.order=i.readInt(!0),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let f=i.readByte();d.skinRequired=(f&1)!=0,d.bendDirection=f&2?1:-1,d.compress=(f&4)!=0,d.stretch=(f&8)!=0,d.uniform=(f&16)!=0,f&32&&(d.mix=f&64?i.readFloat():1),f&128&&(d.softness=i.readFloat()*t),s.ikConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let u=i.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new Jt(u);d.order=i.readInt(!0),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];let f=i.readByte();d.skinRequired=(f&1)!=0,d.local=(f&2)!=0,d.relative=(f&4)!=0,f&8&&(d.offsetRotation=i.readFloat()),f&16&&(d.offsetX=i.readFloat()*t),f&32&&(d.offsetY=i.readFloat()*t),f&64&&(d.offsetScaleX=i.readFloat()),f&128&&(d.offsetScaleY=i.readFloat()),f=i.readByte(),f&1&&(d.offsetShearY=i.readFloat()),f&2&&(d.mixRotate=i.readFloat()),f&4&&(d.mixX=i.readFloat()),f&8&&(d.mixY=i.readFloat()),f&16&&(d.mixScaleX=i.readFloat()),f&32&&(d.mixScaleY=i.readFloat()),f&64&&(d.mixShearY=i.readFloat()),s.transformConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let u=i.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new zt(u);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)];const f=i.readByte();d.positionMode=f&1,d.spacingMode=f>>1&3,d.rotateMode=f>>3&3,f&128&&(d.offsetRotation=i.readFloat()),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){const u=i.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Fs(u);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let f=i.readByte();d.skinRequired=(f&1)!=0,f&2&&(d.x=i.readFloat()),f&4&&(d.y=i.readFloat()),f&8&&(d.rotate=i.readFloat()),f&16&&(d.scaleX=i.readFloat()),f&32&&(d.shearX=i.readFloat()),d.limit=(f&64?i.readFloat():5e3)*t,d.step=1/i.readUnsignedByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=f&128?i.readFloat():1,d.wind=i.readFloat(),d.gravity=i.readFloat(),f=i.readByte(),f&1&&(d.inertiaGlobal=!0),f&2&&(d.strengthGlobal=!0),f&4&&(d.dampingGlobal=!0),f&8&&(d.massGlobal=!0),f&16&&(d.windGlobal=!0),f&32&&(d.gravityGlobal=!0),f&64&&(d.mixGlobal=!0),d.mix=f&128?i.readFloat():1,s.physicsConstraints.push(d)}let l=this.readSkin(i,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let n=s.skins.length;for(R.setArraySize(s.skins,r=n+i.readInt(!0));n<r;n++){let h=this.readSkin(i,s,!1,o);if(!h)throw new Error("readSkin() should not have returned null.");s.skins[n]=h}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let h=this.linkedMeshes[n];const u=s.skins[h.skinIndex];if(!h.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(h.slotIndex,h.parent);if(!d)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?d:h.mesh,h.mesh.setParentMesh(d),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Event data name must not be null");let u=new Wt(h);u.intValue=i.readInt(!1),u.floatValue=i.readFloat(),u.stringValue=i.readString(),u.audioPath=i.readString(),u.audioPath&&(u.volume=i.readFloat(),u.balance=i.readFloat()),s.events.push(u)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,h,s))}return s}readSkin(e,t,s,i){let a=null,c=0;if(s){if(c=e.readInt(!0),c==0)return null;a=new Ke("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");a=new Ke(o),i&&D.rgba8888ToColor(a.color,e.readInt32()),a.bones.length=e.readInt(!0);for(let r=0,l=a.bones.length;r<l;r++)a.bones[r]=t.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.physicsConstraints[e.readInt(!0)]);c=e.readInt(!0)}for(let o=0;o<c;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let u=this.readAttachment(e,t,a,r,h,i);u&&a.setAttachment(r,h,u)}}return a}readAttachment(e,t,s,i,a,c){let o=this.scale,r=e.readByte();const l=r&8?e.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(r&7){case xe.Region:{let n=r&16?e.readStringRef():null;const h=r&32?e.readInt32():4294967295,u=r&64?this.readSequence(e):null;let d=r&128?e.readFloat():0,f=e.readFloat(),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat();n||(n=l);let b=this.attachmentLoader.newRegionAttachment(s,l,n,u);return b?(b.path=n,b.x=f*o,b.y=m*o,b.scaleX=x,b.scaleY=p,b.rotation=d,b.width=w*o,b.height=g*o,D.rgba8888ToColor(b.color,h),b.sequence=u,u==null&&b.updateRegion(),b):null}case xe.BoundingBox:{let n=this.readVertices(e,(r&16)!=0),h=c?e.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,l);return u?(u.worldVerticesLength=n.length,u.vertices=n.vertices,u.bones=n.bones,c&&D.rgba8888ToColor(u.color,h),u):null}case xe.Mesh:{let n=r&16?e.readStringRef():l;const h=r&32?e.readInt32():4294967295,u=r&64?this.readSequence(e):null,d=e.readInt(!0),f=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,f.length,1),x=this.readShortArray(e,(f.length-d-2)*3);let p=[],w=0,g=0;c&&(p=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),g=e.readFloat()),n||(n=l);let b=this.attachmentLoader.newMeshAttachment(s,l,n,u);return b?(b.path=n,D.rgba8888ToColor(b.color,h),b.bones=f.bones,b.vertices=f.vertices,b.worldVerticesLength=f.length,b.triangles=x,b.regionUVs=m,u==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=u,c&&(b.edges=p,b.width=w*o,b.height=g*o),b):null}case xe.LinkedMesh:{const n=r&16?e.readStringRef():l;if(n==null)throw new Error("Path of linked mesh must not be null");const h=r&32?e.readInt32():4294967295,u=r&64?this.readSequence(e):null,d=(r&128)!=0,f=e.readInt(!0),m=e.readStringRef();let x=0,p=0;c&&(x=e.readFloat(),p=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,l,n,u);return w?(w.path=n,D.rgba8888ToColor(w.color,h),w.sequence=u,c&&(w.width=x*o,w.height=p*o),this.linkedMeshes.push(new $s(w,f,i,m,d)),w):null}case xe.Path:{const n=(r&16)!=0,h=(r&32)!=0,u=this.readVertices(e,(r&64)!=0),d=R.newArray(u.length/6,0);for(let x=0,p=d.length;x<p;x++)d[x]=e.readFloat()*o;const f=c?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=n,m.constantSpeed=h,m.worldVerticesLength=u.length,m.vertices=u.vertices,m.bones=u.bones,m.lengths=d,c&&D.rgba8888ToColor(m.color,f),m):null}case xe.Point:{const n=e.readFloat(),h=e.readFloat(),u=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,l);return f?(f.x=h*o,f.y=u*o,f.rotation=n,c&&D.rgba8888ToColor(f.color,d),f):null}case xe.Clipping:{const n=e.readInt(!0),h=this.readVertices(e,(r&16)!=0);let u=c?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[n],d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,c&&D.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(e){let t=new it(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),a=new js;if(a.length=i<<1,!t)return a.vertices=this.readFloatArray(e,a.length,s),a;let c=new Array,o=new Array;for(let r=0;r<i;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),c.push(e.readFloat()*s),c.push(e.readFloat()*s),c.push(e.readFloat())}return a.vertices=R.toFloatArray(c),a.bones=o,a}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let a=0;a<t;a++)i[a]=e.readFloat();else for(let a=0;a<t;a++)i[a]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,a=this.scale;for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0),x=m-1;switch(f){case lr:{let p=new we(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readStringRef());i.push(p);break}case or:{let p=e.readInt(!0),w=new gt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,b,v,y,S),A!=x;A++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(A);break;case de:z(e,w,k++,A,0,g,T,b,Y,1),z(e,w,k++,A,1,g,T,v,F,1),z(e,w,k++,A,2,g,T,y,X,1),z(e,w,k++,A,3,g,T,S,C,1)}g=T,b=Y,v=F,y=X,S=C}i.push(w);break}case hr:{let p=e.readInt(!0),w=new xt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,A=0;w.setFrame(S,g,b,v,y),S!=x;S++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(S);break;case de:z(e,w,A++,S,0,g,k,b,T,1),z(e,w,A++,S,1,g,k,v,Y,1),z(e,w,A++,S,2,g,k,y,F,1)}g=k,b=T,v=Y,y=F}i.push(w);break}case cr:{let p=e.readInt(!0),w=new wt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,F=0;w.setFrame(Y,g,b,v,y,S,A,k,T),Y!=x;Y++){let X=e.readFloat(),C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(Y);break;case de:z(e,w,F++,Y,0,g,X,b,C,1),z(e,w,F++,Y,1,g,X,v,M,1),z(e,w,F++,Y,2,g,X,y,P,1),z(e,w,F++,Y,3,g,X,S,O,1),z(e,w,F++,Y,4,g,X,A,_,1),z(e,w,F++,Y,5,g,X,k,N,1),z(e,w,F++,Y,6,g,X,T,G,1)}g=X,b=C,v=M,y=P,S=O,A=_,k=N,T=G}i.push(w);break}case dr:{let p=e.readInt(!0),w=new pt(m,p,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,b,v,y,S,A,k),T!=x;T++){let F=e.readFloat(),X=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(T);break;case de:z(e,w,Y++,T,0,g,F,b,X,1),z(e,w,Y++,T,1,g,F,v,C,1),z(e,w,Y++,T,2,g,F,y,M,1),z(e,w,Y++,T,3,g,F,S,P,1),z(e,w,Y++,T,4,g,F,A,O,1),z(e,w,Y++,T,5,g,F,k,_,1)}g=F,b=X,v=C,y=M,S=P,A=O,k=_}i.push(w);break}case fr:{let p=new bt(m,e.readInt(!0),h),w=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,v=0;p.setFrame(b,w,g),b!=x;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case ce:p.setStepped(b);break;case de:z(e,p,v++,b,0,w,y,g,S,1)}w=y,g=S}i.push(p)}}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0);if(f==nr){let p=new mt(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readByte());i.push(p);continue}let x=e.readInt(!0);switch(f){case Js:i.push(ee(e,new Me(m,x,h),1));break;case Ks:i.push(Kt(e,new at(m,x,h),a));break;case Qs:i.push(ee(e,new nt(m,x,h),a));break;case Zs:i.push(ee(e,new lt(m,x,h),a));break;case er:i.push(Kt(e,new ot(m,x,h),1));break;case tr:i.push(ee(e,new ht(m,x,h),1));break;case sr:i.push(ee(e,new ct(m,x,h),1));break;case rr:i.push(Kt(e,new dt(m,x,h),1));break;case ir:i.push(ee(e,new ft(m,x,h),1));break;case ar:i.push(ee(e,new ut(m,x,h),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new vt(u,e.readInt(!0),h),m=e.readByte(),x=e.readFloat(),p=m&1?m&2?e.readFloat():1:0,w=m&4?e.readFloat()*a:0;for(let g=0,b=0;f.setFrame(g,x,p,w,m&8?1:-1,(m&16)!=0,(m&32)!=0),g!=d;g++){m=e.readByte();const v=e.readFloat(),y=m&1?m&2?e.readFloat():1:0,S=m&4?e.readFloat()*a:0;m&64?f.setStepped(g):m&128&&(z(e,f,b++,g,0,x,v,p,y,1),z(e,f,b++,g,1,x,v,w,S,a)),x=v,p=y,w=S}i.push(f)}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new St(u,e.readInt(!0),h),m=e.readFloat(),x=e.readFloat(),p=e.readFloat(),w=e.readFloat(),g=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;f.setFrame(y,m,x,p,w,g,b,v),y!=d;y++){let A=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),X=e.readFloat(),C=e.readFloat();switch(e.readByte()){case ce:f.setStepped(y);break;case de:z(e,f,S++,y,0,m,A,x,k,1),z(e,f,S++,y,1,m,A,p,T,1),z(e,f,S++,y,2,m,A,w,Y,1),z(e,f,S++,y,3,m,A,g,F,1),z(e,f,S++,y,4,m,A,b,X,1),z(e,f,S++,y,5,m,A,v,C,1)}m=A,x=k,p=T,w=Y,g=F,b=X,v=C}i.push(f)}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),u=s.pathConstraints[h];for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),x=e.readInt(!0),p=e.readInt(!0);switch(m){case gr:i.push(ee(e,new At(x,p,h),u.positionMode==0?a:1));break;case xr:i.push(ee(e,new It(x,p,h),u.spacingMode==0||u.spacingMode==1?a:1));break;case br:let w=new Ct(x,p,h),g=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,A=0,k=w.getFrameCount()-1;w.setFrame(S,g,b,v,y),S!=k;S++){let T=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),X=e.readFloat();switch(e.readByte()){case ce:w.setStepped(S);break;case de:z(e,w,A++,S,0,g,T,b,Y,1),z(e,w,A++,S,1,g,T,v,F,1),z(e,w,A++,S,2,g,T,y,X,1)}g=T,b=Y,v=F,y=X}i.push(w)}}}for(let l=0,n=e.readInt(!0);l<n;l++){const h=e.readInt(!0)-1;for(let u=0,d=e.readInt(!0);u<d;u++){const f=e.readByte(),m=e.readInt(!0);if(f==Cr){const p=new De(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat());i.push(p);continue}const x=e.readInt(!0);switch(f){case wr:i.push(ee(e,new kt(m,x,h),1));break;case pr:i.push(ee(e,new Yt(m,x,h),1));break;case yr:i.push(ee(e,new Tt(m,x,h),1));break;case vr:i.push(ee(e,new Mt(m,x,h),1));break;case Sr:i.push(ee(e,new Xt(m,x,h),1));break;case Ar:i.push(ee(e,new Ft(m,x,h),1));break;case Ir:i.push(ee(e,new Et(m,x,h),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=s.skins[e.readInt(!0)];for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readInt(!0);for(let m=0,x=e.readInt(!0);m<x;m++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let w=h.getAttachment(f,p),g=e.readByte(),b=e.readInt(!0),v=b-1;switch(g){case ur:{let y=w,S=y.bones,A=y.vertices,k=S?A.length/3*2:A.length,T=e.readInt(!0),Y=new yt(b,T,f,y),F=e.readFloat();for(let X=0,C=0;;X++){let M,P=e.readInt(!0);if(P==0)M=S?R.newFloatArray(k):A;else{M=R.newFloatArray(k);let _=e.readInt(!0);if(P+=_,a==1)for(let N=_;N<P;N++)M[N]=e.readFloat();else for(let N=_;N<P;N++)M[N]=e.readFloat()*a;if(!S)for(let N=0,G=M.length;N<G;N++)M[N]+=A[N]}if(Y.setFrame(X,F,M),X==v)break;let O=e.readFloat();switch(e.readByte()){case ce:Y.setStepped(X);break;case de:z(e,Y,C++,X,0,F,O,0,1,1)}F=O}i.push(Y);break}case mr:{let y=new Ae(b,f,w);for(let S=0;S<b;S++){let A=e.readFloat(),k=e.readInt32();y.setFrame(S,A,cs[k&15],k>>4,e.readFloat())}i.push(y);break}}}}}let c=e.readInt(!0);if(c>0){let l=new pe(c),n=s.slots.length;for(let h=0;h<c;h++){let u=e.readFloat(),d=e.readInt(!0),f=R.newArray(n,0);for(let w=n-1;w>=0;w--)f[w]=-1;let m=R.newArray(n-d,0),x=0,p=0;for(let w=0;w<d;w++){let g=e.readInt(!0);for(;x!=g;)m[p++]=x++;f[x+e.readInt(!0)]=x++}for(;x<n;)m[p++]=x++;for(let w=n-1;w>=0;w--)f[w]==-1&&(f[w]=m[--p]);l.setFrame(h,u,f)}i.push(l)}let o=e.readInt(!0);if(o>0){let l=new Xe(o);for(let n=0;n<o;n++){let h=e.readFloat(),u=s.events[e.readInt(!0)],d=new _t(h,u);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(n,d)}i.push(l)}let r=0;for(let l=0,n=i.length;l<n;l++)r=Math.max(r,i[l].getDuration());return new Ne(t,i,r)}},Es=class{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let a=this.readUnsignedByte();switch(a>>4){case 12:case 13:t+=String.fromCharCode((a&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((a&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(a),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},$s=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}},js=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}},xe=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(xe||{});function ee(e,t,s){let i=e.readFloat(),a=e.readFloat()*s;for(let c=0,o=0,r=t.getFrameCount()-1;t.setFrame(c,i,a),c!=r;c++){let l=e.readFloat(),n=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(c);break;case de:z(e,t,o++,c,0,i,l,a,n,s)}i=l,a=n}return t}function Kt(e,t,s){let i=e.readFloat(),a=e.readFloat()*s,c=e.readFloat()*s;for(let o=0,r=0,l=t.getFrameCount()-1;t.setFrame(o,i,a,c),o!=l;o++){let n=e.readFloat(),h=e.readFloat()*s,u=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(o);break;case de:z(e,t,r++,o,0,i,n,a,h,s),z(e,t,r++,o,1,i,n,c,u,s)}i=n,a=h,c=u}return t}function z(e,t,s,i,a,c,o,r,l,n){t.setBezier(s,i,a,c,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var Js=0,Ks=1,Qs=2,Zs=3,er=4,tr=5,sr=6,rr=7,ir=8,ar=9,nr=10,lr=0,or=1,hr=2,cr=3,dr=4,fr=5,ur=0,mr=1,gr=0,xr=1,br=2,wr=0,pr=1,yr=2,vr=4,Sr=5,Ar=6,Ir=7,Cr=8,ce=1,de=2,kr=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Te(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,c=e.slots,o=c.length;s.length=0,a.freeAll(i),i.length=0;for(let r=0;r<o;r++){let l=c[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof Ue){let h=n;s.push(h);let u=a.obtain();u.length!=h.worldVerticesLength&&(u=R.newFloatArray(h.worldVerticesLength)),i.push(u),h.computeWorldVertices(l,0,h.worldVerticesLength,u,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let c=0,o=a.length;c<o;c++){let r=a[c],l=r;for(let n=0,h=r.length;n<h;n+=2){let u=l[n],d=l[n+1];e=Math.min(e,u),t=Math.min(t,d),s=Math.max(s,u),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let a=this.minX,c=this.minY,o=this.maxX,r=this.maxY;if(e<=a&&s<=a||t<=c&&i<=c||e>=o&&s>=o||t>=r&&i>=r)return!1;let l=(i-t)/(s-e),n=l*(a-e)+t;if(n>c&&n<r||(n=l*(o-e)+t,n>c&&n<r))return!0;let h=(c-t)/l+e;return h>a&&h<o||(h=(r-t)/l+e,h>a&&h<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,a=e.length,c=a-2,o=!1;for(let r=0;r<a;r+=2){let l=i[r+1],n=i[c+1];if(l<s&&n>=s||n<s&&l>=s){let h=i[r];h+(s-l)/(n-l)*(i[c]-h)<t&&(o=!o)}c=r}return o}intersectsSegment(e,t,s,i){let a=this.polygons;for(let c=0,o=a.length;c<o;c++)if(this.intersectsSegmentPolygon(a[c],e,t,s,i))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,t,s,i,a){let c=e,o=e.length,r=t-i,l=s-a,n=t*a-s*i,h=c[o-2],u=c[o-1];for(let d=0;d<o;d+=2){let f=c[d],m=c[d+1],x=h*m-u*f,p=h-f,w=u-m,g=r*w-l*p,b=(n*p-r*x)/g;if((b>=h&&b<=f||b>=f&&b<=h)&&(b>=t&&b<=i||b>=i&&b<=t)){let v=(n*w-l*x)/g;if((v>=u&&v<=m||v>=m&&v<=u)&&(v>=s&&v<=a||v>=a&&v<=s))return!0}h=f,u=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},re=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Te(()=>new Array);polygonIndicesPool=new Te(()=>new Array);triangulate(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let o=0;o<s;o++)i[o]=o;let a=this.isConcaveArray;a.length=0;for(let o=0,r=s;o<r;++o)a[o]=re.isConcave(o,s,t,i);let c=this.triangles;for(c.length=0;s>3;){let o=s-1,r=0,l=1;for(;;){e:if(!a[r]){let u=i[o]<<1,d=i[r]<<1,f=i[l]<<1,m=t[u],x=t[u+1],p=t[d],w=t[d+1],g=t[f],b=t[f+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!a[v])continue;let y=i[v]<<1,S=t[y],A=t[y+1];if(re.positiveArea(g,b,m,x,S,A)&&re.positiveArea(m,x,p,w,S,A)&&re.positiveArea(p,w,g,b,S,A))break e}break}if(l==0){do{if(!a[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%s}c.push(i[(s+r-1)%s]),c.push(i[r]),c.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let n=(s+r-1)%s,h=r==s?0:r;a[n]=re.isConcave(n,s,t,i),a[h]=re.isConcave(h,s,t,i)}return s==3&&(c.push(i[2]),c.push(i[0]),c.push(i[1])),c}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,h=t.length;n<h;n+=3){let u=t[n]<<1,d=t[n+1]<<1,f=t[n+2]<<1,m=s[u],x=s[u+1],p=s[d],w=s[d+1],g=s[f],b=s[f+1],v=!1;if(r==u){let y=o.length-4,S=re.winding(o[y],o[y+1],o[y+2],o[y+3],g,b),A=re.winding(g,b,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(g),o.push(b),c.push(f),v=!0)}v||(o.length>0?(i.push(o),a.push(c)):(this.polygonPool.free(o),this.polygonIndicesPool.free(c)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(x),o.push(p),o.push(w),o.push(g),o.push(b),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(u),c.push(d),c.push(f),l=re.winding(m,x,p,w,g,b),r=u)}o.length>0&&(i.push(o),a.push(c));for(let n=0,h=i.length;n<h;n++){if(c=a[n],c.length==0)continue;let u=c[0],d=c[c.length-1];o=i[n];let f=o.length-4,m=o[f],x=o[f+1],p=o[f+2],w=o[f+3],g=o[0],b=o[1],v=o[2],y=o[3],S=re.winding(m,x,p,w,g,b);for(let A=0;A<h;A++){if(A==n)continue;let k=a[A];if(k.length!=3)continue;let T=k[0],Y=k[1],F=k[2],X=i[A],C=X[X.length-2],M=X[X.length-1];if(T!=u||Y!=d)continue;let P=re.winding(m,x,p,w,C,M),O=re.winding(C,M,g,b,v,y);P==S&&O==S&&(X.length=0,k.length=0,o.push(C),o.push(M),c.push(F),m=p,x=w,p=C,w=M,A=0)}}for(let n=i.length-1;n>=0;n--)o=i[n],o.length==0&&(i.splice(n,1),this.polygonPool.free(o),c=a[n],a.splice(n,1),this.polygonIndicesPool.free(c));return i}static isConcave(e,t,s,i){let a=i[(t+e-1)%t]<<1,c=i[e]<<1,o=i[(e+1)%t]<<1;return!this.positiveArea(s[a],s[a+1],s[c],s[c+1],s[o],s[o+1])}static positiveArea(e,t,s,i,a,c){return e*(c-i)+s*(t-c)+a*(i-t)>=0}static winding(e,t,s,i,a,c){let o=s-e,r=i-t;return a*r-c*o+o*t-e*r>=0?1:-1}},Qt=class{triangulator=new re;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let a=this.clippingPolygon;Qt.makeClockwise(a);let c=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let o=0,r=c.length;o<r;o++){let l=c[o];Qt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return c.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,a,c,o,r){let l,n,h,u,d,f;typeof t=="number"?(l=s,n=i,h=a,u=c,d=o,f=r):(l=t,n=s,h=i,u=a,d=c,f=o),h&&u&&d&&typeof f=="boolean"?this.clipTrianglesRender(e,l,n,h,u,d,f):this.clipTrianglesNoRender(e,l,n)}clipTrianglesNoRender(e,t,s){let i=this.clipOutput,a=this.clippedVertices,c=this.clippedTriangles,o=this.clippingPolygons,r=o.length,l=0;a.length=0,c.length=0;for(let n=0;n<s;n+=3){let h=t[n]<<1,u=e[h],d=e[h+1];h=t[n+1]<<1;let f=e[h],m=e[h+1];h=t[n+2]<<1;let x=e[h],p=e[h+1];for(let w=0;w<r;w++){let g=a.length;if(this.clip(u,d,f,m,x,p,o[w],i)){let b=i.length;if(b==0)continue;let v=b>>1,y=this.clipOutput,S=R.setArraySize(a,g+v*2);for(let k=0;k<b;k+=2,g+=2){let T=y[k],Y=y[k+1];S[g]=T,S[g+1]=Y}g=c.length;let A=R.setArraySize(c,g+3*(v-2));v--;for(let k=1;k<v;k++,g+=3)A[g]=l,A[g+1]=l+k,A[g+2]=l+k+1;l+=v+1}else{let b=R.setArraySize(a,g+6);b[g]=u,b[g+1]=d,b[g+2]=f,b[g+3]=m,b[g+4]=x,b[g+5]=p,g=c.length;let v=R.setArraySize(c,g+3);v[g]=l,v[g+1]=l+1,v[g+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,s,i,a,c,o){let r=this.clipOutput,l=this.clippedVertices,n=this.clippedTriangles,h=this.clippingPolygons,u=h.length,d=o?12:8,f=0;l.length=0,n.length=0;for(let m=0;m<s;m+=3){let x=t[m]<<1,p=e[x],w=e[x+1],g=i[x],b=i[x+1];x=t[m+1]<<1;let v=e[x],y=e[x+1],S=i[x],A=i[x+1];x=t[m+2]<<1;let k=e[x],T=e[x+1],Y=i[x],F=i[x+1];for(let X=0;X<u;X++){let C=l.length;if(this.clip(p,w,v,y,k,T,h[X],r)){let M=r.length;if(M==0)continue;let P=y-T,O=k-v,_=p-k,N=T-w,G=1/(P*_+O*(w-T)),$=M>>1,j=this.clipOutput,L=R.setArraySize(l,C+$*d);for(let U=0;U<M;U+=2,C+=d){let ie=j[U],te=j[U+1];L[C]=ie,L[C+1]=te,L[C+2]=a.r,L[C+3]=a.g,L[C+4]=a.b,L[C+5]=a.a;let K=ie-k,Q=te-T,Z=(P*K+O*Q)*G,fe=(N*K+_*Q)*G,ke=1-Z-fe;L[C+6]=g*Z+S*fe+Y*ke,L[C+7]=b*Z+A*fe+F*ke,o&&(L[C+8]=c.r,L[C+9]=c.g,L[C+10]=c.b,L[C+11]=c.a)}C=n.length;let W=R.setArraySize(n,C+3*($-2));$--;for(let U=1;U<$;U++,C+=3)W[C]=f,W[C+1]=f+U,W[C+2]=f+U+1;f+=$+1}else{let M=R.setArraySize(l,C+3*d);M[C]=p,M[C+1]=w,M[C+2]=a.r,M[C+3]=a.g,M[C+4]=a.b,M[C+5]=a.a,o?(M[C+6]=g,M[C+7]=b,M[C+8]=c.r,M[C+9]=c.g,M[C+10]=c.b,M[C+11]=c.a,M[C+12]=v,M[C+13]=y,M[C+14]=a.r,M[C+15]=a.g,M[C+16]=a.b,M[C+17]=a.a,M[C+18]=S,M[C+19]=A,M[C+20]=c.r,M[C+21]=c.g,M[C+22]=c.b,M[C+23]=c.a,M[C+24]=k,M[C+25]=T,M[C+26]=a.r,M[C+27]=a.g,M[C+28]=a.b,M[C+29]=a.a,M[C+30]=Y,M[C+31]=F,M[C+32]=c.r,M[C+33]=c.g,M[C+34]=c.b,M[C+35]=c.a):(M[C+6]=g,M[C+7]=b,M[C+8]=v,M[C+9]=y,M[C+10]=a.r,M[C+11]=a.g,M[C+12]=a.b,M[C+13]=a.a,M[C+14]=S,M[C+15]=A,M[C+16]=k,M[C+17]=T,M[C+18]=a.r,M[C+19]=a.g,M[C+20]=a.b,M[C+21]=a.a,M[C+22]=Y,M[C+23]=F),C=n.length;let P=R.setArraySize(n,C+3);P[C]=f,P[C+1]=f+1,P[C+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,t,s,i){let a=this.clipOutput,c=this.clippedVertices,o=this.clippedUVs,r=this.clippedTriangles,l=this.clippingPolygons,n=l.length,h=0;c.length=0,o.length=0,r.length=0;for(let u=0;u<s;u+=3){let d=t[u]<<1,f=e[d],m=e[d+1],x=i[d],p=i[d+1];d=t[u+1]<<1;let w=e[d],g=e[d+1],b=i[d],v=i[d+1];d=t[u+2]<<1;let y=e[d],S=e[d+1],A=i[d],k=i[d+1];for(let T=0;T<n;T++){let Y=c.length;if(this.clip(f,m,w,g,y,S,l[T],a)){let F=a.length;if(F==0)continue;let X=g-S,C=y-w,M=f-y,P=S-m,O=1/(X*M+C*(m-S)),_=F>>1,N=this.clipOutput,G=R.setArraySize(c,Y+_*2),$=R.setArraySize(o,Y+_*2);for(let L=0;L<F;L+=2,Y+=2){let W=N[L],U=N[L+1];G[Y]=W,G[Y+1]=U;let ie=W-y,te=U-S,K=(X*ie+C*te)*O,Q=(P*ie+M*te)*O,Z=1-K-Q;$[Y]=x*K+b*Q+A*Z,$[Y+1]=p*K+v*Q+k*Z}Y=r.length;let j=R.setArraySize(r,Y+3*(_-2));_--;for(let L=1;L<_;L++,Y+=3)j[Y]=h,j[Y+1]=h+L,j[Y+2]=h+L+1;h+=_+1}else{let F=R.setArraySize(c,Y+6);F[Y]=f,F[Y+1]=m,F[Y+2]=w,F[Y+3]=g,F[Y+4]=y,F[Y+5]=S;let X=R.setArraySize(o,Y+3*2);X[Y]=x,X[Y+1]=p,X[Y+2]=b,X[Y+3]=v,X[Y+4]=A,X[Y+5]=k,Y=r.length;let C=R.setArraySize(r,Y+3);C[Y]=h,C[Y+1]=h+1,C[Y+2]=h+2,h+=3;break}}}}clip(e,t,s,i,a,c,o,r){let l=r,n=!1,h;o.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(s),h.push(i),h.push(a),h.push(c),h.push(e),h.push(t),r.length=0;let u=o.length-4,d=o;for(let f=0;;f+=2){let m=d[f],x=d[f+1],p=m-d[f+2],w=x-d[f+3],g=r.length,b=h;for(let y=0,S=h.length-2;y<S;){let A=b[y],k=b[y+1];y+=2;let T=b[y],Y=b[y+1],F=w*(m-T)>p*(x-Y),X=w*(m-A)-p*(x-k);if(X>0){if(F){r.push(T),r.push(Y);continue}let C=T-A,M=Y-k,P=X/(C*w-M*p);if(P>=0&&P<=1)r.push(A+C*P),r.push(k+M*P);else{r.push(T),r.push(Y);continue}}else if(F){let C=T-A,M=Y-k,P=X/(C*w-M*p);if(P>=0&&P<=1)r.push(A+C*P),r.push(k+M*P),r.push(T),r.push(Y);else{r.push(T),r.push(Y);continue}}n=!0}if(g==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),f==u)break;let v=r;r=h,r.length=0,h=v}if(l!=r){l.length=0;for(let f=0,m=r.length-2;f<m;f++)l[f]=r[f]}else l.length=l.length-2;return n}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],a=0,c=0,o=0,r=0;for(let l=0,n=s-3;l<n;l+=2)a=t[l],c=t[l+1],o=t[l+2],r=t[l+3],i+=a*r-o*c;if(!(i<0))for(let l=0,n=s-2,h=s>>1;l<h;l+=2){let u=t[l],d=t[l+1],f=n-l;t[l]=t[f],t[l+1]=t[f+1],t[f]=u,t[f+1]=d}}},Yr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ht,i=typeof e=="string"?JSON.parse(e):e,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.referenceScale=I(a,"referenceScale",100)*t,s.fps=a.fps,s.imagesPath=a.images??null,s.audioPath=a.audio??null),i.bones)for(let c=0;c<i.bones.length;c++){let o=i.bones[c],r=null,l=I(o,"parent",null);l&&(r=s.findBone(l));let n=new Ot(s.bones.length,o.name,r);n.length=I(o,"length",0)*t,n.x=I(o,"x",0)*t,n.y=I(o,"y",0)*t,n.rotation=I(o,"rotation",0),n.scaleX=I(o,"scaleX",1),n.scaleY=I(o,"scaleY",1),n.shearX=I(o,"shearX",0),n.shearY=I(o,"shearY",0),n.inherit=R.enumValue(Fe,I(o,"inherit","Normal")),n.skinRequired=I(o,"skin",!1);let h=I(o,"color",null);h&&n.color.setFromString(h),s.bones.push(n)}if(i.slots)for(let c=0;c<i.slots.length;c++){let o=i.slots[c],r=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${r}`);let n=new jt(s.slots.length,r,l),h=I(o,"color",null);h&&n.color.setFromString(h);let u=I(o,"dark",null);u&&(n.darkColor=D.fromString(u)),n.attachmentName=I(o,"attachment",null),n.blendMode=R.enumValue(Qe,I(o,"blend","normal")),n.visible=I(o,"visible",!0),s.slots.push(n)}if(i.ik)for(let c=0;c<i.ik.length;c++){let o=i.ik[c],r=new Ut(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let h=s.findBone(o.bones[n]);if(!h)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(h)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);r.target=l,r.mix=I(o,"mix",1),r.softness=I(o,"softness",0)*t,r.bendDirection=I(o,"bendPositive",!0)?1:-1,r.compress=I(o,"compress",!1),r.stretch=I(o,"stretch",!1),r.uniform=I(o,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let c=0;c<i.transform.length;c++){let o=i.transform[c],r=new Jt(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let u=o.bones[h],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=I(o,"local",!1),r.relative=I(o,"relative",!1),r.offsetRotation=I(o,"rotation",0),r.offsetX=I(o,"x",0)*t,r.offsetY=I(o,"y",0)*t,r.offsetScaleX=I(o,"scaleX",0),r.offsetScaleY=I(o,"scaleY",0),r.offsetShearY=I(o,"shearY",0),r.mixRotate=I(o,"mixRotate",1),r.mixX=I(o,"mixX",1),r.mixY=I(o,"mixY",r.mixX),r.mixScaleX=I(o,"mixScaleX",1),r.mixScaleY=I(o,"mixScaleY",r.mixScaleX),r.mixShearY=I(o,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let c=0;c<i.path.length;c++){let o=i.path[c],r=new zt(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let u=o.bones[h],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=R.enumValue(He,I(o,"positionMode","Percent")),r.spacingMode=R.enumValue($e,I(o,"spacingMode","Length")),r.rotateMode=R.enumValue(je,I(o,"rotateMode","Tangent")),r.offsetRotation=I(o,"rotation",0),r.position=I(o,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=I(o,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=I(o,"mixRotate",1),r.mixX=I(o,"mixX",1),r.mixY=I(o,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let c=0;c<i.physics.length;c++){const o=i.physics[c],r=new Fs(o.name);r.order=I(o,"order",0),r.skinRequired=I(o,"skin",!1);const l=o.bone,n=s.findBone(l);if(n==null)throw new Error("Physics bone not found: "+l);r.bone=n,r.x=I(o,"x",0),r.y=I(o,"y",0),r.rotate=I(o,"rotate",0),r.scaleX=I(o,"scaleX",0),r.shearX=I(o,"shearX",0),r.limit=I(o,"limit",5e3)*t,r.step=1/I(o,"fps",60),r.inertia=I(o,"inertia",1),r.strength=I(o,"strength",100),r.damping=I(o,"damping",1),r.massInverse=1/I(o,"mass",1),r.wind=I(o,"wind",0),r.gravity=I(o,"gravity",0),r.mix=I(o,"mix",1),r.inertiaGlobal=I(o,"inertiaGlobal",!1),r.strengthGlobal=I(o,"strengthGlobal",!1),r.dampingGlobal=I(o,"dampingGlobal",!1),r.massGlobal=I(o,"massGlobal",!1),r.windGlobal=I(o,"windGlobal",!1),r.gravityGlobal=I(o,"gravityGlobal",!1),r.mixGlobal=I(o,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let c=0;c<i.skins.length;c++){let o=i.skins[c],r=new Ke(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],h=s.findBone(n);if(!h)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],h=s.findIkConstraint(n);if(!h)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],h=s.findTransformConstraint(n);if(!h)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],h=s.findPathConstraint(n);if(!h)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.physics)for(let l=0;l<o.physics.length;l++){let n=o.physics[l],h=s.findPhysicsConstraint(n);if(!h)throw new Error(`Couldn't find physics constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}for(let l in o.attachments){let n=s.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let h=o.attachments[l];for(let u in h){let d=this.readAttachment(h[u],r,n.index,u,s);d&&r.setAttachment(n.index,u,d)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let c=0,o=this.linkedMeshes.length;c<o;c++){let r=this.linkedMeshes[c],l=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${r.skin}`);let n=l.getAttachment(r.slotIndex,r.parent);if(!n)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let c in i.events){let o=i.events[c],r=new Wt(c);r.intValue=I(o,"int",0),r.floatValue=I(o,"float",0),r.stringValue=I(o,"string",""),r.audioPath=I(o,"audio",null),r.audioPath&&(r.volume=I(o,"volume",1),r.balance=I(o,"balance",0)),s.events.push(r)}if(i.animations)for(let c in i.animations){let o=i.animations[c];this.readAnimation(o,c,s)}return s}readAttachment(e,t,s,i,a){let c=this.scale;switch(i=I(e,"name",i),I(e,"type","region")){case"region":{let o=I(e,"path",i),r=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,i,o,r);if(!l)return null;l.path=o,l.x=I(e,"x",0)*c,l.y=I(e,"y",0)*c,l.scaleX=I(e,"scaleX",1),l.scaleY=I(e,"scaleY",1),l.rotation=I(e,"rotation",0),l.width=e.width*c,l.height=e.height*c,l.sequence=r;let n=I(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=I(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=I(e,"path",i),r=this.readSequence(I(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,i,o,r);if(!l)return null;l.path=o;let n=I(e,"color",null);n&&l.color.setFromString(n),l.width=I(e,"width",0)*c,l.height=I(e,"height",0)*c,l.sequence=r;let h=I(e,"parent",null);if(h)return this.linkedMeshes.push(new Tr(l,I(e,"skin",null),s,h,I(e,"timelines",!0))),l;let u=e.uvs;return this.readVertices(e,l,u.length),l.triangles=e.triangles,l.regionUVs=u,l.region!=null&&l.updateRegion(),l.edges=I(e,"edges",null),l.hullLength=I(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=I(e,"closed",!1),o.constantSpeed=I(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=R.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)l[h]=e.lengths[h]*c;o.lengths=l;let n=I(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=I(e,"x",0)*c,o.y=I(e,"y",0)*c,o.rotation=I(e,"rotation",0);let r=I(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let r=I(e,"end",null);r&&(o.endSlot=a.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=I(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let t=new it(I(e,"count",0));return t.start=I(e,"start",1),t.digits=I(e,"digits",0),t.setupIndex=I(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let a=e.vertices;if(s==a.length){let r=R.toFloatArray(a);if(i!=1)for(let l=0,n=a.length;l<n;l++)r[l]*=i;t.vertices=r;return}let c=new Array,o=new Array;for(let r=0,l=a.length;r<l;){let n=a[r++];o.push(n);for(let h=r+n*4;r<h;r+=4)o.push(a[r]),c.push(a[r+1]*i),c.push(a[r+2]*i),c.push(a[r+3])}t.bones=o,t.vertices=R.toFloatArray(c)}readAnimation(e,t,s){let i=this.scale,a=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let h in r){let u=r[h];if(!u)continue;let d=u.length;if(h=="attachment"){let f=new we(d,n);for(let m=0;m<d;m++){let x=u[m];f.setFrame(m,I(x,"time",0),I(x,"name",null))}a.push(f)}else if(h=="rgba"){let f=new gt(d,d<<2,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.color);for(let w=0,g=0;;w++){f.setFrame(w,x,p.r,p.g,p.b,p.a);let b=u[w+1];if(!b){f.shrink(g);break}let v=I(b,"time",0),y=D.fromString(b.color),S=m.curve;S&&(g=H(S,f,g,w,0,x,v,p.r,y.r,1),g=H(S,f,g,w,1,x,v,p.g,y.g,1),g=H(S,f,g,w,2,x,v,p.b,y.b,1),g=H(S,f,g,w,3,x,v,p.a,y.a,1)),x=v,p=y,m=b}a.push(f)}else if(h=="rgb"){let f=new xt(d,d*3,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.color);for(let w=0,g=0;;w++){f.setFrame(w,x,p.r,p.g,p.b);let b=u[w+1];if(!b){f.shrink(g);break}let v=I(b,"time",0),y=D.fromString(b.color),S=m.curve;S&&(g=H(S,f,g,w,0,x,v,p.r,y.r,1),g=H(S,f,g,w,1,x,v,p.g,y.g,1),g=H(S,f,g,w,2,x,v,p.b,y.b,1)),x=v,p=y,m=b}a.push(f)}else if(h=="alpha")a.push(he(u,new bt(d,d,n),0,1));else if(h=="rgba2"){let f=new wt(d,d*7,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.light),w=D.fromString(m.dark);for(let g=0,b=0;;g++){f.setFrame(g,x,p.r,p.g,p.b,p.a,w.r,w.g,w.b);let v=u[g+1];if(!v){f.shrink(b);break}let y=I(v,"time",0),S=D.fromString(v.light),A=D.fromString(v.dark),k=m.curve;k&&(b=H(k,f,b,g,0,x,y,p.r,S.r,1),b=H(k,f,b,g,1,x,y,p.g,S.g,1),b=H(k,f,b,g,2,x,y,p.b,S.b,1),b=H(k,f,b,g,3,x,y,p.a,S.a,1),b=H(k,f,b,g,4,x,y,w.r,A.r,1),b=H(k,f,b,g,5,x,y,w.g,A.g,1),b=H(k,f,b,g,6,x,y,w.b,A.b,1)),x=y,p=S,w=A,m=v}a.push(f)}else if(h=="rgb2"){let f=new pt(d,d*6,n),m=u[0],x=I(m,"time",0),p=D.fromString(m.light),w=D.fromString(m.dark);for(let g=0,b=0;;g++){f.setFrame(g,x,p.r,p.g,p.b,w.r,w.g,w.b);let v=u[g+1];if(!v){f.shrink(b);break}let y=I(v,"time",0),S=D.fromString(v.light),A=D.fromString(v.dark),k=m.curve;k&&(b=H(k,f,b,g,0,x,y,p.r,S.r,1),b=H(k,f,b,g,1,x,y,p.g,S.g,1),b=H(k,f,b,g,2,x,y,p.b,S.b,1),b=H(k,f,b,g,3,x,y,w.r,A.r,1),b=H(k,f,b,g,4,x,y,w.g,A.g,1),b=H(k,f,b,g,5,x,y,w.b,A.b,1)),x=y,p=S,w=A,m=v}a.push(f)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let h in r){let u=r[h],d=u.length;if(d!=0){if(h==="rotate")a.push(he(u,new Me(d,d,n),0,1));else if(h==="translate"){let f=new at(d,d<<1,n);a.push(Zt(u,f,"x","y",0,i))}else if(h==="translatex"){let f=new nt(d,d,n);a.push(he(u,f,0,i))}else if(h==="translatey"){let f=new lt(d,d,n);a.push(he(u,f,0,i))}else if(h==="scale"){let f=new ot(d,d<<1,n);a.push(Zt(u,f,"x","y",1,1))}else if(h==="scalex"){let f=new ht(d,d,n);a.push(he(u,f,1,1))}else if(h==="scaley"){let f=new ct(d,d,n);a.push(he(u,f,1,1))}else if(h==="shear"){let f=new dt(d,d<<1,n);a.push(Zt(u,f,"x","y",0,1))}else if(h==="shearx"){let f=new ft(d,d,n);a.push(he(u,f,0,1))}else if(h==="sheary"){let f=new ut(d,d,n);a.push(he(u,f,0,1))}else if(h==="inherit"){let f=new mt(d,l.index);for(let m=0;m<u.length;m++){let x=u[m];f.setFrame(m,I(x,"time",0),R.enumValue(Fe,I(x,"inherit","Normal")))}a.push(f)}}}}if(e.ik)for(let o in e.ik){let r=e.ik[o],l=r[0];if(!l)continue;let n=s.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let h=s.ikConstraints.indexOf(n),u=new vt(r.length,r.length<<1,h),d=I(l,"time",0),f=I(l,"mix",1),m=I(l,"softness",0)*i;for(let x=0,p=0;;x++){u.setFrame(x,d,f,m,I(l,"bendPositive",!0)?1:-1,I(l,"compress",!1),I(l,"stretch",!1));let w=r[x+1];if(!w){u.shrink(p);break}let g=I(w,"time",0),b=I(w,"mix",1),v=I(w,"softness",0)*i,y=l.curve;y&&(p=H(y,u,p,x,0,d,g,f,b,1),p=H(y,u,p,x,1,d,g,m,v,i)),d=g,f=b,m=v,l=w}a.push(u)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=s.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let h=s.transformConstraints.indexOf(n),u=new St(r.length,r.length*6,h),d=I(l,"time",0),f=I(l,"mixRotate",1),m=I(l,"mixX",1),x=I(l,"mixY",m),p=I(l,"mixScaleX",1),w=I(l,"mixScaleY",p),g=I(l,"mixShearY",1);for(let b=0,v=0;;b++){u.setFrame(b,d,f,m,x,p,w,g);let y=r[b+1];if(!y){u.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),T=I(y,"mixY",k),Y=I(y,"mixScaleX",1),F=I(y,"mixScaleY",Y),X=I(y,"mixShearY",1),C=l.curve;C&&(v=H(C,u,v,b,0,d,S,f,A,1),v=H(C,u,v,b,1,d,S,m,k,1),v=H(C,u,v,b,2,d,S,x,T,1),v=H(C,u,v,b,3,d,S,p,Y,1),v=H(C,u,v,b,4,d,S,w,F,1),v=H(C,u,v,b,5,d,S,g,X,1)),d=S,f=A,m=k,x=T,p=Y,w=F,p=Y,l=y}a.push(u)}if(e.path)for(let o in e.path){let r=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=s.pathConstraints.indexOf(l);for(let h in r){let u=r[h],d=u[0];if(!d)continue;let f=u.length;if(h==="position"){let m=new At(f,f,n);a.push(he(u,m,0,l.positionMode==0?i:1))}else if(h==="spacing"){let m=new It(f,f,n);a.push(he(u,m,0,l.spacingMode==0||l.spacingMode==1?i:1))}else if(h==="mix"){let m=new Ct(f,f*3,n),x=I(d,"time",0),p=I(d,"mixRotate",1),w=I(d,"mixX",1),g=I(d,"mixY",w);for(let b=0,v=0;;b++){m.setFrame(b,x,p,w,g);let y=u[b+1];if(!y){m.shrink(v);break}let S=I(y,"time",0),A=I(y,"mixRotate",1),k=I(y,"mixX",1),T=I(y,"mixY",k),Y=d.curve;Y&&(v=H(Y,m,v,b,0,x,S,p,A,1),v=H(Y,m,v,b,1,x,S,w,k,1),v=H(Y,m,v,b,2,x,S,g,T,1)),x=S,p=A,w=k,g=T,d=y}a.push(m)}}}if(e.physics)for(let o in e.physics){let r=e.physics[o],l=-1;if(o.length>0){let n=s.findPhysicsConstraint(o);if(!n)throw new Error("Physics constraint not found: "+o);l=s.physicsConstraints.indexOf(n)}for(let n in r){let h=r[n],u=h[0];if(!u)continue;let d=h.length;if(n=="reset"){const m=new De(d,l);for(let x=0;u!=null;u=h[x+1],x++)m.setFrame(x,I(u,"time",0));a.push(m);continue}let f;if(n=="inertia")f=new kt(d,d,l);else if(n=="strength")f=new Yt(d,d,l);else if(n=="damping")f=new Tt(d,d,l);else if(n=="mass")f=new Mt(d,d,l);else if(n=="wind")f=new Xt(d,d,l);else if(n=="gravity")f=new Ft(d,d,l);else if(n=="mix")f=new Et(d,d,l);else continue;a.push(he(h,f,0,1))}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let h=r[n],u=s.findSlot(n);if(!u)throw new Error("Slot not found: "+n);let d=u.index;for(let f in h){let m=h[f],x=l.getAttachment(d,f);for(let p in m){let w=m[p],g=w[0];if(g){if(p=="deform"){let b=x.bones,v=x.vertices,y=b?v.length/3*2:v.length,S=new yt(w.length,w.length,d,x),A=I(g,"time",0);for(let k=0,T=0;;k++){let Y,F=I(g,"vertices",null);if(!F)Y=b?R.newFloatArray(y):v;else{Y=R.newFloatArray(y);let P=I(g,"offset",0);if(R.arrayCopy(F,0,Y,P,F.length),i!=1)for(let O=P,_=O+F.length;O<_;O++)Y[O]*=i;if(!b)for(let O=0;O<y;O++)Y[O]+=v[O]}S.setFrame(k,A,Y);let X=w[k+1];if(!X){S.shrink(T);break}let C=I(X,"time",0),M=g.curve;M&&(T=H(M,S,T,k,0,A,C,0,1,1)),A=C,g=X}a.push(S)}else if(p=="sequence"){let b=new Ae(w.length,d,x),v=0;for(let y=0;y<w.length;y++){let S=I(g,"delay",v),A=I(g,"time",0),k=hs[I(g,"mode","hold")],T=I(g,"index",0);b.setFrame(y,A,k,T,S),v=S,g=w[y+1]}a.push(b)}}}}}}if(e.drawOrder){let o=new pe(e.drawOrder.length),r=s.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let h=e.drawOrder[n],u=null,d=I(h,"offsets",null);if(d){u=R.newArray(r,-1);let f=R.newArray(r-d.length,0),m=0,x=0;for(let p=0;p<d.length;p++){let w=d[p],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;m!=b;)f[x++]=m++;u[m+w.offset]=m++}for(;m<r;)f[x++]=m++;for(let p=r-1;p>=0;p--)u[p]==-1&&(u[p]=f[--x])}o.setFrame(l,I(h,"time",0),u)}a.push(o)}if(e.events){let o=new Xe(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],h=s.findEvent(n.name);if(!h)throw new Error("Event not found: "+n.name);let u=new _t(R.toSinglePrecision(I(n,"time",0)),h);u.intValue=I(n,"int",h.intValue),u.floatValue=I(n,"float",h.floatValue),u.stringValue=I(n,"string",h.stringValue),u.data.audioPath&&(u.volume=I(n,"volume",1),u.balance=I(n,"balance",0)),o.setFrame(r,u)}a.push(o)}let c=0;for(let o=0,r=a.length;o<r;o++)c=Math.max(c,a[o].getDuration());s.animations.push(new Ne(t,a,c))}},Tr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}};function he(e,t,s,i){let a=e[0],c=I(a,"time",0),o=I(a,"value",s)*i,r=0;for(let l=0;;l++){t.setFrame(l,c,o);let n=e[l+1];if(!n)return t.shrink(r),t;let h=I(n,"time",0),u=I(n,"value",s)*i;a.curve&&(r=H(a.curve,t,r,l,0,c,h,o,u,i)),c=h,o=u,a=n}}function Zt(e,t,s,i,a,c){let o=e[0],r=I(o,"time",0),l=I(o,s,a)*c,n=I(o,i,a)*c,h=0;for(let u=0;;u++){t.setFrame(u,r,l,n);let d=e[u+1];if(!d)return t.shrink(h),t;let f=I(d,"time",0),m=I(d,s,a)*c,x=I(d,i,a)*c,p=o.curve;p&&(h=H(p,t,h,u,0,r,f,l,m,c),h=H(p,t,h,u,1,r,f,n,x,c)),r=f,l=m,n=x,o=d}}function H(e,t,s,i,a,c,o,r,l,n){if(e=="stepped")return t.setStepped(i),s;let h=a<<2,u=e[h],d=e[h+1]*n,f=e[h+2],m=e[h+3]*n;return t.setBezier(s,i,a,c,r,u,d,f,m,o,l),s+1}function I(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var Rs=class extends Vt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Mr=class extends ks{constructor(e="",t=new qt){super(s=>new Rs(s),e,t)}},Xr=R.newFloatArray(8),Ze=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=R.newFloatArray(8*1024);tempColor=new D;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder;this.debugRendering&&(t.strokeStyle="green");for(let c=0,o=a.length;c<o;c++){let r=a[c],l=r.bone;if(!l.active)continue;let n=r.getAttachment();if(!(n instanceof V))continue;n.computeWorldVertices(r,Xr,0,2);let h=n.region,u=h.texture.getImage(),d=r.color,f=n.color;s.set(i.r*d.r*f.r,i.g*d.g*f.g,i.b*d.b*f.b,i.a*d.a*f.a),t.save(),t.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),t.translate(n.offset[0],n.offset[1]),t.rotate(n.rotation*Math.PI/180);let m=n.width/h.originalWidth;t.scale(m*n.scaleX,m*n.scaleY);let x=h.width,p=h.height;if(t.translate(x/2,p/2),n.region.degrees==90){let w=x;x=p,p=w,t.rotate(-Math.PI/2)}t.scale(1,-1),t.translate(-x/2,-p/2),t.globalAlpha=s.a,t.drawImage(u,u.width*h.u,u.height*h.v,x,p,0,0,x,p),this.debugRendering&&t.strokeRect(0,0,x,p),t.restore()}}drawTriangles(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder,c=null,o=this.vertices,r=null;for(let n=0,h=a.length;n<h;n++){let u=a[n],d=u.getAttachment(),f,m;if(d instanceof V){let x=d;o=this.computeRegionVertices(u,x,!1),r=Ze.QUAD_TRIANGLES,f=x.region.texture.getImage()}else if(d instanceof ye){let x=d;o=this.computeMeshVertices(u,x,!1),r=x.triangles,f=x.region.texture.getImage()}else continue;if(f){u.data.blendMode!=c&&(c=u.data.blendMode);let x=u.color,p=d.color;s.set(i.r*x.r*p.r,i.g*x.g*p.g,i.b*x.b*p.b,i.a*x.a*p.a),t.globalAlpha=s.a;for(var l=0;l<r.length;l+=3){let w=r[l]*8,g=r[l+1]*8,b=r[l+2]*8,v=o[w],y=o[w+1],S=o[w+6],A=o[w+7],k=o[g],T=o[g+1],Y=o[g+6],F=o[g+7],X=o[b],C=o[b+1],M=o[b+6],P=o[b+7];this.drawTriangle(f,v,y,S,A,k,T,Y,F,X,C,M,P),this.debugRendering&&(t.strokeStyle="green",t.beginPath(),t.moveTo(v,y),t.lineTo(k,T),t.lineTo(X,C),t.lineTo(v,y),t.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,t,s,i,a,c,o,r,l,n,h,u,d){let f=this.ctx;const m=e.width-1,x=e.height-1;i*=m,a*=x,r*=m,l*=x,u*=m,d*=x,f.beginPath(),f.moveTo(t,s),f.lineTo(c,o),f.lineTo(n,h),f.closePath(),c-=t,o-=s,n-=t,h-=s,r-=i,l-=a,u-=i,d-=a;let p=r*d-u*l;if(p==0)return;p=1/p;const w=(d*c-l*n)*p,g=(d*o-l*h)*p,b=(r*n-u*c)*p,v=(r*h-u*o)*p,y=t-w*i-b*a,S=s-g*i-v*a;f.save(),f.transform(w,g,b,v,y,S),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,c=t.color,o=i.a*a.a*c.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*c.r*r,i.g*a.g*c.g*r,i.b*a.b*c.b*r,o),t.computeWorldVertices(e,this.vertices,0,Ze.VERTEX_SIZE);let n=this.vertices,h=t.uvs;return n[V.C1R]=l.r,n[V.C1G]=l.g,n[V.C1B]=l.b,n[V.C1A]=l.a,n[V.U1]=h[0],n[V.V1]=h[1],n[V.C2R]=l.r,n[V.C2G]=l.g,n[V.C2B]=l.b,n[V.C2A]=l.a,n[V.U2]=h[2],n[V.V2]=h[3],n[V.C3R]=l.r,n[V.C3G]=l.g,n[V.C3B]=l.b,n[V.C3A]=l.a,n[V.U3]=h[4],n[V.V3]=h[5],n[V.C4R]=l.r,n[V.C4G]=l.g,n[V.C4B]=l.b,n[V.C4A]=l.a,n[V.U4]=h[6],n[V.V4]=h[7],n}computeMeshVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,c=t.color,o=i.a*a.a*c.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*c.r*r,i.g*a.g*c.g*r,i.b*a.b*c.b*r,o);let n=t.worldVerticesLength/2,h=this.vertices;h.length<t.worldVerticesLength&&(this.vertices=h=R.newFloatArray(t.worldVerticesLength)),t.computeWorldVertices(e,0,t.worldVerticesLength,h,0,Ze.VERTEX_SIZE);let u=t.uvs;for(let d=0,f=0,m=2;d<n;d++)h[m++]=l.r,h[m++]=l.g,h[m++]=l.b,h[m++]=l.a,h[m++]=u[f++],h[m++]=u[f++],m+=2;return h}},es=Ze;B(es,"QUAD_TRIANGLES",[0,1,2,2,3,0]),B(es,"VERTEX_SIZE",2+2+4);export{bt as AlphaTimeline,Ne as Animation,xs as AnimationState,qs as AnimationStateAdapter,_s as AnimationStateData,Mr as AssetManager,ks as AssetManagerBase,zs as AtlasAttachmentLoader,rt as Attachment,we as AttachmentTimeline,Es as BinaryInput,Qe as BlendMode,Dt as Bone,Ot as BoneData,Ue as BoundingBoxAttachment,ys as CURRENT,Rs as CanvasTexture,ze as ClippingAttachment,D as Color,Ee as ConstraintData,oe as CurveTimeline,ae as CurveTimeline1,Oe as CurveTimeline2,Ns as DebugUtils,yt as DeformTimeline,qt as Downloader,pe as DrawOrderTimeline,_t as Event,Wt as EventData,ws as EventQueue,Xe as EventTimeline,se as EventType,Rt as FIRST,Ws as FakeTexture,We as HOLD_FIRST,ps as HOLD_MIX,Pt as HOLD_SUBSEQUENT,Ys as IkConstraint,Ut as IkConstraintData,vt as IkConstraintTimeline,Fe as Inherit,mt as InheritTimeline,Vs as IntSet,ns as Interpolation,E as MathUtils,ye as MeshAttachment,ds as MixBlend,fs as MixDirection,Ie as PathAttachment,Ce as PathConstraint,zt as PathConstraintData,Ct as PathConstraintMixTimeline,At as PathConstraintPositionTimeline,It as PathConstraintSpacingTimeline,Xs as Physics,Tt as PhysicsConstraintDampingTimeline,Ft as PhysicsConstraintGravityTimeline,kt as PhysicsConstraintInertiaTimeline,Mt as PhysicsConstraintMassTimeline,Et as PhysicsConstraintMixTimeline,De as PhysicsConstraintResetTimeline,Yt as PhysicsConstraintStrengthTimeline,ue as PhysicsConstraintTimeline,Xt as PhysicsConstraintWindTimeline,Nt as PointAttachment,Te as Pool,He as PositionMode,ls as Pow,Ls as PowOut,pt as RGB2Timeline,wt as RGBA2Timeline,gt as RGBATimeline,xt as RGBTimeline,V as RegionAttachment,je as RotateMode,Me as RotateTimeline,Bt as SETUP,_e as SUBSEQUENT,ot as ScaleTimeline,ht as ScaleXTimeline,ct as ScaleYTimeline,Ae as SequenceTimeline,dt as ShearTimeline,ft as ShearXTimeline,ut as ShearYTimeline,Je as Skeleton,Hs as SkeletonBinary,kr as SkeletonBounds,Qt as SkeletonClipping,Ht as SkeletonData,Yr as SkeletonJson,es as SkeletonRenderer,Ke as Skin,$t as SkinEntry,Ts as Slot,jt as SlotData,$e as SpacingMode,st as StringSet,Vt as Texture,As as TextureAtlas,Is as TextureAtlasPage,Lt as TextureAtlasRegion,Ge as TextureFilter,Ss as TextureRegion,vs as TextureWrap,Os as TimeKeeper,J as Timeline,bs as TrackEntry,Ms as TransformConstraint,Jt as TransformConstraintData,St as TransformConstraintTimeline,at as TranslateTimeline,nt as TranslateXTimeline,lt as TranslateYTimeline,re as Triangulator,R as Utils,Ve as Vector2,le as VertexAttachment,Ds as WindowedMean};
|