@esotericsoftware/spine-canvaskit 4.2.86 → 4.2.88
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.
- package/dist/esm/spine-canvaskit.min.mjs +2 -2
- package/dist/esm/spine-canvaskit.mjs +65 -82
- package/dist/esm/spine-canvaskit.mjs.map +2 -2
- package/dist/iife/spine-canvaskit.js +65 -82
- package/dist/iife/spine-canvaskit.js.map +2 -2
- package/dist/iife/spine-canvaskit.min.js +2 -2
- package/dist/index.d.ts +5 -7
- package/dist/index.js +59 -63
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _s=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}},$e=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,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},N=class me{constructor(t=0,s=0,r=0,i=0){this.r=t,this.g=s,this.b=r,this.a=i}static WHITE=new me(1,1,1,1);static RED=new me(1,0,0,1);static GREEN=new me(0,1,0,1);static BLUE=new me(0,0,1,1);static MAGENTA=new me(1,0,1,1);set(t,s,r,i){return this.r=t,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,r,i){return this.r+=t,this.g+=s,this.b+=r,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(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new me){return s.setFromString(t)}},P=class ne{static PI=3.1415927;static PI2=ne.PI*2;static invPI2=1/ne.PI2;static radiansToDegrees=180/ne.PI;static radDeg=ne.radiansToDegrees;static degreesToRadians=ne.PI/180;static degRad=ne.degreesToRadians;static clamp(t,s,r){return t<s?s:t>r?r:t}static cosDeg(t){return Math.cos(t*ne.degRad)}static sinDeg(t){return Math.sin(t*ne.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ne.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ne.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,r){let i=Math.random(),h=s-t;return i<=(r-t)/h?t+Math.sqrt(i*h*(r-t)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},es=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ts=class extends es{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}},Gs=class extends ts{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},R=class pe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,h){for(let l=s,a=i;l<s+h;l++,a++)r[a]=t[l]}static arrayFill(t,s,r,i){for(let h=s;h<r;h++)t[h]=i}static setArraySize(t,s,r=0){let i=t.length;if(i==s)return t;if(t.length=s,i<s)for(let h=i;h<s;h++)t[h]=r;return t}static ensureArrayCapacity(t,s,r=0){return t.length>=s?t:pe.setArraySize(t,s,r)}static newArray(t,s){let r=new Array(t);for(let i=0;i<t;i++)r[i]=s;return r}static newFloatArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(t){return pe.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return pe.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,r=!0){for(var i=0;i<t.length;i++)if(t[i]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},$s=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)}}},ve=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}},Ye=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}},Hs=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)}},js=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}},He=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},le=class Ps extends He{static nextID=0;id=Ps.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,h,l){r=h+(r>>1)*l;let a=t.bone.skeleton,n=t.deform,o=this.vertices,c=this.bones;if(!c){n.length>0&&(o=n);let u=t.bone,w=u.worldX,b=u.worldY,p=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,A=h;A<r;v+=2,A+=l){let S=o[v],C=o[v+1];i[A]=S*p+C*g+w,i[A+1]=S*x+C*y+b}return}let f=0,d=0;for(let u=0;u<s;u+=2){let w=c[f];f+=w+1,d+=w}let m=a.bones;if(n.length==0)for(let u=h,w=d*3;u<r;u+=l){let b=0,p=0,g=c[f++];for(g+=f;f<g;f++,w+=3){let x=m[c[f]],y=o[w],v=o[w+1],A=o[w+2];b+=(y*x.a+v*x.b+x.worldX)*A,p+=(y*x.c+v*x.d+x.worldY)*A}i[u]=b,i[u+1]=p}else{let u=n;for(let w=h,b=d*3,p=d<<1;w<r;w+=l){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,b+=3,p+=2){let v=m[c[f]],A=o[b]+u[p],S=o[b+1]+u[p+1],C=o[b+2];g+=(A*v.a+S*v.b+v.worldX)*C,x+=(A*v.c+S*v.d+v.worldY)*C}i[w]=g,i[w+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},ss=class We{static _nextID=0;id=We.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new We(this.regions.length);return R.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let r=t.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(t,s){let r=t,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return We._nextID++}},is=(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))(is||{}),rs=[0,1,2,3,4,5,6],Xe=class{name;timelines=[];timelineIds=new $e;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,r,i,h,l,a){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let n=this.timelines;for(let o=0,c=n.length;o<c;o++)n[o].apply(e,t,s,i,h,l,a)}},as=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(as||{}),ns=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ns||{}),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},H=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 r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let i=s;i<r;i+=s)if(e[i]>t)return i-s;return r-s}},re=class extends H{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,r,i,h,l,a,n,o,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(r-h*2+a)*.03,u=(i-l*2+n)*.03,w=((h-a)*3-r+o)*.006,b=((l-n)*3-i+c)*.006,p=m*2+w,g=u*2+b,x=(h-r)*.3+m+w*.16666667,y=(l-i)*.3+u+b*.16666667,v=r+x,A=i+y;for(let S=d+18;d<S;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let n=this.frames[t],o=this.frames[t+s];return o+(e-n)/(i[r]-n)*(i[r+1]-o)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=e){let n=i[r-2],o=i[r-1];return o+(e-n)/(i[r]-n)*(i[r+1]-o)}t+=this.getFrameEntries();let l=i[h-2],a=i[h-1];return a+(e-l)/(this.frames[t]-l)*(this.frames[t+s]-a)}},se=class extends re{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 i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=t[s],h=t[s+1];return h+(e-i)/(t[s+2]-i)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let h=this.getCurveValue(e);switch(s){case 0:return i+h*t;case 1:case 2:h+=i-r}return r+h*t}getAbsoluteValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let h=this.getCurveValue(e);return s==0?i+(h-i)*t:r+(h-r)*t}getAbsoluteValue2(e,t,s,r,i,h){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}return s==0?i+(h-i)*t:r+(h-r)*t}getScaleValue(e,t,s,r,i,h){const l=this.frames;if(e<l[0]){switch(s){case 0:return h;case 1:return i+(h-i)*t}return i}let a=this.getCurveValue(e)*h;if(t==1)return s==3?i+a-h:a;if(r==1)switch(s){case 0:return h+(Math.abs(a)*P.signum(h)-h)*t;case 1:case 2:return i+(Math.abs(a)*P.signum(i)-i)*t}else{let n=0;switch(s){case 0:return n=Math.abs(h)*P.signum(a),n+(a-n)*t;case 1:case 2:return n=Math.abs(i)*P.signum(a),n+(a-n)*t}}return i+(a-h)*t}},Fe=class extends re{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Ae=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,i,h,a.rotation,a.data.rotation))}},je=class extends Fe{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*i,a.y+=(a.data.y-a.y)*i}return}let o=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);o+=(n[f+3+1]-o)*u,c+=(n[f+3+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.x=a.data.x+o*i,a.y=a.data.y+c*i;break;case 1:case 2:a.x+=(a.data.x+o-a.x)*i,a.y+=(a.data.y+c-a.y)*i;break;case 3:a.x+=o*i,a.y+=c*i}}},Je=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,i,h,a.x,a.data.x))}},Ke=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,i,h,a.y,a.data.y))}},Qe=class extends Fe{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*i,a.scaleY+=(a.data.scaleY-a.scaleY)*i}return}let o,c,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);o+=(n[f+3+1]-o)*u,c+=(n[f+3+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(o*=a.data.scaleX,c*=a.data.scaleY,i==1)h==3?(a.scaleX+=o-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=o,a.scaleY=c);else{let m=0,u=0;if(l==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(o)*P.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*P.signum(u)-u)*i;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(o)*P.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*P.signum(u)-u)*i;break;case 3:a.scaleX+=(o-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}else switch(h){case 0:m=Math.abs(a.data.scaleX)*P.signum(o),u=Math.abs(a.data.scaleY)*P.signum(c),a.scaleX=m+(o-m)*i,a.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(a.scaleX)*P.signum(o),u=Math.abs(a.scaleY)*P.signum(c),a.scaleX=m+(o-m)*i,a.scaleY=u+(c-u)*i;break;case 3:a.scaleX+=(o-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}}}},Ze=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,i,h,l,a.scaleX,a.data.scaleX))}},et=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,i,h,l,a.scaleY,a.data.scaleY))}},tt=class extends Fe{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*i,a.shearY+=(a.data.shearY-a.shearY)*i}return}let o=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);o+=(n[f+3+1]-o)*u,c+=(n[f+3+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.shearX=a.data.shearX+o*i,a.shearY=a.data.shearY+c*i;break;case 1:case 2:a.shearX+=(a.data.shearX+o-a.shearX)*i,a.shearY+=(a.data.shearY+c-a.shearY)*i;break;case 3:a.shearX+=o*i,a.shearY+=c*i}}},st=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,i,h,a.shearX,a.data.shearX))}},it=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,q.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,l){let a=e.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,i,h,a.shearY,a.data.shearY))}},rt=class extends H{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,r,i,h,l){let a=e.bones[this.boneIndex];if(!a.active)return;if(l==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[H.search(n,s,2)+1]}},at=class extends re{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,r,i,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h}apply(e,t,s,r,i,h,l){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color;if(s<n[0]){let b=a.data.color;switch(h){case 0:o.setFromColor(b);return;case 1:o.add((b.r-o.r)*i,(b.g-o.g)*i,(b.b-o.b)*i,(b.a-o.a)*i)}return}let c=0,f=0,d=0,m=0,u=H.search(n,s,5),w=this.curves[u/5];switch(w){case 0:let b=n[u];c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];let p=(s-b)/(n[u+5]-b);c+=(n[u+5+1]-c)*p,f+=(n[u+5+2]-f)*p,d+=(n[u+5+3]-d)*p,m+=(n[u+5+4]-m)*p;break;case 1:c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,w-2),f=this.getBezierValue(s,u,2,w+18-2),d=this.getBezierValue(s,u,3,w+18*2-2),m=this.getBezierValue(s,u,4,w+18*3-2)}i==1?o.set(c,f,d,m):(h==0&&o.setFromColor(a.data.color),o.add((c-o.r)*i,(f-o.g)*i,(d-o.b)*i,(m-o.a)*i))}},nt=class extends re{slotIndex=0;constructor(e,t,s){super(e,t,[q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i}apply(e,t,s,r,i,h,l){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color;if(s<n[0]){let w=a.data.color;switch(h){case 0:o.r=w.r,o.g=w.g,o.b=w.b;return;case 1:o.r+=(w.r-o.r)*i,o.g+=(w.g-o.g)*i,o.b+=(w.b-o.b)*i}return}let c=0,f=0,d=0,m=H.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let w=n[m];c=n[m+1],f=n[m+2],d=n[m+3];let b=(s-w)/(n[m+4]-w);c+=(n[m+4+1]-c)*b,f+=(n[m+4+2]-f)*b,d+=(n[m+4+3]-d)*b;break;case 1:c=n[m+1],f=n[m+2],d=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2),d=this.getBezierValue(s,m,3,u+18*2-2)}if(i==1)o.r=c,o.g=f,o.b=d;else{if(h==0){let w=a.data.color;o.r=w.r,o.g=w.g,o.b=w.b}o.r+=(c-o.r)*i,o.g+=(f-o.g)*i,o.b+=(d-o.b)*i}}},lt=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,q.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,h,l){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*i}return}let o=this.getCurveValue(s);i==1?n.a=o:(h==0&&(n.a=a.data.color.a),n.a+=(o-n.a)*i)}},ot=class extends re{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,r,i,h,l,a,n){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=a,this.frames[e+7]=n}apply(e,t,s,r,i,h,l){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:o.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:o.add((y.r-o.r)*i,(y.g-o.g)*i,(y.b-o.b)*i,(y.a-o.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,8),x=this.curves[g>>3];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];let v=(s-y)/(n[g+8]-y);f+=(n[g+8+1]-f)*v,d+=(n[g+8+2]-d)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,w+=(n[g+8+5]-w)*v,b+=(n[g+8+6]-b)*v,p+=(n[g+8+7]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],b=n[g+6],p=n[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),w=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),p=this.getBezierValue(s,g,7,x+18*6-2)}if(i==1)o.set(f,d,m,u),c.r=w,c.g=b,c.b=p;else{if(h==0){o.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}o.add((f-o.r)*i,(d-o.g)*i,(m-o.b)*i,(u-o.a)*i),c.r+=(w-c.r)*i,c.g+=(b-c.g)*i,c.b+=(p-c.b)*i}}},ht=class extends re{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,r,i,h,l,a){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=a}apply(e,t,s,r,i,h,l){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,o=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:o.r=y.r,o.g=y.g,o.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:o.r+=(y.r-o.r)*i,o.g+=(y.g-o.g)*i,o.b+=(y.b-o.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,b=0,p=0,g=H.search(n,s,7),x=this.curves[g/7];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];let v=(s-y)/(n[g+7]-y);f+=(n[g+7+1]-f)*v,d+=(n[g+7+2]-d)*v,m+=(n[g+7+3]-m)*v,w+=(n[g+7+4]-w)*v,b+=(n[g+7+5]-b)*v,p+=(n[g+7+6]-p)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],b=n[g+5],p=n[g+6];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),w=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),p=this.getBezierValue(s,g,6,x+18*5-2)}if(i==1)o.r=f,o.g=d,o.b=m,c.r=w,c.g=b,c.b=p;else{if(h==0){let y=a.data.color,v=a.data.darkColor;o.r=y.r,o.g=y.g,o.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}o.r+=(f-o.r)*i,o.g+=(d-o.g)*i,o.b+=(m-o.b)*i,c.r+=(w-c.r)*i,c.g+=(b-c.g)*i,c.b+=(p-c.b)*i}}},ue=class extends H{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,r,i,h,l){let a=e.slots[this.slotIndex];if(a.bone.active){if(l==1){h==0&&this.setAttachment(e,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,a,a.data.attachmentName);return}this.setAttachment(e,a,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ct=class extends re{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[q.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,i,h,l,a,n,o,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(r-h*2+a)*.03,u=n*.03-l*.06,w=((h-a)*3-r+o)*.006,b=(l-n+.33333333)*.018,p=m*2+w,g=u*2+b,x=(h-r)*.3+m+w*.16666667,y=l*.3+u+b*.16666667,v=r+x,A=y;for(let S=d+18;d<S;d+=2)f[d]=v,f[d+1]=A,x+=p,y+=g,p+=w,g+=b,v+=x,A+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let a=this.frames[t];return(e-a)/(this.frames[t+this.getFrameEntries()]-a);case 1:return 0}if(r-=2,s[r]>e){let a=this.frames[t];return s[r+1]*(e-a)/(s[r]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let a=s[r-2],n=s[r-1];return n+(e-a)/(s[r]-a)*(s[r+1]-n)}let h=s[i-2],l=s[i-1];return l+(1-l)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,i,h,l){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof le)||n.timelineAttachment!=this.attachment)return;let o=a.deform;o.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:o.length=0;return;case 1:if(i==1){o.length=0;return}o.length=f;let g=n;if(g.bones){i=1-i;for(var m=0;m<f;m++)o[m]*=i}else{let x=g.vertices;for(var m=0;m<f;m++)o[m]+=(x[m]-o[m])*i}}return}if(o.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(i==1)if(h==3){let x=n;if(x.bones)for(let y=0;y<f;y++)o[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)o[v]+=g[v]-y[v]}}else R.arrayCopy(g,0,o,0,f);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<f;v++)o[v]=g[v]*i;else{let v=y.vertices;for(let A=0;A<f;A++){let S=v[A];o[A]=S+(g[A]-S)*i}}break}case 1:case 2:for(let y=0;y<f;y++)o[y]+=(g[y]-o[y])*i;break;case 3:let x=n;if(x.bones)for(let y=0;y<f;y++)o[y]+=g[y]*i;else{let y=x.vertices;for(let v=0;v<f;v++)o[v]+=(g[v]-y[v])*i}}return}let u=H.search1(d,s),w=this.getCurvePercent(s,u),b=c[u],p=c[u+1];if(i==1)if(h==3){let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];o[x]+=y+(p[x]-y)*w}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];o[y]+=v+(p[y]-v)*w-x[y]}}}else for(let g=0;g<f;g++){let x=b[g];o[g]=x+(p[g]-x)*w}else switch(h){case 0:{let x=n;if(x.bones)for(let y=0;y<f;y++){let v=b[y];o[y]=(v+(p[y]-v)*w)*i}else{let y=x.vertices;for(let v=0;v<f;v++){let A=b[v],S=y[v];o[v]=S+(A+(p[v]-A)*w-S)*i}}break}case 1:case 2:for(let x=0;x<f;x++){let y=b[x];o[x]+=(y+(p[x]-y)*w-o[x])*i}break;case 3:let g=n;if(g.bones)for(let x=0;x<f;x++){let y=b[x];o[x]+=(y+(p[x]-y)*w)*i}else{let x=g.vertices;for(let y=0;y<f;y++){let v=b[y];o[y]+=(v+(p[y]-v)*w-x[y])*i}}}}},Ee=class Bs extends H{static propertyIds=[""+q.event];events;constructor(t){super(t,Bs.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,r,i,h,l,a){if(!i)return;let n=this.frames,o=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,h,l,a),s=-1;else if(s>=n[o-1])return;if(r<n[0])return;let c=0;if(s<n[0])c=0;else{c=H.search1(n,s)+1;let f=n[c];for(;c>0&&n[c-1]==f;)c--}for(;c<o&&r>=n[c];c++)i.push(this.events[c])}},we=class Vs extends H{static propertyIds=[""+q.drawOrder];drawOrders;constructor(t){super(t,Vs.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,r){this.frames[t]=s,this.drawOrders[t]=r}apply(t,s,r,i,h,l,a){if(a==1){l==0&&R.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(l==0||l==1)&&R.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let n=H.search1(this.frames,r),o=this.drawOrders[n];if(!o)R.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,f=t.slots;for(let d=0,m=o.length;d<m;d++)c[d]=f[o[d]]}}},dt=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,[q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,i,h,l){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h?1:0,this.frames[e+5]=l?1:0}apply(e,t,s,r,i,h,l){let a=e.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*i,a.softness+=(a.data.softness-a.softness)*i,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let o=0,c=0,f=H.search(n,s,6),d=this.curves[f/6];switch(d){case 0:let m=n[f];o=n[f+1],c=n[f+2];let u=(s-m)/(n[f+6]-m);o+=(n[f+6+1]-o)*u,c+=(n[f+6+2]-c)*u;break;case 1:o=n[f+1],c=n[f+2];break;default:o=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(a.mix=a.data.mix+(o-a.data.mix)*i,a.softness=a.data.softness+(c-a.data.softness)*i,l==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0)):(a.mix+=(o-a.mix)*i,a.softness+=(c-a.softness)*i,l==0&&(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0))}},ft=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,[q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,l,a){let n=this.frames;e*=7,n[e]=t,n[e+1]=s,n[e+2]=r,n[e+3]=i,n[e+4]=h,n[e+5]=l,n[e+6]=a}apply(e,t,s,r,i,h,l){let a=e.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let p=a.data;switch(h){case 0:a.mixRotate=p.mixRotate,a.mixX=p.mixX,a.mixY=p.mixY,a.mixScaleX=p.mixScaleX,a.mixScaleY=p.mixScaleY,a.mixShearY=p.mixShearY;return;case 1:a.mixRotate+=(p.mixRotate-a.mixRotate)*i,a.mixX+=(p.mixX-a.mixX)*i,a.mixY+=(p.mixY-a.mixY)*i,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*i,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*i,a.mixShearY+=(p.mixShearY-a.mixShearY)*i}return}let o,c,f,d,m,u,w=H.search(n,s,7),b=this.curves[w/7];switch(b){case 0:let p=n[w];o=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];let g=(s-p)/(n[w+7]-p);o+=(n[w+7+1]-o)*g,c+=(n[w+7+2]-c)*g,f+=(n[w+7+3]-f)*g,d+=(n[w+7+4]-d)*g,m+=(n[w+7+5]-m)*g,u+=(n[w+7+6]-u)*g;break;case 1:o=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];break;default:o=this.getBezierValue(s,w,1,b-2),c=this.getBezierValue(s,w,2,b+18-2),f=this.getBezierValue(s,w,3,b+18*2-2),d=this.getBezierValue(s,w,4,b+18*3-2),m=this.getBezierValue(s,w,5,b+18*4-2),u=this.getBezierValue(s,w,6,b+18*5-2)}if(h==0){let p=a.data;a.mixRotate=p.mixRotate+(o-p.mixRotate)*i,a.mixX=p.mixX+(c-p.mixX)*i,a.mixY=p.mixY+(f-p.mixY)*i,a.mixScaleX=p.mixScaleX+(d-p.mixScaleX)*i,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*i,a.mixShearY=p.mixShearY+(u-p.mixShearY)*i}else a.mixRotate+=(o-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i,a.mixScaleX+=(d-a.mixScaleX)*i,a.mixScaleY+=(m-a.mixScaleY)*i,a.mixShearY+=(u-a.mixShearY)*i}},ut=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,l){let a=e.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,i,h,a.position,a.data.position))}},mt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,l){let a=e.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,i,h,a.spacing,a.data.spacing))}},gt=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,[q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,i){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=r,h[e+3]=i}apply(e,t,s,r,i,h,l){let a=e.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*i,a.mixX+=(a.data.mixX-a.mixX)*i,a.mixY+=(a.data.mixY-a.mixY)*i}return}let o,c,f,d=H.search(n,s,4),m=this.curves[d>>2];switch(m){case 0:let u=n[d];o=n[d+1],c=n[d+2],f=n[d+3];let w=(s-u)/(n[d+4]-u);o+=(n[d+4+1]-o)*w,c+=(n[d+4+2]-c)*w,f+=(n[d+4+3]-f)*w;break;case 1:o=n[d+1],c=n[d+2],f=n[d+3];break;default:o=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),f=this.getBezierValue(s,d,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(o-u.mixRotate)*i,a.mixX=u.mixX+(c-u.mixX)*i,a.mixY=u.mixY+(f-u.mixY)*i}else a.mixRotate+=(o-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i}},ce=class extends se{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,l){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const o of e.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,i,h,this.get(o),this.setup(o),n))}else a=e.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,i,h,this.get(a),this.setup(a)))}},xt=class extends ce{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}},wt=class extends ce{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}},pt=class extends ce{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}},bt=class extends ce{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}},yt=class extends ce{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}},vt=class extends ce{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}},At=class extends ce{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}},St=class Ls extends H{static propertyIds=[q.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Ls.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,h,l,a){let n;if(this.constraintIndex!=-1&&(n=t.physicsConstraints[this.constraintIndex],!n.active))return;const o=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],h,l,a),s=-1;else if(s>=o[o.length-1])return;if(!(r<o[0])&&(s<o[0]||r>=o[H.search1(o,s)+1]))if(n!=null)n.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},It=class de extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[q.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return de.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,r,i,h){let l=this.frames;t*=de.ENTRIES,l[t]=s,l[t+de.MODE]=r|i<<4,l[t+de.DELAY]=h}apply(t,s,r,i,h,l,a){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let o=n.attachment,c=this.attachment;if(o!=c&&(!(o instanceof le)||o.timelineAttachment!=c))return;if(a==1){l==0&&(n.sequenceIndex=-1);return}let f=this.frames;if(r<f[0]){(l==0||l==1)&&(n.sequenceIndex=-1);return}let d=H.search(f,r,de.ENTRIES),m=f[d],u=f[d+de.MODE],w=f[d+de.DELAY];if(!this.attachment.sequence)return;let b=u>>4,p=this.attachment.sequence.regions.length,g=rs[u&15];if(g!=0)switch(b+=(r-m)/w+1e-5|0,g){case 1:b=Math.min(p-1,b);break;case 2:b%=p;break;case 3:{let x=(p<<1)-2;b=x==0?0:b%x,b>=p&&(b=x-b);break}case 4:b=Math.max(p-1-b,0);break;case 5:b=p-1-b%p;break;case 6:{let x=(p<<1)-2;b=x==0?0:(b+p-1)%x,b>=p&&(b=x-b)}}n.sequenceIndex=b}},ls=class Ue{static _emptyAnimation=new Xe("<empty>",[],0);static emptyAnimation(){return Ue._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new hs(this);propertyIDs=new $e;animationsChanged=!1;trackEntryPool=new ve(()=>new os);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let l=t*h.timeScale;if(h.delay>0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+t)*a.timeScale,h.trackTime+=l,this.setCurrent(r,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(t,s){let r=t.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((r.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let d=0,m=r.length;d<m;d++){let u=r[d];if(!u||u.delay>0)continue;i=!0;let w=d==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,t,w):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let p=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,S=A.length;if(d==0&&b==1||w==3){d==0&&(p=!0);for(let C=0;C<S;C++){R.webkit602BugfixHelper(b,w);var h=A[C];h instanceof ue?this.applyAttachmentTimeline(h,t,y,w,p):h.apply(t,g,y,v,b,w,0)}}else{let C=u.timelineMode,k=u.shortestRotation,Y=!k&&u.timelinesRotation.length!=S<<1;Y&&(u.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let F=A[M],E=C[M]==Re?w:0;!k&&F instanceof Ae?this.applyRotateTimeline(F,t,y,b,E,u.timelinesRotation,M<<1,Y):F instanceof ue?this.applyAttachmentTimeline(F,t,y,w,p):(R.webkit602BugfixHelper(b,w),F.apply(t,g,y,v,b,E,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var l=this.unkeyedState+Tt,a=t.slots,n=0,o=t.slots.length;n<o;n++){var c=a[n];if(c.attachmentState==l){var f=c.data.attachmentName;c.setAttachment(f?t.getAttachment(c.data.index,f):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,s,r){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;t.mixDuration==0?(h=1,r==1&&(r=0)):(h=t.mixTime/t.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let l=h<i.mixAttachmentThreshold,a=h<i.mixDrawOrderThreshold,n=i.animation.timelines,o=n.length,c=i.alpha*t.interruptAlpha,f=c*(1-h),d=i.animationLast,m=i.getAnimationTime(),u=m,w=null;if(i.reverse?u=i.animation.duration-u:h<i.eventThreshold&&(w=this.events),r==3)for(let b=0;b<o;b++)n[b].apply(s,d,u,w,f,r,1);else{let b=i.timelineMode,p=i.timelineHoldMix,g=i.shortestRotation,x=!g&&i.timelinesRotation.length!=o<<1;x&&(i.timelinesRotation.length=o<<1),i.totalAlpha=0;for(let y=0;y<o;y++){let v=n[y],A=1,S,C=0;switch(b[y]){case Re:if(!a&&v instanceof we)continue;S=r,C=f;break;case Ct:S=0,C=f;break;case kt:S=r,C=c;break;case Pe:S=0,C=c;break;default:S=0;let k=p[y];C=c*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=C,!g&&v instanceof Ae?this.applyRotateTimeline(v,s,u,C,S,i.timelinesRotation,y<<1,x):v instanceof ue?this.applyAttachmentTimeline(v,s,u,S,l&&C>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(C,r),a&&v instanceof we&&S==0&&(A=0),v.apply(s,d,u,w,C,S,A))}}return t.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(t,s,r,i,h){var l=s.slots[t.slotIndex];l.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,l,l.data.attachmentName,h):this.setAttachment(s,l,t.attachmentNames[H.search1(t.frames,r)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+Tt))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+fs)}applyRotateTimeline(t,s,r,i,h,l,a,n){if(n&&(l[a]=0),i==1){t.apply(s,0,r,null,1,h,0);return}let o=s.bones[t.boneIndex];if(!o.active)return;let c=t.frames,f=0,d=0;if(r<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:f=o.rotation,d=o.data.rotation}else f=h==0?o.data.rotation:o.rotation,d=o.data.rotation+t.getCurveValue(r);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=l[a];else{let w=0,b=0;n?(w=0,b=u):(w=l[a],b=l[a+1]);let p=w-w%360;m=u+p;let g=u>=0,x=w>=0;Math.abs(b)<=90&&P.signum(b)!=P.signum(u)&&(Math.abs(w-p)>180?(m+=360*P.signum(w),x=g):p!=0?m-=360*P.signum(w):x=g),x!=g&&(m+=360*P.signum(w)),l[a]=m}l[a+1]=u,o.rotation=f+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,h=i-r,l=t.trackLast%h,a=this.events,n=0,o=a.length;for(;n<o;n++){let f=a[n];if(f.time<l)break;f.time>i||this.queue.event(t,f)}let c=!1;if(t.loop)if(h==0)c=!0;else{const f=Math.floor(t.trackTime/h);c=f>0&&f>Math.floor(t.trackLast/h)}else c=s>=i&&t.animationLast<i;for(c&&this.queue.complete(t);n<o;n++){let f=a[n];f.time<r||this.queue.event(t,f)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,r){let i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,i,r)}setAnimationWith(t,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let l=this.trackEntry(t,s,r,h);return this.setCurrent(t,l,i),this.queue.drain(),l}addAnimation(t,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,r,i)}addAnimationWith(t,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(t,s,r,h);return h?(h.next=l,l.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(t,l,!0),this.queue.drain(),i<0&&(i=0)),l.delay=i,l}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,Ue.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,Ue.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(R.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let s=t.mixingTo,r=t.animation.timelines,i=t.animation.timelines.length,h=t.timelineMode;h.length=i;let l=t.timelineHoldMix;l.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<i;n++)h[n]=a.addAll(r[n].getPropertyIds())?Pe:kt;return}e:for(let n=0;n<i;n++){let o=r[n],c=o.getPropertyIds();if(!a.addAll(c))h[n]=Re;else if(!s||o instanceof ue||o instanceof we||o instanceof Ee||!s.animation.hasTimeline(c))h[n]=Ct;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(t.mixDuration>0){h[n]=ds,l[n]=f;continue e}break}h[n]=Pe}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},os=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}},hs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),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 r=e[s],i=e[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let l=0;l<t.length;l++){let a=t[l];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let l=0;l<t.length;l++){let a=t[l];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let l=0;l<t.length;l++){let a=t[l];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let l=0;l<t.length;l++){let a=t[l];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let l=0;l<t.length;l++){let a=t[l];a.complete&&a.complete(i)}break;case 5:let h=e[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let l=0;l<t.length;l++){let a=t[l];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},cs=(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))(cs||{}),Js=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Re=0,Ct=1,kt=2,Pe=3,ds=4,Tt=1,fs=2,us=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);this.setMixWith(r,i,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Mt=class Ns extends le{color=new N(1,1,1,1);constructor(t){super(t)}copy(){let t=new Ns(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Be=class Ds extends le{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ds(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Yt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ve=(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))(Ve||{}),ms=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ms||{}),gs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ks=class extends Yt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Le=class{pages=new Array;regions=new Array;constructor(e){let t=new Qs(e),s=new Array(4),r={};r.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},r.format=()=>{},r.filter=o=>{o.minFilter=R.enumValue(Ve,s[1]),o.magFilter=R.enumValue(Ve,s[2])},r.repeat=o=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},r.pma=o=>{o.pma=s[1]=="true"};var i={};i.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},i.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},i.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},i.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},i.rotate=o=>{let c=s[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},i.index=o=>{o.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let l=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)l=null,h=t.readLine();else if(l){let o=new Xt(l,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let f=i[s[0]];if(f)f(o);else{a||(a=[]),n||(n=[]),a.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));n.push(d)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height),a&&a.length>0&&n&&n.length>0&&(o.names=a,o.values=n,a=null,n=null),o.u=o.x/l.width,o.v=o.y/l.height,o.degrees==90?(o.u2=(o.x+o.height)/l.width,o.v2=(o.y+o.width)/l.height):(o.u2=(o.x+o.width)/l.width,o.v2=(o.y+o.height)/l.height),this.regions.push(o)}else{for(l=new xs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let o=r[s[0]];o&&o(l)}this.pages.push(l)}}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()}},Qs=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 r=1,i=s+1;;r++){let h=t.indexOf(",",i);if(h==-1)return e[r]=t.substr(i).trim(),r;if(e[r]=t.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},xs=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}},Xt=class extends gs{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)}},Se=class $t extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=R.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,l=0,a=0;if(this.region instanceof Xt){let n=this.region,o=n.page,c=o.width,f=o.height;switch(n.degrees){case 90:i-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/f,l=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+t[d+1]*l,s[d+1]=h+(1-t[d])*a;return;case 180:i-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/f,l=n.originalWidth/c,a=n.originalHeight/f;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d])*l,s[d+1]=h+(1-t[d+1])*a;return;case 270:i-=n.offsetY/c,h-=n.offsetX/f,l=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d+1])*l,s[d+1]=h+t[d]*a;return}i-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/f,l=n.originalWidth/c,a=n.originalHeight/f}else this.region?(l=this.region.u2-i,a=this.region.v2-h):(i=h=0,l=a=1);for(let n=0;n<r;n+=2)s[n]=i+t[n]*l,s[n+1]=h+t[n+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new $t(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?R.newFloatArray(this.uvs.length):new Array(this.uvs.length),R.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,r,i,h,l){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,h,l)}newLinkedMesh(){let t=new $t(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},Ie=class Os extends le{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(t){super(t)}copy(){let t=new Os(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),R.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},ws=class qs extends le{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*P.degRad,r=Math.cos(s),i=Math.sin(s),h=r*t.a+i*t.b,l=r*t.c+i*t.d;return P.atan2Deg(l,h)}copy(){let t=new qs(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Ne=class Ws extends He{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,l=-this.height/2*this.scaleY+this.region.offsetY*i,a=h+this.region.width*r,n=l+this.region.height*i,o=this.rotation*P.degRad,c=Math.cos(o),f=Math.sin(o),d=this.x,m=this.y,u=h*c+d,w=h*f,b=l*c+m,p=l*f,g=a*c+d,x=a*f,y=n*c+m,v=n*f,A=this.offset;A[0]=u-p,A[1]=b+w,A[2]=u-v,A[3]=y+w,A[4]=g-v,A[5]=y+x,A[6]=g-p,A[7]=b+x,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,r,i){this.sequence!=null&&this.sequence.apply(t,this);let h=t.bone,l=this.offset,a=h.worldX,n=h.worldY,o=h.a,c=h.b,f=h.c,d=h.d,m=0,u=0;m=l[0],u=l[1],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=l[2],u=l[3],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=l[4],u=l[5],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=l[6],u=l[7],s[r]=m*o+u*c+a,s[r+1]=m*f+u*d+n}copy(){let t=new Ws(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,R.arrayCopy(this.uvs,0,t.uvs,0,8),R.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},ps=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let l=s.getPath(t,i),a=this.atlas.findRegion(l);if(a==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+e+")");r[i]=a}}newRegionAttachment(e,t,s,r){let i=new Ne(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");i.region=h}return i}newMeshAttachment(e,t,s,r){let i=new Se(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");i.region=h}return i}newBoundingBoxAttachment(e,t){return new Mt(t)}newPathAttachment(e,t){return new Ie(t)}newPointAttachment(e,t){return new ws(t)}newClippingAttachment(e,t){return new Be(t)}},Ft=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new N;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}},De=(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))(De||{}),Et=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,r,i,h,l){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=l;let a=this.parent;if(!a){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,w=(s+h)*P.degRad,b=(s+90+l)*P.degRad;this.a=Math.cos(w)*r*m,this.b=Math.cos(b)*i*m,this.c=Math.sin(w)*r*u,this.d=Math.sin(b)*i*u,this.worldX=e*m+d.x,this.worldY=t*u+d.y;return}let n=a.a,o=a.b,c=a.c,f=a.d;switch(this.worldX=n*e+o*t+a.worldX,this.worldY=c*e+f*t+a.worldY,this.inherit){case 0:{const d=(s+h)*P.degRad,m=(s+90+l)*P.degRad,u=Math.cos(d)*r,w=Math.cos(m)*i,b=Math.sin(d)*r,p=Math.sin(m)*i;this.a=n*u+o*b,this.b=n*w+o*p,this.c=c*u+f*b,this.d=c*w+f*p;return}case 1:{const d=(s+h)*P.degRad,m=(s+90+l)*P.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(m)*i,this.c=Math.sin(d)*r,this.d=Math.sin(m)*i;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=d,c*=m;let u=n*n+c*c,w=0;u>1e-4?(u=Math.abs(n*f*m-o*d*c)/u,o=c*u,f=n*u,w=Math.atan2(c,n)*P.radDeg):(n=0,c=0,w=90-Math.atan2(f,o)*P.radDeg);const b=(s+h-w)*P.degRad,p=(s+l-w+90)*P.degRad,g=Math.cos(b)*r,x=Math.cos(p)*i,y=Math.sin(b)*r,v=Math.sin(p)*i;this.a=n*g-o*y,this.b=n*x-o*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=P.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(n*d+o*m)/this.skeleton.scaleX,w=(c*d+f*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+w*w);b>1e-5&&(b=1/b),u*=b,w*=b,b=Math.sqrt(u*u+w*w),this.inherit==3&&n*f-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(w,u);const p=Math.cos(s)*b,g=Math.sin(s)*b;h*=P.degRad,l=(90+l)*P.degRad;const x=Math.cos(h)*r,y=Math.cos(l)*i,v=Math.sin(h)*r,A=Math.sin(l)*i;this.a=u*x+p*v,this.b=u*y+p*A,this.c=w*x+g*v,this.d=w*y+g*A;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)*P.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)*P.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,h=1/(t*i-s*r),l=i*h,a=s*h,n=r*h,o=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*l-f*a,this.ay=f*o-c*n;let d,m,u,w;if(this.inherit==1)d=this.a,m=this.b,u=this.c,w=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*i-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*i-s*r),l=i*h,a=s*h;break}case 3:case 4:let b=P.cosDeg(this.rotation),p=P.sinDeg(this.rotation);t=(t*b+s*p)/this.skeleton.scaleX,r=(r*b+i*p)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=P.PI/2+Math.atan2(r,t);s=Math.cos(x)*g,i=Math.sin(x)*g,h=1/(t*i-s*r),l=i*h,a=s*h,n=r*h,o=t*h}d=l*this.a-a*this.c,m=l*this.b-a*this.d,u=o*this.c-n*this.a,w=o*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let b=d*w-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*w,b)*P.radDeg,this.arotation=Math.atan2(u,d)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+w*w),this.ashearY=0,this.arotation=90-Math.atan2(w,m)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.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,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*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=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*P.radDeg}rotateWorld(e){e*=P.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,i=this.b;this.a=s*r-t*this.c,this.b=s*i-t*this.d,this.c=t*r+s*this.c,this.d=t*i+s*this.d}},Ce=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},Zs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new ys,r=new bs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=r}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,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 r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),r(h)},(h,l)=>{const a=`Couldn't load binary ${e}: status ${h}, ${l}`;this.error(s,e,a),i(a)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),r(h)},(h,l)=>{const a=`Couldn't load JSON ${e}: status ${h}, ${l}`;this.error(s,e,a),i(a)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[e],i=r!==void 0;return i&&(this.cache.assetsLoaded[e]=r.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(t,e,h),h)).catch(h=>this.error(s,e,h))),i}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.textureLoader(a);this.success(t,e,n),r(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.textureLoader(a);this.success(t,e,n),r(n)},a.onerror=()=>{const n=`Couldn't load image: ${e}`;this.error(s,e,n),i(n)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),a.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let i=e.lastIndexOf("/"),h=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((l,a)=>{this.downloader.downloadText(e,n=>{try{let o=new Le(n),c=o.pages.length,f=!1;for(let d of o.pages)this.loadTexture(r?r[d.name]:h+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(t,e,o),l(o)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,w),a(w)}f=!0})}catch(o){const c=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,c),a(c)}},(n,o)=>{const c=`Couldn't load texture atlas ${e}: status ${n}, ${o}`;this.error(s,e,c),a(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},r){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,h)=>{this.downloader.downloadText(e,l=>{try{const a=new Le(l);this.success(t,e,a),i(a)}catch(a){const n=`Couldn't parse texture atlas ${e}: ${a.message}`;this.error(s,e,n),h(n)}},(l,a)=>{const n=`Couldn't load texture atlas ${e}: status ${l}, ${a}`;this.error(s,e,n),h(n)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(r,i)=>t(i),(r,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
-
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){--this.cache.assetsRefCount[e]===0&&this.remove(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},bs=class ze{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ze.AVAILABLE_CACHES.get(t);if(s)return s;const r=new ze;return ze.AVAILABLE_CACHES.set(t,r),r}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},ys=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,r=new Uint8Array(s),i=0;i<s;i++)r[i]=t.charCodeAt(i);return r}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;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToString(r))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||e,!0);let h=()=>{this.finish(e,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(r))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let i=new XMLHttpRequest;i.open("GET",r||e,!0),i.responseType="arraybuffer";let h=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let i=t==200||t==0?[s]:[t,s];for(let h=i.length-1,l=r.length;h<l;h+=2)r[h].apply(null,i)}},Rt=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}},Pt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},vs=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 r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(i)}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,r,i,h,l){let a=e.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,o=a.b,c=a.c,f=a.d,d=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*P.signum(e.skeleton.scaleX),u=(s-e.worldY)*P.signum(e.skeleton.scaleY);break;case 2:let p=Math.abs(n*f-o*c)/Math.max(1e-4,n*n+c*c),g=n/e.skeleton.scaleX,x=c/e.skeleton.scaleY;o=-x*p*e.skeleton.scaleX,f=g*p*e.skeleton.scaleY,d+=Math.atan2(x,g)*P.radDeg;default:let y=t-a.worldX,v=s-a.worldY,A=n*f-o*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*o)/A-e.ax,u=(v*n-y*c)/A-e.ay)}d+=Math.atan2(u,m)*P.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=e.ascaleX,b=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const p=e.data.length*w;if(p>1e-4){const g=m*m+u*u;if(r&&g<p*p||i&&g>p*p){const x=(Math.sqrt(g)/p-1)*l+1;w*=x,h&&(b*=x)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*l,w,b,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,h,l,a,n){if(e.inherit!=0||t.inherit!=0)return;let o=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,u=d,w=t.ascaleX,b=0,p=0,g=0;f<0?(f=-f,b=180,g=-1):(b=0,g=1),d<0&&(d=-d,g=-g),w<0?(w=-w,p=180):p=0;let x=t.ax,y=0,v=0,A=0,S=e.a,C=e.b,k=e.c,Y=e.d,M=Math.abs(f-d)<=1e-4;!M||h?(y=0,v=S*x+e.worldX,A=k*x+e.worldY):(y=t.ay,v=S*x+C*y+e.worldX,A=k*x+Y*y+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,C=F.b,k=F.c,Y=F.d;let E=S*Y-C*k,T=v-F.worldX,X=A-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let V=(T*Y-X*C)*E-o,D=(X*S-T*k)*E-c,L=Math.sqrt(V*V+D*D),O=t.data.length*w,$,z;if(L<1e-4){this.apply1(e,s,r,!1,h,!1,n),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}T=s-F.worldX,X=r-F.worldY;let j=(T*Y-X*C)*E-o,B=(X*S-T*k)*E-c,W=j*j+B*B;if(a!=0){a*=f*(w+1)*.5;let J=Math.sqrt(W),K=J-L-O*f+a;if(K>0){let Q=Math.min(1,K/(a*2))-1;Q=(K-a*(1-Q*Q))/J,j-=Q*j,B-=Q*B,W=j*j+B*B}}e:if(M){O*=f;let J=(W-L*L-O*O)/(2*L*O);J<-1?(J=-1,z=Math.PI*i):J>1?(J=1,z=0,h&&(S=(Math.sqrt(W)/(L+O)-1)*n+1,m*=S,l&&(u*=S))):z=Math.acos(J)*i,S=L+O*J,C=O*Math.sin(z),$=Math.atan2(B*S-j*C,j*S+B*C)}else{S=f*O,C=d*O;let J=S*S,K=C*C,Q=Math.atan2(B,j);k=K*L*L+J*W-J*K;let ie=-2*K*L,ge=K-J;if(Y=ie*ie-4*ge*k,Y>=0){let xe=Math.sqrt(Y);ie<0&&(xe=-xe),xe=-(ie+xe)*.5;let ye=xe/ge,Zt=k/xe,Me=Math.abs(ye)<Math.abs(Zt)?ye:Zt;if(ye=W-Me*Me,ye>=0){X=Math.sqrt(ye)*i,$=Q-Math.atan2(X,Me),z=Math.atan2(X/d,(Me-L)/f);break e}}let be=P.PI,ke=L-S,_e=ke*ke,Jt=0,Kt=0,Te=L+S,Ge=Te*Te,Qt=0;k=-S*L/(J-K),k>=-1&&k<=1&&(k=Math.acos(k),T=S*Math.cos(k)+L,X=C*Math.sin(k),Y=T*T+X*X,Y<_e&&(be=k,_e=Y,ke=T,Jt=X),Y>Ge&&(Kt=k,Ge=Y,Te=T,Qt=X)),W<=(_e+Ge)*.5?($=Q-Math.atan2(Jt*i,ke),z=be*i):($=Q-Math.atan2(Qt*i,Te),z=Kt*i)}let G=Math.atan2(y,x)*g,ee=e.arotation;$=($-G)*P.radDeg+b-ee,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(o,c,ee+$*n,m,u,0,0),ee=t.arotation,z=((z+G)*P.radDeg-t.ashearX)*g+p-ee,z>180?z-=360:z<-180&&(z+=360),t.updateWorldTransformWith(x,y,ee+z*n,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Bt=class extends Ce{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)}},Vt=class extends Ce{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=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Lt=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Lt||{}),Nt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Nt||{}),Dt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Dt||{}),As=class fe{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;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(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0,h=t.bones.length;i<h;i++){let l=s.findBone(t.bones[i].name);if(!l)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(l)}let r=s.findSlot(t.target.name);if(!r)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=r,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof Ie))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let l=this.data,a=l.rotateMode==0,n=l.rotateMode==2,o=this.bones,c=o.length,f=a?c:c+1,d=R.setArraySize(this.spaces,f),m=n?this.lengths=R.setArraySize(this.lengths,c):[],u=this.spacing;switch(l.spacingMode){case 2:if(n)for(let A=0,S=f-1;A<S;A++){let C=o[A],k=C.data.length,Y=k*C.a,M=k*C.c;m[A]=Math.sqrt(Y*Y+M*M)}R.arrayFill(d,1,f,u);break;case 3:let y=0;for(let A=0,S=f-1;A<S;){let C=o[A],k=C.data.length;if(k<fe.epsilon)n&&(m[A]=0),d[++A]=u;else{let Y=k*C.a,M=k*C.c,F=Math.sqrt(Y*Y+M*M);n&&(m[A]=F),d[++A]=F,y+=F}}if(y>0){y=f/y*u;for(let A=1;A<f;A++)d[A]*=y}break;default:let v=l.spacingMode==0;for(let A=0,S=f-1;A<S;){let C=o[A],k=C.data.length;if(k<fe.epsilon)n&&(m[A]=0),d[++A]=u;else{let Y=k*C.a,M=k*C.c,F=Math.sqrt(Y*Y+M*M);n&&(m[A]=F),d[++A]=(v?k+u:u)*F/k}}}let w=this.computeWorldPositions(s,f,a),b=w[0],p=w[1],g=l.offsetRotation,x=!1;if(g==0)x=l.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?P.degRad:-P.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=o[y];A.worldX+=(b-A.worldX)*i,A.worldY+=(p-A.worldY)*h;let S=w[v],C=w[v+1],k=S-b,Y=C-p;if(n){let M=m[y];if(M!=0){let F=(Math.sqrt(k*k+Y*Y)/M-1)*r+1;A.a*=F,A.c*=F}}if(b=S,p=C,r>0){let M=A.a,F=A.b,E=A.c,T=A.d,X=0,V=0,D=0;if(a?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(Y,k),X-=Math.atan2(E,M),x){V=Math.cos(X),D=Math.sin(X);let L=A.data.length;b+=(L*(V*M-D*E)-k)*r,p+=(L*(D*M+V*E)-Y)*r}else X+=g;X>P.PI?X-=P.PI2:X<-P.PI&&(X+=P.PI2),X*=r,V=Math.cos(X),D=Math.sin(X),A.a=V*M-D*E,A.b=V*F-D*T,A.c=D*M+V*E,A.d=D*F+V*T}A.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,h=this.position,l=this.spaces,a=R.setArraySize(this.positions,s*3+2),n=this.world,o=t.closed,c=t.worldVerticesLength,f=c/6,d=fe.NONE;if(!t.constantSpeed){let L=t.lengths;f-=o?1:2;let O=L[f];this.data.positionMode==1&&(h*=O);let $;switch(this.data.spacingMode){case 2:$=O;break;case 3:$=O/s;break;default:$=1}n=R.setArraySize(this.world,8);for(let z=0,j=0,B=0;z<s;z++,j+=3){let W=l[z]*$;h+=W;let G=h;if(o)G%=O,G<0&&(G+=O),B=0;else if(G<0){d!=fe.BEFORE&&(d=fe.BEFORE,t.computeWorldVertices(i,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>O){d!=fe.AFTER&&(d=fe.AFTER,t.computeWorldVertices(i,c-6,4,n,0,2)),this.addAfterPosition(G-O,n,0,a,j);continue}for(;;B++){let ee=L[B];if(!(G>ee)){if(B==0)G/=ee;else{let J=L[B-1];G=(G-J)/(ee-J)}break}}B!=d&&(d=B,o&&B==f?(t.computeWorldVertices(i,c-4,4,n,0,2),t.computeWorldVertices(i,0,4,n,4,2)):t.computeWorldVertices(i,B*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,j,r||z>0&&W==0)}return a}o?(c+=2,n=R.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,n,0,2),t.computeWorldVertices(i,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(f--,c-=4,n=R.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,n,0,2));let m=R.setArraySize(this.curves,f),u=0,w=n[0],b=n[1],p=0,g=0,x=0,y=0,v=0,A=0,S=0,C=0,k=0,Y=0,M=0,F=0,E=0,T=0;for(let L=0,O=2;L<f;L++,O+=6)p=n[O],g=n[O+1],x=n[O+2],y=n[O+3],v=n[O+4],A=n[O+5],S=(w-p*2+x)*.1875,C=(b-g*2+y)*.1875,k=((p-x)*3-w+v)*.09375,Y=((g-y)*3-b+A)*.09375,M=S*2+k,F=C*2+Y,E=(p-w)*.75+S+k*.16666667,T=(g-b)*.75+C+Y*.16666667,u+=Math.sqrt(E*E+T*T),E+=M,T+=F,M+=k,F+=Y,u+=Math.sqrt(E*E+T*T),E+=M,T+=F,u+=Math.sqrt(E*E+T*T),E+=M+k,T+=F+Y,u+=Math.sqrt(E*E+T*T),m[L]=u,w=v,b=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let V=this.segments,D=0;for(let L=0,O=0,$=0,z=0;L<s;L++,O+=3){let j=l[L]*X;h+=j;let B=h;if(o)B%=u,B<0&&(B+=u),$=0;else if(B<0){this.addBeforePosition(B,n,0,a,O);continue}else if(B>u){this.addAfterPosition(B-u,n,c-4,a,O);continue}for(;;$++){let W=m[$];if(!(B>W)){if($==0)B/=W;else{let G=m[$-1];B=(B-G)/(W-G)}break}}if($!=d){d=$;let W=$*6;for(w=n[W],b=n[W+1],p=n[W+2],g=n[W+3],x=n[W+4],y=n[W+5],v=n[W+6],A=n[W+7],S=(w-p*2+x)*.03,C=(b-g*2+y)*.03,k=((p-x)*3-w+v)*.006,Y=((g-y)*3-b+A)*.006,M=S*2+k,F=C*2+Y,E=(p-w)*.3+S+k*.16666667,T=(g-b)*.3+C+Y*.16666667,D=Math.sqrt(E*E+T*T),V[0]=D,W=1;W<8;W++)E+=M,T+=F,M+=k,F+=Y,D+=Math.sqrt(E*E+T*T),V[W]=D;E+=M,T+=F,D+=Math.sqrt(E*E+T*T),V[8]=D,E+=M+k,T+=F+Y,D+=Math.sqrt(E*E+T*T),V[9]=D,z=0}for(B*=D;;z++){let W=V[z];if(!(B>W)){if(z==0)B/=W;else{let G=V[z-1];B=z+(B-G)/(W-G)}break}}this.addCurvePosition(B*.1,w,b,p,g,x,y,v,A,a,O,r||L>0&&j==0)}return a}addBeforePosition(t,s,r,i,h){let l=s[r],a=s[r+1],n=s[r+2]-l,o=s[r+3]-a,c=Math.atan2(o,n);i[h]=l+t*Math.cos(c),i[h+1]=a+t*Math.sin(c),i[h+2]=c}addAfterPosition(t,s,r,i,h){let l=s[r+2],a=s[r+3],n=l-s[r],o=a-s[r+1],c=Math.atan2(o,n);i[h]=l+t*Math.cos(c),i[h+1]=a+t*Math.sin(c),i[h+2]=c}addCurvePosition(t,s,r,i,h,l,a,n,o,c,f,d){if(t==0||isNaN(t)){c[f]=s,c[f+1]=r,c[f+2]=Math.atan2(h-r,i-s);return}let m=t*t,u=m*t,w=1-t,b=w*w,p=b*w,g=w*t,x=g*3,y=w*x,v=x*t,A=s*p+i*y+l*v+n*u,S=r*p+h*y+a*v+o*u;c[f]=A,c[f+1]=S,d&&(t<.001?c[f+2]=Math.atan2(h-r,i-s):c[f+2]=Math.atan2(S-(r*b+h*g*2+a*m),A-(s*b+i*g*2+l*m)))}},ei=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,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,a=l.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=n.time;const c=l.worldX,f=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=f;else{let d=this.remaining,m=this.inertia,u=this.data.step,w=this.skeleton.data.referenceScale,b=-1,p=this.data.limit*o,g=p*Math.abs(n.scaleY);if(p*=Math.abs(n.scaleX),s||r){if(s){const x=(this.ux-c)*m;this.xOffset+=x>p?p:x<-p?-p:x,this.ux=c}if(r){const x=(this.uy-f)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=f}if(d>=u){b=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*w*n.scaleX,A=this.gravity*w*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),r&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),d-=u;while(d>=u)}s&&(l.worldX+=this.xOffset*t*this.data.x),r&&(l.worldY+=this.yOffset*t*this.data.y)}if(i||h){let x=Math.atan2(l.c,l.a),y=0,v=0,A=0,S=this.cx-l.worldX,C=this.cy-l.worldY;if(S>p?S=p:S<-p&&(S=-p),C>g?C=g:C<-g&&(C=-g),i){A=(this.data.rotate+this.data.shearX)*t;let k=Math.atan2(C+this.ty,S+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(k-Math.ceil(k*P.invPI2-.5)*P.PI2)*m,k=this.rotateOffset*A+x,y=Math.cos(k),v=Math.sin(k),h&&(k=a*l.getWorldScaleX(),k>0&&(this.scaleOffset+=(S*y+C*v)*m/k))}else{y=Math.cos(x),v=Math.sin(x);const k=a*l.getWorldScaleX();k>0&&(this.scaleOffset+=(S*y+C*v)*m/k)}if(d=this.remaining,d>=u){b==-1&&(b=Math.pow(this.damping,60*u));const k=this.massInverse*u,Y=this.strength,M=this.wind,F=Oe.yDown?-this.gravity:this.gravity,E=a/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*k,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),i){if(this.rotateVelocity-=((M*v+F*y)*E+this.rotateOffset*Y)*k,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,d<u)break;const T=this.rotateOffset*A+x;y=Math.cos(T),v=Math.sin(T)}else if(d<u)break}}this.remaining=d}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*t*this.data.x),r&&(l.worldY+=this.yOffset*t*this.data.y)}if(i){let n=this.rotateOffset*t,o=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=n*this.data.rotate,o=Math.sin(d),c=Math.cos(d),f=l.b,l.b=c*f-o*l.d,l.d=o*f+c*l.d),d+=n*this.data.shearX,o=Math.sin(d),c=Math.cos(d),f=l.a,l.a=c*f-o*l.c,l.c=o*f+c*l.c}else n*=this.data.rotate,o=Math.sin(n),c=Math.cos(n),f=l.a,l.a=c*f-o*l.c,l.c=o*f+c*l.c,f=l.b,l.b=c*f-o*l.d,l.d=o*f+c*l.d}if(h){const n=1+this.scaleOffset*t*this.data.scaleX;l.a*=n,l.c*=n}e!=3&&(this.tx=a*l.a,this.ty=a*l.c),l.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*P.degRad,i=Math.cos(r),h=Math.sin(r),l=this.cx-e,a=this.cy-t;this.translate(l*i-a*h-l,l*h+a*i-a)}},Ss=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 N,this.darkColor=e.darkColor?new N: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}},Is=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ye;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 r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(i)}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,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,a=this.target,n=a.a,o=a.b,c=a.c,f=a.d,d=n*f-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(e!=0){let x=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)-Math.atan2(v,x)+m;S>P.PI?S-=P.PI2:S<-P.PI&&(S+=P.PI2),S*=e;let C=Math.cos(S),k=Math.sin(S);g.a=C*x-k*v,g.b=C*y-k*A,g.c=k*x+C*v,g.d=k*y+C*A}if(l){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*t,g.worldY+=(x.y-g.worldY)*s}if(r!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(n*n+c*c)-x+this.data.offsetScaleX)*r)/x),g.a*=x,g.c*=x}if(i!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(o*o+f*f)-x+this.data.offsetScaleY)*i)/x),g.b*=x,g.d*=x}if(h>0){let x=g.b,y=g.d,v=Math.atan2(y,x),A=Math.atan2(f,o)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>P.PI?A-=P.PI2:A<-P.PI&&(A+=P.PI2),A=v+(A+u)*h;let S=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*S,g.d=Math.sin(A)*S}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,a=this.target,n=a.a,o=a.b,c=a.c,f=a.d,d=n*f-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let b=0,p=w.length;b<p;b++){let g=w[b];if(e!=0){let x=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)+m;S>P.PI?S-=P.PI2:S<-P.PI&&(S+=P.PI2),S*=e;let C=Math.cos(S),k=Math.sin(S);g.a=C*x-k*v,g.b=C*y-k*A,g.c=k*x+C*v,g.d=k*y+C*A}if(l){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*t,g.worldY+=x.y*s}if(r!=0){let x=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=x,g.c*=x}if(i!=0){let x=(Math.sqrt(o*o+f*f)-1+this.data.offsetScaleY)*i+1;g.b*=x,g.d*=x}if(h>0){let x=Math.atan2(f,o)-Math.atan2(c,n);x>P.PI?x-=P.PI2:x<-P.PI&&(x+=P.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-P.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*A,g.d=Math.sin(x)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=this.target,a=this.bones;for(let n=0,o=a.length;n<o;n++){let c=a[n],f=c.arotation;e!=0&&(f+=(l.arotation-f+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(l.ax-d+this.data.offsetX)*t,m+=(l.ay-m+this.data.offsetY)*s;let u=c.ascaleX,w=c.ascaleY;r!=0&&u!=0&&(u=(u+(l.ascaleX-u+this.data.offsetScaleX)*r)/u),i!=0&&w!=0&&(w=(w+(l.ascaleY-w+this.data.offsetScaleY)*i)/w);let b=c.ashearY;h!=0&&(b+=(l.ashearY-b+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,l=this.target,a=this.bones;for(let n=0,o=a.length;n<o;n++){let c=a[n],f=c.arotation+(l.arotation+this.data.offsetRotation)*e,d=c.ax+(l.ax+this.data.offsetX)*t,m=c.ay+(l.ay+this.data.offsetY)*s,u=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*r+1),w=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*i+1),b=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,b)}}},Oe=class Ht{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ht.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=t.bones[s],i;if(!r.parent)i=new Et(r,this,null);else{let h=this.bones[r.parent.index];i=new Et(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let r=t.slots[s],i=this.bones[r.boneData.index],h=new Ss(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let r=t.ikConstraints[s];this.ikConstraints.push(new vs(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new Is(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new As(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new ei(r,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let u=s[d];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let w=this.bones[d[m].index];do w.sorted=!1,w.active=!0,w=w.parent;while(w)}}let r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,l=this.physicsConstraints,a=r.length,n=i.length,o=h.length,c=this.physicsConstraints.length,f=a+n+o+c;e:for(let d=0;d<f;d++){for(let m=0;m<a;m++){let u=r[m];if(u.data.order==d){this.sortIkConstraint(u);continue e}}for(let m=0;m<n;m++){let u=i[m];if(u.data.order==d){this.sortTransformConstraint(u);continue e}}for(let m=0;m<o;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=l[m];if(u.data.order==d){this.sortPhysicsConstraint(u);continue e}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&R.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let r=t.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&R.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let n=0,o=this.data.skins.length;n<o;n++)this.sortPathConstraintAttachment(this.data.skins[n],r,i);let h=s.getAttachment();h instanceof Ie&&this.sortPathConstraintAttachmentWith(h,i);let l=t.bones,a=l.length;for(let n=0;n<a;n++)this.sortBone(l[n]);this._updateCache.push(t);for(let n=0;n<a;n++)this.sortReset(l[n].children);for(let n=0;n<a;n++)l[n].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&R.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,r=s.length;if(t.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(t);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(t,s,r){let i=t.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Ie))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,l=r.length;h<l;){let a=r[h++];for(a+=h;h<a;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,r=t.length;s<r;s++){let i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let l=s[i];l.ax=l.x,l.ay=l.y,l.arotation=l.rotation,l.ascaleX=l.scaleX,l.ascaleY=l.scaleY,l.ashearX=l.shearX,l.ashearY=l.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let b=1,p=r.length;b<p;b++){let g=r[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,l=s.b,a=s.c,n=s.d;i.worldX=h*this.x+l*this.y+s.worldX,i.worldY=a*this.x+n*this.y+s.worldY;const o=(i.rotation+i.shearX)*P.degRad,c=(i.rotation+90+i.shearY)*P.degRad,f=Math.cos(o)*i.scaleX,d=Math.cos(c)*i.scaleY,m=Math.sin(o)*i.scaleX,u=Math.sin(c)*i.scaleY;i.a=(h*f+l*m)*this.scaleX,i.b=(h*d+l*u)*this.scaleX,i.c=(a*f+n*m)*this.scaleY,i.d=(a*d+n*u)*this.scaleY;let w=this._updateCache;for(let b=0,p=w.length;b<p;b++){let g=w[b];g!=i&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;R.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,r=t.length;s<r;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==t)return h}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==t)return h}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],l=h.data.attachmentName;if(l){let a=t.getAttachment(r,l);a&&h.setAttachment(a)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let r=this.data.findSlot(t);if(!r)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(r.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(t,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let l=r[i];if(l.data.name==t){let a=null;if(s&&(a=this.getAttachment(i,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+t);l.setAttachment(a);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Ye,r=new Ye;return this.getBounds(s,r,void 0,t),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(t,s,r=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,f=h.length;c<f;c++){let d=h[c];if(!d.bone.active)continue;let m=0,u=null,w=null,b=d.getAttachment();if(b instanceof Ne)m=8,u=R.setArraySize(r,m,0),b.computeWorldVertices(d,u,0,2),w=Ht.quadTriangles;else if(b instanceof Se){let p=b;m=p.worldVerticesLength,u=R.setArraySize(r,m,0),p.computeWorldVertices(d,0,m,u,0,2),w=p.triangles}else if(b instanceof Be&&i!=null){i.clipStart(d,b);continue}if(u&&w){i!=null&&i.isClipping()&&(i.clipTriangles(u,w,w.length),u=i.clippedVertices,m=i.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let x=u[p],y=u[p+1];l=Math.min(l,x),a=Math.min(a,y),n=Math.max(n,x),o=Math.max(o,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(l,a),s.set(n-l,o-a)}update(t){this.time+=t}physicsTranslate(t,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(t,s)}physicsRotate(t,s,r){const i=this.physicsConstraints;for(let h=0,l=i.length;h<l;h++)i[h].rotate(t,s,r)}},Cs=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Cs||{}),ks=class extends Ce{_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)}},Ot=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,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}},qt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},qe=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.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 r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==i){h=!0;break}h||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==i){h=!0;break}h||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof Se?(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 r in s){let i=s[r];i&&e.push(new qt(t,r,i))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new qt(e,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let i=e.slots[r],h=i.getAttachment();if(h&&s<t.attachments.length){let l=t.attachments[s];for(let a in l){let n=l[a];if(h==n){let o=this.getAttachment(s,a);o&&i.setAttachment(o);break}}}s++}}},Wt=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;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}},Ut=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Ut||{}),zt=class extends Ce{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)}},Ts=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ot;s.name="";let r=new Ms(e),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let l=r.readBoolean();l&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let a=0;a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let f=o==0?null:s.bones[r.readInt(!0)],d=new Ft(o,c,f);d.rotation=r.readFloat(),d.x=r.readFloat()*t,d.y=r.readFloat()*t,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*t,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),l&&(N.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[r.readInt(!0)],d=new Wt(o,c,f);N.rgba8888ToColor(d.color,r.readInt32());let m=r.readInt32();m!=-1&&N.rgb888ToColor(d.darkColor=new N,m),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),l&&(d.visible=r.readBoolean()),s.slots.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){let f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Bt(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(d.softness=r.readFloat()*t),s.ikConstraints.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){let f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new zt(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=r.readFloat()),(m&16)!=0&&(d.offsetX=r.readFloat()*t),(m&32)!=0&&(d.offsetY=r.readFloat()*t),(m&64)!=0&&(d.offsetScaleX=r.readFloat()),(m&128)!=0&&(d.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(d.offsetShearY=r.readFloat()),(m&2)!=0&&(d.mixRotate=r.readFloat()),(m&4)!=0&&(d.mixX=r.readFloat()),(m&8)!=0&&(d.mixY=r.readFloat()),(m&16)!=0&&(d.mixScaleX=r.readFloat()),(m&32)!=0&&(d.mixScaleY=r.readFloat()),(m&64)!=0&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){let f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Vt(f);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const m=r.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}a=r.readInt(!0);for(let o=0,c;o<a;o++){const f=r.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new ks(f);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=r.readFloat()),(m&4)!=0&&(d.y=r.readFloat()),(m&8)!=0&&(d.rotate=r.readFloat()),(m&16)!=0&&(d.scaleX=r.readFloat()),(m&32)!=0&&(d.shearX=r.readFloat()),d.limit=((m&64)!=0?r.readFloat():5e3)*t,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=(m&128)!=0?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(d)}let n=this.readSkin(r,s,!0,l);n&&(s.defaultSkin=n,s.skins.push(n));{let o=s.skins.length;for(R.setArraySize(s.skins,a=o+r.readInt(!0));o<a;o++){let c=this.readSkin(r,s,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[o]=c}}a=this.linkedMeshes.length;for(let o=0;o<a;o++){let c=this.linkedMeshes[o];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let f=new Pt(c);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}a=r.readInt(!0);for(let o=0;o<a;o++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(e,t,s,r){let i=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;i=new qe("default")}else{let l=e.readString();if(!l)throw new Error("Skin name must not be null.");i=new qe(l),r&&N.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let a=0,n=i.bones.length;a<n;a++)i.bones[a]=t.bones[e.readInt(!0)];for(let a=0,n=e.readInt(!0);a<n;a++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let l=0;l<h;l++){let a=e.readInt(!0);for(let n=0,o=e.readInt(!0);n<o;n++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,i,a,c,r);f&&i.setAttachment(a,c,f)}}return i}readAttachment(e,t,s,r,i,h){let l=this.scale,a=e.readByte();const n=(a&8)!=0?e.readStringRef():i;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let o=(a&16)!=0?e.readStringRef():null;const c=(a&32)!=0?e.readInt32():4294967295,f=(a&64)!=0?this.readSequence(e):null;let d=(a&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),w=e.readFloat(),b=e.readFloat(),p=e.readFloat(),g=e.readFloat();o||(o=n);let x=this.attachmentLoader.newRegionAttachment(s,n,o,f);return x?(x.path=o,x.x=m*l,x.y=u*l,x.scaleX=w,x.scaleY=b,x.rotation=d,x.width=p*l,x.height=g*l,N.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let o=this.readVertices(e,(a&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,n);return f?(f.worldVerticesLength=o.length,f.vertices=o.vertices,f.bones=o.bones,h&&N.rgba8888ToColor(f.color,c),f):null}case 2:{let o=(a&16)!=0?e.readStringRef():n;const c=(a&32)!=0?e.readInt32():4294967295,f=(a&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(a&128)!=0),u=this.readFloatArray(e,m.length,1),w=this.readShortArray(e,(m.length-d-2)*3);let b=[],p=0,g=0;h&&(b=this.readShortArray(e,e.readInt(!0)),p=e.readFloat(),g=e.readFloat()),o||(o=n);let x=this.attachmentLoader.newMeshAttachment(s,n,o,f);return x?(x.path=o,N.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=w,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,h&&(x.edges=b,x.width=p*l,x.height=g*l),x):null}case 3:{const o=(a&16)!=0?e.readStringRef():n;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?e.readInt32():4294967295,f=(a&64)!=0?this.readSequence(e):null,d=(a&128)!=0,m=e.readInt(!0),u=e.readStringRef();let w=0,b=0;h&&(w=e.readFloat(),b=e.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,n,o,f);return p?(p.path=o,N.rgba8888ToColor(p.color,c),p.sequence=f,h&&(p.width=w*l,p.height=b*l),this.linkedMeshes.push(new ti(p,m,r,u,d)),p):null}case 4:{const o=(a&16)!=0,c=(a&32)!=0,f=this.readVertices(e,(a&64)!=0),d=R.newArray(f.length/6,0);for(let w=0,b=d.length;w<b;w++)d[w]=e.readFloat()*l;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=o,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,h&&N.rgba8888ToColor(u.color,m),u):null}case 5:{const o=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*l,m.y=f*l,m.rotation=o,h&&N.rgba8888ToColor(m.color,d),m):null}case 6:{const o=e.readInt(!0),c=this.readVertices(e,(a&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,n);return d?(d.endSlot=t.slots[o],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&N.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){let t=new ss(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,r=e.readInt(!0),i=new si;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let h=new Array,l=new Array;for(let a=0;a<r;a++){let n=e.readInt(!0);l.push(n);for(let o=0;o<n;o++)l.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return i.vertices=R.toFloatArray(h),i.bones=l,i}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let i=0;i<t;i++)r[i]=e.readFloat();else for(let i=0;i<t;i++)r[i]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,i=this.scale;for(let n=0,o=e.readInt(!0);n<o;n++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),u=e.readInt(!0),w=u-1;switch(m){case mi:{let b=new ue(u,c);for(let p=0;p<u;p++)b.setFrame(p,e.readFloat(),e.readStringRef());r.push(b);break}case gi:{let b=e.readInt(!0),p=new at(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let S=0,C=0;p.setFrame(S,g,x,y,v,A),S!=w;S++){let k=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(S);break;case he:U(e,p,C++,S,0,g,k,x,Y,1),U(e,p,C++,S,1,g,k,y,M,1),U(e,p,C++,S,2,g,k,v,F,1),U(e,p,C++,S,3,g,k,A,E,1)}g=k,x=Y,y=M,v=F,A=E}r.push(p);break}case xi:{let b=e.readInt(!0),p=new nt(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,S=0;p.setFrame(A,g,x,y,v),A!=w;A++){let C=e.readFloat(),k=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(A);break;case he:U(e,p,S++,A,0,g,C,x,k,1),U(e,p,S++,A,1,g,C,y,Y,1),U(e,p,S++,A,2,g,C,v,M,1)}g=C,x=k,y=Y,v=M}r.push(p);break}case wi:{let b=e.readInt(!0),p=new ot(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let Y=0,M=0;p.setFrame(Y,g,x,y,v,A,S,C,k),Y!=w;Y++){let F=e.readFloat(),E=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(Y);break;case he:U(e,p,M++,Y,0,g,F,x,E,1),U(e,p,M++,Y,1,g,F,y,T,1),U(e,p,M++,Y,2,g,F,v,X,1),U(e,p,M++,Y,3,g,F,A,V,1),U(e,p,M++,Y,4,g,F,S,D,1),U(e,p,M++,Y,5,g,F,C,L,1),U(e,p,M++,Y,6,g,F,k,O,1)}g=F,x=E,y=T,v=X,A=V,S=D,C=L,k=O}r.push(p);break}case pi:{let b=e.readInt(!0),p=new ht(u,b,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let k=0,Y=0;p.setFrame(k,g,x,y,v,A,S,C),k!=w;k++){let M=e.readFloat(),F=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(k);break;case he:U(e,p,Y++,k,0,g,M,x,F,1),U(e,p,Y++,k,1,g,M,y,E,1),U(e,p,Y++,k,2,g,M,v,T,1),U(e,p,Y++,k,3,g,M,A,X,1),U(e,p,Y++,k,4,g,M,S,V,1),U(e,p,Y++,k,5,g,M,C,D,1)}g=M,x=F,y=E,v=T,A=X,S=V,C=D}r.push(p);break}case bi:{let b=new lt(u,e.readInt(!0),c),p=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,p,g),x!=w;x++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(x);break;case he:U(e,b,y++,x,0,p,v,g,A,1)}p=v,g=A}r.push(b)}}}}for(let n=0,o=e.readInt(!0);n<o;n++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),u=e.readInt(!0);if(m==ui){let b=new rt(u,c);for(let p=0;p<u;p++)b.setFrame(p,e.readFloat(),e.readByte());r.push(b);continue}let w=e.readInt(!0);switch(m){case ii:r.push(Z(e,new Ae(u,w,c),1));break;case ri:r.push(_t(e,new je(u,w,c),i));break;case ai:r.push(Z(e,new Je(u,w,c),i));break;case ni:r.push(Z(e,new Ke(u,w,c),i));break;case li:r.push(_t(e,new Qe(u,w,c),1));break;case oi:r.push(Z(e,new Ze(u,w,c),1));break;case hi:r.push(Z(e,new et(u,w,c),1));break;case ci:r.push(_t(e,new tt(u,w,c),1));break;case di:r.push(Z(e,new st(u,w,c),1));break;case fi:r.push(Z(e,new it(u,w,c),1))}}}for(let n=0,o=e.readInt(!0);n<o;n++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new dt(f,e.readInt(!0),c),u=e.readByte(),w=e.readFloat(),b=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,p=(u&4)!=0?e.readFloat()*i:0;for(let g=0,x=0;m.setFrame(g,w,b,p,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=e.readByte();const y=e.readFloat(),v=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,A=(u&4)!=0?e.readFloat()*i:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(U(e,m,x++,g,0,w,y,b,v,1),U(e,m,x++,g,1,w,y,p,A,i)),w=y,b=v,p=A}r.push(m)}for(let n=0,o=e.readInt(!0);n<o;n++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new ft(f,e.readInt(!0),c),u=e.readFloat(),w=e.readFloat(),b=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,b,p,g,x,y),v!=d;v++){let S=e.readFloat(),C=e.readFloat(),k=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat(),E=e.readFloat();switch(e.readByte()){case oe:m.setStepped(v);break;case he:U(e,m,A++,v,0,u,S,w,C,1),U(e,m,A++,v,1,u,S,b,k,1),U(e,m,A++,v,2,u,S,p,Y,1),U(e,m,A++,v,3,u,S,g,M,1),U(e,m,A++,v,4,u,S,x,F,1),U(e,m,A++,v,5,u,S,y,E,1)}u=S,w=C,b=k,p=Y,g=M,x=F,y=E}r.push(m)}for(let n=0,o=e.readInt(!0);n<o;n++){let c=e.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=e.readInt(!0);d<m;d++){const u=e.readByte(),w=e.readInt(!0),b=e.readInt(!0);switch(u){case Ai:r.push(Z(e,new ut(w,b,c),f.positionMode==0?i:1));break;case Si:r.push(Z(e,new mt(w,b,c),f.spacingMode==0||f.spacingMode==1?i:1));break;case Ii:let p=new gt(w,b,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,S=0,C=p.getFrameCount()-1;p.setFrame(A,g,x,y,v),A!=C;A++){let k=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:p.setStepped(A);break;case he:U(e,p,S++,A,0,g,k,x,Y,1),U(e,p,S++,A,1,g,k,y,M,1),U(e,p,S++,A,2,g,k,v,F,1)}g=k,x=Y,y=M,v=F}r.push(p)}}}for(let n=0,o=e.readInt(!0);n<o;n++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const m=e.readByte(),u=e.readInt(!0);if(m==Ei){const b=new St(u,c);for(let p=0;p<u;p++)b.setFrame(p,e.readFloat());r.push(b);continue}const w=e.readInt(!0);switch(m){case Ci:r.push(Z(e,new xt(u,w,c),1));break;case ki:r.push(Z(e,new wt(u,w,c),1));break;case Ti:r.push(Z(e,new pt(u,w,c),1));break;case Mi:r.push(Z(e,new bt(u,w,c),1));break;case Yi:r.push(Z(e,new yt(u,w,c),1));break;case Xi:r.push(Z(e,new vt(u,w,c),1));break;case Fi:r.push(Z(e,new At(u,w,c),1))}}}for(let n=0,o=e.readInt(!0);n<o;n++){let c=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readInt(!0);for(let u=0,w=e.readInt(!0);u<w;u++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,b),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case yi:{let v=p,A=v.bones,S=v.vertices,C=A?S.length/3*2:S.length,k=e.readInt(!0),Y=new ct(x,k,m,v),M=e.readFloat();for(let F=0,E=0;;F++){let T,X=e.readInt(!0);if(X==0)T=A?R.newFloatArray(C):S;else{T=R.newFloatArray(C);let D=e.readInt(!0);if(X+=D,i==1)for(let L=D;L<X;L++)T[L]=e.readFloat();else for(let L=D;L<X;L++)T[L]=e.readFloat()*i;if(!A)for(let L=0,O=T.length;L<O;L++)T[L]+=S[L]}if(Y.setFrame(F,M,T),F==y)break;let V=e.readFloat();switch(e.readByte()){case oe:Y.setStepped(F);break;case he:U(e,Y,E++,F,0,M,V,0,1,1)}M=V}r.push(Y);break}case vi:{let v=new It(x,m,p);for(let A=0;A<x;A++){let S=e.readFloat(),C=e.readInt32();v.setFrame(A,S,rs[C&15],C>>4,e.readFloat())}r.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let n=new we(h),o=s.slots.length;for(let c=0;c<h;c++){let f=e.readFloat(),d=e.readInt(!0),m=R.newArray(o,0);for(let p=o-1;p>=0;p--)m[p]=-1;let u=R.newArray(o-d,0),w=0,b=0;for(let p=0;p<d;p++){let g=e.readInt(!0);for(;w!=g;)u[b++]=w++;m[w+e.readInt(!0)]=w++}for(;w<o;)u[b++]=w++;for(let p=o-1;p>=0;p--)m[p]==-1&&(m[p]=u[--b]);n.setFrame(c,f,m)}r.push(n)}let l=e.readInt(!0);if(l>0){let n=new Ee(l);for(let o=0;o<l;o++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new Rt(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),n.setFrame(o,d)}r.push(n)}let a=0;for(let n=0,o=r.length;n<o;n++)a=Math.max(a,r[n].getDuration());return new Xe(t,r,a)}},Ms=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}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)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(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 r=0;r<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(i),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},ti=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},si=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function Z(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let h=0,l=0,a=t.getFrameCount()-1;t.setFrame(h,r,i),h!=a;h++){let n=e.readFloat(),o=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(h);break;case he:U(e,t,l++,h,0,r,n,i,o,s)}r=n,i=o}return t}function _t(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,h=e.readFloat()*s;for(let l=0,a=0,n=t.getFrameCount()-1;t.setFrame(l,r,i,h),l!=n;l++){let o=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(l);break;case he:U(e,t,a++,l,0,r,o,i,c,s),U(e,t,a++,l,1,r,o,h,f,s)}r=o,i=c,h=f}return t}function U(e,t,s,r,i,h,l,a,n,o){t.setBezier(s,r,i,h,a,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,l,n)}var ii=0,ri=1,ai=2,ni=3,li=4,oi=5,hi=6,ci=7,di=8,fi=9,ui=10,mi=0,gi=1,xi=2,wi=3,pi=4,bi=5,yi=0,vi=1,Ai=0,Si=1,Ii=2,Ci=0,ki=1,Ti=2,Mi=4,Yi=5,Xi=6,Fi=7,Ei=8,oe=1,he=2,Ri=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new ve(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=e.slots,l=h.length;s.length=0,i.freeAll(r),r.length=0;for(let a=0;a<l;a++){let n=h[a];if(!n.bone.active)continue;let o=n.getAttachment();if(o instanceof Mt){let c=o;s.push(c);let f=i.obtain();f.length!=c.worldVerticesLength&&(f=R.newFloatArray(c.worldVerticesLength)),r.push(f),c.computeWorldVertices(n,0,c.worldVerticesLength,f,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,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,l=i.length;h<l;h++){let a=i[h],n=a;for(let o=0,c=a.length;o<c;o+=2){let f=n[o],d=n[o+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),r=Math.max(r,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let i=this.minX,h=this.minY,l=this.maxX,a=this.maxY;if(e<=i&&s<=i||t<=h&&r<=h||e>=l&&s>=l||t>=a&&r>=a)return!1;let n=(r-t)/(s-e),o=n*(i-e)+t;if(o>h&&o<a||(o=n*(l-e)+t,o>h&&o<a))return!0;let c=(h-t)/n+e;return c>i&&c<l||(c=(a-t)/n+e,c>i&&c<l)}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 r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,i=e.length,h=i-2,l=!1;for(let a=0;a<i;a+=2){let n=r[a+1],o=r[h+1];if(n<s&&o>=s||o<s&&n>=s){let c=r[a];c+(s-n)/(o-n)*(r[h]-c)<t&&(l=!l)}h=a}return l}intersectsSegment(e,t,s,r){let i=this.polygons;for(let h=0,l=i.length;h<l;h++)if(this.intersectsSegmentPolygon(i[h],e,t,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,r,i){let h=e,l=e.length,a=t-r,n=s-i,o=t*i-s*r,c=h[l-2],f=h[l-1];for(let d=0;d<l;d+=2){let m=h[d],u=h[d+1],w=c*u-f*m,b=c-m,p=f-u,g=a*p-n*b,x=(o*b-a*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=r||x>=r&&x<=t)){let y=(o*p-n*w)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,f=u}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}},Ys=class te{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new ve(()=>new Array);polygonIndicesPool=new ve(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<r;a++)i[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=r;a<n;++a)h[a]=te.isConcave(a,r,s,i);let l=this.triangles;for(l.length=0;r>3;){let a=r-1,n=0,o=1;for(;;){e:if(!h[n]){let d=i[a]<<1,m=i[n]<<1,u=i[o]<<1,w=s[d],b=s[d+1],p=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(o+1)%r;v!=a;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,S=s[A],C=s[A+1];if(te.positiveArea(x,y,w,b,S,C)&&te.positiveArea(w,b,p,g,S,C)&&te.positiveArea(p,g,x,y,S,C))break e}break}if(o==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=o,o=(o+1)%r}l.push(i[(r+n-1)%r]),l.push(i[n]),l.push(i[(n+1)%r]),i.splice(n,1),h.splice(n,1),r--;let c=(r+n-1)%r,f=n==r?0:n;h[c]=te.isConcave(c,r,s,i),h[f]=te.isConcave(f,r,s,i)}return r==3&&(l.push(i[2]),l.push(i[0]),l.push(i[1])),l}decompose(t,s){let r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,o=0;for(let c=0,f=s.length;c<f;c+=3){let d=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,w=r[d],b=r[d+1],p=r[m],g=r[m+1],x=r[u],y=r[u+1],v=!1;if(n==d){let A=a.length-4,S=te.winding(a[A],a[A+1],a[A+2],a[A+3],x,y),C=te.winding(x,y,a[0],a[1],a[2],a[3]);S==o&&C==o&&(a.push(x),a.push(y),l.push(u),v=!0)}v||(a.length>0?(i.push(a),h.push(l)):(this.polygonPool.free(a),this.polygonIndicesPool.free(l)),a=this.polygonPool.obtain(),a.length=0,a.push(w),a.push(b),a.push(p),a.push(g),a.push(x),a.push(y),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(d),l.push(m),l.push(u),o=te.winding(w,b,p,g,x,y),n=d)}a.length>0&&(i.push(a),h.push(l));for(let c=0,f=i.length;c<f;c++){if(l=h[c],l.length==0)continue;let d=l[0],m=l[l.length-1];a=i[c];let u=a.length-4,w=a[u],b=a[u+1],p=a[u+2],g=a[u+3],x=a[0],y=a[1],v=a[2],A=a[3],S=te.winding(w,b,p,g,x,y);for(let C=0;C<f;C++){if(C==c)continue;let k=h[C];if(k.length!=3)continue;let Y=k[0],M=k[1],F=k[2],E=i[C],T=E[E.length-2],X=E[E.length-1];if(Y!=d||M!=m)continue;let V=te.winding(w,b,p,g,T,X),D=te.winding(T,X,x,y,v,A);V==S&&D==S&&(E.length=0,k.length=0,a.push(T),a.push(X),l.push(F),w=p,b=g,p=T,g=X,C=0)}}for(let c=i.length-1;c>=0;c--)a=i[c],a.length==0&&(i.splice(c,1),this.polygonPool.free(a),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return i}static isConcave(t,s,r,i){let h=i[(s+t-1)%s]<<1,l=i[t]<<1,a=i[(t+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[l],r[l+1],r[a],r[a+1])}static positiveArea(t,s,r,i,h,l){return t*(l-i)+r*(s-l)+h*(i-s)>=0}static winding(t,s,r,i,h,l){let a=r-t,n=i-s;return h*n-l*a+a*s-t*n>=0?1:-1}},Xs=class jt{triangulator=new Ys;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let h=this.clippingPolygon;jt.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=l.length;a<n;a++){let o=l[a];jt.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.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(t,s,r,i,h,l,a,n){let o,c,f,d,m,u;typeof s=="number"?(o=r,c=i,f=h,d=l,m=a,u=n):(o=s,c=r,f=i,d=h,m=l,u=a),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,o,c,f,d,m,u):this.clipTrianglesNoRender(t,o,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,h=this.clippedVertices,l=this.clippedTriangles,a=this.clippingPolygons,n=a.length,o=0;h.length=0,l.length=0;for(let c=0;c<r;c+=3){let f=s[c]<<1,d=t[f],m=t[f+1];f=s[c+1]<<1;let u=t[f],w=t[f+1];f=s[c+2]<<1;let b=t[f],p=t[f+1];for(let g=0;g<n;g++){let x=h.length;if(this.clip(d,m,u,w,b,p,a[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,S=R.setArraySize(h,x+v*2);for(let k=0;k<y;k+=2,x+=2){let Y=A[k],M=A[k+1];S[x]=Y,S[x+1]=M}x=l.length;let C=R.setArraySize(l,x+3*(v-2));v--;for(let k=1;k<v;k++,x+=3)C[x]=o,C[x+1]=o+k,C[x+2]=o+k+1;o+=v+1}else{let y=R.setArraySize(h,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=w,y[x+4]=b,y[x+5]=p,x=l.length;let v=R.setArraySize(l,x+3);v[x]=o,v[x+1]=o+1,v[x+2]=o+2,o+=3;break}}}}clipTrianglesRender(t,s,r,i,h,l,a){let n=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=a?12:8,u=0;o.length=0,c.length=0;for(let w=0;w<r;w+=3){let b=s[w]<<1,p=t[b],g=t[b+1],x=i[b],y=i[b+1];b=s[w+1]<<1;let v=t[b],A=t[b+1],S=i[b],C=i[b+1];b=s[w+2]<<1;let k=t[b],Y=t[b+1],M=i[b],F=i[b+1];for(let E=0;E<d;E++){let T=o.length;if(this.clip(p,g,v,A,k,Y,f[E],n)){let X=n.length;if(X==0)continue;let V=A-Y,D=k-v,L=p-k,O=Y-g,$=1/(V*L+D*(g-Y)),z=X>>1,j=this.clipOutput,B=R.setArraySize(o,T+z*m);for(let G=0;G<X;G+=2,T+=m){let ee=j[G],J=j[G+1];B[T]=ee,B[T+1]=J,B[T+2]=h.r,B[T+3]=h.g,B[T+4]=h.b,B[T+5]=h.a;let K=ee-k,Q=J-Y,ie=(V*K+D*Q)*$,ge=(O*K+L*Q)*$,be=1-ie-ge;B[T+6]=x*ie+S*ge+M*be,B[T+7]=y*ie+C*ge+F*be,a&&(B[T+8]=l.r,B[T+9]=l.g,B[T+10]=l.b,B[T+11]=l.a)}T=c.length;let W=R.setArraySize(c,T+3*(z-2));z--;for(let G=1;G<z;G++,T+=3)W[T]=u,W[T+1]=u+G,W[T+2]=u+G+1;u+=z+1}else{let X=R.setArraySize(o,T+3*m);X[T]=p,X[T+1]=g,X[T+2]=h.r,X[T+3]=h.g,X[T+4]=h.b,X[T+5]=h.a,a?(X[T+6]=x,X[T+7]=y,X[T+8]=l.r,X[T+9]=l.g,X[T+10]=l.b,X[T+11]=l.a,X[T+12]=v,X[T+13]=A,X[T+14]=h.r,X[T+15]=h.g,X[T+16]=h.b,X[T+17]=h.a,X[T+18]=S,X[T+19]=C,X[T+20]=l.r,X[T+21]=l.g,X[T+22]=l.b,X[T+23]=l.a,X[T+24]=k,X[T+25]=Y,X[T+26]=h.r,X[T+27]=h.g,X[T+28]=h.b,X[T+29]=h.a,X[T+30]=M,X[T+31]=F,X[T+32]=l.r,X[T+33]=l.g,X[T+34]=l.b,X[T+35]=l.a):(X[T+6]=x,X[T+7]=y,X[T+8]=v,X[T+9]=A,X[T+10]=h.r,X[T+11]=h.g,X[T+12]=h.b,X[T+13]=h.a,X[T+14]=S,X[T+15]=C,X[T+16]=k,X[T+17]=Y,X[T+18]=h.r,X[T+19]=h.g,X[T+20]=h.b,X[T+21]=h.a,X[T+22]=M,X[T+23]=F),T=c.length;let V=R.setArraySize(c,T+3);V[T]=u,V[T+1]=u+1,V[T+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,r,i){let h=this.clipOutput,l=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,o=this.clippingPolygons,c=o.length,f=0;l.length=0,a.length=0,n.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,u=t[m],w=t[m+1],b=i[m],p=i[m+1];m=s[d+1]<<1;let g=t[m],x=t[m+1],y=i[m],v=i[m+1];m=s[d+2]<<1;let A=t[m],S=t[m+1],C=i[m],k=i[m+1];for(let Y=0;Y<c;Y++){let M=l.length;if(this.clip(u,w,g,x,A,S,o[Y],h)){let F=h.length;if(F==0)continue;let E=x-S,T=A-g,X=u-A,V=S-w,D=1/(E*X+T*(w-S)),L=F>>1,O=this.clipOutput,$=R.setArraySize(l,M+L*2),z=R.setArraySize(a,M+L*2);for(let B=0;B<F;B+=2,M+=2){let W=O[B],G=O[B+1];$[M]=W,$[M+1]=G;let ee=W-A,J=G-S,K=(E*ee+T*J)*D,Q=(V*ee+X*J)*D,ie=1-K-Q;z[M]=b*K+y*Q+C*ie,z[M+1]=p*K+v*Q+k*ie}M=n.length;let j=R.setArraySize(n,M+3*(L-2));L--;for(let B=1;B<L;B++,M+=3)j[M]=f,j[M+1]=f+B,j[M+2]=f+B+1;f+=L+1}else{let F=R.setArraySize(l,M+6);F[M]=u,F[M+1]=w,F[M+2]=g,F[M+3]=x,F[M+4]=A,F[M+5]=S;let E=R.setArraySize(a,M+3*2);E[M]=b,E[M+1]=p,E[M+2]=y,E[M+3]=v,E[M+4]=C,E[M+5]=k,M=n.length;let T=R.setArraySize(n,M+3);T[M]=f,T[M+1]=f+1,T[M+2]=f+2,f+=3;break}}}}clip(t,s,r,i,h,l,a,n){let o=n,c=!1,f;a.length%4>=2?(f=n,n=this.scratch):f=this.scratch,f.length=0,f.push(t),f.push(s),f.push(r),f.push(i),f.push(h),f.push(l),f.push(t),f.push(s),n.length=0;let d=a.length-4,m=a;for(let u=0;;u+=2){let w=m[u],b=m[u+1],p=w-m[u+2],g=b-m[u+3],x=n.length,y=f;for(let A=0,S=f.length-2;A<S;){let C=y[A],k=y[A+1];A+=2;let Y=y[A],M=y[A+1],F=g*(w-Y)>p*(b-M),E=g*(w-C)-p*(b-k);if(E>0){if(F){n.push(Y),n.push(M);continue}let T=Y-C,X=M-k,V=E/(T*g-X*p);if(V>=0&&V<=1)n.push(C+T*V),n.push(k+X*V);else{n.push(Y),n.push(M);continue}}else if(F){let T=Y-C,X=M-k,V=E/(T*g-X*p);if(V>=0&&V<=1)n.push(C+T*V),n.push(k+X*V),n.push(Y),n.push(M);else{n.push(Y),n.push(M);continue}}c=!0}if(x==n.length)return o.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==d)break;let v=n;n=f,n.length=0,f=v}if(o!=n){o.length=0;for(let u=0,w=n.length-2;u<w;u++)o[u]=n[u]}else o.length=o.length-2;return c}static makeClockwise(t){let s=t,r=t.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,l=0,a=0,n=0;for(let o=0,c=r-3;o<c;o+=2)h=s[o],l=s[o+1],a=s[o+2],n=s[o+3],i+=h*n-a*l;if(!(i<0))for(let o=0,c=r-2,f=r>>1;o<f;o+=2){let d=s[o],m=s[o+1],u=c-o;s[o]=s[u],s[o+1]=s[u+1],s[u]=d,s[u+1]=m}}},Fs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ot,r=typeof e=="string"?JSON.parse(e):e,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=I(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let l=r.bones[h],a=null,n=I(l,"parent",null);n&&(a=s.findBone(n));let o=new Ft(s.bones.length,l.name,a);o.length=I(l,"length",0)*t,o.x=I(l,"x",0)*t,o.y=I(l,"y",0)*t,o.rotation=I(l,"rotation",0),o.scaleX=I(l,"scaleX",1),o.scaleY=I(l,"scaleY",1),o.shearX=I(l,"shearX",0),o.shearY=I(l,"shearY",0),o.inherit=R.enumValue(De,I(l,"inherit","Normal")),o.skinRequired=I(l,"skin",!1);let c=I(l,"color",null);c&&o.color.setFromString(c),s.bones.push(o)}if(r.slots)for(let h=0;h<r.slots.length;h++){let l=r.slots[h],a=l.name,n=s.findBone(l.bone);if(!n)throw new Error(`Couldn't find bone ${l.bone} for slot ${a}`);let o=new Wt(s.slots.length,a,n),c=I(l,"color",null);c&&o.color.setFromString(c);let f=I(l,"dark",null);f&&(o.darkColor=N.fromString(f)),o.attachmentName=I(l,"attachment",null),o.blendMode=R.enumValue(Ut,I(l,"blend","normal")),o.visible=I(l,"visible",!0),s.slots.push(o)}if(r.ik)for(let h=0;h<r.ik.length;h++){let l=r.ik[h],a=new Bt(l.name);a.order=I(l,"order",0),a.skinRequired=I(l,"skin",!1);for(let o=0;o<l.bones.length;o++){let c=s.findBone(l.bones[o]);if(!c)throw new Error(`Couldn't find bone ${l.bones[o]} for IK constraint ${l.name}.`);a.bones.push(c)}let n=s.findBone(l.target);if(!n)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);a.target=n,a.mix=I(l,"mix",1),a.softness=I(l,"softness",0)*t,a.bendDirection=I(l,"bendPositive",!0)?1:-1,a.compress=I(l,"compress",!1),a.stretch=I(l,"stretch",!1),a.uniform=I(l,"uniform",!1),s.ikConstraints.push(a)}if(r.transform)for(let h=0;h<r.transform.length;h++){let l=r.transform[h],a=new zt(l.name);a.order=I(l,"order",0),a.skinRequired=I(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let f=l.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${l.name}.`);a.bones.push(d)}let n=l.target,o=s.findBone(n);if(!o)throw new Error(`Couldn't find target bone ${n} for transform constraint ${l.name}.`);a.target=o,a.local=I(l,"local",!1),a.relative=I(l,"relative",!1),a.offsetRotation=I(l,"rotation",0),a.offsetX=I(l,"x",0)*t,a.offsetY=I(l,"y",0)*t,a.offsetScaleX=I(l,"scaleX",0),a.offsetScaleY=I(l,"scaleY",0),a.offsetShearY=I(l,"shearY",0),a.mixRotate=I(l,"mixRotate",1),a.mixX=I(l,"mixX",1),a.mixY=I(l,"mixY",a.mixX),a.mixScaleX=I(l,"mixScaleX",1),a.mixScaleY=I(l,"mixScaleY",a.mixScaleX),a.mixShearY=I(l,"mixShearY",1),s.transformConstraints.push(a)}if(r.path)for(let h=0;h<r.path.length;h++){let l=r.path[h],a=new Vt(l.name);a.order=I(l,"order",0),a.skinRequired=I(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let f=l.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${l.name}.`);a.bones.push(d)}let n=l.target,o=s.findSlot(n);if(!o)throw new Error(`Couldn't find target slot ${n} for path constraint ${l.name}.`);a.target=o,a.positionMode=R.enumValue(Lt,I(l,"positionMode","Percent")),a.spacingMode=R.enumValue(Nt,I(l,"spacingMode","Length")),a.rotateMode=R.enumValue(Dt,I(l,"rotateMode","Tangent")),a.offsetRotation=I(l,"rotation",0),a.position=I(l,"position",0),a.positionMode==0&&(a.position*=t),a.spacing=I(l,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=t),a.mixRotate=I(l,"mixRotate",1),a.mixX=I(l,"mixX",1),a.mixY=I(l,"mixY",a.mixX),s.pathConstraints.push(a)}if(r.physics)for(let h=0;h<r.physics.length;h++){const l=r.physics[h],a=new ks(l.name);a.order=I(l,"order",0),a.skinRequired=I(l,"skin",!1);const n=l.bone,o=s.findBone(n);if(o==null)throw new Error("Physics bone not found: "+n);a.bone=o,a.x=I(l,"x",0),a.y=I(l,"y",0),a.rotate=I(l,"rotate",0),a.scaleX=I(l,"scaleX",0),a.shearX=I(l,"shearX",0),a.limit=I(l,"limit",5e3)*t,a.step=1/I(l,"fps",60),a.inertia=I(l,"inertia",1),a.strength=I(l,"strength",100),a.damping=I(l,"damping",1),a.massInverse=1/I(l,"mass",1),a.wind=I(l,"wind",0),a.gravity=I(l,"gravity",0),a.mix=I(l,"mix",1),a.inertiaGlobal=I(l,"inertiaGlobal",!1),a.strengthGlobal=I(l,"strengthGlobal",!1),a.dampingGlobal=I(l,"dampingGlobal",!1),a.massGlobal=I(l,"massGlobal",!1),a.windGlobal=I(l,"windGlobal",!1),a.gravityGlobal=I(l,"gravityGlobal",!1),a.mixGlobal=I(l,"mixGlobal",!1),s.physicsConstraints.push(a)}if(r.skins)for(let h=0;h<r.skins.length;h++){let l=r.skins[h],a=new qe(l.name);if(l.bones)for(let n=0;n<l.bones.length;n++){let o=l.bones[n],c=s.findBone(o);if(!c)throw new Error(`Couldn't find bone ${o} for skin ${l.name}.`);a.bones.push(c)}if(l.ik)for(let n=0;n<l.ik.length;n++){let o=l.ik[n],c=s.findIkConstraint(o);if(!c)throw new Error(`Couldn't find IK constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}if(l.transform)for(let n=0;n<l.transform.length;n++){let o=l.transform[n],c=s.findTransformConstraint(o);if(!c)throw new Error(`Couldn't find transform constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}if(l.path)for(let n=0;n<l.path.length;n++){let o=l.path[n],c=s.findPathConstraint(o);if(!c)throw new Error(`Couldn't find path constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}if(l.physics)for(let n=0;n<l.physics.length;n++){let o=l.physics[n],c=s.findPhysicsConstraint(o);if(!c)throw new Error(`Couldn't find physics constraint ${o} for skin ${l.name}.`);a.constraints.push(c)}for(let n in l.attachments){let o=s.findSlot(n);if(!o)throw new Error(`Couldn't find slot ${n} for skin ${l.name}.`);let c=l.attachments[n];for(let f in c){let d=this.readAttachment(c[f],a,o.index,f,s);d&&a.setAttachment(o.index,f,d)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let o=n.getAttachment(a.slotIndex,a.parent);if(!o)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?o:a.mesh,a.mesh.setParentMesh(o),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let l=r.events[h],a=new Pt(h);a.intValue=I(l,"int",0),a.floatValue=I(l,"float",0),a.stringValue=I(l,"string",""),a.audioPath=I(l,"audio",null),a.audioPath&&(a.volume=I(l,"volume",1),a.balance=I(l,"balance",0)),s.events.push(a)}if(r.animations)for(let h in r.animations){let l=r.animations[h];this.readAnimation(l,h,s)}return s}readAttachment(e,t,s,r,i){let h=this.scale;switch(r=I(e,"name",r),I(e,"type","region")){case"region":{let l=I(e,"path",r),a=this.readSequence(I(e,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(t,r,l,a);if(!n)return null;n.path=l,n.x=I(e,"x",0)*h,n.y=I(e,"y",0)*h,n.scaleX=I(e,"scaleX",1),n.scaleY=I(e,"scaleY",1),n.rotation=I(e,"rotation",0),n.width=e.width*h,n.height=e.height*h,n.sequence=a;let o=I(e,"color",null);return o&&n.color.setFromString(o),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!l)return null;this.readVertices(e,l,e.vertexCount<<1);let a=I(e,"color",null);return a&&l.color.setFromString(a),l}case"mesh":case"linkedmesh":{let l=I(e,"path",r),a=this.readSequence(I(e,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(t,r,l,a);if(!n)return null;n.path=l;let o=I(e,"color",null);o&&n.color.setFromString(o),n.width=I(e,"width",0)*h,n.height=I(e,"height",0)*h,n.sequence=a;let c=I(e,"parent",null);if(c)return this.linkedMeshes.push(new Pi(n,I(e,"skin",null),s,c,I(e,"timelines",!0))),n;let f=e.uvs;return this.readVertices(e,n,f.length),n.triangles=e.triangles,n.regionUVs=f,n.region!=null&&n.updateRegion(),n.edges=I(e,"edges",null),n.hullLength=I(e,"hull",0)*2,n}case"path":{let l=this.attachmentLoader.newPathAttachment(t,r);if(!l)return null;l.closed=I(e,"closed",!1),l.constantSpeed=I(e,"constantSpeed",!0);let a=e.vertexCount;this.readVertices(e,l,a<<1);let n=R.newArray(a/3,0);for(let c=0;c<e.lengths.length;c++)n[c]=e.lengths[c]*h;l.lengths=n;let o=I(e,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(t,r);if(!l)return null;l.x=I(e,"x",0)*h,l.y=I(e,"y",0)*h,l.rotation=I(e,"rotation",0);let a=I(e,"color",null);return a&&l.color.setFromString(a),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(t,r);if(!l)return null;let a=I(e,"end",null);a&&(l.endSlot=i.findSlot(a));let n=e.vertexCount;this.readVertices(e,l,n<<1);let o=I(e,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(e){if(e==null)return null;let t=new ss(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 r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let a=R.toFloatArray(i);if(r!=1)for(let n=0,o=i.length;n<o;n++)a[n]*=r;t.vertices=a;return}let h=new Array,l=new Array;for(let a=0,n=i.length;a<n;){let o=i[a++];l.push(o);for(let c=a+o*4;a<c;a+=4)l.push(i[a]),h.push(i[a+1]*r),h.push(i[a+2]*r),h.push(i[a+3])}t.bones=l,t.vertices=R.toFloatArray(h)}readAnimation(e,t,s){let r=this.scale,i=new Array;if(e.slots)for(let l in e.slots){let a=e.slots[l],n=s.findSlot(l);if(!n)throw new Error("Slot not found: "+l);let o=n.index;for(let c in a){let f=a[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ue(d,o);for(let u=0;u<d;u++){let w=f[u];m.setFrame(u,I(w,"time",0),I(w,"name",null))}i.push(m)}else if(c=="rgba"){let m=new at(d,d<<2,o),u=f[0],w=I(u,"time",0),b=N.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b,b.a);let x=f[p+1];if(!x){m.shrink(g);break}let y=I(x,"time",0),v=N.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1),g=_(A,m,g,p,3,w,y,b.a,v.a,1)),w=y,b=v,u=x}i.push(m)}else if(c=="rgb"){let m=new nt(d,d*3,o),u=f[0],w=I(u,"time",0),b=N.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,w,b.r,b.g,b.b);let x=f[p+1];if(!x){m.shrink(g);break}let y=I(x,"time",0),v=N.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,p,0,w,y,b.r,v.r,1),g=_(A,m,g,p,1,w,y,b.g,v.g,1),g=_(A,m,g,p,2,w,y,b.b,v.b,1)),w=y,b=v,u=x}i.push(m)}else if(c=="alpha")i.push(ae(f,new lt(d,d,o),0,1));else if(c=="rgba2"){let m=new ot(d,d*7,o),u=f[0],w=I(u,"time",0),b=N.fromString(u.light),p=N.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,b.a,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=I(y,"time",0),A=N.fromString(y.light),S=N.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,b.a,A.a,1),x=_(C,m,x,g,4,w,v,p.r,S.r,1),x=_(C,m,x,g,5,w,v,p.g,S.g,1),x=_(C,m,x,g,6,w,v,p.b,S.b,1)),w=v,b=A,p=S,u=y}i.push(m)}else if(c=="rgb2"){let m=new ht(d,d*6,o),u=f[0],w=I(u,"time",0),b=N.fromString(u.light),p=N.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,b.r,b.g,b.b,p.r,p.g,p.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=I(y,"time",0),A=N.fromString(y.light),S=N.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,b.r,A.r,1),x=_(C,m,x,g,1,w,v,b.g,A.g,1),x=_(C,m,x,g,2,w,v,b.b,A.b,1),x=_(C,m,x,g,3,w,v,p.r,S.r,1),x=_(C,m,x,g,4,w,v,p.g,S.g,1),x=_(C,m,x,g,5,w,v,p.b,S.b,1)),w=v,b=A,p=S,u=y}i.push(m)}}}if(e.bones)for(let l in e.bones){let a=e.bones[l],n=s.findBone(l);if(!n)throw new Error("Bone not found: "+l);let o=n.index;for(let c in a){let f=a[c],d=f.length;if(d!=0){if(c==="rotate")i.push(ae(f,new Ae(d,d,o),0,1));else if(c==="translate"){let m=new je(d,d<<1,o);i.push(Gt(f,m,"x","y",0,r))}else if(c==="translatex"){let m=new Je(d,d,o);i.push(ae(f,m,0,r))}else if(c==="translatey"){let m=new Ke(d,d,o);i.push(ae(f,m,0,r))}else if(c==="scale"){let m=new Qe(d,d<<1,o);i.push(Gt(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new Ze(d,d,o);i.push(ae(f,m,1,1))}else if(c==="scaley"){let m=new et(d,d,o);i.push(ae(f,m,1,1))}else if(c==="shear"){let m=new tt(d,d<<1,o);i.push(Gt(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new st(d,d,o);i.push(ae(f,m,0,1))}else if(c==="sheary"){let m=new it(d,d,o);i.push(ae(f,m,0,1))}else if(c==="inherit"){let m=new rt(d,n.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,I(w,"time",0),R.enumValue(De,I(w,"inherit","Normal")))}i.push(m)}}}}if(e.ik)for(let l in e.ik){let a=e.ik[l],n=a[0];if(!n)continue;let o=s.findIkConstraint(l);if(!o)throw new Error("IK Constraint not found: "+l);let c=s.ikConstraints.indexOf(o),f=new dt(a.length,a.length<<1,c),d=I(n,"time",0),m=I(n,"mix",1),u=I(n,"softness",0)*r;for(let w=0,b=0;;w++){f.setFrame(w,d,m,u,I(n,"bendPositive",!0)?1:-1,I(n,"compress",!1),I(n,"stretch",!1));let p=a[w+1];if(!p){f.shrink(b);break}let g=I(p,"time",0),x=I(p,"mix",1),y=I(p,"softness",0)*r,v=n.curve;v&&(b=_(v,f,b,w,0,d,g,m,x,1),b=_(v,f,b,w,1,d,g,u,y,r)),d=g,m=x,u=y,n=p}i.push(f)}if(e.transform)for(let l in e.transform){let a=e.transform[l],n=a[0];if(!n)continue;let o=s.findTransformConstraint(l);if(!o)throw new Error("Transform constraint not found: "+l);let c=s.transformConstraints.indexOf(o),f=new ft(a.length,a.length*6,c),d=I(n,"time",0),m=I(n,"mixRotate",1),u=I(n,"mixX",1),w=I(n,"mixY",u),b=I(n,"mixScaleX",1),p=I(n,"mixScaleY",b),g=I(n,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,b,p,g);let v=a[x+1];if(!v){f.shrink(y);break}let A=I(v,"time",0),S=I(v,"mixRotate",1),C=I(v,"mixX",1),k=I(v,"mixY",C),Y=I(v,"mixScaleX",1),M=I(v,"mixScaleY",Y),F=I(v,"mixShearY",1),E=n.curve;E&&(y=_(E,f,y,x,0,d,A,m,S,1),y=_(E,f,y,x,1,d,A,u,C,1),y=_(E,f,y,x,2,d,A,w,k,1),y=_(E,f,y,x,3,d,A,b,Y,1),y=_(E,f,y,x,4,d,A,p,M,1),y=_(E,f,y,x,5,d,A,g,F,1)),d=A,m=S,u=C,w=k,b=Y,p=M,b=Y,n=v}i.push(f)}if(e.path)for(let l in e.path){let a=e.path[l],n=s.findPathConstraint(l);if(!n)throw new Error("Path constraint not found: "+l);let o=s.pathConstraints.indexOf(n);for(let c in a){let f=a[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new ut(m,m,o);i.push(ae(f,u,0,n.positionMode==0?r:1))}else if(c==="spacing"){let u=new mt(m,m,o);i.push(ae(f,u,0,n.spacingMode==0||n.spacingMode==1?r:1))}else if(c==="mix"){let u=new gt(m,m*3,o),w=I(d,"time",0),b=I(d,"mixRotate",1),p=I(d,"mixX",1),g=I(d,"mixY",p);for(let x=0,y=0;;x++){u.setFrame(x,w,b,p,g);let v=f[x+1];if(!v){u.shrink(y);break}let A=I(v,"time",0),S=I(v,"mixRotate",1),C=I(v,"mixX",1),k=I(v,"mixY",C),Y=d.curve;Y&&(y=_(Y,u,y,x,0,w,A,b,S,1),y=_(Y,u,y,x,1,w,A,p,C,1),y=_(Y,u,y,x,2,w,A,g,k,1)),w=A,b=S,p=C,g=k,d=v}i.push(u)}}}if(e.physics)for(let l in e.physics){let a=e.physics[l],n=-1;if(l.length>0){let o=s.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);n=s.physicsConstraints.indexOf(o)}for(let o in a){let c=a[o],f=c[0];if(!f)continue;let d=c.length;if(o=="reset"){const u=new St(d,n);for(let w=0;f!=null;f=c[w+1],w++)u.setFrame(w,I(f,"time",0));i.push(u);continue}let m;if(o=="inertia")m=new xt(d,d,n);else if(o=="strength")m=new wt(d,d,n);else if(o=="damping")m=new pt(d,d,n);else if(o=="mass")m=new bt(d,d,n);else if(o=="wind")m=new yt(d,d,n);else if(o=="gravity")m=new vt(d,d,n);else if(o=="mix")m=new At(d,d,n);else continue;i.push(ae(c,m,0,1))}}if(e.attachments)for(let l in e.attachments){let a=e.attachments[l],n=s.findSkin(l);if(!n)throw new Error("Skin not found: "+l);for(let o in a){let c=a[o],f=s.findSlot(o);if(!f)throw new Error("Slot not found: "+o);let d=f.index;for(let m in c){let u=c[m],w=n.getAttachment(d,m);for(let b in u){let p=u[b],g=p[0];if(g){if(b=="deform"){let x=w.bones,y=w.vertices,v=x?y.length/3*2:y.length,A=new ct(p.length,p.length,d,w),S=I(g,"time",0);for(let C=0,k=0;;C++){let Y,M=I(g,"vertices",null);if(!M)Y=x?R.newFloatArray(v):y;else{Y=R.newFloatArray(v);let X=I(g,"offset",0);if(R.arrayCopy(M,0,Y,X,M.length),r!=1)for(let V=X,D=V+M.length;V<D;V++)Y[V]*=r;if(!x)for(let V=0;V<v;V++)Y[V]+=y[V]}A.setFrame(C,S,Y);let F=p[C+1];if(!F){A.shrink(k);break}let E=I(F,"time",0),T=g.curve;T&&(k=_(T,A,k,C,0,S,E,0,1,1)),S=E,g=F}i.push(A)}else if(b=="sequence"){let x=new It(p.length,d,w),y=0;for(let v=0;v<p.length;v++){let A=I(g,"delay",y),S=I(g,"time",0),C=is[I(g,"mode","hold")],k=I(g,"index",0);x.setFrame(v,S,C,k,A),y=A,g=p[v+1]}i.push(x)}}}}}}if(e.drawOrder){let l=new we(e.drawOrder.length),a=s.slots.length,n=0;for(let o=0;o<e.drawOrder.length;o++,n++){let c=e.drawOrder[o],f=null,d=I(c,"offsets",null);if(d){f=R.newArray(a,-1);let m=R.newArray(a-d.length,0),u=0,w=0;for(let b=0;b<d.length;b++){let p=d[b],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[w++]=u++;f[u+p.offset]=u++}for(;u<a;)m[w++]=u++;for(let b=a-1;b>=0;b--)f[b]==-1&&(f[b]=m[--w])}l.setFrame(n,I(c,"time",0),f)}i.push(l)}if(e.events){let l=new Ee(e.events.length),a=0;for(let n=0;n<e.events.length;n++,a++){let o=e.events[n],c=s.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let f=new Rt(R.toSinglePrecision(I(o,"time",0)),c);f.intValue=I(o,"int",c.intValue),f.floatValue=I(o,"float",c.floatValue),f.stringValue=I(o,"string",c.stringValue),f.data.audioPath&&(f.volume=I(o,"volume",1),f.balance=I(o,"balance",0)),l.setFrame(a,f)}i.push(l)}let h=0;for(let l=0,a=i.length;l<a;l++)h=Math.max(h,i[l].getDuration());s.animations.push(new Xe(t,i,h))}},Pi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function ae(e,t,s,r){let i=e[0],h=I(i,"time",0),l=I(i,"value",s)*r,a=0;for(let n=0;;n++){t.setFrame(n,h,l);let o=e[n+1];if(!o)return t.shrink(a),t;let c=I(o,"time",0),f=I(o,"value",s)*r;i.curve&&(a=_(i.curve,t,a,n,0,h,c,l,f,r)),h=c,l=f,i=o}}function Gt(e,t,s,r,i,h){let l=e[0],a=I(l,"time",0),n=I(l,s,i)*h,o=I(l,r,i)*h,c=0;for(let f=0;;f++){t.setFrame(f,a,n,o);let d=e[f+1];if(!d)return t.shrink(c),t;let m=I(d,"time",0),u=I(d,s,i)*h,w=I(d,r,i)*h,b=l.curve;b&&(c=_(b,t,c,f,0,a,m,n,u,h),c=_(b,t,c,f,1,a,m,o,w,h)),a=m,n=u,o=w,l=d}}function _(e,t,s,r,i,h,l,a,n,o){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,f=e[c],d=e[c+1]*o,m=e[c+2],u=e[c+3]*o;return t.setBezier(s,r,i,h,a,f,d,m,u,l,n),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))),Oe.yDown=!0;function Bi(e,t){switch(t){case 0:return e.BlendMode.SrcOver;case 1:return e.BlendMode.Plus;case 2:return e.BlendMode.SrcOver;case 3:return e.BlendMode.Screen;default:return e.BlendMode.SrcOver}}function Es(e){if(typeof Buffer<"u")return e.toString("utf-8");if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(e);throw new Error("Unsupported environment")}var Vi=class Us extends Yt{getImage(){return this._image}setFilters(t,s){}setWraps(t,s){}dispose(){const t=this._image;for(const s of t.paintPerBlendMode.values())s.delete();for(const s of t.shaders)s.delete();t.image.delete(),this._image=null}static async fromFile(t,s,r){const i=await r(s);if(!i)throw new Error(`Could not load image ${s}`);const h=t.MakeImageFromEncoded(i);if(!h)throw new Error(`Could not load image ${s}`);const l=new Map,a=[];for(const n of[0,1,2,3]){const o=new t.Paint,c=h.makeShaderOptions(t.TileMode.Clamp,t.TileMode.Clamp,t.FilterMode.Linear,t.MipmapMode.Linear);o.setShader(c),o.setBlendMode(Bi(t,n)),l.set(n,o),a.push(c)}return new Us({shaders:a,paintPerBlendMode:l,image:h})}};async function Li(e,t,s){const r=new Le(Es(await s(t))),i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";for(const l of r.pages){const a=await Vi.fromFile(e,h+l.name,s);l.setTexture(a)}return r}async function Ni(e,t,s,r=1){const i=new ps(t),h=e.endsWith(".json")?new Fs(i):new Ts(i);h.scale=r;let l=await s(e);return e.endsWith(".json")&&(l=Es(l)),h.readSkeletonData(l)}var Rs=class{skeleton;animationState;constructor(e){this.skeleton=new Oe(e),this.animationState=new ls(new us(e))}update(e,t=2){this.animationState.update(e),this.skeleton.update(e),this.animationState.apply(this.skeleton),this.skeleton.updateWorldTransform(t)}},Di=class zs{constructor(t){this.ck=t}clipper=new Xs;tempColor=new N;tempColor2=new N;static QUAD_TRIANGLES=[0,1,2,2,3,0];scratchPositions=R.newFloatArray(100);scratchColors=R.newFloatArray(100);scratchUVs=R.newFloatArray(100);render(t,s){s instanceof Rs&&(s=s.skeleton);let r=this.clipper,i=s.drawOrder,h=s.color;for(let l=0,a=i.length;l<a;l++){let n=i[l];if(!n.bone.active){r.clipEndWithSlot(n);continue}let o=n.getAttachment(),c=this.scratchPositions,f=this.scratchColors,d,m,u,w,b=0;if(o instanceof Ne){let p=o;c=c.length<8?R.newFloatArray(8):c,b=4,p.computeWorldVertices(n,c,0,2),u=zs.QUAD_TRIANGLES,d=p.uvs,m=p.region?.texture,w=p.color}else if(o instanceof Se){let p=o;c=c.length<p.worldVerticesLength?R.newFloatArray(p.worldVerticesLength):c,b=p.worldVerticesLength>>1,p.computeWorldVertices(n,0,p.worldVerticesLength,c,0,2),u=p.triangles,m=p.region?.texture,d=p.uvs,w=p.color}else if(o instanceof Be){let p=o;r.clipStart(n,p);continue}else{r.clipEndWithSlot(n);continue}if(m){r.isClipping()&&(r.clipTrianglesUnpacked(c,u,u.length,d),c=r.clippedVertices,d=r.clippedUVs,u=r.clippedTriangles);let p=n.color,g=this.tempColor;g.r=h.r*p.r*w.r,g.g=h.g*p.g*w.g,g.b=h.b*p.b*w.b,g.a=h.a*p.a*w.a,f.length/4<b&&(f=R.newFloatArray(b*4));for(let C=0,k=b*4;C<k;C+=4)f[C]=g.r,f[C+1]=g.g,f[C+2]=g.b,f[C+3]=g.a;const x=this.scratchUVs.length<d.length?R.newFloatArray(d.length):this.scratchUVs,y=m.getImage().image.width(),v=m.getImage().image.height();for(let C=0;C<d.length;C+=2)x[C]=d[C]*y,x[C+1]=d[C+1]*v;const A=n.data.blendMode,S=this.ck.MakeVertices(this.ck.VertexMode.Triangles,c,x,f,u,!1);t.drawVertices(S,this.ck.BlendMode.Modulate,m.getImage().paintPerBlendMode.get(A)),S.delete()}r.clipEndWithSlot(n)}r.clipEnd()}};export{lt as AlphaTimeline,Xe as Animation,ls as AnimationState,Js as AnimationStateAdapter,us as AnimationStateData,bs as AssetCache,Zs as AssetManagerBase,ps as AtlasAttachmentLoader,He as Attachment,ue as AttachmentTimeline,Ms as BinaryInput,Ut as BlendMode,Et as Bone,Ft as BoneData,Mt as BoundingBoxAttachment,fs as CURRENT,Be as ClippingAttachment,N as Color,Ce as ConstraintData,re as CurveTimeline,se as CurveTimeline1,Fe as CurveTimeline2,$s as DebugUtils,ct as DeformTimeline,ys as Downloader,we as DrawOrderTimeline,Rt as Event,Pt as EventData,hs as EventQueue,Ee as EventTimeline,cs as EventType,Ct as FIRST,Ks as FakeTexture,Pe as HOLD_FIRST,ds as HOLD_MIX,kt as HOLD_SUBSEQUENT,vs as IkConstraint,Bt as IkConstraintData,dt as IkConstraintTimeline,De as Inherit,rt as InheritTimeline,_s as IntSet,es as Interpolation,P as MathUtils,Se as MeshAttachment,as as MixBlend,ns as MixDirection,Ie as PathAttachment,As as PathConstraint,Vt as PathConstraintData,gt as PathConstraintMixTimeline,ut as PathConstraintPositionTimeline,mt as PathConstraintSpacingTimeline,Cs as Physics,pt as PhysicsConstraintDampingTimeline,vt as PhysicsConstraintGravityTimeline,xt as PhysicsConstraintInertiaTimeline,bt as PhysicsConstraintMassTimeline,At as PhysicsConstraintMixTimeline,St as PhysicsConstraintResetTimeline,wt as PhysicsConstraintStrengthTimeline,ce as PhysicsConstraintTimeline,yt as PhysicsConstraintWindTimeline,ws as PointAttachment,ve as Pool,Lt as PositionMode,ts as Pow,Gs as PowOut,ht as RGB2Timeline,ot as RGBA2Timeline,at as RGBATimeline,nt as RGBTimeline,Ne as RegionAttachment,Dt as RotateMode,Ae as RotateTimeline,Tt as SETUP,Re as SUBSEQUENT,Qe as ScaleTimeline,Ze as ScaleXTimeline,et as ScaleYTimeline,It as SequenceTimeline,tt as ShearTimeline,st as ShearXTimeline,it as ShearYTimeline,Oe as Skeleton,Ts as SkeletonBinary,Ri as SkeletonBounds,Xs as SkeletonClipping,Ot as SkeletonData,Rs as SkeletonDrawable,Fs as SkeletonJson,Di as SkeletonRenderer,qe as Skin,qt as SkinEntry,Ss as Slot,Wt as SlotData,Nt as SpacingMode,$e as StringSet,Yt as Texture,Le as TextureAtlas,xs as TextureAtlasPage,Xt as TextureAtlasRegion,Ve as TextureFilter,gs as TextureRegion,ms as TextureWrap,Hs as TimeKeeper,H as Timeline,os as TrackEntry,Is as TransformConstraint,zt as TransformConstraintData,ft as TransformConstraintTimeline,je as TranslateTimeline,Je as TranslateXTimeline,Ke as TranslateYTimeline,Ys as Triangulator,R as Utils,Ye as Vector2,le as VertexAttachment,js as WindowedMean,Ni as loadSkeletonData,Li as loadTextureAtlas};
|
|
1
|
+
"use strict";var _s=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},$t=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},q=class mt{constructor(e=0,s=0,r=0,i=0){this.r=e,this.g=s,this.b=r,this.a=i}static WHITE=new mt(1,1,1,1);static RED=new mt(1,0,0,1);static GREEN=new mt(0,1,0,1);static BLUE=new mt(0,0,1,1);static MAGENTA=new mt(1,0,1,1);set(e,s,r,i){return this.r=e,this.g=s,this.b=r,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,s,r,i){return this.r+=e,this.g+=s,this.b+=r,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,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new mt){return s.setFromString(e)}},E=class nt{static PI=3.1415927;static PI2=nt.PI*2;static invPI2=1/nt.PI2;static radiansToDegrees=180/nt.PI;static radDeg=nt.radiansToDegrees;static degreesToRadians=nt.PI/180;static degRad=nt.degreesToRadians;static clamp(e,s,r){return e<s?s:e>r?r:e}static cosDeg(e){return Math.cos(e*nt.degRad)}static sinDeg(e){return Math.sin(e*nt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*nt.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 s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return nt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,r){let i=Math.random(),h=s-e;return i<=(r-e)/h?e+Math.sqrt(i*h*(r-e)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},es=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},ss=class extends es{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Gs=class extends ss{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},P=class pt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,r,i,h){for(let o=s,a=i;o<s+h;o++,a++)r[a]=e[o]}static arrayFill(e,s,r,i){for(let h=s;h<r;h++)e[h]=i}static setArraySize(e,s,r=0){let i=e.length;if(i==s)return e;if(e.length=s,i<s)for(let h=i;h<s;h++)e[h]=r;return e}static ensureArrayCapacity(e,s,r=0){return e.length>=s?e:pt.setArraySize(e,s,r)}static newArray(e,s){let r=new Array(e);for(let i=0;i<e;i++)r[i]=s;return r}static newFloatArray(e){if(pt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(e){if(pt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(e){return pt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return pt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,r=!0){for(var i=0;i<e.length;i++)if(e[i]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},$s=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},vt=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Yt=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Hs=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},js=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Ht=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},lt=class Ps extends Ht{static nextID=0;id=Ps.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,r,i,h,o){r=h+(r>>1)*o;let a=e.bone.skeleton,n=e.deform,l=this.vertices,c=this.bones;if(!c){n.length>0&&(l=n);let u=e.bone,w=u.worldX,p=u.worldY,b=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,A=h;A<r;v+=2,A+=o){let I=l[v],C=l[v+1];i[A]=I*b+C*g+w,i[A+1]=I*x+C*y+p}return}let f=0,d=0;for(let u=0;u<s;u+=2){let w=c[f];f+=w+1,d+=w}let m=a.bones;if(n.length==0)for(let u=h,w=d*3;u<r;u+=o){let p=0,b=0,g=c[f++];for(g+=f;f<g;f++,w+=3){let x=m[c[f]],y=l[w],v=l[w+1],A=l[w+2];p+=(y*x.a+v*x.b+x.worldX)*A,b+=(y*x.c+v*x.d+x.worldY)*A}i[u]=p,i[u+1]=b}else{let u=n;for(let w=h,p=d*3,b=d<<1;w<r;w+=o){let g=0,x=0,y=c[f++];for(y+=f;f<y;f++,p+=3,b+=2){let v=m[c[f]],A=l[p]+u[b],I=l[p+1]+u[b+1],C=l[p+2];g+=(A*v.a+I*v.b+v.worldX)*C,x+=(A*v.c+I*v.d+v.worldY)*C}i[w]=g,i[w+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},is=class Ut{static _nextID=0;id=Ut.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Ut(this.regions.length);return P.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,s){let r=e.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(e,s){let r=e,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return Ut._nextID++}},rs=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(rs||{}),as=[0,1,2,3,4,5,6],Xt=class{name;timelines=[];timelineIds=new $t;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,i,h,o,a){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let n=this.timelines;for(let l=0,c=n.length;l<c;l++)n[l].apply(t,e,s,i,h,o,a)}},ns=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(ns||{}),ls=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(ls||{}),O={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},H=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=P.newFloatArray(t*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(t,e){let s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}},rt=class extends H{curves;constructor(t,e,s){super(t,s),this.curves=P.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=P.newFloatArray(e);P.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,i,h,o,a,n,l,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(r-h*2+a)*.03,u=(i-o*2+n)*.03,w=((h-a)*3-r+l)*.006,p=((o-n)*3-i+c)*.006,b=m*2+w,g=u*2+p,x=(h-r)*.3+m+w*.16666667,y=(o-i)*.3+u+p*.16666667,v=r+x,A=i+y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=b,y+=g,b+=w,g+=p,v+=x,A+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],l=this.frames[e+s];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=t){let n=i[r-2],l=i[r-1];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}e+=this.getFrameEntries();let o=i[h-2],a=i[h-1];return a+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-a)}},st=class extends rt{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=e[s],h=e[s+1];return h+(t-i)/(e[s+2]-i)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);switch(s){case 0:return i+h*e;case 1:case 2:h+=i-r}return r+h*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}let h=this.getCurveValue(t);return s==0?i+(h-i)*e:r+(h-r)*e}getAbsoluteValue2(t,e,s,r,i,h){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*e}return r}return s==0?i+(h-i)*e:r+(h-r)*e}getScaleValue(t,e,s,r,i,h){const o=this.frames;if(t<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*e}return i}let a=this.getCurveValue(t)*h;if(e==1)return s==3?i+a-h:a;if(r==1)switch(s){case 0:return h+(Math.abs(a)*E.signum(h)-h)*e;case 1:case 2:return i+(Math.abs(a)*E.signum(i)-i)*e}else{let n=0;switch(s){case 0:return n=Math.abs(h)*E.signum(a),n+(a-n)*e;case 1:case 2:return n=Math.abs(i)*E.signum(a),n+(a-n)*e}}return i+(a-h)*e}},Ft=class extends rt{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}},At=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,i,h,a.rotation,a.data.rotation))}},jt=class extends Ft{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*i,a.y+=(a.data.y-a.y)*i}return}let l=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.x=a.data.x+l*i,a.y=a.data.y+c*i;break;case 1:case 2:a.x+=(a.data.x+l-a.x)*i,a.y+=(a.data.y+c-a.y)*i;break;case 3:a.x+=l*i,a.y+=c*i}}},Jt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,i,h,a.x,a.data.x))}},Kt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,i,h,a.y,a.data.y))}},Qt=class extends Ft{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*i,a.scaleY+=(a.data.scaleY-a.scaleY)*i}return}let l,c,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(l*=a.data.scaleX,c*=a.data.scaleY,i==1)h==3?(a.scaleX+=l-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=l,a.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,a.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 3:a.scaleX+=(l-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}else switch(h){case 0:m=Math.abs(a.data.scaleX)*E.signum(l),u=Math.abs(a.data.scaleY)*E.signum(c),a.scaleX=m+(l-m)*i,a.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(a.scaleX)*E.signum(l),u=Math.abs(a.scaleY)*E.signum(c),a.scaleX=m+(l-m)*i,a.scaleY=u+(c-u)*i;break;case 3:a.scaleX+=(l-a.data.scaleX)*i,a.scaleY+=(c-a.data.scaleY)*i}}}},Zt=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,i,h,o,a.scaleX,a.data.scaleX))}},te=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,i,h,o,a.scaleY,a.data.scaleY))}},ee=class extends Ft{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*i,a.shearY+=(a.data.shearY-a.shearY)*i}return}let l=0,c=0,f=H.search(n,s,3),d=this.curves[f/3];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+3]-m);l+=(n[f+3+1]-l)*u,c+=(n[f+3+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:a.shearX=a.data.shearX+l*i,a.shearY=a.data.shearY+c*i;break;case 1:case 2:a.shearX+=(a.data.shearX+l-a.shearX)*i,a.shearY+=(a.data.shearY+c-a.shearY)*i;break;case 3:a.shearX+=l*i,a.shearY+=c*i}}},se=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,i,h,a.shearX,a.data.shearX))}},ie=class extends st{boneIndex=0;constructor(t,e,s){super(t,e,O.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,i,h,a.shearY,a.data.shearY))}},re=class extends H{boneIndex=0;constructor(t,e){super(t,[O.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,i,h,o){let a=t.bones[this.boneIndex];if(!a.active)return;if(o==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[H.search(n,s,2)+1]}},ae=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let p=a.data.color;switch(h){case 0:l.setFromColor(p);return;case 1:l.add((p.r-l.r)*i,(p.g-l.g)*i,(p.b-l.b)*i,(p.a-l.a)*i)}return}let c=0,f=0,d=0,m=0,u=H.search(n,s,5),w=this.curves[u/5];switch(w){case 0:let p=n[u];c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];let b=(s-p)/(n[u+5]-p);c+=(n[u+5+1]-c)*b,f+=(n[u+5+2]-f)*b,d+=(n[u+5+3]-d)*b,m+=(n[u+5+4]-m)*b;break;case 1:c=n[u+1],f=n[u+2],d=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,w-2),f=this.getBezierValue(s,u,2,w+18-2),d=this.getBezierValue(s,u,3,w+18*2-2),m=this.getBezierValue(s,u,4,w+18*3-2)}i==1?l.set(c,f,d,m):(h==0&&l.setFromColor(a.data.color),l.add((c-l.r)*i,(f-l.g)*i,(d-l.b)*i,(m-l.a)*i))}},ne=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let w=a.data.color;switch(h){case 0:l.r=w.r,l.g=w.g,l.b=w.b;return;case 1:l.r+=(w.r-l.r)*i,l.g+=(w.g-l.g)*i,l.b+=(w.b-l.b)*i}return}let c=0,f=0,d=0,m=H.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let w=n[m];c=n[m+1],f=n[m+2],d=n[m+3];let p=(s-w)/(n[m+4]-w);c+=(n[m+4+1]-c)*p,f+=(n[m+4+2]-f)*p,d+=(n[m+4+3]-d)*p;break;case 1:c=n[m+1],f=n[m+2],d=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),f=this.getBezierValue(s,m,2,u+18-2),d=this.getBezierValue(s,m,3,u+18*2-2)}if(i==1)l.r=c,l.g=f,l.b=d;else{if(h==0){let w=a.data.color;l.r=w.r,l.g=w.g,l.b=w.b}l.r+=(c-l.r)*i,l.g+=(f-l.g)*i,l.b+=(d-l.b)*i}}},le=class extends st{slotIndex=0;constructor(t,e,s){super(t,e,O.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*i}return}let l=this.getCurveValue(s);i==1?n.a=l:(h==0&&(n.a=a.data.color.a),n.a+=(l-n.a)*i)}},oe=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.alpha+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,h,o,a,n){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=a,this.frames[t+7]=n}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*i,(y.g-l.g)*i,(y.b-l.b)*i,(y.a-l.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,p=0,b=0,g=H.search(n,s,8),x=this.curves[g>>3];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],p=n[g+6],b=n[g+7];let v=(s-y)/(n[g+8]-y);f+=(n[g+8+1]-f)*v,d+=(n[g+8+2]-d)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,w+=(n[g+8+5]-w)*v,p+=(n[g+8+6]-p)*v,b+=(n[g+8+7]-b)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],u=n[g+4],w=n[g+5],p=n[g+6],b=n[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),w=this.getBezierValue(s,g,5,x+18*4-2),p=this.getBezierValue(s,g,6,x+18*5-2),b=this.getBezierValue(s,g,7,x+18*6-2)}if(i==1)l.set(f,d,m,u),c.r=w,c.g=p,c.b=b;else{if(h==0){l.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((f-l.r)*i,(d-l.g)*i,(m-l.b)*i,(u-l.a)*i),c.r+=(w-c.r)*i,c.g+=(p-c.g)*i,c.b+=(b-c.b)*i}}},he=class extends rt{slotIndex=0;constructor(t,e,s){super(t,e,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,o,a){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=a}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*i,l.g+=(y.g-l.g)*i,l.b+=(y.b-l.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let f=0,d=0,m=0,u=0,w=0,p=0,b=0,g=H.search(n,s,7),x=this.curves[g/7];switch(x){case 0:let y=n[g];f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],p=n[g+5],b=n[g+6];let v=(s-y)/(n[g+7]-y);f+=(n[g+7+1]-f)*v,d+=(n[g+7+2]-d)*v,m+=(n[g+7+3]-m)*v,w+=(n[g+7+4]-w)*v,p+=(n[g+7+5]-p)*v,b+=(n[g+7+6]-b)*v;break;case 1:f=n[g+1],d=n[g+2],m=n[g+3],w=n[g+4],p=n[g+5],b=n[g+6];break;default:f=this.getBezierValue(s,g,1,x-2),d=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),w=this.getBezierValue(s,g,4,x+18*3-2),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2)}if(i==1)l.r=f,l.g=d,l.b=m,c.r=w,c.g=p,c.b=b;else{if(h==0){let y=a.data.color,v=a.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(f-l.r)*i,l.g+=(d-l.g)*i,l.b+=(m-l.b)*i,c.r+=(w-c.r)*i,c.g+=(p-c.g)*i,c.b+=(b-c.b)*i}}},ut=class extends H{slotIndex=0;attachmentNames;constructor(t,e){super(t,[O.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(a.bone.active){if(o==1){h==0&&this.setAttachment(t,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,a,a.data.attachmentName);return}this.setAttachment(t,a,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},ce=class extends rt{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[O.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,i,h,o,a,n,l,c){let f=this.curves,d=this.getFrameCount()+t*18;s==0&&(f[e]=2+d);let m=(r-h*2+a)*.03,u=n*.03-o*.06,w=((h-a)*3-r+l)*.006,p=(o-n+.33333333)*.018,b=m*2+w,g=u*2+p,x=(h-r)*.3+m+w*.16666667,y=o*.3+u+p*.16666667,v=r+x,A=y;for(let I=d+18;d<I;d+=2)f[d]=v,f[d+1]=A,x+=b,y+=g,b+=w,g+=p,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let a=this.frames[e];return(t-a)/(this.frames[e+this.getFrameEntries()]-a);case 1:return 0}if(r-=2,s[r]>t){let a=this.frames[e];return s[r+1]*(t-a)/(s[r]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let a=s[r-2],n=s[r-1];return n+(t-a)/(s[r]-a)*(s[r+1]-n)}let h=s[i-2],o=s[i-1];return o+(1-o)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,r,i,h,o){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof lt)||n.timelineAttachment!=this.attachment)return;let l=a.deform;l.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:l.length=0;return;case 1:if(i==1){l.length=0;return}l.length=f;let g=n;if(g.bones){i=1-i;for(var m=0;m<f;m++)l[m]*=i}else{let x=g.vertices;for(var m=0;m<f;m++)l[m]+=(x[m]-l[m])*i}}return}if(l.length=f,s>=d[d.length-1]){let g=c[d.length-1];if(i==1)if(h==3){let x=n;if(x.bones)for(let y=0;y<f;y++)l[y]+=g[y];else{let y=x.vertices;for(let v=0;v<f;v++)l[v]+=g[v]-y[v]}}else P.arrayCopy(g,0,l,0,f);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<f;v++)l[v]=g[v]*i;else{let v=y.vertices;for(let A=0;A<f;A++){let I=v[A];l[A]=I+(g[A]-I)*i}}break}case 1:case 2:for(let y=0;y<f;y++)l[y]+=(g[y]-l[y])*i;break;case 3:let x=n;if(x.bones)for(let y=0;y<f;y++)l[y]+=g[y]*i;else{let y=x.vertices;for(let v=0;v<f;v++)l[v]+=(g[v]-y[v])*i}}return}let u=H.search1(d,s),w=this.getCurvePercent(s,u),p=c[u],b=c[u+1];if(i==1)if(h==3){let g=n;if(g.bones)for(let x=0;x<f;x++){let y=p[x];l[x]+=y+(b[x]-y)*w}else{let x=g.vertices;for(let y=0;y<f;y++){let v=p[y];l[y]+=v+(b[y]-v)*w-x[y]}}}else for(let g=0;g<f;g++){let x=p[g];l[g]=x+(b[g]-x)*w}else switch(h){case 0:{let x=n;if(x.bones)for(let y=0;y<f;y++){let v=p[y];l[y]=(v+(b[y]-v)*w)*i}else{let y=x.vertices;for(let v=0;v<f;v++){let A=p[v],I=y[v];l[v]=I+(A+(b[v]-A)*w-I)*i}}break}case 1:case 2:for(let x=0;x<f;x++){let y=p[x];l[x]+=(y+(b[x]-y)*w-l[x])*i}break;case 3:let g=n;if(g.bones)for(let x=0;x<f;x++){let y=p[x];l[x]+=(y+(b[x]-y)*w)*i}else{let x=g.vertices;for(let y=0;y<f;y++){let v=p[y];l[y]+=(v+(b[y]-v)*w-x[y])*i}}}}},Et=class Bs extends H{static propertyIds=[""+O.event];events;constructor(e){super(e,Bs.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,r,i,h,o,a){if(!i)return;let n=this.frames,l=this.frames.length;if(s>r)this.apply(e,s,Number.MAX_VALUE,i,h,o,a),s=-1;else if(s>=n[l-1])return;if(r<n[0])return;let c=0;if(s<n[0])c=0;else{c=H.search1(n,s)+1;let f=n[c];for(;c>0&&n[c-1]==f;)c--}for(;c<l&&r>=n[c];c++)i.push(this.events[c])}},wt=class Vs extends H{static propertyIds=[""+O.drawOrder];drawOrders;constructor(e){super(e,Vs.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,r){this.frames[e]=s,this.drawOrders[e]=r}apply(e,s,r,i,h,o,a){if(a==1){o==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let n=H.search1(this.frames,r),l=this.drawOrders[n];if(!l)P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,f=e.slots;for(let d=0,m=l.length;d<m;d++)c[d]=f[l[d]]}}},de=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,h,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=h?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,r,i,h,o){let a=t.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*i,a.softness+=(a.data.softness-a.softness)*i,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let l=0,c=0,f=H.search(n,s,6),d=this.curves[f/6];switch(d){case 0:let m=n[f];l=n[f+1],c=n[f+2];let u=(s-m)/(n[f+6]-m);l+=(n[f+6+1]-l)*u,c+=(n[f+6+2]-c)*u;break;case 1:l=n[f+1],c=n[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(a.mix=a.data.mix+(l-a.data.mix)*i,a.softness=a.data.softness+(c-a.data.softness)*i,o==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0)):(a.mix+=(l-a.mix)*i,a.softness+=(c-a.softness)*i,o==0&&(a.bendDirection=n[f+3],a.compress=n[f+4]!=0,a.stretch=n[f+5]!=0))}},fe=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,h,o,a){let n=this.frames;t*=7,n[t]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i,n[t+4]=h,n[t+5]=o,n[t+6]=a}apply(t,e,s,r,i,h,o){let a=t.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let b=a.data;switch(h){case 0:a.mixRotate=b.mixRotate,a.mixX=b.mixX,a.mixY=b.mixY,a.mixScaleX=b.mixScaleX,a.mixScaleY=b.mixScaleY,a.mixShearY=b.mixShearY;return;case 1:a.mixRotate+=(b.mixRotate-a.mixRotate)*i,a.mixX+=(b.mixX-a.mixX)*i,a.mixY+=(b.mixY-a.mixY)*i,a.mixScaleX+=(b.mixScaleX-a.mixScaleX)*i,a.mixScaleY+=(b.mixScaleY-a.mixScaleY)*i,a.mixShearY+=(b.mixShearY-a.mixShearY)*i}return}let l,c,f,d,m,u,w=H.search(n,s,7),p=this.curves[w/7];switch(p){case 0:let b=n[w];l=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];let g=(s-b)/(n[w+7]-b);l+=(n[w+7+1]-l)*g,c+=(n[w+7+2]-c)*g,f+=(n[w+7+3]-f)*g,d+=(n[w+7+4]-d)*g,m+=(n[w+7+5]-m)*g,u+=(n[w+7+6]-u)*g;break;case 1:l=n[w+1],c=n[w+2],f=n[w+3],d=n[w+4],m=n[w+5],u=n[w+6];break;default:l=this.getBezierValue(s,w,1,p-2),c=this.getBezierValue(s,w,2,p+18-2),f=this.getBezierValue(s,w,3,p+18*2-2),d=this.getBezierValue(s,w,4,p+18*3-2),m=this.getBezierValue(s,w,5,p+18*4-2),u=this.getBezierValue(s,w,6,p+18*5-2)}if(h==0){let b=a.data;a.mixRotate=b.mixRotate+(l-b.mixRotate)*i,a.mixX=b.mixX+(c-b.mixX)*i,a.mixY=b.mixY+(f-b.mixY)*i,a.mixScaleX=b.mixScaleX+(d-b.mixScaleX)*i,a.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*i,a.mixShearY=b.mixShearY+(u-b.mixShearY)*i}else a.mixRotate+=(l-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i,a.mixScaleX+=(d-a.mixScaleX)*i,a.mixScaleY+=(m-a.mixScaleY)*i,a.mixShearY+=(u-a.mixShearY)*i}},ue=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,i,h,a.position,a.data.position))}},me=class extends st{constraintIndex=0;constructor(t,e,s){super(t,e,O.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,i,h,a.spacing,a.data.spacing))}},ge=class extends rt{constraintIndex=0;constructor(t,e,s){super(t,e,[O.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=r,h[t+3]=i}apply(t,e,s,r,i,h,o){let a=t.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*i,a.mixX+=(a.data.mixX-a.mixX)*i,a.mixY+=(a.data.mixY-a.mixY)*i}return}let l,c,f,d=H.search(n,s,4),m=this.curves[d>>2];switch(m){case 0:let u=n[d];l=n[d+1],c=n[d+2],f=n[d+3];let w=(s-u)/(n[d+4]-u);l+=(n[d+4+1]-l)*w,c+=(n[d+4+2]-c)*w,f+=(n[d+4+3]-f)*w;break;case 1:l=n[d+1],c=n[d+2],f=n[d+3];break;default:l=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),f=this.getBezierValue(s,d,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(l-u.mixRotate)*i,a.mixX=u.mixX+(c-u.mixX)*i,a.mixY=u.mixY+(f-u.mixY)*i}else a.mixRotate+=(l-a.mixRotate)*i,a.mixX+=(c-a.mixX)*i,a.mixY+=(f-a.mixY)*i}},ct=class extends st{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,h,o){let a;if(this.constraintIndex==-1){const n=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),n))}else a=t.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,i,h,this.get(a),this.setup(a)))}},xe=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},we=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},pe=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},be=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},ye=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ve=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},Ae=class extends ct{constructor(t,e,s){super(t,e,s,O.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},Se=class Ls extends H{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,Ls.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,r,i,h,o,a){let n;if(this.constraintIndex!=-1&&(n=e.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>r)this.apply(e,s,Number.MAX_VALUE,[],h,o,a),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[H.search1(l,s)+1]))if(n!=null)n.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},Ie=class dt extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,r){super(e,[O.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,r,i,h){let o=this.frames;e*=dt.ENTRIES,o[e]=s,o[e+dt.MODE]=r|i<<4,o[e+dt.DELAY]=h}apply(e,s,r,i,h,o,a){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,c=this.attachment;if(l!=c&&(!(l instanceof lt)||l.timelineAttachment!=c))return;if(a==1){o==0&&(n.sequenceIndex=-1);return}let f=this.frames;if(r<f[0]){(o==0||o==1)&&(n.sequenceIndex=-1);return}let d=H.search(f,r,dt.ENTRIES),m=f[d],u=f[d+dt.MODE],w=f[d+dt.DELAY];if(!this.attachment.sequence)return;let p=u>>4,b=this.attachment.sequence.regions.length,g=as[u&15];if(g!=0)switch(p+=(r-m)/w+1e-5|0,g){case 1:p=Math.min(b-1,p);break;case 2:p%=b;break;case 3:{let x=(b<<1)-2;p=x==0?0:p%x,p>=b&&(p=x-p);break}case 4:p=Math.max(b-1-p,0);break;case 5:p=b-1-p%b;break;case 6:{let x=(b<<1)-2;p=x==0?0:(p+b-1)%x,p>=b&&(p=x-p)}}n.sequenceIndex=p}},os=class Wt{static _emptyAnimation=new Xt("<empty>",[],0);static emptyAnimation(){return Wt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new cs(this);propertyIDs=new $t;animationsChanged=!1;trackEntryPool=new vt(()=>new hs);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=e*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+e)*a.timeScale,h.trackTime+=o,this.setCurrent(r,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(e,s){let r=e.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((r.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=e),e.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let d=0,m=r.length;d<m;d++){let u=r[d];if(!u||u.delay>0)continue;i=!0;let w=d==0?1:u.mixBlend,p=u.alpha;u.mixingFrom?p*=this.applyMixingFrom(u,e,w):u.trackTime>=u.trackEnd&&!u.next&&(p=0);let b=p>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,I=A.length;if(d==0&&p==1||w==3){d==0&&(b=!0);for(let C=0;C<I;C++){P.webkit602BugfixHelper(p,w);var h=A[C];h instanceof ut?this.applyAttachmentTimeline(h,e,y,w,b):h.apply(e,g,y,v,p,w,0)}}else{let C=u.timelineMode,k=u.shortestRotation,M=!k&&u.timelinesRotation.length!=I<<1;M&&(u.timelinesRotation.length=I<<1);for(let Y=0;Y<I;Y++){let F=A[Y],R=C[Y]==Rt?w:0;!k&&F instanceof At?this.applyRotateTimeline(F,e,y,p,R,u.timelinesRotation,Y<<1,M):F instanceof ut?this.applyAttachmentTimeline(F,e,y,w,b):(P.webkit602BugfixHelper(p,w),F.apply(e,g,y,v,p,R,0))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Te,a=e.slots,n=0,l=e.slots.length;n<l;n++){var c=a[n];if(c.attachmentState==o){var f=c.data.attachmentName;c.setAttachment(f?e.getAttachment(c.data.index,f):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s,r){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;e.mixDuration==0?(h=1,r==1&&(r=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let o=h<i.mixAttachmentThreshold,a=h<i.mixDrawOrderThreshold,n=i.animation.timelines,l=n.length,c=i.alpha*e.interruptAlpha,f=c*(1-h),d=i.animationLast,m=i.getAnimationTime(),u=m,w=null;if(i.reverse?u=i.animation.duration-u:h<i.eventThreshold&&(w=this.events),r==3)for(let p=0;p<l;p++)n[p].apply(s,d,u,w,f,r,1);else{let p=i.timelineMode,b=i.timelineHoldMix,g=i.shortestRotation,x=!g&&i.timelinesRotation.length!=l<<1;x&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let y=0;y<l;y++){let v=n[y],A=1,I,C=0;switch(p[y]){case Rt:if(!a&&v instanceof wt)continue;I=r,C=f;break;case Ce:I=0,C=f;break;case ke:I=r,C=c;break;case Pt:I=0,C=c;break;default:I=0;let k=b[y];C=c*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=C,!g&&v instanceof At?this.applyRotateTimeline(v,s,u,C,I,i.timelinesRotation,y<<1,x):v instanceof ut?this.applyAttachmentTimeline(v,s,u,I,o&&C>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(C,r),a&&v instanceof wt&&I==0&&(A=0),v.apply(s,d,u,w,C,I,A))}}return e.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(e,s,r,i,h){var o=s.slots[e.slotIndex];o.bone.active&&(r<e.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,e.attachmentNames[H.search1(e.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Te))}setAttachment(e,s,r,i){s.setAttachment(r?e.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+us)}applyRotateTimeline(e,s,r,i,h,o,a,n){if(n&&(o[a]=0),i==1){e.apply(s,0,r,null,1,h,0);return}let l=s.bones[e.boneIndex];if(!l.active)return;let c=e.frames,f=0,d=0;if(r<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:f=l.rotation,d=l.data.rotation}else f=h==0?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(r);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[a];else{let w=0,p=0;n?(w=0,p=u):(w=o[a],p=o[a+1]);let b=w-w%360;m=u+b;let g=u>=0,x=w>=0;Math.abs(p)<=90&&E.signum(p)!=E.signum(u)&&(Math.abs(w-b)>180?(m+=360*E.signum(w),x=g):b!=0?m-=360*E.signum(w):x=g),x!=g&&(m+=360*E.signum(w)),o[a]=m}o[a+1]=u,l.rotation=f+m*i}queueEvents(e,s){let r=e.animationStart,i=e.animationEnd,h=i-r,o=e.trackLast%h,a=this.events,n=0,l=a.length;for(;n<l;n++){let f=a[n];if(f.time<o)break;f.time>i||this.queue.event(e,f)}let c=!1;if(e.loop)if(h==0)c=!0;else{const f=Math.floor(e.trackTime/h);c=f>0&&f>Math.floor(e.trackLast/h)}else c=s>=i&&e.animationLast<i;for(c&&this.queue.complete(e);n<l;n++){let f=a[n];f.time<r||this.queue.event(e,f)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,r){let i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,i,r)}setAnimationWith(e,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let o=this.trackEntry(e,s,r,h);return this.setCurrent(e,o,i),this.queue.drain(),o}addAnimation(e,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,r,i)}addAnimationWith(e,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(e,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(e,s=0){let r=this.setAnimationWith(e,Wt.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(e,s=0,r=0){let i=this.addAnimationWith(e,Wt.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(P.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let i=e[s];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 s=e.mixingTo,r=e.animation.timelines,i=e.animation.timelines.length,h=e.timelineMode;h.length=i;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<i;n++)h[n]=a.addAll(r[n].getPropertyIds())?Pt:ke;return}t:for(let n=0;n<i;n++){let l=r[n],c=l.getPropertyIds();if(!a.addAll(c))h[n]=Rt;else if(!s||l instanceof ut||l instanceof wt||l instanceof Et||!s.animation.hasTimeline(c))h[n]=Ce;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(e.mixDuration>0){h[n]=fs,o[n]=f;continue t}break}h[n]=Pt}}}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 s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},hs=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(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}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 t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},cs=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<e.length;o++){let a=e[o];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<e.length;o++){let a=e[o];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<e.length;o++){let a=e[o];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<e.length;o++){let a=e[o];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<e.length;o++){let a=e[o];a.complete&&a.complete(i)}break;case 5:let h=t[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<e.length;o++){let a=e[o];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ds=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(ds||{}),Js=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},Rt=0,Ce=1,ke=2,Pt=3,fs=4,Te=1,us=2,ms=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Me=class Ns extends lt{color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ns(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Bt=class Ds extends lt{endSlot=null;color=new q(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Ds(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Ye=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Vt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Vt||{}),gs=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(gs||{}),xs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ks=class extends Ye{setFilters(t,e){}setWraps(t,e){}dispose(){}},Lt=class{pages=new Array;regions=new Array;constructor(t){let e=new Qs(t),s=new Array(4),r={};r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.format=()=>{},r.filter=l=>{l.minFilter=P.enumValue(Vt,s[1]),l.magFilter=P.enumValue(Vt,s[2])},r.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},r.pma=l=>{l.pma=s[1]=="true"};var i={};i.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},i.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},i.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},i.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},i.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},i.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let o=null,a=null,n=null;for(;h!==null;)if(h.trim().length==0)o=null,h=e.readLine();else if(o){let l=new Xe(o,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let f=i[s[0]];if(f)f(l);else{a||(a=[]),n||(n=[]),a.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));n.push(d)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),a&&a.length>0&&n&&n.length>0&&(l.names=a,l.values=n,a=null,n=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new ws(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Qs=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=e.indexOf(",",i);if(h==-1)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},ws=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Xe=class extends xs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},St=class He extends lt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new q(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new q(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=P.newFloatArray(e.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,a=0;if(this.region instanceof Xe){let n=this.region,l=n.page,c=l.width,f=l.height;switch(n.degrees){case 90:i-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/f,o=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+e[d+1]*o,s[d+1]=h+(1-e[d])*a;return;case 180:i-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/f,o=n.originalWidth/c,a=n.originalHeight/f;for(let d=0;d<r;d+=2)s[d]=i+(1-e[d])*o,s[d+1]=h+(1-e[d+1])*a;return;case 270:i-=n.offsetY/c,h-=n.offsetX/f,o=n.originalHeight/c,a=n.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+(1-e[d+1])*o,s[d+1]=h+e[d]*a;return}i-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/f,o=n.originalWidth/c,a=n.originalHeight/f}else this.region?(o=this.region.u2-i,a=this.region.v2-h):(i=h=0,o=a=1);for(let n=0;n<r;n+=2)s[n]=i+e[n]*o,s[n+1]=h+e[n+1]*a}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 He(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),P.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),P.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,r,i,h,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,r,i,h,o)}newLinkedMesh(){let e=new He(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}},It=class Os extends lt{lengths=[];closed=!1;constantSpeed=!1;color=new q(1,1,1,1);constructor(e){super(e)}copy(){let e=new Os(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},ps=class qs extends lt{x=0;y=0;rotation=0;color=new q(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*E.degRad,r=Math.cos(s),i=Math.sin(s),h=r*e.a+i*e.b,o=r*e.c+i*e.d;return E.atan2Deg(o,h)}copy(){let e=new qs(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Nt=class Us extends Ht{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new q(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new q(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,a=h+this.region.width*r,n=o+this.region.height*i,l=this.rotation*E.degRad,c=Math.cos(l),f=Math.sin(l),d=this.x,m=this.y,u=h*c+d,w=h*f,p=o*c+m,b=o*f,g=a*c+d,x=a*f,y=n*c+m,v=n*f,A=this.offset;A[0]=u-b,A[1]=p+w,A[2]=u-v,A[3]=y+w,A[4]=g-v,A[5]=y+x,A[6]=g-b,A[7]=p+x,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,r,i){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,o=this.offset,a=h.worldX,n=h.worldY,l=h.a,c=h.b,f=h.c,d=h.d,m=0,u=0;m=o[0],u=o[1],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=o[2],u=o[3],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=o[4],u=o[5],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n,r+=i,m=o[6],u=o[7],s[r]=m*l+u*c+a,s[r+1]=m*f+u*d+n}copy(){let e=new Us(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,P.arrayCopy(this.uvs,0,e.uvs,0,8),P.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},bs=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let o=s.getPath(e,i),a=this.atlas.findRegion(o);if(a==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new Nt(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=h}return i}newMeshAttachment(t,e,s,r){let i=new St(e,s);if(r!=null)this.loadSequence(e,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=h}return i}newBoundingBoxAttachment(t,e){return new Me(e)}newPathAttachment(t,e){return new It(e)}newPointAttachment(t,e){return new ps(e)}newClippingAttachment(t,e){return new Bt(e)}},Fe=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new q;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Dt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Dt||{}),Ee=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(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){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(t,e,s,r,i,h,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let a=this.parent;if(!a){let d=this.skeleton;const m=d.scaleX,u=d.scaleY,w=(s+h)*E.degRad,p=(s+90+o)*E.degRad;this.a=Math.cos(w)*r*m,this.b=Math.cos(p)*i*m,this.c=Math.sin(w)*r*u,this.d=Math.sin(p)*i*u,this.worldX=t*m+d.x,this.worldY=e*u+d.y;return}let n=a.a,l=a.b,c=a.c,f=a.d;switch(this.worldX=n*t+l*e+a.worldX,this.worldY=c*t+f*e+a.worldY,this.inherit){case 0:{const d=(s+h)*E.degRad,m=(s+90+o)*E.degRad,u=Math.cos(d)*r,w=Math.cos(m)*i,p=Math.sin(d)*r,b=Math.sin(m)*i;this.a=n*u+l*p,this.b=n*w+l*b,this.c=c*u+f*p,this.d=c*w+f*b;return}case 1:{const d=(s+h)*E.degRad,m=(s+90+o)*E.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(m)*i,this.c=Math.sin(d)*r,this.d=Math.sin(m)*i;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=d,c*=m;let u=n*n+c*c,w=0;u>1e-4?(u=Math.abs(n*f*m-l*d*c)/u,l=c*u,f=n*u,w=Math.atan2(c,n)*E.radDeg):(n=0,c=0,w=90-Math.atan2(f,l)*E.radDeg);const p=(s+h-w)*E.degRad,b=(s+o-w+90)*E.degRad,g=Math.cos(p)*r,x=Math.cos(b)*i,y=Math.sin(p)*r,v=Math.sin(b)*i;this.a=n*g-l*y,this.b=n*x-l*v,this.c=c*g+f*y,this.d=c*x+f*v;break}case 3:case 4:{s*=E.degRad;const d=Math.cos(s),m=Math.sin(s);let u=(n*d+l*m)/this.skeleton.scaleX,w=(c*d+f*m)/this.skeleton.scaleY,p=Math.sqrt(u*u+w*w);p>1e-5&&(p=1/p),u*=p,w*=p,p=Math.sqrt(u*u+w*w),this.inherit==3&&n*f-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(w,u);const b=Math.cos(s)*p,g=Math.sin(s)*p;h*=E.degRad,o=(90+o)*E.degRad;const x=Math.cos(h)*r,y=Math.cos(o)*i,v=Math.sin(h)*r,A=Math.sin(o)*i;this.a=u*x+b*v,this.b=u*y+b*A,this.c=w*x+g*v,this.d=w*y+g*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){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 e=t.a,s=t.b,r=t.c,i=t.d,h=1/(e*i-s*r),o=i*h,a=s*h,n=r*h,l=e*h,c=this.worldX-t.worldX,f=this.worldY-t.worldY;this.ax=c*o-f*a,this.ay=f*l-c*n;let d,m,u,w;if(this.inherit==1)d=this.a,m=this.b,u=this.c,w=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(e*i-s*r)/(e*e+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*i-s*r),o=i*h,a=s*h;break}case 3:case 4:let p=E.cosDeg(this.rotation),b=E.sinDeg(this.rotation);e=(e*p+s*b)/this.skeleton.scaleX,r=(r*p+i*b)/this.skeleton.scaleY;let g=Math.sqrt(e*e+r*r);g>1e-5&&(g=1/g),e*=g,r*=g,g=Math.sqrt(e*e+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=E.PI/2+Math.atan2(r,e);s=Math.cos(x)*g,i=Math.sin(x)*g,h=1/(e*i-s*r),o=i*h,a=s*h,n=r*h,l=e*h}d=o*this.a-a*this.c,m=o*this.b-a*this.d,u=l*this.c-n*this.a,w=l*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){let p=d*w-m*u;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*m+u*w,p)*E.radDeg,this.arotation=Math.atan2(u,d)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+w*w),this.ashearY=0,this.arotation=90-Math.atan2(w,m)*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(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=E.sinDeg(t),s=E.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=E.sinDeg(t),s=E.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*E.radDeg}rotateWorld(t){t*=E.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}},Ct=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Zs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new vs,r=new ys){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=r}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),r(h)},(h,o)=>{const a=`Couldn't load binary ${t}: status ${h}, ${o}`;this.error(s,t,a),i(a)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,r=>{this.success(e,t,r)},(r,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${r}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),r(h)},(h,o)=>{const a=`Couldn't load JSON ${t}: status ${h}, ${o}`;this.error(s,t,a),i(a)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[t],i=r!==void 0;return i&&(this.cache.assetsLoaded[t]=r.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),i}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),i(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.textureLoader(a);this.success(e,t,n),r(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.textureLoader(a);this.success(e,t,n),r(n)},a.onerror=()=>{const n=`Couldn't load image: ${t}`;this.error(s,t,n),i(n)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,a)=>{this.downloader.downloadText(t,n=>{try{let l=new Lt(n),c=l.pages.length,f=!1;for(let d of l.pages)this.loadTexture(r?r[d.name]:h+d.name,(m,u)=>{f||(d.setTexture(u),--c==0&&(this.success(e,t,l),o(l)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,w),a(w)}f=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),a(c)}},(n,l)=>{const c=`Couldn't load texture atlas ${t}: status ${n}, ${l}`;this.error(s,t,c),a(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},r){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,h)=>{this.downloader.downloadText(t,o=>{try{const a=new Lt(o);this.success(e,t,a),i(a)}catch(a){const n=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,n),h(n)}},(o,a)=>{const n=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,n),h(n)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(r,i)=>e(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(r,i)=>e(i),(r,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
+
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){--this.cache.assetsRefCount[t]===0&&this.remove(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},ys=class zt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=zt.AVAILABLE_CACHES.get(e);if(s)return s;const r=new zt;return zt.AVAILABLE_CACHES.set(e,r),r}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},vs=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToString(r))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||t,!0);let h=()=>{this.finish(t,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(t,e,s){this.downloadText(t,r=>{e(JSON.parse(r))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const r=this.rawDataUris[t];if(r&&!r.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(r))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||t,!0),i.responseType="arraybuffer";let h=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(t,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=e==200||e==0?[s]:[e,s];for(let h=i.length-1,o=r.length;h<o;h+=2)r[h].apply(null,i)}},Re=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Pe=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},As=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,r,i,h,o){let a=t.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,l=a.b,c=a.c,f=a.d,d=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case 1:m=(e-t.worldX)*E.signum(t.skeleton.scaleX),u=(s-t.worldY)*E.signum(t.skeleton.scaleY);break;case 2:let b=Math.abs(n*f-l*c)/Math.max(1e-4,n*n+c*c),g=n/t.skeleton.scaleX,x=c/t.skeleton.scaleY;l=-x*b*t.skeleton.scaleX,f=g*b*t.skeleton.scaleY,d+=Math.atan2(x,g)*E.radDeg;default:let y=e-a.worldX,v=s-a.worldY,A=n*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*l)/A-t.ax,u=(v*n-y*c)/A-t.ay)}d+=Math.atan2(u,m)*E.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=t.ascaleX,p=t.ascaleY;if(r||i){switch(t.inherit){case 3:case 4:m=e-t.worldX,u=s-t.worldY}const b=t.data.length*w;if(b>1e-4){const g=m*m+u*u;if(r&&g<b*b||i&&g>b*b){const x=(Math.sqrt(g)/b-1)*o+1;w*=x,h&&(p*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*o,w,p,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,h,o,a,n){if(t.inherit!=0||e.inherit!=0)return;let l=t.ax,c=t.ay,f=t.ascaleX,d=t.ascaleY,m=f,u=d,w=e.ascaleX,p=0,b=0,g=0;f<0?(f=-f,p=180,g=-1):(p=0,g=1),d<0&&(d=-d,g=-g),w<0?(w=-w,b=180):b=0;let x=e.ax,y=0,v=0,A=0,I=t.a,C=t.b,k=t.c,M=t.d,Y=Math.abs(f-d)<=1e-4;!Y||h?(y=0,v=I*x+t.worldX,A=k*x+t.worldY):(y=e.ay,v=I*x+C*y+t.worldX,A=k*x+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");I=F.a,C=F.b,k=F.c,M=F.d;let R=I*M-C*k,T=v-F.worldX,X=A-F.worldY;R=Math.abs(R)<=1e-4?0:1/R;let V=(T*M-X*C)*R-l,N=(X*I-T*k)*R-c,L=Math.sqrt(V*V+N*N),D=e.data.length*w,$,z;if(L<1e-4){this.apply1(t,s,r,!1,h,!1,n),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}T=s-F.worldX,X=r-F.worldY;let j=(T*M-X*C)*R-l,B=(X*I-T*k)*R-c,U=j*j+B*B;if(a!=0){a*=f*(w+1)*.5;let J=Math.sqrt(U),K=J-L-D*f+a;if(K>0){let Q=Math.min(1,K/(a*2))-1;Q=(K-a*(1-Q*Q))/J,j-=Q*j,B-=Q*B,U=j*j+B*B}}t:if(Y){D*=f;let J=(U-L*L-D*D)/(2*L*D);J<-1?(J=-1,z=Math.PI*i):J>1?(J=1,z=0,h&&(I=(Math.sqrt(U)/(L+D)-1)*n+1,m*=I,o&&(u*=I))):z=Math.acos(J)*i,I=L+D*J,C=D*Math.sin(z),$=Math.atan2(B*I-j*C,j*I+B*C)}else{I=f*D,C=d*D;let J=I*I,K=C*C,Q=Math.atan2(B,j);k=K*L*L+J*U-J*K;let it=-2*K*L,gt=K-J;if(M=it*it-4*gt*k,M>=0){let xt=Math.sqrt(M);it<0&&(xt=-xt),xt=-(it+xt)*.5;let yt=xt/gt,ts=k/xt,Mt=Math.abs(yt)<Math.abs(ts)?yt:ts;if(yt=U-Mt*Mt,yt>=0){X=Math.sqrt(yt)*i,$=Q-Math.atan2(X,Mt),z=Math.atan2(X/d,(Mt-L)/f);break t}}let bt=E.PI,kt=L-I,_t=kt*kt,Ke=0,Qe=0,Tt=L+I,Gt=Tt*Tt,Ze=0;k=-I*L/(J-K),k>=-1&&k<=1&&(k=Math.acos(k),T=I*Math.cos(k)+L,X=C*Math.sin(k),M=T*T+X*X,M<_t&&(bt=k,_t=M,kt=T,Ke=X),M>Gt&&(Qe=k,Gt=M,Tt=T,Ze=X)),U<=(_t+Gt)*.5?($=Q-Math.atan2(Ke*i,kt),z=bt*i):($=Q-Math.atan2(Ze*i,Tt),z=Qe*i)}let G=Math.atan2(y,x)*g,tt=t.arotation;$=($-G)*E.radDeg+p-tt,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(l,c,tt+$*n,m,u,0,0),tt=e.arotation,z=((z+G)*E.radDeg-e.ashearX)*g+b-tt,z>180?z-=360:z<-180&&(z+=360),e.updateWorldTransformWith(x,y,tt+z*n,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Be=class extends Ct{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},Ve=class extends Ct{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Le=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Le||{}),Ne=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ne||{}),De=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(De||{}),Ss=class ft{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;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,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0,h=e.bones.length;i<h;i++){let o=s.findBone(e.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(e.target.name);if(!r)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=r,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 s=this.target.getAttachment();if(!(s instanceof It))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,a=o.rotateMode==0,n=o.rotateMode==2,l=this.bones,c=l.length,f=a?c:c+1,d=P.setArraySize(this.spaces,f),m=n?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(n)for(let A=0,I=f-1;A<I;A++){let C=l[A],k=C.data.length,M=k*C.a,Y=k*C.c;m[A]=Math.sqrt(M*M+Y*Y)}P.arrayFill(d,1,f,u);break;case 3:let y=0;for(let A=0,I=f-1;A<I;){let C=l[A],k=C.data.length;if(k<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=k*C.a,Y=k*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=F,y+=F}}if(y>0){y=f/y*u;for(let A=1;A<f;A++)d[A]*=y}break;default:let v=o.spacingMode==0;for(let A=0,I=f-1;A<I;){let C=l[A],k=C.data.length;if(k<ft.epsilon)n&&(m[A]=0),d[++A]=u;else{let M=k*C.a,Y=k*C.c,F=Math.sqrt(M*M+Y*Y);n&&(m[A]=F),d[++A]=(v?k+u:u)*F/k}}}let w=this.computeWorldPositions(s,f,a),p=w[0],b=w[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==1;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?E.degRad:-E.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(p-A.worldX)*i,A.worldY+=(b-A.worldY)*h;let I=w[v],C=w[v+1],k=I-p,M=C-b;if(n){let Y=m[y];if(Y!=0){let F=(Math.sqrt(k*k+M*M)/Y-1)*r+1;A.a*=F,A.c*=F}}if(p=I,b=C,r>0){let Y=A.a,F=A.b,R=A.c,T=A.d,X=0,V=0,N=0;if(a?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(M,k),X-=Math.atan2(R,Y),x){V=Math.cos(X),N=Math.sin(X);let L=A.data.length;p+=(L*(V*Y-N*R)-k)*r,b+=(L*(N*Y+V*R)-M)*r}else X+=g;X>E.PI?X-=E.PI2:X<-E.PI&&(X+=E.PI2),X*=r,V=Math.cos(X),N=Math.sin(X),A.a=V*Y-N*R,A.b=V*F-N*T,A.c=N*Y+V*R,A.d=N*F+V*T}A.updateAppliedTransform()}}computeWorldPositions(e,s,r){let i=this.target,h=this.position,o=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,l=e.closed,c=e.worldVerticesLength,f=c/6,d=ft.NONE;if(!e.constantSpeed){let L=e.lengths;f-=l?1:2;let D=L[f];this.data.positionMode==1&&(h*=D);let $;switch(this.data.spacingMode){case 2:$=D;break;case 3:$=D/s;break;default:$=1}n=P.setArraySize(this.world,8);for(let z=0,j=0,B=0;z<s;z++,j+=3){let U=o[z]*$;h+=U;let G=h;if(l)G%=D,G<0&&(G+=D),B=0;else if(G<0){d!=ft.BEFORE&&(d=ft.BEFORE,e.computeWorldVertices(i,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,j);continue}else if(G>D){d!=ft.AFTER&&(d=ft.AFTER,e.computeWorldVertices(i,c-6,4,n,0,2)),this.addAfterPosition(G-D,n,0,a,j);continue}for(;;B++){let tt=L[B];if(!(G>tt)){if(B==0)G/=tt;else{let J=L[B-1];G=(G-J)/(tt-J)}break}}B!=d&&(d=B,l&&B==f?(e.computeWorldVertices(i,c-4,4,n,0,2),e.computeWorldVertices(i,0,4,n,4,2)):e.computeWorldVertices(i,B*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,j,r||z>0&&U==0)}return a}l?(c+=2,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c-4,n,0,2),e.computeWorldVertices(i,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(f--,c-=4,n=P.setArraySize(this.world,c),e.computeWorldVertices(i,2,c,n,0,2));let m=P.setArraySize(this.curves,f),u=0,w=n[0],p=n[1],b=0,g=0,x=0,y=0,v=0,A=0,I=0,C=0,k=0,M=0,Y=0,F=0,R=0,T=0;for(let L=0,D=2;L<f;L++,D+=6)b=n[D],g=n[D+1],x=n[D+2],y=n[D+3],v=n[D+4],A=n[D+5],I=(w-b*2+x)*.1875,C=(p-g*2+y)*.1875,k=((b-x)*3-w+v)*.09375,M=((g-y)*3-p+A)*.09375,Y=I*2+k,F=C*2+M,R=(b-w)*.75+I+k*.16666667,T=(g-p)*.75+C+M*.16666667,u+=Math.sqrt(R*R+T*T),R+=Y,T+=F,Y+=k,F+=M,u+=Math.sqrt(R*R+T*T),R+=Y,T+=F,u+=Math.sqrt(R*R+T*T),R+=Y+k,T+=F+M,u+=Math.sqrt(R*R+T*T),m[L]=u,w=v,p=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let V=this.segments,N=0;for(let L=0,D=0,$=0,z=0;L<s;L++,D+=3){let j=o[L]*X;h+=j;let B=h;if(l)B%=u,B<0&&(B+=u),$=0;else if(B<0){this.addBeforePosition(B,n,0,a,D);continue}else if(B>u){this.addAfterPosition(B-u,n,c-4,a,D);continue}for(;;$++){let U=m[$];if(!(B>U)){if($==0)B/=U;else{let G=m[$-1];B=(B-G)/(U-G)}break}}if($!=d){d=$;let U=$*6;for(w=n[U],p=n[U+1],b=n[U+2],g=n[U+3],x=n[U+4],y=n[U+5],v=n[U+6],A=n[U+7],I=(w-b*2+x)*.03,C=(p-g*2+y)*.03,k=((b-x)*3-w+v)*.006,M=((g-y)*3-p+A)*.006,Y=I*2+k,F=C*2+M,R=(b-w)*.3+I+k*.16666667,T=(g-p)*.3+C+M*.16666667,N=Math.sqrt(R*R+T*T),V[0]=N,U=1;U<8;U++)R+=Y,T+=F,Y+=k,F+=M,N+=Math.sqrt(R*R+T*T),V[U]=N;R+=Y,T+=F,N+=Math.sqrt(R*R+T*T),V[8]=N,R+=Y+k,T+=F+M,N+=Math.sqrt(R*R+T*T),V[9]=N,z=0}for(B*=N;;z++){let U=V[z];if(!(B>U)){if(z==0)B/=U;else{let G=V[z-1];B=z+(B-G)/(U-G)}break}}this.addCurvePosition(B*.1,w,p,b,g,x,y,v,A,a,D,r||L>0&&j==0)}return a}addBeforePosition(e,s,r,i,h){let o=s[r],a=s[r+1],n=s[r+2]-o,l=s[r+3]-a,c=Math.atan2(l,n);i[h]=o+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addAfterPosition(e,s,r,i,h){let o=s[r+2],a=s[r+3],n=o-s[r],l=a-s[r+1],c=Math.atan2(l,n);i[h]=o+e*Math.cos(c),i[h+1]=a+e*Math.sin(c),i[h+2]=c}addCurvePosition(e,s,r,i,h,o,a,n,l,c,f,d){if(e==0||isNaN(e)){c[f]=s,c[f+1]=r,c[f+2]=Math.atan2(h-r,i-s);return}let m=e*e,u=m*e,w=1-e,p=w*w,b=p*w,g=w*e,x=g*3,y=w*x,v=x*e,A=s*b+i*y+o*v+n*u,I=r*b+h*y+a*v+l*u;c[f]=A,c[f+1]=I,d&&(e<.001?c[f+2]=Math.atan2(h-r,i-s):c[f+2]=Math.atan2(I-(r*p+h*g*2+a*m),A-(s*p+i*g*2+o*m)))}},ti=class{data;_bone=null;set bone(t){this._bone=t}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(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.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 t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=n.time;const c=o.worldX,f=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=f;else{let d=this.remaining,m=this.inertia,u=this.data.step,w=this.skeleton.data.referenceScale,p=-1,b=this.data.limit*l,g=b*Math.abs(n.scaleY);if(b*=Math.abs(n.scaleX),s||r){if(s){const x=(this.ux-c)*m;this.xOffset+=x>b?b:x<-b?-b:x,this.ux=c}if(r){const x=(this.uy-f)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=f}if(d>=u){p=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*w*n.scaleX,A=this.gravity*w*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=p),r&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=p),d-=u;while(d>=u)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||h){let x=Math.atan2(o.c,o.a),y=0,v=0,A=0,I=this.cx-o.worldX,C=this.cy-o.worldY;if(I>b?I=b:I<-b&&(I=-b),C>g?C=g:C<-g&&(C=-g),i){A=(this.data.rotate+this.data.shearX)*e;let k=Math.atan2(C+this.ty,I+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(k-Math.ceil(k*E.invPI2-.5)*E.PI2)*m,k=this.rotateOffset*A+x,y=Math.cos(k),v=Math.sin(k),h&&(k=a*o.getWorldScaleX(),k>0&&(this.scaleOffset+=(I*y+C*v)*m/k))}else{y=Math.cos(x),v=Math.sin(x);const k=a*o.getWorldScaleX();k>0&&(this.scaleOffset+=(I*y+C*v)*m/k)}if(d=this.remaining,d>=u){p==-1&&(p=Math.pow(this.damping,60*u));const k=this.massInverse*u,M=this.strength,Y=this.wind,F=Ot.yDown?-this.gravity:this.gravity,R=a/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*k,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=p),i){if(this.rotateVelocity-=((Y*v+F*y)*R+this.rotateOffset*M)*k,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=p,d<u)break;const T=this.rotateOffset*A+x;y=Math.cos(T),v=Math.sin(T)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let n=this.rotateOffset*e,l=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=n*this.data.rotate,l=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-l*o.d,o.d=l*f+c*o.d),d+=n*this.data.shearX,l=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-l*o.c,o.c=l*f+c*o.c}else n*=this.data.rotate,l=Math.sin(n),c=Math.cos(n),f=o.a,o.a=c*f-l*o.c,o.c=l*f+c*o.c,f=o.b,o.b=c*f-l*o.d,o.d=l*f+c*o.d}if(h){const n=1+this.scaleOffset*e*this.data.scaleX;o.a*=n,o.c*=n}t!=3&&(this.tx=a*o.a,this.ty=a*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*E.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-t,a=this.cy-e;this.translate(o*i-a*h-o,o*h+a*i-a)}},Is=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new q,this.darkColor=t.darkColor?new q:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof lt)||!(this.attachment instanceof lt)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,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}},Cs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Yt;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0;r<t.bones.length;r++){let i=e.findBone(t.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){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 t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,f=a.d,d=n*f-l*c>0?E.degRad:-E.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let p=0,b=w.length;p<b;p++){let g=w[p];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)-Math.atan2(v,x)+m;I>E.PI?I-=E.PI2:I<-E.PI&&(I+=E.PI2),I*=t;let C=Math.cos(I),k=Math.sin(I);g.a=C*x-k*v,g.b=C*y-k*A,g.c=k*x+C*v,g.d=k*y+C*A}if(o){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*e,g.worldY+=(x.y-g.worldY)*s}if(r!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(n*n+c*c)-x+this.data.offsetScaleX)*r)/x),g.a*=x,g.c*=x}if(i!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(l*l+f*f)-x+this.data.offsetScaleY)*i)/x),g.b*=x,g.d*=x}if(h>0){let x=g.b,y=g.d,v=Math.atan2(y,x),A=Math.atan2(f,l)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A=v+(A+u)*h;let I=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*I,g.d=Math.sin(A)*I}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,f=a.d,d=n*f-l*c>0?E.degRad:-E.degRad,m=this.data.offsetRotation*d,u=this.data.offsetShearY*d,w=this.bones;for(let p=0,b=w.length;p<b;p++){let g=w[p];if(t!=0){let x=g.a,y=g.b,v=g.c,A=g.d,I=Math.atan2(c,n)+m;I>E.PI?I-=E.PI2:I<-E.PI&&(I+=E.PI2),I*=t;let C=Math.cos(I),k=Math.sin(I);g.a=C*x-k*v,g.b=C*y-k*A,g.c=k*x+C*v,g.d=k*y+C*A}if(o){let x=this.temp;a.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*e,g.worldY+=x.y*s}if(r!=0){let x=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=x,g.c*=x}if(i!=0){let x=(Math.sqrt(l*l+f*f)-1+this.data.offsetScaleY)*i+1;g.b*=x,g.d*=x}if(h>0){let x=Math.atan2(f,l)-Math.atan2(c,n);x>E.PI?x-=E.PI2:x<-E.PI&&(x+=E.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-E.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*A,g.d=Math.sin(x)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],f=c.arotation;t!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*t);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,w=c.ascaleY;r!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*r)/u),i!=0&&w!=0&&(w=(w+(o.ascaleY-w+this.data.offsetScaleY)*i)/w);let p=c.ashearY;h!=0&&(p+=(o.ashearY-p+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],f=c.arotation+(o.arotation+this.data.offsetRotation)*t,d=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),w=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),p=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,m,f,u,w,c.ashearX,p)}}},Ot=class je{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return je.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 s=0;s<e.bones.length;s++){let r=e.bones[s],i;if(!r.parent)i=new Ee(r,this,null);else{let h=this.bones[r.parent.index];i=new Ee(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let r=e.slots[s],i=this.bones[r.boneData.index],h=new Is(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let r=e.ikConstraints[s];this.ikConstraints.push(new As(r,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let r=e.transformConstraints[s];this.transformConstraints.push(new Cs(r,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let r=e.pathConstraints[s];this.pathConstraints.push(new Ss(r,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let r=e.physicsConstraints[s];this.physicsConstraints.push(new ti(r,this))}this.color=new q(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let d=0,m=s.length;d<m;d++){let u=s[d];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let w=this.bones[d[m].index];do w.sorted=!1,w.active=!0,w=w.parent;while(w)}}let r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,a=r.length,n=i.length,l=h.length,c=this.physicsConstraints.length,f=a+n+l+c;t:for(let d=0;d<f;d++){for(let m=0;m<a;m++){let u=r[m];if(u.data.order==d){this.sortIkConstraint(u);continue t}}for(let m=0;m<n;m++){let u=i[m];if(u.data.order==d){this.sortTransformConstraint(u);continue t}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==d){this.sortPhysicsConstraint(u);continue t}}}for(let d=0,m=s.length;d<m;d++)this.sortBone(s[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let r=e.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let n=0,l=this.data.skins.length;n<l;n++)this.sortPathConstraintAttachment(this.data.skins[n],r,i);let h=s.getAttachment();h instanceof It&&this.sortPathConstraintAttachmentWith(h,i);let o=e.bones,a=o.length;for(let n=0;n<a;n++)this.sortBone(o[n]);this._updateCache.push(e);for(let n=0;n<a;n++)this.sortReset(o[n].children);for(let n=0;n<a;n++)o[n].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,r=s.length;if(e.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(e);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(e,s,r){let i=e.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof It))return;let r=e.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let a=r[h++];for(a+=h;h<a;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,r=e.length;s<r;s++){let i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let p=1,b=r.length;p<b;p++){let g=r[p];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,a=s.c,n=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=a*this.x+n*this.y+s.worldY;const l=(i.rotation+i.shearX)*E.degRad,c=(i.rotation+90+i.shearY)*E.degRad,f=Math.cos(l)*i.scaleX,d=Math.cos(c)*i.scaleY,m=Math.sin(l)*i.scaleX,u=Math.sin(c)*i.scaleY;i.a=(h*f+o*m)*this.scaleX,i.b=(h*d+o*u)*this.scaleX,i.c=(a*f+n*m)*this.scaleY,i.d=(a*d+n*u)*this.scaleY;let w=this._updateCache;for(let p=0,b=w.length;p<b;p++){let g=w[p];g!=i&&g.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;P.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,r=e.length;s<r;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],o=h.data.attachmentName;if(o){let a=e.getAttachment(r,o);a&&h.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let r=this.data.findSlot(e);if(!r)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(r.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(e,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let o=r[i];if(o.data.name==e){let a=null;if(s&&(a=this.getAttachment(i,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Yt,r=new Yt;return this.getBounds(s,r,void 0,e),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(e,s,r=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,f=h.length;c<f;c++){let d=h[c];if(!d.bone.active)continue;let m=0,u=null,w=null,p=d.getAttachment();if(p instanceof Nt)m=8,u=P.setArraySize(r,m,0),p.computeWorldVertices(d,u,0,2),w=je.quadTriangles;else if(p instanceof St){let b=p;m=b.worldVerticesLength,u=P.setArraySize(r,m,0),b.computeWorldVertices(d,0,m,u,0,2),w=b.triangles}else if(p instanceof Bt&&i!=null){i.clipStart(d,p);continue}if(u&&w){i!=null&&i.isClipping()&&(i.clipTriangles(u,w,w.length),u=i.clippedVertices,m=i.clippedVertices.length);for(let b=0,g=u.length;b<g;b+=2){let x=u[b],y=u[b+1];o=Math.min(o,x),a=Math.min(a,y),n=Math.max(n,x),l=Math.max(l,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),e.set(o,a),s.set(n-o,l-a)}update(e){this.time+=e}physicsTranslate(e,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(e,s)}physicsRotate(e,s,r){const i=this.physicsConstraints;for(let h=0,o=i.length;h<o;h++)i[h].rotate(e,s,r)}},ks=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(ks||{}),Ts=class extends Ct{_bone=null;set bone(t){this._bone=t}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(t){super(t,0,!1)}},Oe=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(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const i=e[s];if(i.name==t)return i}return null}},qe=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},qt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new q(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let r=0;r<t.bones.length;r++){let i=t.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<t.constraints.length;r++){let i=t.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let e=t.getAttachments();for(let r=0;r<e.length;r++){var s=e[r];s.attachment&&(s.attachment instanceof St?(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(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new qe(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new qe(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],h=i.getAttachment();if(h&&s<e.attachments.length){let o=e.attachments[s];for(let a in o){let n=o[a];if(h==n){let l=this.getAttachment(s,a);l&&i.setAttachment(l);break}}}s++}}},Ue=class{index=0;name;boneData;color=new q(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},We=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(We||{}),ze=class extends Ct{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},Ms=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Oe;s.name="";let r=new Ys(t),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let a=0;a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let f=l==0?null:s.bones[r.readInt(!0)],d=new Fe(l,c,f);d.rotation=r.readFloat(),d.x=r.readFloat()*e,d.y=r.readFloat()*e,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*e,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),o&&(q.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[r.readInt(!0)],d=new Ue(l,c,f);q.rgba8888ToColor(d.color,r.readInt32());let m=r.readInt32();m!=-1&&q.rgb888ToColor(d.darkColor=new q,m),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),o&&(d.visible=r.readBoolean()),s.slots.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Be(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?r.readFloat():1),(m&128)!=0&&(d.softness=r.readFloat()*e),s.ikConstraints.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new ze(f);d.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=r.readFloat()),(m&16)!=0&&(d.offsetX=r.readFloat()*e),(m&32)!=0&&(d.offsetY=r.readFloat()*e),(m&64)!=0&&(d.offsetScaleX=r.readFloat()),(m&128)!=0&&(d.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(d.offsetShearY=r.readFloat()),(m&2)!=0&&(d.mixRotate=r.readFloat()),(m&4)!=0&&(d.mixX=r.readFloat()),(m&8)!=0&&(d.mixY=r.readFloat()),(m&16)!=0&&(d.mixScaleX=r.readFloat()),(m&32)!=0&&(d.mixScaleY=r.readFloat()),(m&64)!=0&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){let f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Ve(f);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const m=r.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=e),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=e),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}a=r.readInt(!0);for(let l=0,c;l<a;l++){const f=r.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ts(f);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let m=r.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=r.readFloat()),(m&4)!=0&&(d.y=r.readFloat()),(m&8)!=0&&(d.rotate=r.readFloat()),(m&16)!=0&&(d.scaleX=r.readFloat()),(m&32)!=0&&(d.shearX=r.readFloat()),d.limit=((m&64)!=0?r.readFloat():5e3)*e,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=(m&128)!=0?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),m=r.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?r.readFloat():1,s.physicsConstraints.push(d)}let n=this.readSkin(r,s,!0,o);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(P.setArraySize(s.skins,a=l+r.readInt(!0));l<a;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}a=this.linkedMeshes.length;for(let l=0;l<a;l++){let c=this.linkedMeshes[l];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let f=new Pe(c);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}a=r.readInt(!0);for(let l=0;l<a;l++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(t,e,s,r){let i=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;i=new qt("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");i=new qt(o),r&&q.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let a=0,n=i.bones.length;a<n;a++)i.bones[a]=e.bones[t.readInt(!0)];for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let a=0,n=t.readInt(!0);a<n;a++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let o=0;o<h;o++){let a=t.readInt(!0);for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(t,e,i,a,c,r);f&&i.setAttachment(a,c,f)}}return i}readAttachment(t,e,s,r,i,h){let o=this.scale,a=t.readByte();const n=(a&8)!=0?t.readStringRef():i;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let l=(a&16)!=0?t.readStringRef():null;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null;let d=(a&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),w=t.readFloat(),p=t.readFloat(),b=t.readFloat(),g=t.readFloat();l||(l=n);let x=this.attachmentLoader.newRegionAttachment(s,n,l,f);return x?(x.path=l,x.x=m*o,x.y=u*o,x.scaleX=w,x.scaleY=p,x.rotation=d,x.width=b*o,x.height=g*o,q.rgba8888ToColor(x.color,c),x.sequence=f,f==null&&x.updateRegion(),x):null}case 1:{let l=this.readVertices(t,(a&16)!=0),c=h?t.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,n);return f?(f.worldVerticesLength=l.length,f.vertices=l.vertices,f.bones=l.bones,h&&q.rgba8888ToColor(f.color,c),f):null}case 2:{let l=(a&16)!=0?t.readStringRef():n;const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=t.readInt(!0),m=this.readVertices(t,(a&128)!=0),u=this.readFloatArray(t,m.length,1),w=this.readShortArray(t,(m.length-d-2)*3);let p=[],b=0,g=0;h&&(p=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),g=t.readFloat()),l||(l=n);let x=this.attachmentLoader.newMeshAttachment(s,n,l,f);return x?(x.path=l,q.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=w,x.regionUVs=u,f==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=f,h&&(x.edges=p,x.width=b*o,x.height=g*o),x):null}case 3:{const l=(a&16)!=0?t.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?t.readInt32():4294967295,f=(a&64)!=0?this.readSequence(t):null,d=(a&128)!=0,m=t.readInt(!0),u=t.readStringRef();let w=0,p=0;h&&(w=t.readFloat(),p=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,n,l,f);return b?(b.path=l,q.rgba8888ToColor(b.color,c),b.sequence=f,h&&(b.width=w*o,b.height=p*o),this.linkedMeshes.push(new ei(b,m,r,u,d)),b):null}case 4:{const l=(a&16)!=0,c=(a&32)!=0,f=this.readVertices(t,(a&64)!=0),d=P.newArray(f.length/6,0);for(let w=0,p=d.length;w<p;w++)d[w]=t.readFloat()*o;const m=h?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=l,u.constantSpeed=c,u.worldVerticesLength=f.length,u.vertices=f.vertices,u.bones=f.bones,u.lengths=d,h&&q.rgba8888ToColor(u.color,m),u):null}case 5:{const l=t.readFloat(),c=t.readFloat(),f=t.readFloat(),d=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*o,m.y=f*o,m.rotation=l,h&&q.rgba8888ToColor(m.color,d),m):null}case 6:{const l=t.readInt(!0),c=this.readVertices(t,(a&16)!=0);let f=h?t.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,n);return d?(d.endSlot=e.slots[l],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&q.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(t){let e=new is(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),i=new si;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let h=new Array,o=new Array;for(let a=0;a<r;a++){let n=t.readInt(!0);o.push(n);for(let l=0;l<n;l++)o.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=o,i}readFloatArray(t,e,s){let r=new Array(e);if(s==1)for(let i=0;i<e;i++)r[i]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0),w=u-1;switch(m){case mi:{let p=new ut(u,c);for(let b=0;b<u;b++)p.setFrame(b,t.readFloat(),t.readStringRef());r.push(p);break}case gi:{let p=t.readInt(!0),b=new ae(u,p,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,C=0;b.setFrame(I,g,x,y,v,A),I!=w;I++){let k=t.readFloat(),M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(I);break;case ht:W(t,b,C++,I,0,g,k,x,M,1),W(t,b,C++,I,1,g,k,y,Y,1),W(t,b,C++,I,2,g,k,v,F,1),W(t,b,C++,I,3,g,k,A,R,1)}g=k,x=M,y=Y,v=F,A=R}r.push(b);break}case xi:{let p=t.readInt(!0),b=new ne(u,p,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,I=0;b.setFrame(A,g,x,y,v),A!=w;A++){let C=t.readFloat(),k=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(A);break;case ht:W(t,b,I++,A,0,g,C,x,k,1),W(t,b,I++,A,1,g,C,y,M,1),W(t,b,I++,A,2,g,C,v,Y,1)}g=C,x=k,y=M,v=Y}r.push(b);break}case wi:{let p=t.readInt(!0),b=new oe(u,p,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let M=0,Y=0;b.setFrame(M,g,x,y,v,A,I,C,k),M!=w;M++){let F=t.readFloat(),R=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(M);break;case ht:W(t,b,Y++,M,0,g,F,x,R,1),W(t,b,Y++,M,1,g,F,y,T,1),W(t,b,Y++,M,2,g,F,v,X,1),W(t,b,Y++,M,3,g,F,A,V,1),W(t,b,Y++,M,4,g,F,I,N,1),W(t,b,Y++,M,5,g,F,C,L,1),W(t,b,Y++,M,6,g,F,k,D,1)}g=F,x=R,y=T,v=X,A=V,I=N,C=L,k=D}r.push(b);break}case pi:{let p=t.readInt(!0),b=new he(u,p,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let k=0,M=0;b.setFrame(k,g,x,y,v,A,I,C),k!=w;k++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255;switch(t.readByte()){case ot:b.setStepped(k);break;case ht:W(t,b,M++,k,0,g,Y,x,F,1),W(t,b,M++,k,1,g,Y,y,R,1),W(t,b,M++,k,2,g,Y,v,T,1),W(t,b,M++,k,3,g,Y,A,X,1),W(t,b,M++,k,4,g,Y,I,V,1),W(t,b,M++,k,5,g,Y,C,N,1)}g=Y,x=F,y=R,v=T,A=X,I=V,C=N}r.push(b);break}case bi:{let p=new le(u,t.readInt(!0),c),b=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;p.setFrame(x,b,g),x!=w;x++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case ot:p.setStepped(x);break;case ht:W(t,p,y++,x,0,b,v,g,A,1)}b=v,g=A}r.push(p)}}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0);for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readByte(),u=t.readInt(!0);if(m==ui){let p=new re(u,c);for(let b=0;b<u;b++)p.setFrame(b,t.readFloat(),t.readByte());r.push(p);continue}let w=t.readInt(!0);switch(m){case ii:r.push(Z(t,new At(u,w,c),1));break;case ri:r.push(_e(t,new jt(u,w,c),i));break;case ai:r.push(Z(t,new Jt(u,w,c),i));break;case ni:r.push(Z(t,new Kt(u,w,c),i));break;case li:r.push(_e(t,new Qt(u,w,c),1));break;case oi:r.push(Z(t,new Zt(u,w,c),1));break;case hi:r.push(Z(t,new te(u,w,c),1));break;case ci:r.push(_e(t,new ee(u,w,c),1));break;case di:r.push(Z(t,new se(u,w,c),1));break;case fi:r.push(Z(t,new ie(u,w,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new de(f,t.readInt(!0),c),u=t.readByte(),w=t.readFloat(),p=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,b=(u&4)!=0?t.readFloat()*i:0;for(let g=0,x=0;m.setFrame(g,w,p,b,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=d;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,A=(u&4)!=0?t.readFloat()*i:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(W(t,m,x++,g,0,w,y,p,v,1),W(t,m,x++,g,1,w,y,b,A,i)),w=y,p=v,b=A}r.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=t.readInt(!0),d=f-1,m=new fe(f,t.readInt(!0),c),u=t.readFloat(),w=t.readFloat(),p=t.readFloat(),b=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,p,b,g,x,y),v!=d;v++){let I=t.readFloat(),C=t.readFloat(),k=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),R=t.readFloat();switch(t.readByte()){case ot:m.setStepped(v);break;case ht:W(t,m,A++,v,0,u,I,w,C,1),W(t,m,A++,v,1,u,I,p,k,1),W(t,m,A++,v,2,u,I,b,M,1),W(t,m,A++,v,3,u,I,g,Y,1),W(t,m,A++,v,4,u,I,x,F,1),W(t,m,A++,v,5,u,I,y,R,1)}u=I,w=C,p=k,b=M,g=Y,x=F,y=R}r.push(m)}for(let n=0,l=t.readInt(!0);n<l;n++){let c=t.readInt(!0),f=s.pathConstraints[c];for(let d=0,m=t.readInt(!0);d<m;d++){const u=t.readByte(),w=t.readInt(!0),p=t.readInt(!0);switch(u){case Ai:r.push(Z(t,new ue(w,p,c),f.positionMode==0?i:1));break;case Si:r.push(Z(t,new me(w,p,c),f.spacingMode==0||f.spacingMode==1?i:1));break;case Ii:let b=new ge(w,p,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,I=0,C=b.getFrameCount()-1;b.setFrame(A,g,x,y,v),A!=C;A++){let k=t.readFloat(),M=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case ot:b.setStepped(A);break;case ht:W(t,b,I++,A,0,g,k,x,M,1),W(t,b,I++,A,1,g,k,y,Y,1),W(t,b,I++,A,2,g,k,v,F,1)}g=k,x=M,y=Y,v=F}r.push(b)}}}for(let n=0,l=t.readInt(!0);n<l;n++){const c=t.readInt(!0)-1;for(let f=0,d=t.readInt(!0);f<d;f++){const m=t.readByte(),u=t.readInt(!0);if(m==Ei){const p=new Se(u,c);for(let b=0;b<u;b++)p.setFrame(b,t.readFloat());r.push(p);continue}const w=t.readInt(!0);switch(m){case Ci:r.push(Z(t,new xe(u,w,c),1));break;case ki:r.push(Z(t,new we(u,w,c),1));break;case Ti:r.push(Z(t,new pe(u,w,c),1));break;case Mi:r.push(Z(t,new be(u,w,c),1));break;case Yi:r.push(Z(t,new ye(u,w,c),1));break;case Xi:r.push(Z(t,new ve(u,w,c),1));break;case Fi:r.push(Z(t,new Ae(u,w,c),1))}}}for(let n=0,l=t.readInt(!0);n<l;n++){let c=s.skins[t.readInt(!0)];for(let f=0,d=t.readInt(!0);f<d;f++){let m=t.readInt(!0);for(let u=0,w=t.readInt(!0);u<w;u++){let p=t.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,p),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case yi:{let v=b,A=v.bones,I=v.vertices,C=A?I.length/3*2:I.length,k=t.readInt(!0),M=new ce(x,k,m,v),Y=t.readFloat();for(let F=0,R=0;;F++){let T,X=t.readInt(!0);if(X==0)T=A?P.newFloatArray(C):I;else{T=P.newFloatArray(C);let N=t.readInt(!0);if(X+=N,i==1)for(let L=N;L<X;L++)T[L]=t.readFloat();else for(let L=N;L<X;L++)T[L]=t.readFloat()*i;if(!A)for(let L=0,D=T.length;L<D;L++)T[L]+=I[L]}if(M.setFrame(F,Y,T),F==y)break;let V=t.readFloat();switch(t.readByte()){case ot:M.setStepped(F);break;case ht:W(t,M,R++,F,0,Y,V,0,1,1)}Y=V}r.push(M);break}case vi:{let v=new Ie(x,m,b);for(let A=0;A<x;A++){let I=t.readFloat(),C=t.readInt32();v.setFrame(A,I,as[C&15],C>>4,t.readFloat())}r.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let n=new wt(h),l=s.slots.length;for(let c=0;c<h;c++){let f=t.readFloat(),d=t.readInt(!0),m=P.newArray(l,0);for(let b=l-1;b>=0;b--)m[b]=-1;let u=P.newArray(l-d,0),w=0,p=0;for(let b=0;b<d;b++){let g=t.readInt(!0);for(;w!=g;)u[p++]=w++;m[w+t.readInt(!0)]=w++}for(;w<l;)u[p++]=w++;for(let b=l-1;b>=0;b--)m[b]==-1&&(m[b]=u[--p]);n.setFrame(c,f,m)}r.push(n)}let o=t.readInt(!0);if(o>0){let n=new Et(o);for(let l=0;l<o;l++){let c=t.readFloat(),f=s.events[t.readInt(!0)],d=new Re(c,f);d.intValue=t.readInt(!1),d.floatValue=t.readFloat(),d.stringValue=t.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=t.readFloat(),d.balance=t.readFloat()),n.setFrame(l,d)}r.push(n)}let a=0;for(let n=0,l=r.length;n<l;n++)a=Math.max(a,r[n].getDuration());return new Xt(e,r,a)}},Ys=class{constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let r=0;r<t;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:e+=String.fromCharCode(i),r++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},ei=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},si=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let h=0,o=0,a=e.getFrameCount()-1;e.setFrame(h,r,i),h!=a;h++){let n=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(h);break;case ht:W(t,e,o++,h,0,r,n,i,l,s)}r=n,i=l}return e}function _e(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,h=t.readFloat()*s;for(let o=0,a=0,n=e.getFrameCount()-1;e.setFrame(o,r,i,h),o!=n;o++){let l=t.readFloat(),c=t.readFloat()*s,f=t.readFloat()*s;switch(t.readByte()){case ot:e.setStepped(o);break;case ht:W(t,e,a++,o,0,r,l,i,c,s),W(t,e,a++,o,1,r,l,h,f,s)}r=l,i=c,h=f}return e}function W(t,e,s,r,i,h,o,a,n,l){e.setBezier(s,r,i,h,a,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,o,n)}var ii=0,ri=1,ai=2,ni=3,li=4,oi=5,hi=6,ci=7,di=8,fi=9,ui=10,mi=0,gi=1,xi=2,wi=3,pi=4,bi=5,yi=0,vi=1,Ai=0,Si=1,Ii=2,Ci=0,ki=1,Ti=2,Mi=4,Yi=5,Xi=6,Fi=7,Ei=8,ot=1,ht=2,Ri=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new vt(()=>P.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=t.slots,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let a=0;a<o;a++){let n=h[a];if(!n.bone.active)continue;let l=n.getAttachment();if(l instanceof Me){let c=l;s.push(c);let f=i.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),r.push(f),c.computeWorldVertices(n,0,c.worldVerticesLength,f,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,o=i.length;h<o;h++){let a=i[h],n=a;for(let l=0,c=a.length;l<c;l+=2){let f=n[l],d=n[l+1];t=Math.min(t,f),e=Math.min(e,d),s=Math.max(s,f),r=Math.max(r,d)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,h=this.minY,o=this.maxX,a=this.maxY;if(t<=i&&s<=i||e<=h&&r<=h||t>=o&&s>=o||e>=a&&r>=a)return!1;let n=(r-e)/(s-t),l=n*(i-t)+e;if(l>h&&l<a||(l=n*(o-t)+e,l>h&&l<a))return!0;let c=(h-e)/n+t;return c>i&&c<o||(c=(a-e)/n+t,c>i&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,h=i-2,o=!1;for(let a=0;a<i;a+=2){let n=r[a+1],l=r[h+1];if(n<s&&l>=s||l<s&&n>=s){let c=r[a];c+(s-n)/(l-n)*(r[h]-c)<e&&(o=!o)}h=a}return o}intersectsSegment(t,e,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;h++)if(this.intersectsSegmentPolygon(i[h],t,e,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,r,i){let h=t,o=t.length,a=e-r,n=s-i,l=e*i-s*r,c=h[o-2],f=h[o-1];for(let d=0;d<o;d+=2){let m=h[d],u=h[d+1],w=c*u-f*m,p=c-m,b=f-u,g=a*b-n*p,x=(l*p-a*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let y=(l*b-n*w)/g;if((y>=f&&y<=u||y>=u&&y<=f)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,f=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Xs=class et{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new vt(()=>new Array);polygonIndicesPool=new vt(()=>new Array);triangulate(e){let s=e,r=e.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<r;a++)i[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=r;a<n;++a)h[a]=et.isConcave(a,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let a=r-1,n=0,l=1;for(;;){t:if(!h[n]){let d=i[a]<<1,m=i[n]<<1,u=i[l]<<1,w=s[d],p=s[d+1],b=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(l+1)%r;v!=a;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,I=s[A],C=s[A+1];if(et.positiveArea(x,y,w,p,I,C)&&et.positiveArea(w,p,b,g,I,C)&&et.positiveArea(b,g,x,y,I,C))break t}break}if(l==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=l,l=(l+1)%r}o.push(i[(r+n-1)%r]),o.push(i[n]),o.push(i[(n+1)%r]),i.splice(n,1),h.splice(n,1),r--;let c=(r+n-1)%r,f=n==r?0:n;h[c]=et.isConcave(c,r,s,i),h[f]=et.isConcave(f,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(e,s){let r=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,l=0;for(let c=0,f=s.length;c<f;c+=3){let d=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,w=r[d],p=r[d+1],b=r[m],g=r[m+1],x=r[u],y=r[u+1],v=!1;if(n==d){let A=a.length-4,I=et.winding(a[A],a[A+1],a[A+2],a[A+3],x,y),C=et.winding(x,y,a[0],a[1],a[2],a[3]);I==l&&C==l&&(a.push(x),a.push(y),o.push(u),v=!0)}v||(a.length>0?(i.push(a),h.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(w),a.push(p),a.push(b),a.push(g),a.push(x),a.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),l=et.winding(w,p,b,g,x,y),n=d)}a.length>0&&(i.push(a),h.push(o));for(let c=0,f=i.length;c<f;c++){if(o=h[c],o.length==0)continue;let d=o[0],m=o[o.length-1];a=i[c];let u=a.length-4,w=a[u],p=a[u+1],b=a[u+2],g=a[u+3],x=a[0],y=a[1],v=a[2],A=a[3],I=et.winding(w,p,b,g,x,y);for(let C=0;C<f;C++){if(C==c)continue;let k=h[C];if(k.length!=3)continue;let M=k[0],Y=k[1],F=k[2],R=i[C],T=R[R.length-2],X=R[R.length-1];if(M!=d||Y!=m)continue;let V=et.winding(w,p,b,g,T,X),N=et.winding(T,X,x,y,v,A);V==I&&N==I&&(R.length=0,k.length=0,a.push(T),a.push(X),o.push(F),w=b,p=g,b=T,g=X,C=0)}}for(let c=i.length-1;c>=0;c--)a=i[c],a.length==0&&(i.splice(c,1),this.polygonPool.free(a),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(e,s,r,i){let h=i[(s+e-1)%s]<<1,o=i[e]<<1,a=i[(e+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[a],r[a+1])}static positiveArea(e,s,r,i,h,o){return e*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(e,s,r,i,h,o){let a=r-e,n=i-s;return h*n-o*a+a*s-e*n>=0?1:-1}},Fs=class Je{triangulator=new Xs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(e,0,r,i,0,2);let h=this.clippingPolygon;Je.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=o.length;a<n;a++){let l=o[a];Je.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.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,s,r,i,h,o,a,n){let l,c,f,d,m,u;typeof s=="number"?(l=r,c=i,f=h,d=o,m=a,u=n):(l=s,c=r,f=i,d=h,m=o,u=a),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,l,c,f,d,m,u):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,n=a.length,l=0;h.length=0,o.length=0;for(let c=0;c<r;c+=3){let f=s[c]<<1,d=e[f],m=e[f+1];f=s[c+1]<<1;let u=e[f],w=e[f+1];f=s[c+2]<<1;let p=e[f],b=e[f+1];for(let g=0;g<n;g++){let x=h.length;if(this.clip(d,m,u,w,p,b,a[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,I=P.setArraySize(h,x+v*2);for(let k=0;k<y;k+=2,x+=2){let M=A[k],Y=A[k+1];I[x]=M,I[x+1]=Y}x=o.length;let C=P.setArraySize(o,x+3*(v-2));v--;for(let k=1;k<v;k++,x+=3)C[x]=l,C[x+1]=l+k,C[x+2]=l+k+1;l+=v+1}else{let y=P.setArraySize(h,x+6);y[x]=d,y[x+1]=m,y[x+2]=u,y[x+3]=w,y[x+4]=p,y[x+5]=b,x=o.length;let v=P.setArraySize(o,x+3);v[x]=l,v[x+1]=l+1,v[x+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,s,r,i,h,o,a){let n=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=a?12:8,u=0;l.length=0,c.length=0;for(let w=0;w<r;w+=3){let p=s[w]<<1,b=e[p],g=e[p+1],x=i[p],y=i[p+1];p=s[w+1]<<1;let v=e[p],A=e[p+1],I=i[p],C=i[p+1];p=s[w+2]<<1;let k=e[p],M=e[p+1],Y=i[p],F=i[p+1];for(let R=0;R<d;R++){let T=l.length;if(this.clip(b,g,v,A,k,M,f[R],n)){let X=n.length;if(X==0)continue;let V=A-M,N=k-v,L=b-k,D=M-g,$=1/(V*L+N*(g-M)),z=X>>1,j=this.clipOutput,B=P.setArraySize(l,T+z*m);for(let G=0;G<X;G+=2,T+=m){let tt=j[G],J=j[G+1];B[T]=tt,B[T+1]=J,B[T+2]=h.r,B[T+3]=h.g,B[T+4]=h.b,B[T+5]=h.a;let K=tt-k,Q=J-M,it=(V*K+N*Q)*$,gt=(D*K+L*Q)*$,bt=1-it-gt;B[T+6]=x*it+I*gt+Y*bt,B[T+7]=y*it+C*gt+F*bt,a&&(B[T+8]=o.r,B[T+9]=o.g,B[T+10]=o.b,B[T+11]=o.a)}T=c.length;let U=P.setArraySize(c,T+3*(z-2));z--;for(let G=1;G<z;G++,T+=3)U[T]=u,U[T+1]=u+G,U[T+2]=u+G+1;u+=z+1}else{let X=P.setArraySize(l,T+3*m);X[T]=b,X[T+1]=g,X[T+2]=h.r,X[T+3]=h.g,X[T+4]=h.b,X[T+5]=h.a,a?(X[T+6]=x,X[T+7]=y,X[T+8]=o.r,X[T+9]=o.g,X[T+10]=o.b,X[T+11]=o.a,X[T+12]=v,X[T+13]=A,X[T+14]=h.r,X[T+15]=h.g,X[T+16]=h.b,X[T+17]=h.a,X[T+18]=I,X[T+19]=C,X[T+20]=o.r,X[T+21]=o.g,X[T+22]=o.b,X[T+23]=o.a,X[T+24]=k,X[T+25]=M,X[T+26]=h.r,X[T+27]=h.g,X[T+28]=h.b,X[T+29]=h.a,X[T+30]=Y,X[T+31]=F,X[T+32]=o.r,X[T+33]=o.g,X[T+34]=o.b,X[T+35]=o.a):(X[T+6]=x,X[T+7]=y,X[T+8]=v,X[T+9]=A,X[T+10]=h.r,X[T+11]=h.g,X[T+12]=h.b,X[T+13]=h.a,X[T+14]=I,X[T+15]=C,X[T+16]=k,X[T+17]=M,X[T+18]=h.r,X[T+19]=h.g,X[T+20]=h.b,X[T+21]=h.a,X[T+22]=Y,X[T+23]=F),T=c.length;let V=P.setArraySize(c,T+3);V[T]=u,V[T+1]=u+1,V[T+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,r,i){let h=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,l=this.clippingPolygons,c=l.length,f=0;o.length=0,a.length=0,n.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,u=e[m],w=e[m+1],p=i[m],b=i[m+1];m=s[d+1]<<1;let g=e[m],x=e[m+1],y=i[m],v=i[m+1];m=s[d+2]<<1;let A=e[m],I=e[m+1],C=i[m],k=i[m+1];for(let M=0;M<c;M++){let Y=o.length;if(this.clip(u,w,g,x,A,I,l[M],h)){let F=h.length;if(F==0)continue;let R=x-I,T=A-g,X=u-A,V=I-w,N=1/(R*X+T*(w-I)),L=F>>1,D=this.clipOutput,$=P.setArraySize(o,Y+L*2),z=P.setArraySize(a,Y+L*2);for(let B=0;B<F;B+=2,Y+=2){let U=D[B],G=D[B+1];$[Y]=U,$[Y+1]=G;let tt=U-A,J=G-I,K=(R*tt+T*J)*N,Q=(V*tt+X*J)*N,it=1-K-Q;z[Y]=p*K+y*Q+C*it,z[Y+1]=b*K+v*Q+k*it}Y=n.length;let j=P.setArraySize(n,Y+3*(L-2));L--;for(let B=1;B<L;B++,Y+=3)j[Y]=f,j[Y+1]=f+B,j[Y+2]=f+B+1;f+=L+1}else{let F=P.setArraySize(o,Y+6);F[Y]=u,F[Y+1]=w,F[Y+2]=g,F[Y+3]=x,F[Y+4]=A,F[Y+5]=I;let R=P.setArraySize(a,Y+3*2);R[Y]=p,R[Y+1]=b,R[Y+2]=y,R[Y+3]=v,R[Y+4]=C,R[Y+5]=k,Y=n.length;let T=P.setArraySize(n,Y+3);T[Y]=f,T[Y+1]=f+1,T[Y+2]=f+2,f+=3;break}}}}clip(e,s,r,i,h,o,a,n){let l=n,c=!1,f;a.length%4>=2?(f=n,n=this.scratch):f=this.scratch,f.length=0,f.push(e),f.push(s),f.push(r),f.push(i),f.push(h),f.push(o),f.push(e),f.push(s),n.length=0;let d=a.length-4,m=a;for(let u=0;;u+=2){let w=m[u],p=m[u+1],b=w-m[u+2],g=p-m[u+3],x=n.length,y=f;for(let A=0,I=f.length-2;A<I;){let C=y[A],k=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(w-M)>b*(p-Y),R=g*(w-C)-b*(p-k);if(R>0){if(F){n.push(M),n.push(Y);continue}let T=M-C,X=Y-k,V=R/(T*g-X*b);if(V>=0&&V<=1)n.push(C+T*V),n.push(k+X*V);else{n.push(M),n.push(Y);continue}}else if(F){let T=M-C,X=Y-k,V=R/(T*g-X*b);if(V>=0&&V<=1)n.push(C+T*V),n.push(k+X*V),n.push(M),n.push(Y);else{n.push(M),n.push(Y);continue}}c=!0}if(x==n.length)return l.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==d)break;let v=n;n=f,n.length=0,f=v}if(l!=n){l.length=0;for(let u=0,w=n.length-2;u<w;u++)l[u]=n[u]}else l.length=l.length-2;return c}static makeClockwise(e){let s=e,r=e.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,o=0,a=0,n=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],a=s[l+2],n=s[l+3],i+=h*n-a*o;if(!(i<0))for(let l=0,c=r-2,f=r>>1;l<f;l+=2){let d=s[l],m=s[l+1],u=c-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=d,s[u+1]=m}}},Ge=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Oe,r=typeof t=="string"?JSON.parse(t):t,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=S(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let o=r.bones[h],a=null,n=S(o,"parent",null);n&&(a=s.findBone(n));let l=new Fe(s.bones.length,o.name,a);l.length=S(o,"length",0)*e,l.x=S(o,"x",0)*e,l.y=S(o,"y",0)*e,l.rotation=S(o,"rotation",0),l.scaleX=S(o,"scaleX",1),l.scaleY=S(o,"scaleY",1),l.shearX=S(o,"shearX",0),l.shearY=S(o,"shearY",0),l.inherit=P.enumValue(Dt,S(o,"inherit","Normal")),l.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(r.slots)for(let h=0;h<r.slots.length;h++){let o=r.slots[h],a=o.name,n=s.findBone(o.bone);if(!n)throw new Error(`Couldn't find bone ${o.bone} for slot ${a}`);let l=new Ue(s.slots.length,a,n),c=S(o,"color",null);c&&l.color.setFromString(c);let f=S(o,"dark",null);f&&(l.darkColor=q.fromString(f)),l.attachmentName=S(o,"attachment",null),l.blendMode=P.enumValue(We,S(o,"blend","normal")),l.visible=S(o,"visible",!0),s.slots.push(l)}if(r.ik)for(let h=0;h<r.ik.length;h++){let o=r.ik[h],a=new Be(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);a.bones.push(c)}let n=s.findBone(o.target);if(!n)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);a.target=n,a.mix=S(o,"mix",1),a.softness=S(o,"softness",0)*e,a.bendDirection=S(o,"bendPositive",!0)?1:-1,a.compress=S(o,"compress",!1),a.stretch=S(o,"stretch",!1),a.uniform=S(o,"uniform",!1),s.ikConstraints.push(a)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],a=new ze(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${o.name}.`);a.bones.push(d)}let n=o.target,l=s.findBone(n);if(!l)throw new Error(`Couldn't find target bone ${n} for transform constraint ${o.name}.`);a.target=l,a.local=S(o,"local",!1),a.relative=S(o,"relative",!1),a.offsetRotation=S(o,"rotation",0),a.offsetX=S(o,"x",0)*e,a.offsetY=S(o,"y",0)*e,a.offsetScaleX=S(o,"scaleX",0),a.offsetScaleY=S(o,"scaleY",0),a.offsetShearY=S(o,"shearY",0),a.mixRotate=S(o,"mixRotate",1),a.mixX=S(o,"mixX",1),a.mixY=S(o,"mixY",a.mixX),a.mixScaleX=S(o,"mixScaleX",1),a.mixScaleY=S(o,"mixScaleY",a.mixScaleX),a.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(a)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],a=new Ve(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${o.name}.`);a.bones.push(d)}let n=o.target,l=s.findSlot(n);if(!l)throw new Error(`Couldn't find target slot ${n} for path constraint ${o.name}.`);a.target=l,a.positionMode=P.enumValue(Le,S(o,"positionMode","Percent")),a.spacingMode=P.enumValue(Ne,S(o,"spacingMode","Length")),a.rotateMode=P.enumValue(De,S(o,"rotateMode","Tangent")),a.offsetRotation=S(o,"rotation",0),a.position=S(o,"position",0),a.positionMode==0&&(a.position*=e),a.spacing=S(o,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=e),a.mixRotate=S(o,"mixRotate",1),a.mixX=S(o,"mixX",1),a.mixY=S(o,"mixY",a.mixX),s.pathConstraints.push(a)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],a=new Ts(o.name);a.order=S(o,"order",0),a.skinRequired=S(o,"skin",!1);const n=o.bone,l=s.findBone(n);if(l==null)throw new Error("Physics bone not found: "+n);a.bone=l,a.x=S(o,"x",0),a.y=S(o,"y",0),a.rotate=S(o,"rotate",0),a.scaleX=S(o,"scaleX",0),a.shearX=S(o,"shearX",0),a.limit=S(o,"limit",5e3)*e,a.step=1/S(o,"fps",60),a.inertia=S(o,"inertia",1),a.strength=S(o,"strength",100),a.damping=S(o,"damping",1),a.massInverse=1/S(o,"mass",1),a.wind=S(o,"wind",0),a.gravity=S(o,"gravity",0),a.mix=S(o,"mix",1),a.inertiaGlobal=S(o,"inertiaGlobal",!1),a.strengthGlobal=S(o,"strengthGlobal",!1),a.dampingGlobal=S(o,"dampingGlobal",!1),a.massGlobal=S(o,"massGlobal",!1),a.windGlobal=S(o,"windGlobal",!1),a.gravityGlobal=S(o,"gravityGlobal",!1),a.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(a)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],a=new qt(o.name);if(o.bones)for(let n=0;n<o.bones.length;n++){let l=o.bones[n],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);a.bones.push(c)}if(o.ik)for(let n=0;n<o.ik.length;n++){let l=o.ik[n],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.transform)for(let n=0;n<o.transform.length;n++){let l=o.transform[n],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.path)for(let n=0;n<o.path.length;n++){let l=o.path[n],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.physics)for(let n=0;n<o.physics.length;n++){let l=o.physics[n],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}for(let n in o.attachments){let l=s.findSlot(n);if(!l)throw new Error(`Couldn't find slot ${n} for skin ${o.name}.`);let c=o.attachments[n];for(let f in c){let d=this.readAttachment(c[f],a,l.index,f,s);d&&a.setAttachment(l.index,f,d)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let l=n.getAttachment(a.slotIndex,a.parent);if(!l)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?l:a.mesh,a.mesh.setParentMesh(l),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],a=new Pe(h);a.intValue=S(o,"int",0),a.floatValue=S(o,"float",0),a.stringValue=S(o,"string",""),a.audioPath=S(o,"audio",null),a.audioPath&&(a.volume=S(o,"volume",1),a.balance=S(o,"balance",0)),s.events.push(a)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(t,e,s,r,i){let h=this.scale;switch(r=S(t,"name",r),S(t,"type","region")){case"region":{let o=S(t,"path",r),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(e,r,o,a);if(!n)return null;n.path=o,n.x=S(t,"x",0)*h,n.y=S(t,"y",0)*h,n.scaleX=S(t,"scaleX",1),n.scaleY=S(t,"scaleY",1),n.rotation=S(t,"rotation",0),n.width=t.width*h,n.height=t.height*h,n.sequence=a;let l=S(t,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let a=S(t,"color",null);return a&&o.color.setFromString(a),o}case"mesh":case"linkedmesh":{let o=S(t,"path",r),a=this.readSequence(S(t,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(e,r,o,a);if(!n)return null;n.path=o;let l=S(t,"color",null);l&&n.color.setFromString(l),n.width=S(t,"width",0)*h,n.height=S(t,"height",0)*h,n.sequence=a;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new Pi(n,S(t,"skin",null),s,c,S(t,"timelines",!0))),n;let f=t.uvs;return this.readVertices(t,n,f.length),n.triangles=t.triangles,n.regionUVs=f,n.region!=null&&n.updateRegion(),n.edges=S(t,"edges",null),n.hullLength=S(t,"hull",0)*2,n}case"path":{let o=this.attachmentLoader.newPathAttachment(e,r);if(!o)return null;o.closed=S(t,"closed",!1),o.constantSpeed=S(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,o,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<t.lengths.length;c++)n[c]=t.lengths[c]*h;o.lengths=n;let l=S(t,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,r);if(!o)return null;o.x=S(t,"x",0)*h,o.y=S(t,"y",0)*h,o.rotation=S(t,"rotation",0);let a=S(t,"color",null);return a&&o.color.setFromString(a),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,r);if(!o)return null;let a=S(t,"end",null);a&&(o.endSlot=i.findSlot(a));let n=t.vertexCount;this.readVertices(t,o,n<<1);let l=S(t,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(t){if(t==null)return null;let e=new is(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let a=P.toFloatArray(i);if(r!=1)for(let n=0,l=i.length;n<l;n++)a[n]*=r;e.vertices=a;return}let h=new Array,o=new Array;for(let a=0,n=i.length;a<n;){let l=i[a++];o.push(l);for(let c=a+l*4;a<c;a+=4)o.push(i[a]),h.push(i[a+1]*r),h.push(i[a+2]*r),h.push(i[a+3])}e.bones=o,e.vertices=P.toFloatArray(h)}readAnimation(t,e,s){let r=this.scale,i=new Array;if(t.slots)for(let o in t.slots){let a=t.slots[o],n=s.findSlot(o);if(!n)throw new Error("Slot not found: "+o);let l=n.index;for(let c in a){let f=a[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ut(d,l);for(let u=0;u<d;u++){let w=f[u];m.setFrame(u,S(w,"time",0),S(w,"name",null))}i.push(m)}else if(c=="rgba"){let m=new ae(d,d<<2,l),u=f[0],w=S(u,"time",0),p=q.fromString(u.color);for(let b=0,g=0;;b++){m.setFrame(b,w,p.r,p.g,p.b,p.a);let x=f[b+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,b,0,w,y,p.r,v.r,1),g=_(A,m,g,b,1,w,y,p.g,v.g,1),g=_(A,m,g,b,2,w,y,p.b,v.b,1),g=_(A,m,g,b,3,w,y,p.a,v.a,1)),w=y,p=v,u=x}i.push(m)}else if(c=="rgb"){let m=new ne(d,d*3,l),u=f[0],w=S(u,"time",0),p=q.fromString(u.color);for(let b=0,g=0;;b++){m.setFrame(b,w,p.r,p.g,p.b);let x=f[b+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=q.fromString(x.color),A=u.curve;A&&(g=_(A,m,g,b,0,w,y,p.r,v.r,1),g=_(A,m,g,b,1,w,y,p.g,v.g,1),g=_(A,m,g,b,2,w,y,p.b,v.b,1)),w=y,p=v,u=x}i.push(m)}else if(c=="alpha")i.push(at(f,new le(d,d,l),0,1));else if(c=="rgba2"){let m=new oe(d,d*7,l),u=f[0],w=S(u,"time",0),p=q.fromString(u.light),b=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,p.r,p.g,p.b,p.a,b.r,b.g,b.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,p.r,A.r,1),x=_(C,m,x,g,1,w,v,p.g,A.g,1),x=_(C,m,x,g,2,w,v,p.b,A.b,1),x=_(C,m,x,g,3,w,v,p.a,A.a,1),x=_(C,m,x,g,4,w,v,b.r,I.r,1),x=_(C,m,x,g,5,w,v,b.g,I.g,1),x=_(C,m,x,g,6,w,v,b.b,I.b,1)),w=v,p=A,b=I,u=y}i.push(m)}else if(c=="rgb2"){let m=new he(d,d*6,l),u=f[0],w=S(u,"time",0),p=q.fromString(u.light),b=q.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,w,p.r,p.g,p.b,b.r,b.g,b.b);let y=f[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),A=q.fromString(y.light),I=q.fromString(y.dark),C=u.curve;C&&(x=_(C,m,x,g,0,w,v,p.r,A.r,1),x=_(C,m,x,g,1,w,v,p.g,A.g,1),x=_(C,m,x,g,2,w,v,p.b,A.b,1),x=_(C,m,x,g,3,w,v,b.r,I.r,1),x=_(C,m,x,g,4,w,v,b.g,I.g,1),x=_(C,m,x,g,5,w,v,b.b,I.b,1)),w=v,p=A,b=I,u=y}i.push(m)}}}if(t.bones)for(let o in t.bones){let a=t.bones[o],n=s.findBone(o);if(!n)throw new Error("Bone not found: "+o);let l=n.index;for(let c in a){let f=a[c],d=f.length;if(d!=0){if(c==="rotate")i.push(at(f,new At(d,d,l),0,1));else if(c==="translate"){let m=new jt(d,d<<1,l);i.push($e(f,m,"x","y",0,r))}else if(c==="translatex"){let m=new Jt(d,d,l);i.push(at(f,m,0,r))}else if(c==="translatey"){let m=new Kt(d,d,l);i.push(at(f,m,0,r))}else if(c==="scale"){let m=new Qt(d,d<<1,l);i.push($e(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new Zt(d,d,l);i.push(at(f,m,1,1))}else if(c==="scaley"){let m=new te(d,d,l);i.push(at(f,m,1,1))}else if(c==="shear"){let m=new ee(d,d<<1,l);i.push($e(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new se(d,d,l);i.push(at(f,m,0,1))}else if(c==="sheary"){let m=new ie(d,d,l);i.push(at(f,m,0,1))}else if(c==="inherit"){let m=new re(d,n.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,S(w,"time",0),P.enumValue(Dt,S(w,"inherit","Normal")))}i.push(m)}}}}if(t.ik)for(let o in t.ik){let a=t.ik[o],n=a[0];if(!n)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),f=new de(a.length,a.length<<1,c),d=S(n,"time",0),m=S(n,"mix",1),u=S(n,"softness",0)*r;for(let w=0,p=0;;w++){f.setFrame(w,d,m,u,S(n,"bendPositive",!0)?1:-1,S(n,"compress",!1),S(n,"stretch",!1));let b=a[w+1];if(!b){f.shrink(p);break}let g=S(b,"time",0),x=S(b,"mix",1),y=S(b,"softness",0)*r,v=n.curve;v&&(p=_(v,f,p,w,0,d,g,m,x,1),p=_(v,f,p,w,1,d,g,u,y,r)),d=g,m=x,u=y,n=b}i.push(f)}if(t.transform)for(let o in t.transform){let a=t.transform[o],n=a[0];if(!n)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),f=new fe(a.length,a.length*6,c),d=S(n,"time",0),m=S(n,"mixRotate",1),u=S(n,"mixX",1),w=S(n,"mixY",u),p=S(n,"mixScaleX",1),b=S(n,"mixScaleY",p),g=S(n,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,p,b,g);let v=a[x+1];if(!v){f.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),k=S(v,"mixY",C),M=S(v,"mixScaleX",1),Y=S(v,"mixScaleY",M),F=S(v,"mixShearY",1),R=n.curve;R&&(y=_(R,f,y,x,0,d,A,m,I,1),y=_(R,f,y,x,1,d,A,u,C,1),y=_(R,f,y,x,2,d,A,w,k,1),y=_(R,f,y,x,3,d,A,p,M,1),y=_(R,f,y,x,4,d,A,b,Y,1),y=_(R,f,y,x,5,d,A,g,F,1)),d=A,m=I,u=C,w=k,p=M,b=Y,p=M,n=v}i.push(f)}if(t.path)for(let o in t.path){let a=t.path[o],n=s.findPathConstraint(o);if(!n)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(n);for(let c in a){let f=a[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new ue(m,m,l);i.push(at(f,u,0,n.positionMode==0?r:1))}else if(c==="spacing"){let u=new me(m,m,l);i.push(at(f,u,0,n.spacingMode==0||n.spacingMode==1?r:1))}else if(c==="mix"){let u=new ge(m,m*3,l),w=S(d,"time",0),p=S(d,"mixRotate",1),b=S(d,"mixX",1),g=S(d,"mixY",b);for(let x=0,y=0;;x++){u.setFrame(x,w,p,b,g);let v=f[x+1];if(!v){u.shrink(y);break}let A=S(v,"time",0),I=S(v,"mixRotate",1),C=S(v,"mixX",1),k=S(v,"mixY",C),M=d.curve;M&&(y=_(M,u,y,x,0,w,A,p,I,1),y=_(M,u,y,x,1,w,A,b,C,1),y=_(M,u,y,x,2,w,A,g,k,1)),w=A,p=I,b=C,g=k,d=v}i.push(u)}}}if(t.physics)for(let o in t.physics){let a=t.physics[o],n=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);n=s.physicsConstraints.indexOf(l)}for(let l in a){let c=a[l],f=c[0];if(!f)continue;let d=c.length;if(l=="reset"){const u=new Se(d,n);for(let w=0;f!=null;f=c[w+1],w++)u.setFrame(w,S(f,"time",0));i.push(u);continue}let m;if(l=="inertia")m=new xe(d,d,n);else if(l=="strength")m=new we(d,d,n);else if(l=="damping")m=new pe(d,d,n);else if(l=="mass")m=new be(d,d,n);else if(l=="wind")m=new ye(d,d,n);else if(l=="gravity")m=new ve(d,d,n);else if(l=="mix")m=new Ae(d,d,n);else continue;i.push(at(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let a=t.attachments[o],n=s.findSkin(o);if(!n)throw new Error("Skin not found: "+o);for(let l in a){let c=a[l],f=s.findSlot(l);if(!f)throw new Error("Slot not found: "+l);let d=f.index;for(let m in c){let u=c[m],w=n.getAttachment(d,m);for(let p in u){let b=u[p],g=b[0];if(g){if(p=="deform"){let x=w.bones,y=w.vertices,v=x?y.length/3*2:y.length,A=new ce(b.length,b.length,d,w),I=S(g,"time",0);for(let C=0,k=0;;C++){let M,Y=S(g,"vertices",null);if(!Y)M=x?P.newFloatArray(v):y;else{M=P.newFloatArray(v);let X=S(g,"offset",0);if(P.arrayCopy(Y,0,M,X,Y.length),r!=1)for(let V=X,N=V+Y.length;V<N;V++)M[V]*=r;if(!x)for(let V=0;V<v;V++)M[V]+=y[V]}A.setFrame(C,I,M);let F=b[C+1];if(!F){A.shrink(k);break}let R=S(F,"time",0),T=g.curve;T&&(k=_(T,A,k,C,0,I,R,0,1,1)),I=R,g=F}i.push(A)}else if(p=="sequence"){let x=new Ie(b.length,d,w),y=0;for(let v=0;v<b.length;v++){let A=S(g,"delay",y),I=S(g,"time",0),C=rs[S(g,"mode","hold")],k=S(g,"index",0);x.setFrame(v,I,C,k,A),y=A,g=b[v+1]}i.push(x)}}}}}}if(t.drawOrder){let o=new wt(t.drawOrder.length),a=s.slots.length,n=0;for(let l=0;l<t.drawOrder.length;l++,n++){let c=t.drawOrder[l],f=null,d=S(c,"offsets",null);if(d){f=P.newArray(a,-1);let m=P.newArray(a-d.length,0),u=0,w=0;for(let p=0;p<d.length;p++){let b=d[p],g=s.findSlot(b.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[w++]=u++;f[u+b.offset]=u++}for(;u<a;)m[w++]=u++;for(let p=a-1;p>=0;p--)f[p]==-1&&(f[p]=m[--w])}o.setFrame(n,S(c,"time",0),f)}i.push(o)}if(t.events){let o=new Et(t.events.length),a=0;for(let n=0;n<t.events.length;n++,a++){let l=t.events[n],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let f=new Re(P.toSinglePrecision(S(l,"time",0)),c);f.intValue=S(l,"int",c.intValue),f.floatValue=S(l,"float",c.floatValue),f.stringValue=S(l,"string",c.stringValue),f.data.audioPath&&(f.volume=S(l,"volume",1),f.balance=S(l,"balance",0)),o.setFrame(a,f)}i.push(o)}let h=0;for(let o=0,a=i.length;o<a;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new Xt(e,i,h))}},Pi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function at(t,e,s,r){let i=t[0],h=S(i,"time",0),o=S(i,"value",s)*r,a=0;for(let n=0;;n++){e.setFrame(n,h,o);let l=t[n+1];if(!l)return e.shrink(a),e;let c=S(l,"time",0),f=S(l,"value",s)*r;i.curve&&(a=_(i.curve,e,a,n,0,h,c,o,f,r)),h=c,o=f,i=l}}function $e(t,e,s,r,i,h){let o=t[0],a=S(o,"time",0),n=S(o,s,i)*h,l=S(o,r,i)*h,c=0;for(let f=0;;f++){e.setFrame(f,a,n,l);let d=t[f+1];if(!d)return e.shrink(c),e;let m=S(d,"time",0),u=S(d,s,i)*h,w=S(d,r,i)*h,p=o.curve;p&&(c=_(p,e,c,f,0,a,m,n,u,h),c=_(p,e,c,f,1,a,m,l,w,h)),a=m,n=u,l=w,o=d}}function _(t,e,s,r,i,h,o,a,n,l){if(t=="stepped")return e.setStepped(r),s;let c=i<<2,f=t[c],d=t[c+1]*l,m=t[c+2],u=t[c+3]*l;return e.setBezier(s,r,i,h,a,f,d,m,u,o,n),s+1}function S(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1))),Ot.yDown=!0;function Bi(t,e){switch(e){case 0:return t.BlendMode.SrcOver;case 1:return t.BlendMode.Plus;case 2:return t.BlendMode.SrcOver;case 3:return t.BlendMode.Screen;default:return t.BlendMode.SrcOver}}function Es(t){if(typeof Buffer<"u")return t.toString("utf-8");if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(t);throw new Error("Unsupported environment")}var Vi=class Ws extends Ye{getImage(){return this._image}setFilters(){}setWraps(){}dispose(){const e=this._image;for(const s of e.paintPerBlendMode.values())s.delete();for(const s of e.shaders)s.delete();e.image.delete(),this._image=null}static async fromFile(e,s,r){const i=await r(s);if(!i)throw new Error(`Could not load image ${s}`);const h=e.MakeImageFromEncoded(i);if(!h)throw new Error(`Could not load image ${s}`);const o=new Map,a=[];for(const n of[0,1,2,3]){const l=new e.Paint,c=h.makeShaderOptions(e.TileMode.Clamp,e.TileMode.Clamp,e.FilterMode.Linear,e.MipmapMode.Linear);l.setShader(c),l.setBlendMode(Bi(e,n)),o.set(n,l),a.push(c)}return new Ws({shaders:a,paintPerBlendMode:o,image:h})}};async function Li(t,e,s){const r=new Lt(Es(await s(e))),i=e.lastIndexOf("/"),h=i>=0?e.substring(0,i+1):"";for(const o of r.pages){const a=await Vi.fromFile(t,h+o.name,s);o.setTexture(a)}return r}async function Ni(t,e,s,r=1){const i=new bs(e),h=t.endsWith(".json")?new Ge(i):new Ms(i);h.scale=r;const o=await s(t);return h instanceof Ge?h.readSkeletonData(Es(o)):h.readSkeletonData(o)}var Rs=class{skeleton;animationState;constructor(t){this.skeleton=new Ot(t),this.animationState=new os(new ms(t))}update(t,e=2){this.animationState.update(t),this.skeleton.update(t),this.animationState.apply(this.skeleton),this.skeleton.updateWorldTransform(e)}},Di=class zs{constructor(e){this.ck=e}clipper=new Fs;static QUAD_TRIANGLES=[0,1,2,2,3,0];scratchPositions=P.newFloatArray(100);scratchUVs=P.newFloatArray(100);scratchColors=new Uint32Array(100/4);render(e,s){s instanceof Rs&&(s=s.skeleton);const r=this.clipper,i=s.drawOrder,h=s.color;for(let o=0,a=i.length;o<a;o++){const n=i[o];if(!n.bone.active){r.clipEndWithSlot(n);continue}const l=n.getAttachment();let c=this.scratchPositions,f,d=4;if(l instanceof Nt)l.computeWorldVertices(n,c,0,2),f=zs.QUAD_TRIANGLES;else if(l instanceof St)c.length<l.worldVerticesLength&&(this.scratchPositions=P.newFloatArray(l.worldVerticesLength),c=this.scratchPositions),d=l.worldVerticesLength>>1,l.computeWorldVertices(n,0,l.worldVerticesLength,c,0,2),f=l.triangles;else if(l instanceof Bt){r.clipStart(n,l);continue}else{r.clipEndWithSlot(n);continue}const m=l.region?.texture;if(m){let u=l.uvs,w,p=this.scratchColors;if(r.isClipping()){if(r.clipTrianglesUnpacked(c,f,f.length,u),r.clippedVertices.length<=0){r.clipEndWithSlot(n);continue}c=r.clippedVertices,u=w=r.clippedUVs,f=r.clippedTriangles,d=r.clippedVertices.length/2,p=new Uint32Array(d)}else w=this.scratchUVs,this.scratchUVs.length<u.length&&(w=this.scratchUVs=P.newFloatArray(u.length)),p.length<d&&(p=this.scratchColors=new Uint32Array(d));const b=m.getImage(),g=b.image,x=g.width(),y=g.height();for(let M=0;M<u.length;M+=2)w[M]=u[M]*x,w[M+1]=u[M+1]*y;const v=l.color,A=n.color,I=(E.clamp(h.a*A.a*v.a*255,0,255)<<24|E.clamp(h.r*A.r*v.r*255,0,255)<<16|E.clamp(h.g*A.g*v.g*255,0,255)<<8|E.clamp(h.b*A.b*v.b*255,0,255)<<0)>>>0;for(let M=0,Y=d;M<Y;M++)p[M]=I;const C=this.ck.MakeVertices(this.ck.VertexMode.Triangles,c,w,p,f,!1),k=b.paintPerBlendMode.get(n.data.blendMode);k&&e.drawVertices(C,this.ck.BlendMode.Modulate,k),C.delete()}r.clipEndWithSlot(n)}r.clipEnd()}};export{le as AlphaTimeline,Xt as Animation,os as AnimationState,Js as AnimationStateAdapter,ms as AnimationStateData,ys as AssetCache,Zs as AssetManagerBase,bs as AtlasAttachmentLoader,Ht as Attachment,ut as AttachmentTimeline,Ys as BinaryInput,We as BlendMode,Ee as Bone,Fe as BoneData,Me as BoundingBoxAttachment,us as CURRENT,Bt as ClippingAttachment,q as Color,Ct as ConstraintData,rt as CurveTimeline,st as CurveTimeline1,Ft as CurveTimeline2,$s as DebugUtils,ce as DeformTimeline,vs as Downloader,wt as DrawOrderTimeline,Re as Event,Pe as EventData,cs as EventQueue,Et as EventTimeline,ds as EventType,Ce as FIRST,Ks as FakeTexture,Pt as HOLD_FIRST,fs as HOLD_MIX,ke as HOLD_SUBSEQUENT,As as IkConstraint,Be as IkConstraintData,de as IkConstraintTimeline,Dt as Inherit,re as InheritTimeline,_s as IntSet,es as Interpolation,E as MathUtils,St as MeshAttachment,ns as MixBlend,ls as MixDirection,It as PathAttachment,Ss as PathConstraint,Ve as PathConstraintData,ge as PathConstraintMixTimeline,ue as PathConstraintPositionTimeline,me as PathConstraintSpacingTimeline,ks as Physics,pe as PhysicsConstraintDampingTimeline,ve as PhysicsConstraintGravityTimeline,xe as PhysicsConstraintInertiaTimeline,be as PhysicsConstraintMassTimeline,Ae as PhysicsConstraintMixTimeline,Se as PhysicsConstraintResetTimeline,we as PhysicsConstraintStrengthTimeline,ct as PhysicsConstraintTimeline,ye as PhysicsConstraintWindTimeline,ps as PointAttachment,vt as Pool,Le as PositionMode,ss as Pow,Gs as PowOut,he as RGB2Timeline,oe as RGBA2Timeline,ae as RGBATimeline,ne as RGBTimeline,Nt as RegionAttachment,De as RotateMode,At as RotateTimeline,Te as SETUP,Rt as SUBSEQUENT,Qt as ScaleTimeline,Zt as ScaleXTimeline,te as ScaleYTimeline,Ie as SequenceTimeline,ee as ShearTimeline,se as ShearXTimeline,ie as ShearYTimeline,Ot as Skeleton,Ms as SkeletonBinary,Ri as SkeletonBounds,Fs as SkeletonClipping,Oe as SkeletonData,Rs as SkeletonDrawable,Ge as SkeletonJson,Di as SkeletonRenderer,qt as Skin,qe as SkinEntry,Is as Slot,Ue as SlotData,Ne as SpacingMode,$t as StringSet,Ye as Texture,Lt as TextureAtlas,ws as TextureAtlasPage,Xe as TextureAtlasRegion,Vt as TextureFilter,xs as TextureRegion,gs as TextureWrap,Hs as TimeKeeper,H as Timeline,hs as TrackEntry,Cs as TransformConstraint,ze as TransformConstraintData,fe as TransformConstraintTimeline,jt as TranslateTimeline,Jt as TranslateXTimeline,Kt as TranslateYTimeline,Xs as Triangulator,P as Utils,Yt as Vector2,lt as VertexAttachment,js as WindowedMean,Ni as loadSkeletonData,Li as loadTextureAtlas};
|