@esotericsoftware/spine-canvaskit 4.2.92 → 4.2.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var spine=(()=>{var _e=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,$s=Object.getOwnPropertyNames,js=Object.prototype.hasOwnProperty,Js=(e,t)=>{for(var s in t)_e(e,s,{get:t[s],enumerable:!0})},Ks=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $s(t))!js.call(e,i)&&i!==s&&_e(e,i,{get:()=>t[i],enumerable:!(r=Hs(t,i))||r.enumerable});return e},Qs=e=>Ks(_e({},"__esModule",{value:!0}),e),Qt={};Js(Qt,{AlphaTimeline:()=>at,Animation:()=>ke,AnimationState:()=>as,AnimationStateAdapter:()=>ri,AnimationStateData:()=>fs,AssetCache:()=>ps,AssetManagerBase:()=>li,AtlasAttachmentLoader:()=>ws,Attachment:()=>He,AttachmentTimeline:()=>ue,BinaryInput:()=>ks,BlendMode:()=>Ut,Bone:()=>Ft,BoneData:()=>Xt,BoundingBoxAttachment:()=>kt,CURRENT:()=>ds,ClippingAttachment:()=>Ee,Color:()=>q,ConstraintData:()=>Se,CurveTimeline:()=>ie,CurveTimeline1:()=>se,CurveTimeline2:()=>Me,DebugUtils:()=>ti,DeformTimeline:()=>ht,Downloader:()=>bs,DrawOrderTimeline:()=>ge,Event:()=>Et,EventData:()=>Rt,EventQueue:()=>os,EventTimeline:()=>Ye,EventType:()=>hs,FIRST:()=>Ct,FakeTexture:()=>ni,HOLD_FIRST:()=>Fe,HOLD_MIX:()=>cs,HOLD_SUBSEQUENT:()=>It,IkConstraint:()=>ys,IkConstraintData:()=>Pt,IkConstraintTimeline:()=>ct,Inherit:()=>Ve,InheritTimeline:()=>it,IntSet:()=>Zs,Interpolation:()=>Zt,MathUtils:()=>E,MeshAttachment:()=>ve,MixBlend:()=>rs,MixDirection:()=>ns,PathAttachment:()=>Ae,PathConstraint:()=>vs,PathConstraintData:()=>Bt,PathConstraintMixTimeline:()=>mt,PathConstraintPositionTimeline:()=>ft,PathConstraintSpacingTimeline:()=>ut,Physics:()=>Cs,PhysicsConstraintDampingTimeline:()=>wt,PhysicsConstraintGravityTimeline:()=>yt,PhysicsConstraintInertiaTimeline:()=>gt,PhysicsConstraintMassTimeline:()=>pt,PhysicsConstraintMixTimeline:()=>vt,PhysicsConstraintResetTimeline:()=>At,PhysicsConstraintStrengthTimeline:()=>xt,PhysicsConstraintTimeline:()=>ce,PhysicsConstraintWindTimeline:()=>bt,PointAttachment:()=>xs,Pool:()=>be,PositionMode:()=>Vt,Pow:()=>es,PowOut:()=>ei,RGB2Timeline:()=>ot,RGBA2Timeline:()=>lt,RGBATimeline:()=>rt,RGBTimeline:()=>nt,RegionAttachment:()=>Be,RotateMode:()=>Dt,RotateTimeline:()=>ye,SETUP:()=>Tt,SUBSEQUENT:()=>Xe,ScaleTimeline:()=>Ke,ScaleXTimeline:()=>Qe,ScaleYTimeline:()=>Ze,SequenceTimeline:()=>St,ShearTimeline:()=>et,ShearXTimeline:()=>tt,ShearYTimeline:()=>st,Skeleton:()=>Le,SkeletonBinary:()=>Ts,SkeletonBounds:()=>qi,SkeletonClipping:()=>Ys,SkeletonData:()=>Ot,SkeletonDrawable:()=>Fs,SkeletonJson:()=>_t,SkeletonRenderer:()=>Hi,Skin:()=>De,SkinEntry:()=>Nt,Slot:()=>As,SlotData:()=>qt,SpacingMode:()=>Lt,StringSet:()=>Ge,Texture:()=>Mt,TextureAtlas:()=>Pe,TextureAtlasPage:()=>gs,TextureAtlasRegion:()=>Yt,TextureFilter:()=>Re,TextureRegion:()=>ms,TextureWrap:()=>us,TimeKeeper:()=>si,Timeline:()=>$,TrackEntry:()=>ls,TransformConstraint:()=>Ss,TransformConstraintData:()=>Wt,TransformConstraintTimeline:()=>dt,TranslateTimeline:()=>$e,TranslateXTimeline:()=>je,TranslateYTimeline:()=>Je,Triangulator:()=>Ms,Utils:()=>P,Vector2:()=>Te,VertexAttachment:()=>le,WindowedMean:()=>ii,loadSkeletonData:()=>Gi,loadTextureAtlas:()=>_i});var Zs=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}},Ge=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}},q=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)}},E=class ae{static PI=3.1415927;static PI2=ae.PI*2;static invPI2=1/ae.PI2;static radiansToDegrees=180/ae.PI;static radDeg=ae.radiansToDegrees;static degreesToRadians=ae.PI/180;static degRad=ae.degreesToRadians;static clamp(t,s,r){return t<s?s:t>r?r:t}static cosDeg(t){return Math.cos(t*ae.degRad)}static sinDeg(t){return Math.sin(t*ae.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ae.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 ae.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}},Zt=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},es=class extends Zt{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}},ei=class extends es{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},P=class pe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,h){for(let o=s,n=i;o<s+h;o++,n++)r[n]=t[o]}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)]}},ti=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)}}},be=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}},Te=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}},si=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)}},ii=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 Vs extends He{static nextID=0;id=Vs.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,h,o){r=h+(r>>1)*o;let n=t.bone.skeleton,a=t.deform,l=this.vertices,c=this.bones;if(!c){a.length>0&&(l=a);let u=t.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 C=l[v],I=l[v+1];i[A]=C*b+I*g+w,i[A+1]=C*x+I*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=n.bones;if(a.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=a;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],C=l[p+1]+u[b+1],I=l[p+2];g+=(A*v.a+C*v.b+v.worldX)*I,x+=(A*v.c+C*v.d+v.worldY)*I}i[w]=g,i[w+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},ts=class Ue{static _nextID=0;id=Ue.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Ue(this.regions.length);return P.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 Ue._nextID++}},ss=(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))(ss||{}),is=[0,1,2,3,4,5,6],ke=class{name;timelines=[];timelineIds=new Ge;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,o,n){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l<c;l++)a[l].apply(e,t,s,i,h,o,n)}},rs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(rs||{}),ns=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ns||{}),D={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},$=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=P.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}},ie=class extends ${curves;constructor(e,t,s){super(e,s),this.curves=P.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=P.newFloatArray(t);P.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,i,h,o,n,a,l,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(r-h*2+n)*.03,u=(i-o*2+a)*.03,w=((h-n)*3-r+l)*.006,p=((o-a)*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 C=d+18;d<C;d+=2)f[d]=v,f[d+1]=A,x+=b,y+=g,b+=w,g+=p,v+=x,A+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let a=this.frames[t],l=this.frames[t+s];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=e){let a=i[r-2],l=i[r-1];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}t+=this.getFrameEntries();let o=i[h-2],n=i[h-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},se=class extends ie{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 o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*t}return i}let n=this.getCurveValue(e)*h;if(t==1)return s==3?i+n-h:n;if(r==1)switch(s){case 0:return h+(Math.abs(n)*E.signum(h)-h)*t;case 1:case 2:return i+(Math.abs(n)*E.signum(i)-i)*t}else{let a=0;switch(s){case 0:return a=Math.abs(h)*E.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(i)*E.signum(n),a+(n-a)*t}}return i+(n-h)*t}},Me=class extends ie{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}},ye=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,i,h,n.rotation,n.data.rotation))}},$e=class extends Me{boneIndex=0;constructor(e,t,s){super(e,t,D.x+"|"+s,D.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*i,n.y+=(n.data.y-n.y)*i}return}let l=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);l+=(a[f+3+1]-l)*u,c+=(a[f+3+2]-c)*u;break;case 1:l=a[f+1],c=a[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:n.x=n.data.x+l*i,n.y=n.data.y+c*i;break;case 1:case 2:n.x+=(n.data.x+l-n.x)*i,n.y+=(n.data.y+c-n.y)*i;break;case 3:n.x+=l*i,n.y+=c*i}}},je=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,i,h,n.x,n.data.x))}},Je=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,i,h,n.y,n.data.y))}},Ke=class extends Me{boneIndex=0;constructor(e,t,s){super(e,t,D.scaleX+"|"+s,D.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*i,n.scaleY+=(n.data.scaleY-n.scaleY)*i}return}let l,c,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);l+=(a[f+3+1]-l)*u,c+=(a[f+3+2]-c)*u;break;case 1:l=a[f+1],c=a[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(l*=n.data.scaleX,c*=n.data.scaleY,i==1)h==3?(n.scaleX+=l-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=l,n.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,n.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,n.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}else switch(h){case 0:m=Math.abs(n.data.scaleX)*E.signum(l),u=Math.abs(n.data.scaleY)*E.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(n.scaleX)*E.signum(l),u=Math.abs(n.scaleY)*E.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=u+(c-u)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}}}},Qe=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,i,h,o,n.scaleX,n.data.scaleX))}},Ze=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,i,h,o,n.scaleY,n.data.scaleY))}},et=class extends Me{boneIndex=0;constructor(e,t,s){super(e,t,D.shearX+"|"+s,D.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*i,n.shearY+=(n.data.shearY-n.shearY)*i}return}let l=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);l+=(a[f+3+1]-l)*u,c+=(a[f+3+2]-c)*u;break;case 1:l=a[f+1],c=a[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:n.shearX=n.data.shearX+l*i,n.shearY=n.data.shearY+c*i;break;case 1:case 2:n.shearX+=(n.data.shearX+l-n.shearX)*i,n.shearY+=(n.data.shearY+c-n.shearY)*i;break;case 3:n.shearX+=l*i,n.shearY+=c*i}}},tt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,i,h,n.shearX,n.data.shearX))}},st=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,i,h,n.shearY,n.data.shearY))}},it=class extends ${boneIndex=0;constructor(e,t){super(e,[D.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,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[$.search(a,s,2)+1]}},rt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.rgb+"|"+s,D.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,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let p=n.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=$.search(a,s,5),w=this.curves[u/5];switch(w){case 0:let p=a[u];c=a[u+1],f=a[u+2],d=a[u+3],m=a[u+4];let b=(s-p)/(a[u+5]-p);c+=(a[u+5+1]-c)*b,f+=(a[u+5+2]-f)*b,d+=(a[u+5+3]-d)*b,m+=(a[u+5+4]-m)*b;break;case 1:c=a[u+1],f=a[u+2],d=a[u+3],m=a[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(n.data.color),l.add((c-l.r)*i,(f-l.g)*i,(d-l.b)*i,(m-l.a)*i))}},nt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.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,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let w=n.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=$.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let w=a[m];c=a[m+1],f=a[m+2],d=a[m+3];let p=(s-w)/(a[m+4]-w);c+=(a[m+4+1]-c)*p,f+=(a[m+4+2]-f)*p,d+=(a[m+4+3]-d)*p;break;case 1:c=a[m+1],f=a[m+2],d=a[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=n.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}}},at=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,D.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*i}return}let l=this.getCurveValue(s);i==1?a.a=l:(h==0&&(a.a=n.data.color.a),a.a+=(l-a.a)*i)}},lt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.rgb+"|"+s,D.alpha+"|"+s,D.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,i,h,o,n,a){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]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.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=$.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],w=a[g+5],p=a[g+6],b=a[g+7];let v=(s-y)/(a[g+8]-y);f+=(a[g+8+1]-f)*v,d+=(a[g+8+2]-d)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,w+=(a[g+8+5]-w)*v,p+=(a[g+8+6]-p)*v,b+=(a[g+8+7]-b)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],w=a[g+5],p=a[g+6],b=a[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(n.data.color);let y=n.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}}},ot=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.rgb+"|"+s,D.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){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]=o,this.frames[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.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=$.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],w=a[g+4],p=a[g+5],b=a[g+6];let v=(s-y)/(a[g+7]-y);f+=(a[g+7+1]-f)*v,d+=(a[g+7+2]-d)*v,m+=(a[g+7+3]-m)*v,w+=(a[g+7+4]-w)*v,p+=(a[g+7+5]-p)*v,b+=(a[g+7+6]-b)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],w=a[g+4],p=a[g+5],b=a[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=n.data.color,v=n.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}}},ue=class extends ${slotIndex=0;attachmentNames;constructor(e,t){super(e,[D.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,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){h==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[$.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ht=class extends ie{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[D.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,o,n,a,l,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(r-h*2+n)*.03,u=a*.03-o*.06,w=((h-n)*3-r+l)*.006,p=(o-a+.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 C=d+18;d<C;d+=2)f[d]=v,f[d+1]=A,x+=b,y+=g,b+=w,g+=p,v+=x,A+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,s[r]>e){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let h=s[i-2],o=s[i-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof le)||a.timelineAttachment!=this.attachment)return;let l=n.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=a;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=a;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=a;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 C=v[A];l[A]=C+(g[A]-C)*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=a;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=$.search1(d,s),w=this.getCurvePercent(s,u),p=c[u],b=c[u+1];if(i==1)if(h==3){let g=a;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=a;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],C=y[v];l[v]=C+(A+(b[v]-A)*w-C)*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=a;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}}}}},Ye=class Ls extends ${static propertyIds=[""+D.event];events;constructor(t){super(t,Ls.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,o,n){if(!i)return;let a=this.frames,l=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,h,o,n),s=-1;else if(s>=a[l-1])return;if(r<a[0])return;let c=0;if(s<a[0])c=0;else{c=$.search1(a,s)+1;let f=a[c];for(;c>0&&a[c-1]==f;)c--}for(;c<l&&r>=a[c];c++)i.push(this.events[c])}},ge=class Ds extends ${static propertyIds=[""+D.drawOrder];drawOrders;constructor(t){super(t,Ds.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,o,n){if(n==1){o==0&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=$.search1(this.frames,r),l=this.drawOrders[a];if(!l)P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,f=t.slots;for(let d=0,m=l.length;d<m;d++)c[d]=f[l[d]]}}},ct=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,[D.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,i,h,o){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]=o?1:0}apply(e,t,s,r,i,h,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*i,n.softness+=(n.data.softness-n.softness)*i,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let l=0,c=0,f=$.search(a,s,6),d=this.curves[f/6];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+6]-m);l+=(a[f+6+1]-l)*u,c+=(a[f+6+2]-c)*u;break;case 1:l=a[f+1],c=a[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(n.mix=n.data.mix+(l-n.data.mix)*i,n.softness=n.data.softness+(c-n.data.softness)*i,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0)):(n.mix+=(l-n.mix)*i,n.softness+=(c-n.softness)*i,o==0&&(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0))}},dt=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,[D.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=r,a[e+3]=i,a[e+4]=h,a[e+5]=o,a[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*i,n.mixX+=(b.mixX-n.mixX)*i,n.mixY+=(b.mixY-n.mixY)*i,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*i,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*i,n.mixShearY+=(b.mixShearY-n.mixShearY)*i}return}let l,c,f,d,m,u,w=$.search(a,s,7),p=this.curves[w/7];switch(p){case 0:let b=a[w];l=a[w+1],c=a[w+2],f=a[w+3],d=a[w+4],m=a[w+5],u=a[w+6];let g=(s-b)/(a[w+7]-b);l+=(a[w+7+1]-l)*g,c+=(a[w+7+2]-c)*g,f+=(a[w+7+3]-f)*g,d+=(a[w+7+4]-d)*g,m+=(a[w+7+5]-m)*g,u+=(a[w+7+6]-u)*g;break;case 1:l=a[w+1],c=a[w+2],f=a[w+3],d=a[w+4],m=a[w+5],u=a[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=n.data;n.mixRotate=b.mixRotate+(l-b.mixRotate)*i,n.mixX=b.mixX+(c-b.mixX)*i,n.mixY=b.mixY+(f-b.mixY)*i,n.mixScaleX=b.mixScaleX+(d-b.mixScaleX)*i,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*i,n.mixShearY=b.mixShearY+(u-b.mixShearY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(f-n.mixY)*i,n.mixScaleX+=(d-n.mixScaleX)*i,n.mixScaleY+=(m-n.mixScaleY)*i,n.mixShearY+=(u-n.mixShearY)*i}},ft=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,D.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,i,h,n.position,n.data.position))}},ut=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,D.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,i,h,n.spacing,n.data.spacing))}},mt=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,[D.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,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*i,n.mixX+=(n.data.mixX-n.mixX)*i,n.mixY+=(n.data.mixY-n.mixY)*i}return}let l,c,f,d=$.search(a,s,4),m=this.curves[d>>2];switch(m){case 0:let u=a[d];l=a[d+1],c=a[d+2],f=a[d+3];let w=(s-u)/(a[d+4]-u);l+=(a[d+4+1]-l)*w,c+=(a[d+4+2]-c)*w,f+=(a[d+4+3]-f)*w;break;case 1:l=a[d+1],c=a[d+2],f=a[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=n.data;n.mixRotate=u.mixRotate+(l-u.mixRotate)*i,n.mixX=u.mixX+(c-u.mixX)*i,n.mixY=u.mixY+(f-u.mixY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(f-n.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,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,h,this.get(n),this.setup(n)))}},gt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},xt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},wt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},pt=class extends ce{constructor(e,t,s){super(e,t,s,D.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}},bt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},yt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},vt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},At=class Os extends ${static propertyIds=[D.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Os.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,h,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const l=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],h,o,n),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[$.search1(l,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},St=class de extends ${static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[D.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 o=this.frames;t*=de.ENTRIES,o[t]=s,o[t+de.MODE]=r|i<<4,o[t+de.DELAY]=h}apply(t,s,r,i,h,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let l=a.attachment,c=this.attachment;if(l!=c&&(!(l instanceof le)||l.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let f=this.frames;if(r<f[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let d=$.search(f,r,de.ENTRIES),m=f[d],u=f[d+de.MODE],w=f[d+de.DELAY];if(!this.attachment.sequence)return;let p=u>>4,b=this.attachment.sequence.regions.length,g=is[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)}}a.sequenceIndex=p}},as=class We{static _emptyAnimation=new ke("<empty>",[],0);static emptyAnimation(){return We._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new os(this);propertyIDs=new Ge;animationsChanged=!1;trackEntryPool=new be(()=>new ls);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 o=t*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.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 a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=o}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,p=u.alpha;u.mixingFrom?p*=this.applyMixingFrom(u,t,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,C=A.length;if(d==0&&p==1||w==3){d==0&&(b=!0);for(let I=0;I<C;I++){P.webkit602BugfixHelper(p,w);var h=A[I];h instanceof ue?this.applyAttachmentTimeline(h,t,y,w,b):h.apply(t,g,y,v,p,w,0)}}else{let I=u.timelineMode,T=u.shortestRotation,M=!T&&u.timelinesRotation.length!=C<<1;M&&(u.timelinesRotation.length=C<<1);for(let Y=0;Y<C;Y++){let F=A[Y],R=I[Y]==Xe?w:0;!T&&F instanceof ye?this.applyRotateTimeline(F,t,y,p,R,u.timelinesRotation,Y<<1,M):F instanceof ue?this.applyAttachmentTimeline(F,t,y,w,b):(P.webkit602BugfixHelper(p,w),F.apply(t,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+Tt,n=t.slots,a=0,l=t.slots.length;a<l;a++){var c=n[a];if(c.attachmentState==o){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 o=h<i.mixAttachmentThreshold,n=h<i.mixDrawOrderThreshold,a=i.animation.timelines,l=a.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 p=0;p<l;p++)a[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=a[y],A=1,C,I=0;switch(p[y]){case Xe:if(!n&&v instanceof ge)continue;C=r,I=f;break;case Ct:C=0,I=f;break;case It:C=r,I=c;break;case Fe:C=0,I=c;break;default:C=0;let T=b[y];I=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=I,!g&&v instanceof ye?this.applyRotateTimeline(v,s,u,I,C,i.timelinesRotation,y<<1,x):v instanceof ue?this.applyAttachmentTimeline(v,s,u,C,o&&I>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(I,r),n&&v instanceof ge&&C==0&&(A=0),v.apply(s,d,u,w,I,C,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 o=s.slots[t.slotIndex];o.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,t.attachmentNames[$.search1(t.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Tt))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+ds)}applyRotateTimeline(t,s,r,i,h,o,n,a){if(a&&(o[n]=0),i==1){t.apply(s,0,r,null,1,h,0);return}let l=s.bones[t.boneIndex];if(!l.active)return;let c=t.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+t.getCurveValue(r);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let w=0,p=0;a?(w=0,p=u):(w=o[n],p=o[n+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[n]=m}o[n+1]=u,l.rotation=f+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,h=i-r,o=t.trackLast%h,n=this.events,a=0,l=n.length;for(;a<l;a++){let f=n[a];if(f.time<o)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);a<l;a++){let f=n[a];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 o=this.trackEntry(t,s,r,h);return this.setCurrent(t,o,i),this.queue.drain(),o}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 o=this.trackEntry(t,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,We.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,We.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]:(P.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 o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<i;a++)h[a]=n.addAll(r[a].getPropertyIds())?Fe:It;return}e:for(let a=0;a<i;a++){let l=r[a],c=l.getPropertyIds();if(!n.addAll(c))h[a]=Xe;else if(!s||l instanceof ue||l instanceof ge||l instanceof Ye||!s.animation.hasTimeline(c))h[a]=Ct;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(t.mixDuration>0){h[a]=cs,o[a]=f;continue e}break}h[a]=Fe}}}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()}},ls=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}},os=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 o=0;o<t.length;o++){let n=t[o];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(i)}break;case 5:let h=e[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},hs=(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))(hs||{}),ri=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Xe=0,Ct=1,It=2,Fe=3,cs=4,Tt=1,ds=2,fs=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}},kt=class Ns extends le{color=new q(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}},Ee=class qs extends le{endSlot=null;color=new q(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new qs(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Mt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Re=(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))(Re||{}),us=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(us||{}),ms=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ni=class extends Mt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Pe=class{pages=new Array;regions=new Array;constructor(e){let t=new ai(e),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(Re,s[1]),l.magFilter=P.enumValue(Re,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=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 o=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let l=new Yt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let f=i[s[0]];if(f)f(l);else{n||(n=[]),a||(a=[]),n.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));a.push(d)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),n&&n.length>0&&a&&a.length>0&&(l.names=n,l.values=a,n=null,a=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 gs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},ai=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}}},gs=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}},Yt=class extends ms{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)}},ve=class jt extends le{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(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=P.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,n=0;if(this.region instanceof Yt){let a=this.region,l=a.page,c=l.width,f=l.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+t[d+1]*o,s[d+1]=h+(1-t[d])*n;return;case 180:i-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/f,o=a.originalWidth/c,n=a.originalHeight/f;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d])*o,s[d+1]=h+(1-t[d+1])*n;return;case 270:i-=a.offsetY/c,h-=a.offsetX/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d+1])*o,s[d+1]=h+t[d]*n;return}i-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/f,o=a.originalWidth/c,n=a.originalHeight/f}else this.region?(o=this.region.u2-i,n=this.region.v2-h):(i=h=0,o=n=1);for(let a=0;a<r;a+=2)s[a]=i+t[a]*o,s[a+1]=h+t[a+1]*n}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 jt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.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),P.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,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,h,o)}newLinkedMesh(){let t=new jt(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}},Ae=class Us extends le{lengths=[];closed=!1;constantSpeed=!1;color=new q(1,1,1,1);constructor(t){super(t)}copy(){let t=new Us(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},xs=class Ws extends le{x=0;y=0;rotation=0;color=new q(.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*E.degRad,r=Math.cos(s),i=Math.sin(s),h=r*t.a+i*t.b,o=r*t.c+i*t.d;return E.atan2Deg(o,h)}copy(){let t=new Ws(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Be=class zs extends He{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(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,o=-this.height/2*this.scaleY+this.region.offsetY*i,n=h+this.region.width*r,a=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=n*c+d,x=n*f,y=a*c+m,v=a*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,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,o=this.offset,n=h.worldX,a=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+n,s[r+1]=m*f+u*d+a,r+=i,m=o[2],u=o[3],s[r]=m*l+u*c+n,s[r+1]=m*f+u*d+a,r+=i,m=o[4],u=o[5],s[r]=m*l+u*c+n,s[r+1]=m*f+u*d+a,r+=i,m=o[6],u=o[7],s[r]=m*l+u*c+n,s[r+1]=m*f+u*d+a}copy(){let t=new zs(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,P.arrayCopy(this.uvs,0,t.uvs,0,8),P.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},ws=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 o=s.getPath(t,i),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[i]=n}}newRegionAttachment(e,t,s,r){let i=new Be(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 ve(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 kt(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new xs(t)}newClippingAttachment(e,t){return new Ee(t)}},Xt=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(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}},Ve=(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))(Ve||{}),Ft=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,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let n=this.parent;if(!n){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=e*m+d.x,this.worldY=t*u+d.y;return}let a=n.a,l=n.b,c=n.c,f=n.d;switch(this.worldX=a*e+l*t+n.worldX,this.worldY=c*e+f*t+n.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=a*u+l*p,this.b=a*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;a*=d,c*=m;let u=a*a+c*c,w=0;u>1e-4?(u=Math.abs(a*f*m-l*d*c)/u,l=c*u,f=a*u,w=Math.atan2(c,a)*E.radDeg):(a=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=a*g-l*y,this.b=a*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=(a*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&&a*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 e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*o-f*n,this.ay=f*l-c*a;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),o=i*h,n=s*h;break}case 3:case 4:let p=E.cosDeg(this.rotation),b=E.sinDeg(this.rotation);t=(t*p+s*b)/this.skeleton.scaleX,r=(r*p+i*b)/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=E.PI/2+Math.atan2(r,t);s=Math.cos(x)*g,i=Math.sin(x)*g,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h}d=o*this.a-n*this.c,m=o*this.b-n*this.d,u=l*this.c-a*this.a,w=l*this.d-a*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(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=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*E.radDeg}rotateWorld(e){e*=E.degRad;const t=Math.sin(e),s=Math.cos(e),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}},Se=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},li=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new bs,r=new ps){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,o)=>{const n=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}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,o)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}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(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(t,e,a),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.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((o,n)=>{this.downloader.downloadText(e,a=>{try{let l=new Pe(a),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(t,e,l),o(l)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,w),n(w)}f=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),n(c)}},(a,l)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${l}`;this.error(s,e,c),n(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,o=>{try{const n=new Pe(o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),h(a)})}))}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}},ps=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}},bs=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(o){this.finish(e,400,JSON.stringify(o))}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(o){this.finish(e,400,JSON.stringify(o))}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,o=r.length;h<o;h+=2)r[h].apply(null,i)}},Et=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}},Rt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ys=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let 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,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,l=n.b,c=n.c,f=n.d,d=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*E.signum(e.skeleton.scaleX),u=(s-e.worldY)*E.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(a*f-l*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;l=-x*b*e.skeleton.scaleX,f=g*b*e.skeleton.scaleY,d+=Math.atan2(x,g)*E.radDeg;default:let y=t-n.worldX,v=s-n.worldY,A=a*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*l)/A-e.ax,u=(v*a-y*c)/A-e.ay)}d+=Math.atan2(u,m)*E.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=e.ascaleX,p=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const b=e.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)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,w,p,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,h,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,u=d,w=t.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=t.ax,y=0,v=0,A=0,C=e.a,I=e.b,T=e.c,M=e.d,Y=Math.abs(f-d)<=1e-4;!Y||h?(y=0,v=C*x+e.worldX,A=T*x+e.worldY):(y=t.ay,v=C*x+I*y+e.worldX,A=T*x+M*y+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,I=F.b,T=F.c,M=F.d;let R=C*M-I*T,k=v-F.worldX,X=A-F.worldY;R=Math.abs(R)<=1e-4?0:1/R;let V=(k*M-X*I)*R-l,O=(X*C-k*T)*R-c,L=Math.sqrt(V*V+O*O),N=t.data.length*w,H,_;if(L<1e-4){this.apply1(e,s,r,!1,h,!1,a),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}k=s-F.worldX,X=r-F.worldY;let j=(k*M-X*I)*R-l,B=(X*C-k*T)*R-c,U=j*j+B*B;if(n!=0){n*=f*(w+1)*.5;let J=Math.sqrt(U),Q=J-L-N*f+n;if(Q>0){let Z=Math.min(1,Q/(n*2))-1;Z=(Q-n*(1-Z*Z))/J,j-=Z*j,B-=Z*B,U=j*j+B*B}}e:if(Y){N*=f;let J=(U-L*L-N*N)/(2*L*N);J<-1?(J=-1,_=Math.PI*i):J>1?(J=1,_=0,h&&(C=(Math.sqrt(U)/(L+N)-1)*a+1,m*=C,o&&(u*=C))):_=Math.acos(J)*i,C=L+N*J,I=N*Math.sin(_),H=Math.atan2(B*C-j*I,j*C+B*I)}else{C=f*N,I=d*N;let J=C*C,Q=I*I,Z=Math.atan2(B,j);T=Q*L*L+J*U-J*Q;let ne=-2*Q*L,xe=Q-J;if(M=ne*ne-4*xe*T,M>=0){let we=Math.sqrt(M);ne<0&&(we=-we),we=-(ne+we)*.5;let Ie=we/xe,Bs=T/we,qe=Math.abs(Ie)<Math.abs(Bs)?Ie:Bs;if(Ie=U-qe*qe,Ie>=0){X=Math.sqrt(Ie)*i,H=Z-Math.atan2(X,qe),_=Math.atan2(X/d,(qe-L)/f);break e}}let Ce=E.PI,Oe=L-C,Ht=Oe*Oe,Es=0,Rs=0,Ne=L+C,$t=Ne*Ne,Ps=0;T=-C*L/(J-Q),T>=-1&&T<=1&&(T=Math.acos(T),k=C*Math.cos(T)+L,X=I*Math.sin(T),M=k*k+X*X,M<Ht&&(Ce=T,Ht=M,Oe=k,Es=X),M>$t&&(Rs=T,$t=M,Ne=k,Ps=X)),U<=(Ht+$t)*.5?(H=Z-Math.atan2(Es*i,Oe),_=Ce*i):(H=Z-Math.atan2(Ps*i,Ne),_=Rs*i)}let G=Math.atan2(y,x)*g,ee=e.arotation;H=(H-G)*E.radDeg+p-ee,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(l,c,ee+H*a,m,u,0,0),ee=t.arotation,_=((_+G)*E.radDeg-t.ashearX)*g+b-ee,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(x,y,ee+_*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Pt=class extends Se{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)}},Bt=class extends Se{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)}},Vt=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Vt||{}),Lt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Lt||{}),Dt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Dt||{}),vs=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 o=s.findBone(t.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(o)}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 Ae))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,l=this.bones,c=l.length,f=n?c:c+1,d=P.setArraySize(this.spaces,f),m=a?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(a)for(let A=0,C=f-1;A<C;A++){let I=l[A],T=I.data.length,M=T*I.a,Y=T*I.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,C=f-1;A<C;){let I=l[A],T=I.data.length;if(T<fe.epsilon)a&&(m[A]=0),d[++A]=u;else{let M=T*I.a,Y=T*I.c,F=Math.sqrt(M*M+Y*Y);a&&(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,C=f-1;A<C;){let I=l[A],T=I.data.length;if(T<fe.epsilon)a&&(m[A]=0),d[++A]=u;else{let M=T*I.a,Y=T*I.c,F=Math.sqrt(M*M+Y*Y);a&&(m[A]=F),d[++A]=(v?T+u:u)*F/T}}}let w=this.computeWorldPositions(s,f,n),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 C=w[v],I=w[v+1],T=C-p,M=I-b;if(a){let Y=m[y];if(Y!=0){let F=(Math.sqrt(T*T+M*M)/Y-1)*r+1;A.a*=F,A.c*=F}}if(p=C,b=I,r>0){let Y=A.a,F=A.b,R=A.c,k=A.d,X=0,V=0,O=0;if(n?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(M,T),X-=Math.atan2(R,Y),x){V=Math.cos(X),O=Math.sin(X);let L=A.data.length;p+=(L*(V*Y-O*R)-T)*r,b+=(L*(O*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),O=Math.sin(X),A.a=V*Y-O*R,A.b=V*F-O*k,A.c=O*Y+V*R,A.d=O*F+V*k}A.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,h=this.position,o=this.spaces,n=P.setArraySize(this.positions,s*3+2),a=this.world,l=t.closed,c=t.worldVerticesLength,f=c/6,d=fe.NONE;if(!t.constantSpeed){let L=t.lengths;f-=l?1:2;let N=L[f];this.data.positionMode==1&&(h*=N);let H;switch(this.data.spacingMode){case 2:H=N;break;case 3:H=N/s;break;default:H=1}a=P.setArraySize(this.world,8);for(let _=0,j=0,B=0;_<s;_++,j+=3){let U=o[_]*H;h+=U;let G=h;if(l)G%=N,G<0&&(G+=N),B=0;else if(G<0){d!=fe.BEFORE&&(d=fe.BEFORE,t.computeWorldVertices(i,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>N){d!=fe.AFTER&&(d=fe.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-N,a,0,n,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,l&&B==f?(t.computeWorldVertices(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,B*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,j,r||_>0&&U==0)}return n}l?(c+=2,a=P.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(f--,c-=4,a=P.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=P.setArraySize(this.curves,f),u=0,w=a[0],p=a[1],b=0,g=0,x=0,y=0,v=0,A=0,C=0,I=0,T=0,M=0,Y=0,F=0,R=0,k=0;for(let L=0,N=2;L<f;L++,N+=6)b=a[N],g=a[N+1],x=a[N+2],y=a[N+3],v=a[N+4],A=a[N+5],C=(w-b*2+x)*.1875,I=(p-g*2+y)*.1875,T=((b-x)*3-w+v)*.09375,M=((g-y)*3-p+A)*.09375,Y=C*2+T,F=I*2+M,R=(b-w)*.75+C+T*.16666667,k=(g-p)*.75+I+M*.16666667,u+=Math.sqrt(R*R+k*k),R+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(R*R+k*k),R+=Y,k+=F,u+=Math.sqrt(R*R+k*k),R+=Y+T,k+=F+M,u+=Math.sqrt(R*R+k*k),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,O=0;for(let L=0,N=0,H=0,_=0;L<s;L++,N+=3){let j=o[L]*X;h+=j;let B=h;if(l)B%=u,B<0&&(B+=u),H=0;else if(B<0){this.addBeforePosition(B,a,0,n,N);continue}else if(B>u){this.addAfterPosition(B-u,a,c-4,n,N);continue}for(;;H++){let U=m[H];if(!(B>U)){if(H==0)B/=U;else{let G=m[H-1];B=(B-G)/(U-G)}break}}if(H!=d){d=H;let U=H*6;for(w=a[U],p=a[U+1],b=a[U+2],g=a[U+3],x=a[U+4],y=a[U+5],v=a[U+6],A=a[U+7],C=(w-b*2+x)*.03,I=(p-g*2+y)*.03,T=((b-x)*3-w+v)*.006,M=((g-y)*3-p+A)*.006,Y=C*2+T,F=I*2+M,R=(b-w)*.3+C+T*.16666667,k=(g-p)*.3+I+M*.16666667,O=Math.sqrt(R*R+k*k),V[0]=O,U=1;U<8;U++)R+=Y,k+=F,Y+=T,F+=M,O+=Math.sqrt(R*R+k*k),V[U]=O;R+=Y,k+=F,O+=Math.sqrt(R*R+k*k),V[8]=O,R+=Y+T,k+=F+M,O+=Math.sqrt(R*R+k*k),V[9]=O,_=0}for(B*=O;;_++){let U=V[_];if(!(B>U)){if(_==0)B/=U;else{let G=V[_-1];B=_+(B-G)/(U-G)}break}}this.addCurvePosition(B*.1,w,p,b,g,x,y,v,A,n,N,r||L>0&&j==0)}return n}addBeforePosition(t,s,r,i,h){let o=s[r],n=s[r+1],a=s[r+2]-o,l=s[r+3]-n,c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addAfterPosition(t,s,r,i,h){let o=s[r+2],n=s[r+3],a=o-s[r],l=n-s[r+1],c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addCurvePosition(t,s,r,i,h,o,n,a,l,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,p=w*w,b=p*w,g=w*t,x=g*3,y=w*x,v=x*t,A=s*b+i*y+o*v+a*u,C=r*b+h*y+n*v+l*u;c[f]=A,c[f+1]=C,d&&(t<.001?c[f+2]=Math.atan2(h-r,i-s):c[f+2]=Math.atan2(C-(r*p+h*g*2+n*m),A-(s*p+i*g*2+o*m)))}},oi=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,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=a.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(a.scaleY);if(b*=Math.abs(a.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*a.scaleX,A=this.gravity*w*a.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*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||h){let x=Math.atan2(o.c,o.a),y=0,v=0,A=0,C=this.cx-o.worldX,I=this.cy-o.worldY;if(C>b?C=b:C<-b&&(C=-b),I>g?I=g:I<-g&&(I=-g),i){A=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(I+this.ty,C+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*E.invPI2-.5)*E.PI2)*m,T=this.rotateOffset*A+x,y=Math.cos(T),v=Math.sin(T),h&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(C*y+I*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(C*y+I*v)*m/T)}if(d=this.remaining,d>=u){p==-1&&(p=Math.pow(this.damping,60*u));const T=this.massInverse*u,M=this.strength,Y=this.wind,F=Le.yDown?-this.gravity:this.gravity,R=n/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=p),i){if(this.rotateVelocity-=((Y*v+F*y)*R+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=p,d<u)break;const k=this.rotateOffset*A+x;y=Math.cos(k),v=Math.sin(k)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i){let a=this.rotateOffset*t,l=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*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+=a*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 a*=this.data.rotate,l=Math.sin(a),c=Math.cos(a),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 a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*E.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*h-o,o*h+n*i-n)}},As=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 q,this.darkColor=e.darkColor?new q: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}},Ss=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Te;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,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,f=n.d,d=a*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(e!=0){let x=g.a,y=g.b,v=g.c,A=g.d,C=Math.atan2(c,a)-Math.atan2(v,x)+m;C>E.PI?C-=E.PI2:C<-E.PI&&(C+=E.PI2),C*=e;let I=Math.cos(C),T=Math.sin(C);g.a=I*x-T*v,g.b=I*y-T*A,g.c=T*x+I*v,g.d=T*y+I*A}if(o){let x=this.temp;n.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(a*a+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,a)-(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 C=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*C,g.d=Math.sin(A)*C}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,f=n.d,d=a*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(e!=0){let x=g.a,y=g.b,v=g.c,A=g.d,C=Math.atan2(c,a)+m;C>E.PI?C-=E.PI2:C<-E.PI&&(C+=E.PI2),C*=e;let I=Math.cos(C),T=Math.sin(C);g.a=I*x-T*v,g.b=I*y-T*A,g.c=T*x+I*v,g.d=T*y+I*A}if(o){let x=this.temp;n.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(a*a+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,a);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 e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],f=c.arotation;e!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*t,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 e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],f=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,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)}}},Le=class Jt{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 Jt.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 Ft(r,this,null);else{let h=this.bones[r.parent.index];i=new Ft(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 As(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 ys(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new Ss(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new vs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new oi(r,this))}this.color=new q(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,o=this.physicsConstraints,n=r.length,a=i.length,l=h.length,c=this.physicsConstraints.length,f=n+a+l+c;e:for(let d=0;d<f;d++){for(let m=0;m<n;m++){let u=r[m];if(u.data.order==d){this.sortIkConstraint(u);continue e}}for(let m=0;m<a;m++){let u=i[m];if(u.data.order==d){this.sortTransformConstraint(u);continue e}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=o[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&&P.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&&P.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 a=0,l=this.data.skins.length;a<l;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,i);let h=s.getAttachment();h instanceof Ae&&this.sortPathConstraintAttachmentWith(h,i);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.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 Ae))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let n=r[h++];for(n+=h;h<n;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&P.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 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(t)}updateWorldTransformWith(t,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,n=s.c,a=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=n*this.x+a*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=(n*f+a*m)*this.scaleY,i.d=(n*d+a*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(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;P.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],o=h.data.attachmentName;if(o){let n=t.getAttachment(r,o);n&&h.setAttachment(n)}}}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 o=r[i];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(i,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);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 Te,r=new Te;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,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=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 Be)m=8,u=P.setArraySize(r,m,0),p.computeWorldVertices(d,u,0,2),w=Jt.quadTriangles;else if(p instanceof ve){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 Ee&&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),n=Math.min(n,y),a=Math.max(a,x),l=Math.max(l,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(o,n),s.set(a-o,l-n)}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,o=i.length;h<o;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||{}),Is=class extends Se{_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}},Nt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},De=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new q(.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 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<e.constraints.length;r++){let i=e.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 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 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<e.constraints.length;r++){let i=e.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 t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof ve?(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 Nt(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 Nt(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 o=t.attachments[s];for(let n in o){let a=o[n];if(h==a){let l=this.getAttachment(s,n);l&&i.setAttachment(l);break}}}s++}}},qt=class{index=0;name;boneData;color=new q(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||{}),Wt=class extends Se{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 ks(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 o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}n=r.readInt(!0);for(let l=0;l<n;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 Xt(l,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(),o&&(q.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}n=r.readInt(!0);for(let l=0;l<n;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 qt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Pt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Wt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Bt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){const f=r.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Is(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 a=this.readSkin(r,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let l=s.skins.length;for(P.setArraySize(s.skins,n=l+r.readInt(!0));l<n;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}n=this.linkedMeshes.length;for(let l=0;l<n;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,n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let f=new Rt(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)}n=r.readInt(!0);for(let l=0;l<n;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(e,t,s,r){let i=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;i=new De("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");i=new De(o),r&&q.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let n=0,a=i.bones.length;n<a;n++)i.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let n=e.readInt(!0);for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,i,n,c,r);f&&i.setAttachment(n,c,f)}}return i}readAttachment(e,t,s,r,i,h){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():i;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let l=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null;let d=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),w=e.readFloat(),p=e.readFloat(),b=e.readFloat(),g=e.readFloat();l||(l=a);let x=this.attachmentLoader.newRegionAttachment(s,a,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(e,(n&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,a);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=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),w=this.readShortArray(e,(m.length-d-2)*3);let p=[],b=0,g=0;h&&(p=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),g=e.readFloat()),l||(l=a);let x=this.attachmentLoader.newMeshAttachment(s,a,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=(n&16)!=0?e.readStringRef():a;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let w=0,p=0;h&&(w=e.readFloat(),p=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,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 hi(b,m,r,u,d)),b):null}case 4:{const l=(n&16)!=0,c=(n&32)!=0,f=this.readVertices(e,(n&64)!=0),d=P.newArray(f.length/6,0);for(let w=0,p=d.length;w<p;w++)d[w]=e.readFloat()*o;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);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=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);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=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,a);return d?(d.endSlot=t.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(e){let t=new ts(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 ci;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let h=new Array,o=new Array;for(let n=0;n<r;n++){let a=e.readInt(!0);o.push(a);for(let l=0;l<a;l++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=o,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 a=0,l=e.readInt(!0);a<l;a++){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 Ai:{let p=new ue(u,c);for(let b=0;b<u;b++)p.setFrame(b,e.readFloat(),e.readStringRef());r.push(p);break}case Si:{let p=e.readInt(!0),b=new rt(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,I=0;b.setFrame(C,g,x,y,v,A),C!=w;C++){let T=e.readFloat(),M=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(C);break;case he:W(e,b,I++,C,0,g,T,x,M,1),W(e,b,I++,C,1,g,T,y,Y,1),W(e,b,I++,C,2,g,T,v,F,1),W(e,b,I++,C,3,g,T,A,R,1)}g=T,x=M,y=Y,v=F,A=R}r.push(b);break}case Ci:{let p=e.readInt(!0),b=new nt(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,g,x,y,v),A!=w;A++){let I=e.readFloat(),T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(A);break;case he:W(e,b,C++,A,0,g,I,x,T,1),W(e,b,C++,A,1,g,I,y,M,1),W(e,b,C++,A,2,g,I,v,Y,1)}g=I,x=T,y=M,v=Y}r.push(b);break}case Ii:{let p=e.readInt(!0),b=new lt(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let M=0,Y=0;b.setFrame(M,g,x,y,v,A,C,I,T),M!=w;M++){let F=e.readFloat(),R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(M);break;case he:W(e,b,Y++,M,0,g,F,x,R,1),W(e,b,Y++,M,1,g,F,y,k,1),W(e,b,Y++,M,2,g,F,v,X,1),W(e,b,Y++,M,3,g,F,A,V,1),W(e,b,Y++,M,4,g,F,C,O,1),W(e,b,Y++,M,5,g,F,I,L,1),W(e,b,Y++,M,6,g,F,T,N,1)}g=F,x=R,y=k,v=X,A=V,C=O,I=L,T=N}r.push(b);break}case Ti:{let p=e.readInt(!0),b=new ot(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let T=0,M=0;b.setFrame(T,g,x,y,v,A,C,I),T!=w;T++){let Y=e.readFloat(),F=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(T);break;case he:W(e,b,M++,T,0,g,Y,x,F,1),W(e,b,M++,T,1,g,Y,y,R,1),W(e,b,M++,T,2,g,Y,v,k,1),W(e,b,M++,T,3,g,Y,A,X,1),W(e,b,M++,T,4,g,Y,C,V,1),W(e,b,M++,T,5,g,Y,I,O,1)}g=Y,x=F,y=R,v=k,A=X,C=V,I=O}r.push(b);break}case ki:{let p=new at(u,e.readInt(!0),c),b=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;p.setFrame(x,b,g),x!=w;x++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(x);break;case he:W(e,p,y++,x,0,b,v,g,A,1)}b=v,g=A}r.push(p)}}}}for(let a=0,l=e.readInt(!0);a<l;a++){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==vi){let p=new it(u,c);for(let b=0;b<u;b++)p.setFrame(b,e.readFloat(),e.readByte());r.push(p);continue}let w=e.readInt(!0);switch(m){case di:r.push(K(e,new ye(u,w,c),1));break;case fi:r.push(zt(e,new $e(u,w,c),i));break;case ui:r.push(K(e,new je(u,w,c),i));break;case mi:r.push(K(e,new Je(u,w,c),i));break;case gi:r.push(zt(e,new Ke(u,w,c),1));break;case xi:r.push(K(e,new Qe(u,w,c),1));break;case wi:r.push(K(e,new Ze(u,w,c),1));break;case pi:r.push(zt(e,new et(u,w,c),1));break;case bi:r.push(K(e,new tt(u,w,c),1));break;case yi:r.push(K(e,new st(u,w,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new ct(f,e.readInt(!0),c),u=e.readByte(),w=e.readFloat(),p=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,b=(u&4)!=0?e.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=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&&(W(e,m,x++,g,0,w,y,p,v,1),W(e,m,x++,g,1,w,y,b,A,i)),w=y,p=v,b=A}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new dt(f,e.readInt(!0),c),u=e.readFloat(),w=e.readFloat(),p=e.readFloat(),b=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,p,b,g,x,y),v!=d;v++){let C=e.readFloat(),I=e.readFloat(),T=e.readFloat(),M=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),R=e.readFloat();switch(e.readByte()){case oe:m.setStepped(v);break;case he:W(e,m,A++,v,0,u,C,w,I,1),W(e,m,A++,v,1,u,C,p,T,1),W(e,m,A++,v,2,u,C,b,M,1),W(e,m,A++,v,3,u,C,g,Y,1),W(e,m,A++,v,4,u,C,x,F,1),W(e,m,A++,v,5,u,C,y,R,1)}u=C,w=I,p=T,b=M,g=Y,x=F,y=R}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){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),p=e.readInt(!0);switch(u){case Xi:r.push(K(e,new ft(w,p,c),f.positionMode==0?i:1));break;case Fi:r.push(K(e,new ut(w,p,c),f.spacingMode==0||f.spacingMode==1?i:1));break;case Ei:let b=new mt(w,p,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,C=0,I=b.getFrameCount()-1;b.setFrame(A,g,x,y,v),A!=I;A++){let T=e.readFloat(),M=e.readFloat(),Y=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:b.setStepped(A);break;case he:W(e,b,C++,A,0,g,T,x,M,1),W(e,b,C++,A,1,g,T,y,Y,1),W(e,b,C++,A,2,g,T,v,F,1)}g=T,x=M,y=Y,v=F}r.push(b)}}}for(let a=0,l=e.readInt(!0);a<l;a++){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==Ni){const p=new At(u,c);for(let b=0;b<u;b++)p.setFrame(b,e.readFloat());r.push(p);continue}const w=e.readInt(!0);switch(m){case Ri:r.push(K(e,new gt(u,w,c),1));break;case Pi:r.push(K(e,new xt(u,w,c),1));break;case Bi:r.push(K(e,new wt(u,w,c),1));break;case Vi:r.push(K(e,new pt(u,w,c),1));break;case Li:r.push(K(e,new bt(u,w,c),1));break;case Di:r.push(K(e,new yt(u,w,c),1));break;case Oi:r.push(K(e,new vt(u,w,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){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 p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,p),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case Mi:{let v=b,A=v.bones,C=v.vertices,I=A?C.length/3*2:C.length,T=e.readInt(!0),M=new ht(x,T,m,v),Y=e.readFloat();for(let F=0,R=0;;F++){let k,X=e.readInt(!0);if(X==0)k=A?P.newFloatArray(I):C;else{k=P.newFloatArray(I);let O=e.readInt(!0);if(X+=O,i==1)for(let L=O;L<X;L++)k[L]=e.readFloat();else for(let L=O;L<X;L++)k[L]=e.readFloat()*i;if(!A)for(let L=0,N=k.length;L<N;L++)k[L]+=C[L]}if(M.setFrame(F,Y,k),F==y)break;let V=e.readFloat();switch(e.readByte()){case oe:M.setStepped(F);break;case he:W(e,M,R++,F,0,Y,V,0,1,1)}Y=V}r.push(M);break}case Yi:{let v=new St(x,m,b);for(let A=0;A<x;A++){let C=e.readFloat(),I=e.readInt32();v.setFrame(A,C,is[I&15],I>>4,e.readFloat())}r.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let a=new ge(h),l=s.slots.length;for(let c=0;c<h;c++){let f=e.readFloat(),d=e.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=e.readInt(!0);for(;w!=g;)u[p++]=w++;m[w+e.readInt(!0)]=w++}for(;w<l;)u[p++]=w++;for(let b=l-1;b>=0;b--)m[b]==-1&&(m[b]=u[--p]);a.setFrame(c,f,m)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=new Ye(o);for(let l=0;l<o;l++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new Et(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()),a.setFrame(l,d)}r.push(a)}let n=0;for(let a=0,l=r.length;a<l;a++)n=Math.max(n,r[a].getDuration());return new ke(t,r,n)}},ks=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}},hi=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}},ci=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function K(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let h=0,o=0,n=t.getFrameCount()-1;t.setFrame(h,r,i),h!=n;h++){let a=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(h);break;case he:W(e,t,o++,h,0,r,a,i,l,s)}r=a,i=l}return t}function zt(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,h),o!=a;o++){let l=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(o);break;case he:W(e,t,n++,o,0,r,l,i,c,s),W(e,t,n++,o,1,r,l,h,f,s)}r=l,i=c,h=f}return t}function W(e,t,s,r,i,h,o,n,a,l){t.setBezier(s,r,i,h,n,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,a)}var di=0,fi=1,ui=2,mi=3,gi=4,xi=5,wi=6,pi=7,bi=8,yi=9,vi=10,Ai=0,Si=1,Ci=2,Ii=3,Ti=4,ki=5,Mi=0,Yi=1,Xi=0,Fi=1,Ei=2,Ri=0,Pi=1,Bi=2,Vi=4,Li=5,Di=6,Oi=7,Ni=8,oe=1,he=2,qi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new be(()=>P.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,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n<o;n++){let a=h[n];if(!a.bone.active)continue;let l=a.getAttachment();if(l instanceof kt){let c=l;s.push(c);let f=i.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),r.push(f),c.computeWorldVertices(a,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,o=i.length;h<o;h++){let n=i[h],a=n;for(let l=0,c=n.length;l<c;l+=2){let f=a[l],d=a[l+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,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=h&&r<=h||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),l=a*(i-e)+t;if(l>h&&l<n||(l=a*(o-e)+t,l>h&&l<n))return!0;let c=(h-t)/a+e;return c>i&&c<o||(c=(n-t)/a+e,c>i&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let 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,o=!1;for(let n=0;n<i;n+=2){let a=r[n+1],l=r[h+1];if(a<s&&l>=s||l<s&&a>=s){let c=r[n];c+(s-a)/(l-a)*(r[h]-c)<t&&(o=!o)}h=n}return o}intersectsSegment(e,t,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;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,o=e.length,n=t-r,a=s-i,l=t*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=n*b-a*p,x=(l*p-n*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=r||x>=r&&x<=t)){let y=(l*b-a*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}},Ms=class te{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new be(()=>new Array);polygonIndicesPool=new be(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n<r;n++)i[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=r;n<a;++n)h[n]=te.isConcave(n,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let n=r-1,a=0,l=1;for(;;){e:if(!h[a]){let d=i[n]<<1,m=i[a]<<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!=n;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,C=s[A],I=s[A+1];if(te.positiveArea(x,y,w,p,C,I)&&te.positiveArea(w,p,b,g,C,I)&&te.positiveArea(b,g,x,y,C,I))break e}break}if(l==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=l,l=(l+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),h.splice(a,1),r--;let c=(r+a-1)%r,f=a==r?0:a;h[c]=te.isConcave(c,r,s,i),h[f]=te.isConcave(f,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}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 o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-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(a==d){let A=n.length-4,C=te.winding(n[A],n[A+1],n[A+2],n[A+3],x,y),I=te.winding(x,y,n[0],n[1],n[2],n[3]);C==l&&I==l&&(n.push(x),n.push(y),o.push(u),v=!0)}v||(n.length>0?(i.push(n),h.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(w),n.push(p),n.push(b),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),l=te.winding(w,p,b,g,x,y),a=d)}n.length>0&&(i.push(n),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];n=i[c];let u=n.length-4,w=n[u],p=n[u+1],b=n[u+2],g=n[u+3],x=n[0],y=n[1],v=n[2],A=n[3],C=te.winding(w,p,b,g,x,y);for(let I=0;I<f;I++){if(I==c)continue;let T=h[I];if(T.length!=3)continue;let M=T[0],Y=T[1],F=T[2],R=i[I],k=R[R.length-2],X=R[R.length-1];if(M!=d||Y!=m)continue;let V=te.winding(w,p,b,g,k,X),O=te.winding(k,X,x,y,v,A);V==C&&O==C&&(R.length=0,T.length=0,n.push(k),n.push(X),o.push(F),w=b,p=g,b=k,g=X,I=0)}}for(let c=i.length-1;c>=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let h=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,h,o){return t*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(t,s,r,i,h,o){let n=r-t,a=i-s;return h*a-o*n+n*s-t*a>=0?1:-1}},Ys=class Kt{triangulator=new Ms;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=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let h=this.clippingPolygon;Kt.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=o.length;n<a;n++){let l=o[n];Kt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.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,o,n,a){let l,c,f,d,m,u;typeof s=="number"?(l=r,c=i,f=h,d=o,m=n,u=a):(l=s,c=r,f=i,d=h,m=o,u=n),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,l,c,f,d,m,u):this.clipTrianglesNoRender(t,l,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,l=0;h.length=0,o.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 p=t[f],b=t[f+1];for(let g=0;g<a;g++){let x=h.length;if(this.clip(d,m,u,w,p,b,n[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,C=P.setArraySize(h,x+v*2);for(let T=0;T<y;T+=2,x+=2){let M=A[T],Y=A[T+1];C[x]=M,C[x+1]=Y}x=o.length;let I=P.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)I[x]=l,I[x+1]=l+T,I[x+2]=l+T+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(t,s,r,i,h,o,n){let a=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=n?12:8,u=0;l.length=0,c.length=0;for(let w=0;w<r;w+=3){let p=s[w]<<1,b=t[p],g=t[p+1],x=i[p],y=i[p+1];p=s[w+1]<<1;let v=t[p],A=t[p+1],C=i[p],I=i[p+1];p=s[w+2]<<1;let T=t[p],M=t[p+1],Y=i[p],F=i[p+1];for(let R=0;R<d;R++){let k=l.length;if(this.clip(b,g,v,A,T,M,f[R],a)){let X=a.length;if(X==0)continue;let V=A-M,O=T-v,L=b-T,N=M-g,H=1/(V*L+O*(g-M)),_=X>>1,j=this.clipOutput,B=P.setArraySize(l,k+_*m);for(let G=0;G<X;G+=2,k+=m){let ee=j[G],J=j[G+1];B[k]=ee,B[k+1]=J,B[k+2]=h.r,B[k+3]=h.g,B[k+4]=h.b,B[k+5]=h.a;let Q=ee-T,Z=J-M,ne=(V*Q+O*Z)*H,xe=(N*Q+L*Z)*H,Ce=1-ne-xe;B[k+6]=x*ne+C*xe+Y*Ce,B[k+7]=y*ne+I*xe+F*Ce,n&&(B[k+8]=o.r,B[k+9]=o.g,B[k+10]=o.b,B[k+11]=o.a)}k=c.length;let U=P.setArraySize(c,k+3*(_-2));_--;for(let G=1;G<_;G++,k+=3)U[k]=u,U[k+1]=u+G,U[k+2]=u+G+1;u+=_+1}else{let X=P.setArraySize(l,k+3*m);X[k]=b,X[k+1]=g,X[k+2]=h.r,X[k+3]=h.g,X[k+4]=h.b,X[k+5]=h.a,n?(X[k+6]=x,X[k+7]=y,X[k+8]=o.r,X[k+9]=o.g,X[k+10]=o.b,X[k+11]=o.a,X[k+12]=v,X[k+13]=A,X[k+14]=h.r,X[k+15]=h.g,X[k+16]=h.b,X[k+17]=h.a,X[k+18]=C,X[k+19]=I,X[k+20]=o.r,X[k+21]=o.g,X[k+22]=o.b,X[k+23]=o.a,X[k+24]=T,X[k+25]=M,X[k+26]=h.r,X[k+27]=h.g,X[k+28]=h.b,X[k+29]=h.a,X[k+30]=Y,X[k+31]=F,X[k+32]=o.r,X[k+33]=o.g,X[k+34]=o.b,X[k+35]=o.a):(X[k+6]=x,X[k+7]=y,X[k+8]=v,X[k+9]=A,X[k+10]=h.r,X[k+11]=h.g,X[k+12]=h.b,X[k+13]=h.a,X[k+14]=C,X[k+15]=I,X[k+16]=T,X[k+17]=M,X[k+18]=h.r,X[k+19]=h.g,X[k+20]=h.b,X[k+21]=h.a,X[k+22]=Y,X[k+23]=F),k=c.length;let V=P.setArraySize(c,k+3);V[k]=u,V[k+1]=u+1,V[k+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,r,i){let h=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,l=this.clippingPolygons,c=l.length,f=0;o.length=0,n.length=0,a.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,u=t[m],w=t[m+1],p=i[m],b=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],C=t[m+1],I=i[m],T=i[m+1];for(let M=0;M<c;M++){let Y=o.length;if(this.clip(u,w,g,x,A,C,l[M],h)){let F=h.length;if(F==0)continue;let R=x-C,k=A-g,X=u-A,V=C-w,O=1/(R*X+k*(w-C)),L=F>>1,N=this.clipOutput,H=P.setArraySize(o,Y+L*2),_=P.setArraySize(n,Y+L*2);for(let B=0;B<F;B+=2,Y+=2){let U=N[B],G=N[B+1];H[Y]=U,H[Y+1]=G;let ee=U-A,J=G-C,Q=(R*ee+k*J)*O,Z=(V*ee+X*J)*O,ne=1-Q-Z;_[Y]=p*Q+y*Z+I*ne,_[Y+1]=b*Q+v*Z+T*ne}Y=a.length;let j=P.setArraySize(a,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]=C;let R=P.setArraySize(n,Y+3*2);R[Y]=p,R[Y+1]=b,R[Y+2]=y,R[Y+3]=v,R[Y+4]=I,R[Y+5]=T,Y=a.length;let k=P.setArraySize(a,Y+3);k[Y]=f,k[Y+1]=f+1,k[Y+2]=f+2,f+=3;break}}}}clip(t,s,r,i,h,o,n,a){let l=a,c=!1,f;n.length%4>=2?(f=a,a=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(o),f.push(t),f.push(s),a.length=0;let d=n.length-4,m=n;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=a.length,y=f;for(let A=0,C=f.length-2;A<C;){let I=y[A],T=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(w-M)>b*(p-Y),R=g*(w-I)-b*(p-T);if(R>0){if(F){a.push(M),a.push(Y);continue}let k=M-I,X=Y-T,V=R/(k*g-X*b);if(V>=0&&V<=1)a.push(I+k*V),a.push(T+X*V);else{a.push(M),a.push(Y);continue}}else if(F){let k=M-I,X=Y-T,V=R/(k*g-X*b);if(V>=0&&V<=1)a.push(I+k*V),a.push(T+X*V),a.push(M),a.push(Y);else{a.push(M),a.push(Y);continue}}c=!0}if(x==a.length)return l.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==d)break;let v=a;a=f,a.length=0,f=v}if(l!=a){l.length=0;for(let u=0,w=a.length-2;u<w;u++)l[u]=a[u]}else l.length=l.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,o=0,n=0,a=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],n=s[l+2],a=s[l+3],i+=h*a-n*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}}},_t=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=S(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 o=r.bones[h],n=null,a=S(o,"parent",null);a&&(n=s.findBone(a));let l=new Xt(s.bones.length,o.name,n);l.length=S(o,"length",0)*t,l.x=S(o,"x",0)*t,l.y=S(o,"y",0)*t,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(Ve,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],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let l=new qt(s.slots.length,n,a),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(Ut,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],n=new Pt(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=S(o,"mix",1),n.softness=S(o,"softness",0)*t,n.bendDirection=S(o,"bendPositive",!0)?1:-1,n.compress=S(o,"compress",!1),n.stretch=S(o,"stretch",!1),n.uniform=S(o,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],n=new Wt(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,l=s.findBone(a);if(!l)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=l,n.local=S(o,"local",!1),n.relative=S(o,"relative",!1),n.offsetRotation=S(o,"rotation",0),n.offsetX=S(o,"x",0)*t,n.offsetY=S(o,"y",0)*t,n.offsetScaleX=S(o,"scaleX",0),n.offsetScaleY=S(o,"scaleY",0),n.offsetShearY=S(o,"shearY",0),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),n.mixScaleX=S(o,"mixScaleX",1),n.mixScaleY=S(o,"mixScaleY",n.mixScaleX),n.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],n=new Bt(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,l=s.findSlot(a);if(!l)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=l,n.positionMode=P.enumValue(Vt,S(o,"positionMode","Percent")),n.spacingMode=P.enumValue(Lt,S(o,"spacingMode","Length")),n.rotateMode=P.enumValue(Dt,S(o,"rotateMode","Tangent")),n.offsetRotation=S(o,"rotation",0),n.position=S(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=S(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],n=new Is(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);const a=o.bone,l=s.findBone(a);if(l==null)throw new Error("Physics bone not found: "+a);n.bone=l,n.x=S(o,"x",0),n.y=S(o,"y",0),n.rotate=S(o,"rotate",0),n.scaleX=S(o,"scaleX",0),n.shearX=S(o,"shearX",0),n.limit=S(o,"limit",5e3)*t,n.step=1/S(o,"fps",60),n.inertia=S(o,"inertia",1),n.strength=S(o,"strength",100),n.damping=S(o,"damping",1),n.massInverse=1/S(o,"mass",1),n.wind=S(o,"wind",0),n.gravity=S(o,"gravity",0),n.mix=S(o,"mix",1),n.inertiaGlobal=S(o,"inertiaGlobal",!1),n.strengthGlobal=S(o,"strengthGlobal",!1),n.dampingGlobal=S(o,"dampingGlobal",!1),n.massGlobal=S(o,"massGlobal",!1),n.windGlobal=S(o,"windGlobal",!1),n.gravityGlobal=S(o,"gravityGlobal",!1),n.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],n=new De(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let l=o.bones[a],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let l=o.ik[a],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let l=o.transform[a],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let l=o.path[a],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let l=o.physics[a],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let l=s.findSlot(a);if(!l)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let f in c){let d=this.readAttachment(c[f],n,l.index,f,s);d&&n.setAttachment(l.index,f,d)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let l=a.getAttachment(n.slotIndex,n.parent);if(!l)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?l:n.mesh,n.mesh.setParentMesh(l),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],n=new Rt(h);n.intValue=S(o,"int",0),n.floatValue=S(o,"float",0),n.stringValue=S(o,"string",""),n.audioPath=S(o,"audio",null),n.audioPath&&(n.volume=S(o,"volume",1),n.balance=S(o,"balance",0)),s.events.push(n)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,r,i){let h=this.scale;switch(r=S(e,"name",r),S(e,"type","region")){case"region":{let o=S(e,"path",r),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,r,o,n);if(!a)return null;a.path=o,a.x=S(e,"x",0)*h,a.y=S(e,"y",0)*h,a.scaleX=S(e,"scaleX",1),a.scaleY=S(e,"scaleY",1),a.rotation=S(e,"rotation",0),a.width=e.width*h,a.height=e.height*h,a.sequence=n;let l=S(e,"color",null);return l&&a.color.setFromString(l),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=S(e,"path",r),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,r,o,n);if(!a)return null;a.path=o;let l=S(e,"color",null);l&&a.color.setFromString(l),a.width=S(e,"width",0)*h,a.height=S(e,"height",0)*h,a.sequence=n;let c=S(e,"parent",null);if(c)return this.linkedMeshes.push(new Ui(a,S(e,"skin",null),s,c,S(e,"timelines",!0))),a;let f=e.uvs;return this.readVertices(e,a,f.length),a.triangles=e.triangles,a.regionUVs=f,a.region!=null&&a.updateRegion(),a.edges=S(e,"edges",null),a.hullLength=S(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=S(e,"closed",!1),o.constantSpeed=S(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=P.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*h;o.lengths=a;let l=S(e,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=S(e,"x",0)*h,o.y=S(e,"y",0)*h,o.rotation=S(e,"rotation",0);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let n=S(e,"end",null);n&&(o.endSlot=i.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let l=S(e,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(e){if(e==null)return null;let t=new ts(S(e,"count",0));return t.start=S(e,"start",1),t.digits=S(e,"digits",0),t.setupIndex=S(e,"setup",0),t}readVertices(e,t,s){let r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let n=P.toFloatArray(i);if(r!=1)for(let a=0,l=i.length;a<l;a++)n[a]*=r;t.vertices=n;return}let h=new Array,o=new Array;for(let n=0,a=i.length;n<a;){let l=i[n++];o.push(l);for(let c=n+l*4;n<c;n+=4)o.push(i[n]),h.push(i[n+1]*r),h.push(i[n+2]*r),h.push(i[n+3])}t.bones=o,t.vertices=P.toFloatArray(h)}readAnimation(e,t,s){let r=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let l=a.index;for(let c in n){let f=n[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ue(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 rt(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=z(A,m,g,b,0,w,y,p.r,v.r,1),g=z(A,m,g,b,1,w,y,p.g,v.g,1),g=z(A,m,g,b,2,w,y,p.b,v.b,1),g=z(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 nt(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=z(A,m,g,b,0,w,y,p.r,v.r,1),g=z(A,m,g,b,1,w,y,p.g,v.g,1),g=z(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(re(f,new at(d,d,l),0,1));else if(c=="rgba2"){let m=new lt(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),C=q.fromString(y.dark),I=u.curve;I&&(x=z(I,m,x,g,0,w,v,p.r,A.r,1),x=z(I,m,x,g,1,w,v,p.g,A.g,1),x=z(I,m,x,g,2,w,v,p.b,A.b,1),x=z(I,m,x,g,3,w,v,p.a,A.a,1),x=z(I,m,x,g,4,w,v,b.r,C.r,1),x=z(I,m,x,g,5,w,v,b.g,C.g,1),x=z(I,m,x,g,6,w,v,b.b,C.b,1)),w=v,p=A,b=C,u=y}i.push(m)}else if(c=="rgb2"){let m=new ot(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),C=q.fromString(y.dark),I=u.curve;I&&(x=z(I,m,x,g,0,w,v,p.r,A.r,1),x=z(I,m,x,g,1,w,v,p.g,A.g,1),x=z(I,m,x,g,2,w,v,p.b,A.b,1),x=z(I,m,x,g,3,w,v,b.r,C.r,1),x=z(I,m,x,g,4,w,v,b.g,C.g,1),x=z(I,m,x,g,5,w,v,b.b,C.b,1)),w=v,p=A,b=C,u=y}i.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let l=a.index;for(let c in n){let f=n[c],d=f.length;if(d!=0){if(c==="rotate")i.push(re(f,new ye(d,d,l),0,1));else if(c==="translate"){let m=new $e(d,d<<1,l);i.push(Gt(f,m,"x","y",0,r))}else if(c==="translatex"){let m=new je(d,d,l);i.push(re(f,m,0,r))}else if(c==="translatey"){let m=new Je(d,d,l);i.push(re(f,m,0,r))}else if(c==="scale"){let m=new Ke(d,d<<1,l);i.push(Gt(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new Qe(d,d,l);i.push(re(f,m,1,1))}else if(c==="scaley"){let m=new Ze(d,d,l);i.push(re(f,m,1,1))}else if(c==="shear"){let m=new et(d,d<<1,l);i.push(Gt(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new tt(d,d,l);i.push(re(f,m,0,1))}else if(c==="sheary"){let m=new st(d,d,l);i.push(re(f,m,0,1))}else if(c==="inherit"){let m=new it(d,a.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,S(w,"time",0),P.enumValue(Ve,S(w,"inherit","Normal")))}i.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),f=new ct(n.length,n.length<<1,c),d=S(a,"time",0),m=S(a,"mix",1),u=S(a,"softness",0)*r;for(let w=0,p=0;;w++){f.setFrame(w,d,m,u,S(a,"bendPositive",!0)?1:-1,S(a,"compress",!1),S(a,"stretch",!1));let b=n[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=a.curve;v&&(p=z(v,f,p,w,0,d,g,m,x,1),p=z(v,f,p,w,1,d,g,u,y,r)),d=g,m=x,u=y,a=b}i.push(f)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),f=new dt(n.length,n.length*6,c),d=S(a,"time",0),m=S(a,"mixRotate",1),u=S(a,"mixX",1),w=S(a,"mixY",u),p=S(a,"mixScaleX",1),b=S(a,"mixScaleY",p),g=S(a,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,p,b,g);let v=n[x+1];if(!v){f.shrink(y);break}let A=S(v,"time",0),C=S(v,"mixRotate",1),I=S(v,"mixX",1),T=S(v,"mixY",I),M=S(v,"mixScaleX",1),Y=S(v,"mixScaleY",M),F=S(v,"mixShearY",1),R=a.curve;R&&(y=z(R,f,y,x,0,d,A,m,C,1),y=z(R,f,y,x,1,d,A,u,I,1),y=z(R,f,y,x,2,d,A,w,T,1),y=z(R,f,y,x,3,d,A,p,M,1),y=z(R,f,y,x,4,d,A,b,Y,1),y=z(R,f,y,x,5,d,A,g,F,1)),d=A,m=C,u=I,w=T,p=M,b=Y,p=M,a=v}i.push(f)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(a);for(let c in n){let f=n[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new ft(m,m,l);i.push(re(f,u,0,a.positionMode==0?r:1))}else if(c==="spacing"){let u=new ut(m,m,l);i.push(re(f,u,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(c==="mix"){let u=new mt(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),C=S(v,"mixRotate",1),I=S(v,"mixX",1),T=S(v,"mixY",I),M=d.curve;M&&(y=z(M,u,y,x,0,w,A,p,C,1),y=z(M,u,y,x,1,w,A,b,I,1),y=z(M,u,y,x,2,w,A,g,T,1)),w=A,p=C,b=I,g=T,d=v}i.push(u)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(l)}for(let l in n){let c=n[l],f=c[0];if(!f)continue;let d=c.length;if(l=="reset"){const u=new At(d,a);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 gt(d,d,a);else if(l=="strength")m=new xt(d,d,a);else if(l=="damping")m=new wt(d,d,a);else if(l=="mass")m=new pt(d,d,a);else if(l=="wind")m=new bt(d,d,a);else if(l=="gravity")m=new yt(d,d,a);else if(l=="mix")m=new vt(d,d,a);else continue;i.push(re(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let l in n){let c=n[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=a.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 ht(b.length,b.length,d,w),C=S(g,"time",0);for(let I=0,T=0;;I++){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,O=V+Y.length;V<O;V++)M[V]*=r;if(!x)for(let V=0;V<v;V++)M[V]+=y[V]}A.setFrame(I,C,M);let F=b[I+1];if(!F){A.shrink(T);break}let R=S(F,"time",0),k=g.curve;k&&(T=z(k,A,T,I,0,C,R,0,1,1)),C=R,g=F}i.push(A)}else if(p=="sequence"){let x=new St(b.length,d,w),y=0;for(let v=0;v<b.length;v++){let A=S(g,"delay",y),C=S(g,"time",0),I=ss[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,C,I,T,A),y=A,g=b[v+1]}i.push(x)}}}}}}if(e.drawOrder){let o=new ge(e.drawOrder.length),n=s.slots.length,a=0;for(let l=0;l<e.drawOrder.length;l++,a++){let c=e.drawOrder[l],f=null,d=S(c,"offsets",null);if(d){f=P.newArray(n,-1);let m=P.newArray(n-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<n;)m[w++]=u++;for(let p=n-1;p>=0;p--)f[p]==-1&&(f[p]=m[--w])}o.setFrame(a,S(c,"time",0),f)}i.push(o)}if(e.events){let o=new Ye(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let l=e.events[a],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let f=new Et(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(n,f)}i.push(o)}let h=0;for(let o=0,n=i.length;o<n;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new ke(t,i,h))}},Ui=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 re(e,t,s,r){let i=e[0],h=S(i,"time",0),o=S(i,"value",s)*r,n=0;for(let a=0;;a++){t.setFrame(a,h,o);let l=e[a+1];if(!l)return t.shrink(n),t;let c=S(l,"time",0),f=S(l,"value",s)*r;i.curve&&(n=z(i.curve,t,n,a,0,h,c,o,f,r)),h=c,o=f,i=l}}function Gt(e,t,s,r,i,h){let o=e[0],n=S(o,"time",0),a=S(o,s,i)*h,l=S(o,r,i)*h,c=0;for(let f=0;;f++){t.setFrame(f,n,a,l);let d=e[f+1];if(!d)return t.shrink(c),t;let m=S(d,"time",0),u=S(d,s,i)*h,w=S(d,r,i)*h,p=o.curve;p&&(c=z(p,t,c,f,0,n,m,a,u,h),c=z(p,t,c,f,1,n,m,l,w,h)),n=m,a=u,l=w,o=d}}function z(e,t,s,r,i,h,o,n,a,l){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,f=e[c],d=e[c+1]*l,m=e[c+2],u=e[c+3]*l;return t.setBezier(s,r,i,h,n,f,d,m,u,o,a),s+1}function S(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))),Le.yDown=!0;function Wi(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 Xs(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 zi=class _s extends Mt{getImage(){return this._image}setFilters(){}setWraps(){}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 o=new Map,n=[];for(const a of[0,1,2,3]){const l=new t.Paint,c=h.makeShaderOptions(t.TileMode.Clamp,t.TileMode.Clamp,t.FilterMode.Linear,t.MipmapMode.Linear);l.setShader(c),l.setBlendMode(Wi(t,a)),o.set(a,l),n.push(c)}return new _s({shaders:n,paintPerBlendMode:o,image:h})}};async function _i(e,t,s){const r=new Pe(Xs(await s(t))),i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";for(const o of r.pages){const n=await zi.fromFile(e,h+o.name,s);o.setTexture(n)}return r}async function Gi(e,t,s,r=1){const i=new ws(t),h=e.endsWith(".json")?new _t(i):new Ts(i);h.scale=r;const o=await s(e);return h instanceof _t?h.readSkeletonData(Xs(o)):h.readSkeletonData(o)}var Fs=class{skeleton;animationState;constructor(e){this.skeleton=new Le(e),this.animationState=new as(new fs(e))}update(e,t=2){this.animationState.update(e),this.skeleton.update(e),this.animationState.apply(this.skeleton),this.skeleton.updateWorldTransform(t)}},Hi=class Gs{constructor(t){this.ck=t}clipper=new Ys;static QUAD_TRIANGLES=[0,1,2,2,3,0];scratchPositions=P.newFloatArray(100);scratchUVs=P.newFloatArray(100);scratchColors=new Uint32Array(100/4);render(t,s){s instanceof Fs&&(s=s.skeleton);const r=this.clipper,i=s.drawOrder,h=s.color;for(let o=0,n=i.length;o<n;o++){const a=i[o];if(!a.bone.active){r.clipEndWithSlot(a);continue}const l=a.getAttachment();let c=this.scratchPositions,f,d=4;if(l instanceof Be)l.computeWorldVertices(a,c,0,2),f=Gs.QUAD_TRIANGLES;else if(l instanceof ve)c.length<l.worldVerticesLength&&(this.scratchPositions=P.newFloatArray(l.worldVerticesLength),c=this.scratchPositions),d=l.worldVerticesLength>>1,l.computeWorldVertices(a,0,l.worldVerticesLength,c,0,2),f=l.triangles;else if(l instanceof Ee){r.clipStart(a,l);continue}else{r.clipEndWithSlot(a);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(a);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=a.color,C=(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]=C;const I=this.ck.MakeVertices(this.ck.VertexMode.Triangles,c,w,p,f,!1),T=b.paintPerBlendMode.get(a.data.blendMode);T&&t.drawVertices(I,this.ck.BlendMode.Modulate,T),I.delete()}r.clipEndWithSlot(a)}r.clipEnd()}};return Qs(Qt)})();
1
+ "use strict";var spine=(()=>{var _e=Object.defineProperty,Hs=Object.getOwnPropertyDescriptor,$s=Object.getOwnPropertyNames,js=Object.prototype.hasOwnProperty,Js=(e,t)=>{for(var s in t)_e(e,s,{get:t[s],enumerable:!0})},Ks=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $s(t))!js.call(e,i)&&i!==s&&_e(e,i,{get:()=>t[i],enumerable:!(r=Hs(t,i))||r.enumerable});return e},Qs=e=>Ks(_e({},"__esModule",{value:!0}),e),Qt={};Js(Qt,{AlphaTimeline:()=>at,Animation:()=>ke,AnimationState:()=>as,AnimationStateAdapter:()=>ri,AnimationStateData:()=>fs,AssetCache:()=>ps,AssetManagerBase:()=>li,AtlasAttachmentLoader:()=>ws,Attachment:()=>He,AttachmentTimeline:()=>ue,BinaryInput:()=>ks,BlendMode:()=>Ut,Bone:()=>Ft,BoneData:()=>Xt,BoundingBoxAttachment:()=>kt,CURRENT:()=>ds,ClippingAttachment:()=>Ee,Color:()=>q,ConstraintData:()=>Se,CurveTimeline:()=>ie,CurveTimeline1:()=>se,CurveTimeline2:()=>Me,DebugUtils:()=>ti,DeformTimeline:()=>ht,Downloader:()=>bs,DrawOrderTimeline:()=>ge,Event:()=>Et,EventData:()=>Rt,EventQueue:()=>os,EventTimeline:()=>Ye,EventType:()=>hs,FIRST:()=>Ct,FakeTexture:()=>ni,HOLD_FIRST:()=>Fe,HOLD_MIX:()=>cs,HOLD_SUBSEQUENT:()=>It,IkConstraint:()=>ys,IkConstraintData:()=>Pt,IkConstraintTimeline:()=>ct,Inherit:()=>Ve,InheritTimeline:()=>it,IntSet:()=>Zs,Interpolation:()=>Zt,MathUtils:()=>E,MeshAttachment:()=>ve,MixBlend:()=>rs,MixDirection:()=>ns,PathAttachment:()=>Ae,PathConstraint:()=>vs,PathConstraintData:()=>Bt,PathConstraintMixTimeline:()=>mt,PathConstraintPositionTimeline:()=>ft,PathConstraintSpacingTimeline:()=>ut,Physics:()=>Cs,PhysicsConstraintDampingTimeline:()=>wt,PhysicsConstraintGravityTimeline:()=>yt,PhysicsConstraintInertiaTimeline:()=>gt,PhysicsConstraintMassTimeline:()=>pt,PhysicsConstraintMixTimeline:()=>vt,PhysicsConstraintResetTimeline:()=>At,PhysicsConstraintStrengthTimeline:()=>xt,PhysicsConstraintTimeline:()=>ce,PhysicsConstraintWindTimeline:()=>bt,PointAttachment:()=>xs,Pool:()=>be,PositionMode:()=>Vt,Pow:()=>es,PowOut:()=>ei,RGB2Timeline:()=>ot,RGBA2Timeline:()=>lt,RGBATimeline:()=>rt,RGBTimeline:()=>nt,RegionAttachment:()=>Be,RotateMode:()=>Dt,RotateTimeline:()=>ye,SETUP:()=>Tt,SUBSEQUENT:()=>Xe,ScaleTimeline:()=>Ke,ScaleXTimeline:()=>Qe,ScaleYTimeline:()=>Ze,SequenceTimeline:()=>St,ShearTimeline:()=>et,ShearXTimeline:()=>tt,ShearYTimeline:()=>st,Skeleton:()=>Le,SkeletonBinary:()=>Ts,SkeletonBounds:()=>qi,SkeletonClipping:()=>Ys,SkeletonData:()=>Ot,SkeletonDrawable:()=>Fs,SkeletonJson:()=>_t,SkeletonRenderer:()=>Hi,Skin:()=>De,SkinEntry:()=>Nt,Slot:()=>As,SlotData:()=>qt,SpacingMode:()=>Lt,StringSet:()=>Ge,Texture:()=>Mt,TextureAtlas:()=>Pe,TextureAtlasPage:()=>gs,TextureAtlasRegion:()=>Yt,TextureFilter:()=>Re,TextureRegion:()=>ms,TextureWrap:()=>us,TimeKeeper:()=>si,Timeline:()=>$,TrackEntry:()=>ls,TransformConstraint:()=>Ss,TransformConstraintData:()=>Wt,TransformConstraintTimeline:()=>dt,TranslateTimeline:()=>$e,TranslateXTimeline:()=>je,TranslateYTimeline:()=>Je,Triangulator:()=>Ms,Utils:()=>P,Vector2:()=>Te,VertexAttachment:()=>le,WindowedMean:()=>ii,loadSkeletonData:()=>Gi,loadTextureAtlas:()=>_i});var Zs=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}},Ge=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}},q=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)}},E=class ae{static PI=3.1415927;static PI2=ae.PI*2;static invPI2=1/ae.PI2;static radiansToDegrees=180/ae.PI;static radDeg=ae.radiansToDegrees;static degreesToRadians=ae.PI/180;static degRad=ae.degreesToRadians;static clamp(t,s,r){return t<s?s:t>r?r:t}static cosDeg(t){return Math.cos(t*ae.degRad)}static sinDeg(t){return Math.sin(t*ae.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ae.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 ae.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}},Zt=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},es=class extends Zt{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}},ei=class extends es{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},P=class pe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,h){for(let o=s,n=i;o<s+h;o++,n++)r[n]=t[o]}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)]}},ti=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)}}},be=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}},Te=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}},si=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)}},ii=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 Vs extends He{static nextID=0;id=Vs.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,h,o){r=h+(r>>1)*o;let n=t.bone.skeleton,a=t.deform,l=this.vertices,c=this.bones;if(!c){a.length>0&&(l=a);let u=t.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 C=l[v],I=l[v+1];i[A]=C*b+I*g+w,i[A+1]=C*x+I*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=n.bones;if(a.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=a;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],C=l[p+1]+u[b+1],I=l[p+2];g+=(A*v.a+C*v.b+v.worldX)*I,x+=(A*v.c+C*v.d+v.worldY)*I}i[w]=g,i[w+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},ts=class Ue{static _nextID=0;id=Ue.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Ue(this.regions.length);return P.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 Ue._nextID++}},ss=(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))(ss||{}),is=[0,1,2,3,4,5,6],ke=class{name;timelines=[];timelineIds=new Ge;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,o,n){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l<c;l++)a[l].apply(e,t,s,i,h,o,n)}},rs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(rs||{}),ns=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ns||{}),D={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},$=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=P.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}},ie=class extends ${curves;constructor(e,t,s){super(e,s),this.curves=P.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=P.newFloatArray(t);P.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,i,h,o,n,a,l,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(r-h*2+n)*.03,u=(i-o*2+a)*.03,w=((h-n)*3-r+l)*.006,p=((o-a)*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 C=d+18;d<C;d+=2)f[d]=v,f[d+1]=A,x+=b,y+=g,b+=w,g+=p,v+=x,A+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let a=this.frames[t],l=this.frames[t+s];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=e){let a=i[r-2],l=i[r-1];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}t+=this.getFrameEntries();let o=i[h-2],n=i[h-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},se=class extends ie{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 o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*t}return i}let n=this.getCurveValue(e)*h;if(t==1)return s==3?i+n-h:n;if(r==1)switch(s){case 0:return h+(Math.abs(n)*E.signum(h)-h)*t;case 1:case 2:return i+(Math.abs(n)*E.signum(i)-i)*t}else{let a=0;switch(s){case 0:return a=Math.abs(h)*E.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(i)*E.signum(n),a+(n-a)*t}}return i+(n-h)*t}},Me=class extends ie{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}},ye=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,i,h,n.rotation,n.data.rotation))}},$e=class extends Me{boneIndex=0;constructor(e,t,s){super(e,t,D.x+"|"+s,D.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*i,n.y+=(n.data.y-n.y)*i}return}let l=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);l+=(a[f+3+1]-l)*u,c+=(a[f+3+2]-c)*u;break;case 1:l=a[f+1],c=a[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:n.x=n.data.x+l*i,n.y=n.data.y+c*i;break;case 1:case 2:n.x+=(n.data.x+l-n.x)*i,n.y+=(n.data.y+c-n.y)*i;break;case 3:n.x+=l*i,n.y+=c*i}}},je=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,i,h,n.x,n.data.x))}},Je=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,i,h,n.y,n.data.y))}},Ke=class extends Me{boneIndex=0;constructor(e,t,s){super(e,t,D.scaleX+"|"+s,D.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*i,n.scaleY+=(n.data.scaleY-n.scaleY)*i}return}let l,c,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);l+=(a[f+3+1]-l)*u,c+=(a[f+3+2]-c)*u;break;case 1:l=a[f+1],c=a[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(l*=n.data.scaleX,c*=n.data.scaleY,i==1)h==3?(n.scaleX+=l-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=l,n.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,n.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,n.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}else switch(h){case 0:m=Math.abs(n.data.scaleX)*E.signum(l),u=Math.abs(n.data.scaleY)*E.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(n.scaleX)*E.signum(l),u=Math.abs(n.scaleY)*E.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=u+(c-u)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}}}},Qe=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,i,h,o,n.scaleX,n.data.scaleX))}},Ze=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,i,h,o,n.scaleY,n.data.scaleY))}},et=class extends Me{boneIndex=0;constructor(e,t,s){super(e,t,D.shearX+"|"+s,D.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*i,n.shearY+=(n.data.shearY-n.shearY)*i}return}let l=0,c=0,f=$.search(a,s,3),d=this.curves[f/3];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+3]-m);l+=(a[f+3+1]-l)*u,c+=(a[f+3+2]-c)*u;break;case 1:l=a[f+1],c=a[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:n.shearX=n.data.shearX+l*i,n.shearY=n.data.shearY+c*i;break;case 1:case 2:n.shearX+=(n.data.shearX+l-n.shearX)*i,n.shearY+=(n.data.shearY+c-n.shearY)*i;break;case 3:n.shearX+=l*i,n.shearY+=c*i}}},tt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,i,h,n.shearX,n.data.shearX))}},st=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,D.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,i,h,n.shearY,n.data.shearY))}},it=class extends ${boneIndex=0;constructor(e,t){super(e,[D.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,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[$.search(a,s,2)+1]}},rt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.rgb+"|"+s,D.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,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let p=n.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=$.search(a,s,5),w=this.curves[u/5];switch(w){case 0:let p=a[u];c=a[u+1],f=a[u+2],d=a[u+3],m=a[u+4];let b=(s-p)/(a[u+5]-p);c+=(a[u+5+1]-c)*b,f+=(a[u+5+2]-f)*b,d+=(a[u+5+3]-d)*b,m+=(a[u+5+4]-m)*b;break;case 1:c=a[u+1],f=a[u+2],d=a[u+3],m=a[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(n.data.color),l.add((c-l.r)*i,(f-l.g)*i,(d-l.b)*i,(m-l.a)*i))}},nt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.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,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let w=n.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=$.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let w=a[m];c=a[m+1],f=a[m+2],d=a[m+3];let p=(s-w)/(a[m+4]-w);c+=(a[m+4+1]-c)*p,f+=(a[m+4+2]-f)*p,d+=(a[m+4+3]-d)*p;break;case 1:c=a[m+1],f=a[m+2],d=a[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=n.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}}},at=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,D.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*i}return}let l=this.getCurveValue(s);i==1?a.a=l:(h==0&&(a.a=n.data.color.a),a.a+=(l-a.a)*i)}},lt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.rgb+"|"+s,D.alpha+"|"+s,D.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,i,h,o,n,a){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]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.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=$.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],w=a[g+5],p=a[g+6],b=a[g+7];let v=(s-y)/(a[g+8]-y);f+=(a[g+8+1]-f)*v,d+=(a[g+8+2]-d)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,w+=(a[g+8+5]-w)*v,p+=(a[g+8+6]-p)*v,b+=(a[g+8+7]-b)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],u=a[g+4],w=a[g+5],p=a[g+6],b=a[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(n.data.color);let y=n.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}}},ot=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,[D.rgb+"|"+s,D.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){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]=o,this.frames[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.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=$.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];f=a[g+1],d=a[g+2],m=a[g+3],w=a[g+4],p=a[g+5],b=a[g+6];let v=(s-y)/(a[g+7]-y);f+=(a[g+7+1]-f)*v,d+=(a[g+7+2]-d)*v,m+=(a[g+7+3]-m)*v,w+=(a[g+7+4]-w)*v,p+=(a[g+7+5]-p)*v,b+=(a[g+7+6]-b)*v;break;case 1:f=a[g+1],d=a[g+2],m=a[g+3],w=a[g+4],p=a[g+5],b=a[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=n.data.color,v=n.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}}},ue=class extends ${slotIndex=0;attachmentNames;constructor(e,t){super(e,[D.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,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){h==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[$.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ht=class extends ie{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[D.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,o,n,a,l,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let m=(r-h*2+n)*.03,u=a*.03-o*.06,w=((h-n)*3-r+l)*.006,p=(o-a+.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 C=d+18;d<C;d+=2)f[d]=v,f[d+1]=A,x+=b,y+=g,b+=w,g+=p,v+=x,A+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,s[r]>e){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let h=s[i-2],o=s[i-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof le)||a.timelineAttachment!=this.attachment)return;let l=n.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=a;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=a;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=a;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 C=v[A];l[A]=C+(g[A]-C)*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=a;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=$.search1(d,s),w=this.getCurvePercent(s,u),p=c[u],b=c[u+1];if(i==1)if(h==3){let g=a;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=a;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],C=y[v];l[v]=C+(A+(b[v]-A)*w-C)*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=a;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}}}}},Ye=class Ls extends ${static propertyIds=[""+D.event];events;constructor(t){super(t,Ls.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,o,n){if(!i)return;let a=this.frames,l=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,h,o,n),s=-1;else if(s>=a[l-1])return;if(r<a[0])return;let c=0;if(s<a[0])c=0;else{c=$.search1(a,s)+1;let f=a[c];for(;c>0&&a[c-1]==f;)c--}for(;c<l&&r>=a[c];c++)i.push(this.events[c])}},ge=class Ds extends ${static propertyIds=[""+D.drawOrder];drawOrders;constructor(t){super(t,Ds.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,o,n){if(n==1){o==0&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=$.search1(this.frames,r),l=this.drawOrders[a];if(!l)P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,f=t.slots;for(let d=0,m=l.length;d<m;d++)c[d]=f[l[d]]}}},ct=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,[D.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,i,h,o){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]=o?1:0}apply(e,t,s,r,i,h,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*i,n.softness+=(n.data.softness-n.softness)*i,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let l=0,c=0,f=$.search(a,s,6),d=this.curves[f/6];switch(d){case 0:let m=a[f];l=a[f+1],c=a[f+2];let u=(s-m)/(a[f+6]-m);l+=(a[f+6+1]-l)*u,c+=(a[f+6+2]-c)*u;break;case 1:l=a[f+1],c=a[f+2];break;default:l=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(n.mix=n.data.mix+(l-n.data.mix)*i,n.softness=n.data.softness+(c-n.data.softness)*i,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0)):(n.mix+=(l-n.mix)*i,n.softness+=(c-n.softness)*i,o==0&&(n.bendDirection=a[f+3],n.compress=a[f+4]!=0,n.stretch=a[f+5]!=0))}},dt=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,[D.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=r,a[e+3]=i,a[e+4]=h,a[e+5]=o,a[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*i,n.mixX+=(b.mixX-n.mixX)*i,n.mixY+=(b.mixY-n.mixY)*i,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*i,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*i,n.mixShearY+=(b.mixShearY-n.mixShearY)*i}return}let l,c,f,d,m,u,w=$.search(a,s,7),p=this.curves[w/7];switch(p){case 0:let b=a[w];l=a[w+1],c=a[w+2],f=a[w+3],d=a[w+4],m=a[w+5],u=a[w+6];let g=(s-b)/(a[w+7]-b);l+=(a[w+7+1]-l)*g,c+=(a[w+7+2]-c)*g,f+=(a[w+7+3]-f)*g,d+=(a[w+7+4]-d)*g,m+=(a[w+7+5]-m)*g,u+=(a[w+7+6]-u)*g;break;case 1:l=a[w+1],c=a[w+2],f=a[w+3],d=a[w+4],m=a[w+5],u=a[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=n.data;n.mixRotate=b.mixRotate+(l-b.mixRotate)*i,n.mixX=b.mixX+(c-b.mixX)*i,n.mixY=b.mixY+(f-b.mixY)*i,n.mixScaleX=b.mixScaleX+(d-b.mixScaleX)*i,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*i,n.mixShearY=b.mixShearY+(u-b.mixShearY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(f-n.mixY)*i,n.mixScaleX+=(d-n.mixScaleX)*i,n.mixScaleY+=(m-n.mixScaleY)*i,n.mixShearY+=(u-n.mixShearY)*i}},ft=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,D.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,i,h,n.position,n.data.position))}},ut=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,D.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,i,h,n.spacing,n.data.spacing))}},mt=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,[D.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,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*i,n.mixX+=(n.data.mixX-n.mixX)*i,n.mixY+=(n.data.mixY-n.mixY)*i}return}let l,c,f,d=$.search(a,s,4),m=this.curves[d>>2];switch(m){case 0:let u=a[d];l=a[d+1],c=a[d+2],f=a[d+3];let w=(s-u)/(a[d+4]-u);l+=(a[d+4+1]-l)*w,c+=(a[d+4+2]-c)*w,f+=(a[d+4+3]-f)*w;break;case 1:l=a[d+1],c=a[d+2],f=a[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=n.data;n.mixRotate=u.mixRotate+(l-u.mixRotate)*i,n.mixX=u.mixX+(c-u.mixX)*i,n.mixY=u.mixY+(f-u.mixY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(f-n.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,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,h,this.get(n),this.setup(n)))}},gt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},xt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},wt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},pt=class extends ce{constructor(e,t,s){super(e,t,s,D.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}},bt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},yt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},vt=class extends ce{constructor(e,t,s){super(e,t,s,D.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},At=class Os extends ${static propertyIds=[D.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Os.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,h,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const l=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],h,o,n),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[$.search1(l,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},St=class de extends ${static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[D.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 o=this.frames;t*=de.ENTRIES,o[t]=s,o[t+de.MODE]=r|i<<4,o[t+de.DELAY]=h}apply(t,s,r,i,h,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let l=a.attachment,c=this.attachment;if(l!=c&&(!(l instanceof le)||l.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let f=this.frames;if(r<f[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let d=$.search(f,r,de.ENTRIES),m=f[d],u=f[d+de.MODE],w=f[d+de.DELAY];if(!this.attachment.sequence)return;let p=u>>4,b=this.attachment.sequence.regions.length,g=is[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)}}a.sequenceIndex=p}},as=class We{static _emptyAnimation=new ke("<empty>",[],0);static emptyAnimation(){return We._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new os(this);propertyIDs=new Ge;animationsChanged=!1;trackEntryPool=new be(()=>new ls);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 o=t*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.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 a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=o}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,p=u.alpha;u.mixingFrom?p*=this.applyMixingFrom(u,t,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,C=A.length;if(d==0&&p==1||w==3){d==0&&(b=!0);for(let I=0;I<C;I++){P.webkit602BugfixHelper(p,w);var h=A[I];h instanceof ue?this.applyAttachmentTimeline(h,t,y,w,b):h.apply(t,g,y,v,p,w,0)}}else{let I=u.timelineMode,T=u.shortestRotation,M=!T&&u.timelinesRotation.length!=C<<1;M&&(u.timelinesRotation.length=C<<1);for(let Y=0;Y<C;Y++){let F=A[Y],R=I[Y]==Xe?w:0;!T&&F instanceof ye?this.applyRotateTimeline(F,t,y,p,R,u.timelinesRotation,Y<<1,M):F instanceof ue?this.applyAttachmentTimeline(F,t,y,w,b):(P.webkit602BugfixHelper(p,w),F.apply(t,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+Tt,n=t.slots,a=0,l=t.slots.length;a<l;a++){var c=n[a];if(c.attachmentState==o){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 o=h<i.mixAttachmentThreshold,n=h<i.mixDrawOrderThreshold,a=i.animation.timelines,l=a.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 p=0;p<l;p++)a[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=a[y],A=1,C,I=0;switch(p[y]){case Xe:if(!n&&v instanceof ge)continue;C=r,I=f;break;case Ct:C=0,I=f;break;case It:C=r,I=c;break;case Fe:C=0,I=c;break;default:C=0;let T=b[y];I=c*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=I,!g&&v instanceof ye?this.applyRotateTimeline(v,s,u,I,C,i.timelinesRotation,y<<1,x):v instanceof ue?this.applyAttachmentTimeline(v,s,u,C,o&&I>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(I,r),n&&v instanceof ge&&C==0&&(A=0),v.apply(s,d,u,w,I,C,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 o=s.slots[t.slotIndex];o.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,t.attachmentNames[$.search1(t.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Tt))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+ds)}applyRotateTimeline(t,s,r,i,h,o,n,a){if(a&&(o[n]=0),i==1){t.apply(s,0,r,null,1,h,0);return}let l=s.bones[t.boneIndex];if(!l.active)return;let c=t.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+t.getCurveValue(r);let m=0,u=d-f;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let w=0,p=0;a?(w=0,p=u):(w=o[n],p=o[n+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[n]=m}o[n+1]=u,l.rotation=f+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,h=i-r,o=t.trackLast%h,n=this.events,a=0,l=n.length;for(;a<l;a++){let f=n[a];if(f.time<o)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);a<l;a++){let f=n[a];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 o=this.trackEntry(t,s,r,h);return this.setCurrent(t,o,i),this.queue.drain(),o}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 o=this.trackEntry(t,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,We.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,We.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]:(P.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 o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<i;a++)h[a]=n.addAll(r[a].getPropertyIds())?Fe:It;return}e:for(let a=0;a<i;a++){let l=r[a],c=l.getPropertyIds();if(!n.addAll(c))h[a]=Xe;else if(!s||l instanceof ue||l instanceof ge||l instanceof Ye||!s.animation.hasTimeline(c))h[a]=Ct;else{for(let f=s.mixingTo;f;f=f.mixingTo)if(!f.animation.hasTimeline(c)){if(t.mixDuration>0){h[a]=cs,o[a]=f;continue e}break}h[a]=Fe}}}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()}},ls=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}},os=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 o=0;o<t.length;o++){let n=t[o];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(i)}break;case 5:let h=e[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},hs=(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))(hs||{}),ri=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Xe=0,Ct=1,It=2,Fe=3,cs=4,Tt=1,ds=2,fs=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}},kt=class Ns extends le{color=new q(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}},Ee=class qs extends le{endSlot=null;color=new q(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new qs(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Mt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Re=(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))(Re||{}),us=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(us||{}),ms=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ni=class extends Mt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Pe=class{pages=new Array;regions=new Array;constructor(e){let t=new ai(e),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(Re,s[1]),l.magFilter=P.enumValue(Re,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=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 o=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let l=new Yt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let f=i[s[0]];if(f)f(l);else{n||(n=[]),a||(a=[]),n.push(s[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(s[m+1]));a.push(d)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),n&&n.length>0&&a&&a.length>0&&(l.names=n,l.values=a,n=null,a=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 gs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},ai=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}}},gs=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}},Yt=class extends ms{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)}},ve=class jt extends le{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(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=P.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,n=0;if(this.region instanceof Yt){let a=this.region,l=a.page,c=l.width,f=l.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+t[d+1]*o,s[d+1]=h+(1-t[d])*n;return;case 180:i-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/f,o=a.originalWidth/c,n=a.originalHeight/f;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d])*o,s[d+1]=h+(1-t[d+1])*n;return;case 270:i-=a.offsetY/c,h-=a.offsetX/f,o=a.originalHeight/c,n=a.originalWidth/f;for(let d=0;d<r;d+=2)s[d]=i+(1-t[d+1])*o,s[d+1]=h+t[d]*n;return}i-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/f,o=a.originalWidth/c,n=a.originalHeight/f}else this.region?(o=this.region.u2-i,n=this.region.v2-h):(i=h=0,o=n=1);for(let a=0;a<r;a+=2)s[a]=i+t[a]*o,s[a+1]=h+t[a+1]*n}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 jt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?P.newFloatArray(this.uvs.length):new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.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),P.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,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,h,o)}newLinkedMesh(){let t=new jt(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}},Ae=class Us extends le{lengths=[];closed=!1;constantSpeed=!1;color=new q(1,1,1,1);constructor(t){super(t)}copy(){let t=new Us(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},xs=class Ws extends le{x=0;y=0;rotation=0;color=new q(.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*E.degRad,r=Math.cos(s),i=Math.sin(s),h=r*t.a+i*t.b,o=r*t.c+i*t.d;return E.atan2Deg(o,h)}copy(){let t=new Ws(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Be=class zs extends He{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(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,o=-this.height/2*this.scaleY+this.region.offsetY*i,n=h+this.region.width*r,a=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=n*c+d,x=n*f,y=a*c+m,v=a*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,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,o=this.offset,n=h.worldX,a=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+n,s[r+1]=m*f+u*d+a,r+=i,m=o[2],u=o[3],s[r]=m*l+u*c+n,s[r+1]=m*f+u*d+a,r+=i,m=o[4],u=o[5],s[r]=m*l+u*c+n,s[r+1]=m*f+u*d+a,r+=i,m=o[6],u=o[7],s[r]=m*l+u*c+n,s[r+1]=m*f+u*d+a}copy(){let t=new zs(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,P.arrayCopy(this.uvs,0,t.uvs,0,8),P.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},ws=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 o=s.getPath(t,i),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[i]=n}}newRegionAttachment(e,t,s,r){let i=new Be(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 ve(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 kt(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new xs(t)}newClippingAttachment(e,t){return new Ee(t)}},Xt=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(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}},Ve=(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))(Ve||{}),Ft=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,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let n=this.parent;if(!n){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=e*m+d.x,this.worldY=t*u+d.y;return}let a=n.a,l=n.b,c=n.c,f=n.d;switch(this.worldX=a*e+l*t+n.worldX,this.worldY=c*e+f*t+n.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=a*u+l*p,this.b=a*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;a*=d,c*=m;let u=a*a+c*c,w=0;u>1e-4?(u=Math.abs(a*f*m-l*d*c)/u,l=c*u,f=a*u,w=Math.atan2(c,a)*E.radDeg):(a=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=a*g-l*y,this.b=a*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=(a*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&&a*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 e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*o-f*n,this.ay=f*l-c*a;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),o=i*h,n=s*h;break}case 3:case 4:let p=E.cosDeg(this.rotation),b=E.sinDeg(this.rotation);t=(t*p+s*b)/this.skeleton.scaleX,r=(r*p+i*b)/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=E.PI/2+Math.atan2(r,t);s=Math.cos(x)*g,i=Math.sin(x)*g,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h}d=o*this.a-n*this.c,m=o*this.b-n*this.d,u=l*this.c-a*this.a,w=l*this.d-a*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(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=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*E.radDeg}rotateWorld(e){e*=E.degRad;const t=Math.sin(e),s=Math.cos(e),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}},Se=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},li=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new bs,r=new ps){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,o)=>{const n=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}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,o)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}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(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(e,n);this.success(t,e,a),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(e,n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.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((o,n)=>{this.downloader.downloadText(e,a=>{try{const l=this.createTextureAtlas(e,a);let 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(t,e,l),o(l)))},(m,u)=>{if(!f){const w=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,w),n(w)}f=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),n(c)}},(a,l)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${l}`;this.error(s,e,c),n(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,o=>{try{const n=this.createTextureAtlas(e,o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),h(a)})}))}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){const t=this.cache.assets[e];if(t instanceof Pe){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new Pe(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const r of s.pages)r.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),r=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&r()},s}},ps=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}},bs=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(o){this.finish(e,400,JSON.stringify(o))}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(o){this.finish(e,400,JSON.stringify(o))}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,o=r.length;h<o;h+=2)r[h].apply(null,i)}},Et=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}},Rt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ys=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let 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,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,l=n.b,c=n.c,f=n.d,d=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*E.signum(e.skeleton.scaleX),u=(s-e.worldY)*E.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(a*f-l*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,x=c/e.skeleton.scaleY;l=-x*b*e.skeleton.scaleX,f=g*b*e.skeleton.scaleY,d+=Math.atan2(x,g)*E.radDeg;default:let y=t-n.worldX,v=s-n.worldY,A=a*f-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*f-v*l)/A-e.ax,u=(v*a-y*c)/A-e.ay)}d+=Math.atan2(u,m)*E.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let w=e.ascaleX,p=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const b=e.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)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,w,p,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,h,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,u=d,w=t.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=t.ax,y=0,v=0,A=0,C=e.a,I=e.b,T=e.c,M=e.d,Y=Math.abs(f-d)<=1e-4;!Y||h?(y=0,v=C*x+e.worldX,A=T*x+e.worldY):(y=t.ay,v=C*x+I*y+e.worldX,A=T*x+M*y+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,I=F.b,T=F.c,M=F.d;let R=C*M-I*T,k=v-F.worldX,X=A-F.worldY;R=Math.abs(R)<=1e-4?0:1/R;let V=(k*M-X*I)*R-l,O=(X*C-k*T)*R-c,L=Math.sqrt(V*V+O*O),N=t.data.length*w,H,_;if(L<1e-4){this.apply1(e,s,r,!1,h,!1,a),t.updateWorldTransformWith(x,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}k=s-F.worldX,X=r-F.worldY;let j=(k*M-X*I)*R-l,B=(X*C-k*T)*R-c,U=j*j+B*B;if(n!=0){n*=f*(w+1)*.5;let J=Math.sqrt(U),Q=J-L-N*f+n;if(Q>0){let Z=Math.min(1,Q/(n*2))-1;Z=(Q-n*(1-Z*Z))/J,j-=Z*j,B-=Z*B,U=j*j+B*B}}e:if(Y){N*=f;let J=(U-L*L-N*N)/(2*L*N);J<-1?(J=-1,_=Math.PI*i):J>1?(J=1,_=0,h&&(C=(Math.sqrt(U)/(L+N)-1)*a+1,m*=C,o&&(u*=C))):_=Math.acos(J)*i,C=L+N*J,I=N*Math.sin(_),H=Math.atan2(B*C-j*I,j*C+B*I)}else{C=f*N,I=d*N;let J=C*C,Q=I*I,Z=Math.atan2(B,j);T=Q*L*L+J*U-J*Q;let ne=-2*Q*L,xe=Q-J;if(M=ne*ne-4*xe*T,M>=0){let we=Math.sqrt(M);ne<0&&(we=-we),we=-(ne+we)*.5;let Ie=we/xe,Bs=T/we,qe=Math.abs(Ie)<Math.abs(Bs)?Ie:Bs;if(Ie=U-qe*qe,Ie>=0){X=Math.sqrt(Ie)*i,H=Z-Math.atan2(X,qe),_=Math.atan2(X/d,(qe-L)/f);break e}}let Ce=E.PI,Oe=L-C,Ht=Oe*Oe,Es=0,Rs=0,Ne=L+C,$t=Ne*Ne,Ps=0;T=-C*L/(J-Q),T>=-1&&T<=1&&(T=Math.acos(T),k=C*Math.cos(T)+L,X=I*Math.sin(T),M=k*k+X*X,M<Ht&&(Ce=T,Ht=M,Oe=k,Es=X),M>$t&&(Rs=T,$t=M,Ne=k,Ps=X)),U<=(Ht+$t)*.5?(H=Z-Math.atan2(Es*i,Oe),_=Ce*i):(H=Z-Math.atan2(Ps*i,Ne),_=Rs*i)}let G=Math.atan2(y,x)*g,ee=e.arotation;H=(H-G)*E.radDeg+p-ee,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(l,c,ee+H*a,m,u,0,0),ee=t.arotation,_=((_+G)*E.radDeg-t.ashearX)*g+b-ee,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(x,y,ee+_*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Pt=class extends Se{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)}},Bt=class extends Se{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)}},Vt=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Vt||{}),Lt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Lt||{}),Dt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Dt||{}),vs=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 o=s.findBone(t.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(o)}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 Ae))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,l=this.bones,c=l.length,f=n?c:c+1,d=P.setArraySize(this.spaces,f),m=a?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(a)for(let A=0,C=f-1;A<C;A++){let I=l[A],T=I.data.length,M=T*I.a,Y=T*I.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,C=f-1;A<C;){let I=l[A],T=I.data.length;if(T<fe.epsilon)a&&(m[A]=0),d[++A]=u;else{let M=T*I.a,Y=T*I.c,F=Math.sqrt(M*M+Y*Y);a&&(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,C=f-1;A<C;){let I=l[A],T=I.data.length;if(T<fe.epsilon)a&&(m[A]=0),d[++A]=u;else{let M=T*I.a,Y=T*I.c,F=Math.sqrt(M*M+Y*Y);a&&(m[A]=F),d[++A]=(v?T+u:u)*F/T}}}let w=this.computeWorldPositions(s,f,n),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 C=w[v],I=w[v+1],T=C-p,M=I-b;if(a){let Y=m[y];if(Y!=0){let F=(Math.sqrt(T*T+M*M)/Y-1)*r+1;A.a*=F,A.c*=F}}if(p=C,b=I,r>0){let Y=A.a,F=A.b,R=A.c,k=A.d,X=0,V=0,O=0;if(n?X=w[v-1]:d[y+1]==0?X=w[v+2]:X=Math.atan2(M,T),X-=Math.atan2(R,Y),x){V=Math.cos(X),O=Math.sin(X);let L=A.data.length;p+=(L*(V*Y-O*R)-T)*r,b+=(L*(O*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),O=Math.sin(X),A.a=V*Y-O*R,A.b=V*F-O*k,A.c=O*Y+V*R,A.d=O*F+V*k}A.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,h=this.position,o=this.spaces,n=P.setArraySize(this.positions,s*3+2),a=this.world,l=t.closed,c=t.worldVerticesLength,f=c/6,d=fe.NONE;if(!t.constantSpeed){let L=t.lengths;f-=l?1:2;let N=L[f];this.data.positionMode==1&&(h*=N);let H;switch(this.data.spacingMode){case 2:H=N;break;case 3:H=N/s;break;default:H=1}a=P.setArraySize(this.world,8);for(let _=0,j=0,B=0;_<s;_++,j+=3){let U=o[_]*H;h+=U;let G=h;if(l)G%=N,G<0&&(G+=N),B=0;else if(G<0){d!=fe.BEFORE&&(d=fe.BEFORE,t.computeWorldVertices(i,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,j);continue}else if(G>N){d!=fe.AFTER&&(d=fe.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-N,a,0,n,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,l&&B==f?(t.computeWorldVertices(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,B*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,j,r||_>0&&U==0)}return n}l?(c+=2,a=P.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(f--,c-=4,a=P.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=P.setArraySize(this.curves,f),u=0,w=a[0],p=a[1],b=0,g=0,x=0,y=0,v=0,A=0,C=0,I=0,T=0,M=0,Y=0,F=0,R=0,k=0;for(let L=0,N=2;L<f;L++,N+=6)b=a[N],g=a[N+1],x=a[N+2],y=a[N+3],v=a[N+4],A=a[N+5],C=(w-b*2+x)*.1875,I=(p-g*2+y)*.1875,T=((b-x)*3-w+v)*.09375,M=((g-y)*3-p+A)*.09375,Y=C*2+T,F=I*2+M,R=(b-w)*.75+C+T*.16666667,k=(g-p)*.75+I+M*.16666667,u+=Math.sqrt(R*R+k*k),R+=Y,k+=F,Y+=T,F+=M,u+=Math.sqrt(R*R+k*k),R+=Y,k+=F,u+=Math.sqrt(R*R+k*k),R+=Y+T,k+=F+M,u+=Math.sqrt(R*R+k*k),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,O=0;for(let L=0,N=0,H=0,_=0;L<s;L++,N+=3){let j=o[L]*X;h+=j;let B=h;if(l)B%=u,B<0&&(B+=u),H=0;else if(B<0){this.addBeforePosition(B,a,0,n,N);continue}else if(B>u){this.addAfterPosition(B-u,a,c-4,n,N);continue}for(;;H++){let U=m[H];if(!(B>U)){if(H==0)B/=U;else{let G=m[H-1];B=(B-G)/(U-G)}break}}if(H!=d){d=H;let U=H*6;for(w=a[U],p=a[U+1],b=a[U+2],g=a[U+3],x=a[U+4],y=a[U+5],v=a[U+6],A=a[U+7],C=(w-b*2+x)*.03,I=(p-g*2+y)*.03,T=((b-x)*3-w+v)*.006,M=((g-y)*3-p+A)*.006,Y=C*2+T,F=I*2+M,R=(b-w)*.3+C+T*.16666667,k=(g-p)*.3+I+M*.16666667,O=Math.sqrt(R*R+k*k),V[0]=O,U=1;U<8;U++)R+=Y,k+=F,Y+=T,F+=M,O+=Math.sqrt(R*R+k*k),V[U]=O;R+=Y,k+=F,O+=Math.sqrt(R*R+k*k),V[8]=O,R+=Y+T,k+=F+M,O+=Math.sqrt(R*R+k*k),V[9]=O,_=0}for(B*=O;;_++){let U=V[_];if(!(B>U)){if(_==0)B/=U;else{let G=V[_-1];B=_+(B-G)/(U-G)}break}}this.addCurvePosition(B*.1,w,p,b,g,x,y,v,A,n,N,r||L>0&&j==0)}return n}addBeforePosition(t,s,r,i,h){let o=s[r],n=s[r+1],a=s[r+2]-o,l=s[r+3]-n,c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addAfterPosition(t,s,r,i,h){let o=s[r+2],n=s[r+3],a=o-s[r],l=n-s[r+1],c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addCurvePosition(t,s,r,i,h,o,n,a,l,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,p=w*w,b=p*w,g=w*t,x=g*3,y=w*x,v=x*t,A=s*b+i*y+o*v+a*u,C=r*b+h*y+n*v+l*u;c[f]=A,c[f+1]=C,d&&(t<.001?c[f+2]=Math.atan2(h-r,i-s):c[f+2]=Math.atan2(C-(r*p+h*g*2+n*m),A-(s*p+i*g*2+o*m)))}},oi=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,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=a.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(a.scaleY);if(b*=Math.abs(a.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*a.scaleX,A=this.gravity*w*a.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*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||h){let x=Math.atan2(o.c,o.a),y=0,v=0,A=0,C=this.cx-o.worldX,I=this.cy-o.worldY;if(C>b?C=b:C<-b&&(C=-b),I>g?I=g:I<-g&&(I=-g),i){A=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(I+this.ty,C+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(T-Math.ceil(T*E.invPI2-.5)*E.PI2)*m,T=this.rotateOffset*A+x,y=Math.cos(T),v=Math.sin(T),h&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(C*y+I*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(C*y+I*v)*m/T)}if(d=this.remaining,d>=u){p==-1&&(p=Math.pow(this.damping,60*u));const T=this.massInverse*u,M=this.strength,Y=this.wind,F=Le.yDown?-this.gravity:this.gravity,R=n/w;for(;;)if(d-=u,h&&(this.scaleVelocity+=(Y*y-F*v-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=p),i){if(this.rotateVelocity-=((Y*v+F*y)*R+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=p,d<u)break;const k=this.rotateOffset*A+x;y=Math.cos(k),v=Math.sin(k)}else if(d<u)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i){let a=this.rotateOffset*t,l=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*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+=a*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 a*=this.data.rotate,l=Math.sin(a),c=Math.cos(a),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 a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*E.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*h-o,o*h+n*i-n)}},As=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 q,this.darkColor=e.darkColor?new q: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}},Ss=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Te;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,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,f=n.d,d=a*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(e!=0){let x=g.a,y=g.b,v=g.c,A=g.d,C=Math.atan2(c,a)-Math.atan2(v,x)+m;C>E.PI?C-=E.PI2:C<-E.PI&&(C+=E.PI2),C*=e;let I=Math.cos(C),T=Math.sin(C);g.a=I*x-T*v,g.b=I*y-T*A,g.c=T*x+I*v,g.d=T*y+I*A}if(o){let x=this.temp;n.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(a*a+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,a)-(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 C=Math.sqrt(x*x+y*y);g.b=Math.cos(A)*C,g.d=Math.sin(A)*C}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,f=n.d,d=a*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(e!=0){let x=g.a,y=g.b,v=g.c,A=g.d,C=Math.atan2(c,a)+m;C>E.PI?C-=E.PI2:C<-E.PI&&(C+=E.PI2),C*=e;let I=Math.cos(C),T=Math.sin(C);g.a=I*x-T*v,g.b=I*y-T*A,g.c=T*x+I*v,g.d=T*y+I*A}if(o){let x=this.temp;n.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(a*a+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,a);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 e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],f=c.arotation;e!=0&&(f+=(o.arotation-f+this.data.offsetRotation)*e);let d=c.ax,m=c.ay;d+=(o.ax-d+this.data.offsetX)*t,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 e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],f=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,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)}}},Le=class Jt{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 Jt.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 Ft(r,this,null);else{let h=this.bones[r.parent.index];i=new Ft(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 As(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 ys(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new Ss(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new vs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new oi(r,this))}this.color=new q(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,o=this.physicsConstraints,n=r.length,a=i.length,l=h.length,c=this.physicsConstraints.length,f=n+a+l+c;e:for(let d=0;d<f;d++){for(let m=0;m<n;m++){let u=r[m];if(u.data.order==d){this.sortIkConstraint(u);continue e}}for(let m=0;m<a;m++){let u=i[m];if(u.data.order==d){this.sortTransformConstraint(u);continue e}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==d){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=o[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&&P.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&&P.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 a=0,l=this.data.skins.length;a<l;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,i);let h=s.getAttachment();h instanceof Ae&&this.sortPathConstraintAttachmentWith(h,i);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.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 Ae))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let n=r[h++];for(n+=h;h<n;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&P.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 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(t)}updateWorldTransformWith(t,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,n=s.c,a=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=n*this.x+a*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=(n*f+a*m)*this.scaleY,i.d=(n*d+a*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(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;P.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],o=h.data.attachmentName;if(o){let n=t.getAttachment(r,o);n&&h.setAttachment(n)}}}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 o=r[i];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(i,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);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 Te,r=new Te;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,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=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 Be)m=8,u=P.setArraySize(r,m,0),p.computeWorldVertices(d,u,0,2),w=Jt.quadTriangles;else if(p instanceof ve){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 Ee&&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),n=Math.min(n,y),a=Math.max(a,x),l=Math.max(l,y)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(o,n),s.set(a-o,l-n)}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,o=i.length;h<o;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||{}),Is=class extends Se{_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}},Nt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},De=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new q(.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 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<e.constraints.length;r++){let i=e.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 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 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<e.constraints.length;r++){let i=e.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 t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof ve?(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 Nt(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 Nt(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 o=t.attachments[s];for(let n in o){let a=o[n];if(h==a){let l=this.getAttachment(s,n);l&&i.setAttachment(l);break}}}s++}}},qt=class{index=0;name;boneData;color=new q(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||{}),Wt=class extends Se{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 ks(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 o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}n=r.readInt(!0);for(let l=0;l<n;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 Xt(l,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(),o&&(q.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}n=r.readInt(!0);for(let l=0;l<n;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 qt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Pt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Wt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Bt(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)}n=r.readInt(!0);for(let l=0,c;l<n;l++){const f=r.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Is(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 a=this.readSkin(r,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let l=s.skins.length;for(P.setArraySize(s.skins,n=l+r.readInt(!0));l<n;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}n=this.linkedMeshes.length;for(let l=0;l<n;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,n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let f=new Rt(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)}n=r.readInt(!0);for(let l=0;l<n;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(e,t,s,r){let i=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;i=new De("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");i=new De(o),r&&q.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let n=0,a=i.bones.length;n<a;n++)i.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let n=e.readInt(!0);for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,i,n,c,r);f&&i.setAttachment(n,c,f)}}return i}readAttachment(e,t,s,r,i,h){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():i;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let l=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null;let d=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),w=e.readFloat(),p=e.readFloat(),b=e.readFloat(),g=e.readFloat();l||(l=a);let x=this.attachmentLoader.newRegionAttachment(s,a,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(e,(n&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,a);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=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),w=this.readShortArray(e,(m.length-d-2)*3);let p=[],b=0,g=0;h&&(p=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),g=e.readFloat()),l||(l=a);let x=this.attachmentLoader.newMeshAttachment(s,a,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=(n&16)!=0?e.readStringRef():a;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,f=(n&64)!=0?this.readSequence(e):null,d=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let w=0,p=0;h&&(w=e.readFloat(),p=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,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 hi(b,m,r,u,d)),b):null}case 4:{const l=(n&16)!=0,c=(n&32)!=0,f=this.readVertices(e,(n&64)!=0),d=P.newArray(f.length/6,0);for(let w=0,p=d.length;w<p;w++)d[w]=e.readFloat()*o;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);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=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);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=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,a);return d?(d.endSlot=t.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(e){let t=new ts(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 ci;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let h=new Array,o=new Array;for(let n=0;n<r;n++){let a=e.readInt(!0);o.push(a);for(let l=0;l<a;l++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=o,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 a=0,l=e.readInt(!0);a<l;a++){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 Ai:{let p=new ue(u,c);for(let b=0;b<u;b++)p.setFrame(b,e.readFloat(),e.readStringRef());r.push(p);break}case Si:{let p=e.readInt(!0),b=new rt(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,I=0;b.setFrame(C,g,x,y,v,A),C!=w;C++){let T=e.readFloat(),M=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(C);break;case he:W(e,b,I++,C,0,g,T,x,M,1),W(e,b,I++,C,1,g,T,y,Y,1),W(e,b,I++,C,2,g,T,v,F,1),W(e,b,I++,C,3,g,T,A,R,1)}g=T,x=M,y=Y,v=F,A=R}r.push(b);break}case Ci:{let p=e.readInt(!0),b=new nt(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,g,x,y,v),A!=w;A++){let I=e.readFloat(),T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(A);break;case he:W(e,b,C++,A,0,g,I,x,T,1),W(e,b,C++,A,1,g,I,y,M,1),W(e,b,C++,A,2,g,I,v,Y,1)}g=I,x=T,y=M,v=Y}r.push(b);break}case Ii:{let p=e.readInt(!0),b=new lt(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let M=0,Y=0;b.setFrame(M,g,x,y,v,A,C,I,T),M!=w;M++){let F=e.readFloat(),R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(M);break;case he:W(e,b,Y++,M,0,g,F,x,R,1),W(e,b,Y++,M,1,g,F,y,k,1),W(e,b,Y++,M,2,g,F,v,X,1),W(e,b,Y++,M,3,g,F,A,V,1),W(e,b,Y++,M,4,g,F,C,O,1),W(e,b,Y++,M,5,g,F,I,L,1),W(e,b,Y++,M,6,g,F,T,N,1)}g=F,x=R,y=k,v=X,A=V,C=O,I=L,T=N}r.push(b);break}case Ti:{let p=e.readInt(!0),b=new ot(u,p,c),g=e.readFloat(),x=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let T=0,M=0;b.setFrame(T,g,x,y,v,A,C,I),T!=w;T++){let Y=e.readFloat(),F=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case oe:b.setStepped(T);break;case he:W(e,b,M++,T,0,g,Y,x,F,1),W(e,b,M++,T,1,g,Y,y,R,1),W(e,b,M++,T,2,g,Y,v,k,1),W(e,b,M++,T,3,g,Y,A,X,1),W(e,b,M++,T,4,g,Y,C,V,1),W(e,b,M++,T,5,g,Y,I,O,1)}g=Y,x=F,y=R,v=k,A=X,C=V,I=O}r.push(b);break}case ki:{let p=new at(u,e.readInt(!0),c),b=e.readFloat(),g=e.readUnsignedByte()/255;for(let x=0,y=0;p.setFrame(x,b,g),x!=w;x++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(x);break;case he:W(e,p,y++,x,0,b,v,g,A,1)}b=v,g=A}r.push(p)}}}}for(let a=0,l=e.readInt(!0);a<l;a++){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==vi){let p=new it(u,c);for(let b=0;b<u;b++)p.setFrame(b,e.readFloat(),e.readByte());r.push(p);continue}let w=e.readInt(!0);switch(m){case di:r.push(K(e,new ye(u,w,c),1));break;case fi:r.push(zt(e,new $e(u,w,c),i));break;case ui:r.push(K(e,new je(u,w,c),i));break;case mi:r.push(K(e,new Je(u,w,c),i));break;case gi:r.push(zt(e,new Ke(u,w,c),1));break;case xi:r.push(K(e,new Qe(u,w,c),1));break;case wi:r.push(K(e,new Ze(u,w,c),1));break;case pi:r.push(zt(e,new et(u,w,c),1));break;case bi:r.push(K(e,new tt(u,w,c),1));break;case yi:r.push(K(e,new st(u,w,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new ct(f,e.readInt(!0),c),u=e.readByte(),w=e.readFloat(),p=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,b=(u&4)!=0?e.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=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&&(W(e,m,x++,g,0,w,y,p,v,1),W(e,m,x++,g,1,w,y,b,A,i)),w=y,p=v,b=A}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new dt(f,e.readInt(!0),c),u=e.readFloat(),w=e.readFloat(),p=e.readFloat(),b=e.readFloat(),g=e.readFloat(),x=e.readFloat(),y=e.readFloat();for(let v=0,A=0;m.setFrame(v,u,w,p,b,g,x,y),v!=d;v++){let C=e.readFloat(),I=e.readFloat(),T=e.readFloat(),M=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),R=e.readFloat();switch(e.readByte()){case oe:m.setStepped(v);break;case he:W(e,m,A++,v,0,u,C,w,I,1),W(e,m,A++,v,1,u,C,p,T,1),W(e,m,A++,v,2,u,C,b,M,1),W(e,m,A++,v,3,u,C,g,Y,1),W(e,m,A++,v,4,u,C,x,F,1),W(e,m,A++,v,5,u,C,y,R,1)}u=C,w=I,p=T,b=M,g=Y,x=F,y=R}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){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),p=e.readInt(!0);switch(u){case Xi:r.push(K(e,new ft(w,p,c),f.positionMode==0?i:1));break;case Fi:r.push(K(e,new ut(w,p,c),f.spacingMode==0||f.spacingMode==1?i:1));break;case Ei:let b=new mt(w,p,c),g=e.readFloat(),x=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,C=0,I=b.getFrameCount()-1;b.setFrame(A,g,x,y,v),A!=I;A++){let T=e.readFloat(),M=e.readFloat(),Y=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:b.setStepped(A);break;case he:W(e,b,C++,A,0,g,T,x,M,1),W(e,b,C++,A,1,g,T,y,Y,1),W(e,b,C++,A,2,g,T,v,F,1)}g=T,x=M,y=Y,v=F}r.push(b)}}}for(let a=0,l=e.readInt(!0);a<l;a++){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==Ni){const p=new At(u,c);for(let b=0;b<u;b++)p.setFrame(b,e.readFloat());r.push(p);continue}const w=e.readInt(!0);switch(m){case Ri:r.push(K(e,new gt(u,w,c),1));break;case Pi:r.push(K(e,new xt(u,w,c),1));break;case Bi:r.push(K(e,new wt(u,w,c),1));break;case Vi:r.push(K(e,new pt(u,w,c),1));break;case Li:r.push(K(e,new bt(u,w,c),1));break;case Di:r.push(K(e,new yt(u,w,c),1));break;case Oi:r.push(K(e,new vt(u,w,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){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 p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,p),g=e.readByte(),x=e.readInt(!0),y=x-1;switch(g){case Mi:{let v=b,A=v.bones,C=v.vertices,I=A?C.length/3*2:C.length,T=e.readInt(!0),M=new ht(x,T,m,v),Y=e.readFloat();for(let F=0,R=0;;F++){let k,X=e.readInt(!0);if(X==0)k=A?P.newFloatArray(I):C;else{k=P.newFloatArray(I);let O=e.readInt(!0);if(X+=O,i==1)for(let L=O;L<X;L++)k[L]=e.readFloat();else for(let L=O;L<X;L++)k[L]=e.readFloat()*i;if(!A)for(let L=0,N=k.length;L<N;L++)k[L]+=C[L]}if(M.setFrame(F,Y,k),F==y)break;let V=e.readFloat();switch(e.readByte()){case oe:M.setStepped(F);break;case he:W(e,M,R++,F,0,Y,V,0,1,1)}Y=V}r.push(M);break}case Yi:{let v=new St(x,m,b);for(let A=0;A<x;A++){let C=e.readFloat(),I=e.readInt32();v.setFrame(A,C,is[I&15],I>>4,e.readFloat())}r.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let a=new ge(h),l=s.slots.length;for(let c=0;c<h;c++){let f=e.readFloat(),d=e.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=e.readInt(!0);for(;w!=g;)u[p++]=w++;m[w+e.readInt(!0)]=w++}for(;w<l;)u[p++]=w++;for(let b=l-1;b>=0;b--)m[b]==-1&&(m[b]=u[--p]);a.setFrame(c,f,m)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=new Ye(o);for(let l=0;l<o;l++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new Et(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()),a.setFrame(l,d)}r.push(a)}let n=0;for(let a=0,l=r.length;a<l;a++)n=Math.max(n,r[a].getDuration());return new ke(t,r,n)}},ks=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}},hi=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}},ci=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function K(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let h=0,o=0,n=t.getFrameCount()-1;t.setFrame(h,r,i),h!=n;h++){let a=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(h);break;case he:W(e,t,o++,h,0,r,a,i,l,s)}r=a,i=l}return t}function zt(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,h),o!=a;o++){let l=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(o);break;case he:W(e,t,n++,o,0,r,l,i,c,s),W(e,t,n++,o,1,r,l,h,f,s)}r=l,i=c,h=f}return t}function W(e,t,s,r,i,h,o,n,a,l){t.setBezier(s,r,i,h,n,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,a)}var di=0,fi=1,ui=2,mi=3,gi=4,xi=5,wi=6,pi=7,bi=8,yi=9,vi=10,Ai=0,Si=1,Ci=2,Ii=3,Ti=4,ki=5,Mi=0,Yi=1,Xi=0,Fi=1,Ei=2,Ri=0,Pi=1,Bi=2,Vi=4,Li=5,Di=6,Oi=7,Ni=8,oe=1,he=2,qi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new be(()=>P.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,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n<o;n++){let a=h[n];if(!a.bone.active)continue;let l=a.getAttachment();if(l instanceof kt){let c=l;s.push(c);let f=i.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),r.push(f),c.computeWorldVertices(a,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,o=i.length;h<o;h++){let n=i[h],a=n;for(let l=0,c=n.length;l<c;l+=2){let f=a[l],d=a[l+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,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=h&&r<=h||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),l=a*(i-e)+t;if(l>h&&l<n||(l=a*(o-e)+t,l>h&&l<n))return!0;let c=(h-t)/a+e;return c>i&&c<o||(c=(n-t)/a+e,c>i&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let 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,o=!1;for(let n=0;n<i;n+=2){let a=r[n+1],l=r[h+1];if(a<s&&l>=s||l<s&&a>=s){let c=r[n];c+(s-a)/(l-a)*(r[h]-c)<t&&(o=!o)}h=n}return o}intersectsSegment(e,t,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;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,o=e.length,n=t-r,a=s-i,l=t*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=n*b-a*p,x=(l*p-n*w)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=t&&x<=r||x>=r&&x<=t)){let y=(l*b-a*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}},Ms=class te{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new be(()=>new Array);polygonIndicesPool=new be(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n<r;n++)i[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=r;n<a;++n)h[n]=te.isConcave(n,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let n=r-1,a=0,l=1;for(;;){e:if(!h[a]){let d=i[n]<<1,m=i[a]<<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!=n;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,C=s[A],I=s[A+1];if(te.positiveArea(x,y,w,p,C,I)&&te.positiveArea(w,p,b,g,C,I)&&te.positiveArea(b,g,x,y,C,I))break e}break}if(l==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=l,l=(l+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),h.splice(a,1),r--;let c=(r+a-1)%r,f=a==r?0:a;h[c]=te.isConcave(c,r,s,i),h[f]=te.isConcave(f,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}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 o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-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(a==d){let A=n.length-4,C=te.winding(n[A],n[A+1],n[A+2],n[A+3],x,y),I=te.winding(x,y,n[0],n[1],n[2],n[3]);C==l&&I==l&&(n.push(x),n.push(y),o.push(u),v=!0)}v||(n.length>0?(i.push(n),h.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(w),n.push(p),n.push(b),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(m),o.push(u),l=te.winding(w,p,b,g,x,y),a=d)}n.length>0&&(i.push(n),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];n=i[c];let u=n.length-4,w=n[u],p=n[u+1],b=n[u+2],g=n[u+3],x=n[0],y=n[1],v=n[2],A=n[3],C=te.winding(w,p,b,g,x,y);for(let I=0;I<f;I++){if(I==c)continue;let T=h[I];if(T.length!=3)continue;let M=T[0],Y=T[1],F=T[2],R=i[I],k=R[R.length-2],X=R[R.length-1];if(M!=d||Y!=m)continue;let V=te.winding(w,p,b,g,k,X),O=te.winding(k,X,x,y,v,A);V==C&&O==C&&(R.length=0,T.length=0,n.push(k),n.push(X),o.push(F),w=b,p=g,b=k,g=X,I=0)}}for(let c=i.length-1;c>=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let h=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,h,o){return t*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(t,s,r,i,h,o){let n=r-t,a=i-s;return h*a-o*n+n*s-t*a>=0?1:-1}},Ys=class Kt{triangulator=new Ms;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=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let h=this.clippingPolygon;Kt.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=o.length;n<a;n++){let l=o[n];Kt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.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,o,n,a){let l,c,f,d,m,u;typeof s=="number"?(l=r,c=i,f=h,d=o,m=n,u=a):(l=s,c=r,f=i,d=h,m=o,u=n),f&&d&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,l,c,f,d,m,u):this.clipTrianglesNoRender(t,l,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,l=0;h.length=0,o.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 p=t[f],b=t[f+1];for(let g=0;g<a;g++){let x=h.length;if(this.clip(d,m,u,w,p,b,n[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,C=P.setArraySize(h,x+v*2);for(let T=0;T<y;T+=2,x+=2){let M=A[T],Y=A[T+1];C[x]=M,C[x+1]=Y}x=o.length;let I=P.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)I[x]=l,I[x+1]=l+T,I[x+2]=l+T+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(t,s,r,i,h,o,n){let a=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,m=n?12:8,u=0;l.length=0,c.length=0;for(let w=0;w<r;w+=3){let p=s[w]<<1,b=t[p],g=t[p+1],x=i[p],y=i[p+1];p=s[w+1]<<1;let v=t[p],A=t[p+1],C=i[p],I=i[p+1];p=s[w+2]<<1;let T=t[p],M=t[p+1],Y=i[p],F=i[p+1];for(let R=0;R<d;R++){let k=l.length;if(this.clip(b,g,v,A,T,M,f[R],a)){let X=a.length;if(X==0)continue;let V=A-M,O=T-v,L=b-T,N=M-g,H=1/(V*L+O*(g-M)),_=X>>1,j=this.clipOutput,B=P.setArraySize(l,k+_*m);for(let G=0;G<X;G+=2,k+=m){let ee=j[G],J=j[G+1];B[k]=ee,B[k+1]=J,B[k+2]=h.r,B[k+3]=h.g,B[k+4]=h.b,B[k+5]=h.a;let Q=ee-T,Z=J-M,ne=(V*Q+O*Z)*H,xe=(N*Q+L*Z)*H,Ce=1-ne-xe;B[k+6]=x*ne+C*xe+Y*Ce,B[k+7]=y*ne+I*xe+F*Ce,n&&(B[k+8]=o.r,B[k+9]=o.g,B[k+10]=o.b,B[k+11]=o.a)}k=c.length;let U=P.setArraySize(c,k+3*(_-2));_--;for(let G=1;G<_;G++,k+=3)U[k]=u,U[k+1]=u+G,U[k+2]=u+G+1;u+=_+1}else{let X=P.setArraySize(l,k+3*m);X[k]=b,X[k+1]=g,X[k+2]=h.r,X[k+3]=h.g,X[k+4]=h.b,X[k+5]=h.a,n?(X[k+6]=x,X[k+7]=y,X[k+8]=o.r,X[k+9]=o.g,X[k+10]=o.b,X[k+11]=o.a,X[k+12]=v,X[k+13]=A,X[k+14]=h.r,X[k+15]=h.g,X[k+16]=h.b,X[k+17]=h.a,X[k+18]=C,X[k+19]=I,X[k+20]=o.r,X[k+21]=o.g,X[k+22]=o.b,X[k+23]=o.a,X[k+24]=T,X[k+25]=M,X[k+26]=h.r,X[k+27]=h.g,X[k+28]=h.b,X[k+29]=h.a,X[k+30]=Y,X[k+31]=F,X[k+32]=o.r,X[k+33]=o.g,X[k+34]=o.b,X[k+35]=o.a):(X[k+6]=x,X[k+7]=y,X[k+8]=v,X[k+9]=A,X[k+10]=h.r,X[k+11]=h.g,X[k+12]=h.b,X[k+13]=h.a,X[k+14]=C,X[k+15]=I,X[k+16]=T,X[k+17]=M,X[k+18]=h.r,X[k+19]=h.g,X[k+20]=h.b,X[k+21]=h.a,X[k+22]=Y,X[k+23]=F),k=c.length;let V=P.setArraySize(c,k+3);V[k]=u,V[k+1]=u+1,V[k+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,r,i){let h=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,l=this.clippingPolygons,c=l.length,f=0;o.length=0,n.length=0,a.length=0;for(let d=0;d<r;d+=3){let m=s[d]<<1,u=t[m],w=t[m+1],p=i[m],b=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],C=t[m+1],I=i[m],T=i[m+1];for(let M=0;M<c;M++){let Y=o.length;if(this.clip(u,w,g,x,A,C,l[M],h)){let F=h.length;if(F==0)continue;let R=x-C,k=A-g,X=u-A,V=C-w,O=1/(R*X+k*(w-C)),L=F>>1,N=this.clipOutput,H=P.setArraySize(o,Y+L*2),_=P.setArraySize(n,Y+L*2);for(let B=0;B<F;B+=2,Y+=2){let U=N[B],G=N[B+1];H[Y]=U,H[Y+1]=G;let ee=U-A,J=G-C,Q=(R*ee+k*J)*O,Z=(V*ee+X*J)*O,ne=1-Q-Z;_[Y]=p*Q+y*Z+I*ne,_[Y+1]=b*Q+v*Z+T*ne}Y=a.length;let j=P.setArraySize(a,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]=C;let R=P.setArraySize(n,Y+3*2);R[Y]=p,R[Y+1]=b,R[Y+2]=y,R[Y+3]=v,R[Y+4]=I,R[Y+5]=T,Y=a.length;let k=P.setArraySize(a,Y+3);k[Y]=f,k[Y+1]=f+1,k[Y+2]=f+2,f+=3;break}}}}clip(t,s,r,i,h,o,n,a){let l=a,c=!1,f;n.length%4>=2?(f=a,a=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(o),f.push(t),f.push(s),a.length=0;let d=n.length-4,m=n;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=a.length,y=f;for(let A=0,C=f.length-2;A<C;){let I=y[A],T=y[A+1];A+=2;let M=y[A],Y=y[A+1],F=g*(w-M)>b*(p-Y),R=g*(w-I)-b*(p-T);if(R>0){if(F){a.push(M),a.push(Y);continue}let k=M-I,X=Y-T,V=R/(k*g-X*b);if(V>=0&&V<=1)a.push(I+k*V),a.push(T+X*V);else{a.push(M),a.push(Y);continue}}else if(F){let k=M-I,X=Y-T,V=R/(k*g-X*b);if(V>=0&&V<=1)a.push(I+k*V),a.push(T+X*V),a.push(M),a.push(Y);else{a.push(M),a.push(Y);continue}}c=!0}if(x==a.length)return l.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==d)break;let v=a;a=f,a.length=0,f=v}if(l!=a){l.length=0;for(let u=0,w=a.length-2;u<w;u++)l[u]=a[u]}else l.length=l.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,o=0,n=0,a=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],n=s[l+2],a=s[l+3],i+=h*a-n*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}}},_t=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=S(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 o=r.bones[h],n=null,a=S(o,"parent",null);a&&(n=s.findBone(a));let l=new Xt(s.bones.length,o.name,n);l.length=S(o,"length",0)*t,l.x=S(o,"x",0)*t,l.y=S(o,"y",0)*t,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(Ve,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],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let l=new qt(s.slots.length,n,a),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(Ut,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],n=new Pt(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=S(o,"mix",1),n.softness=S(o,"softness",0)*t,n.bendDirection=S(o,"bendPositive",!0)?1:-1,n.compress=S(o,"compress",!1),n.stretch=S(o,"stretch",!1),n.uniform=S(o,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],n=new Wt(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,l=s.findBone(a);if(!l)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=l,n.local=S(o,"local",!1),n.relative=S(o,"relative",!1),n.offsetRotation=S(o,"rotation",0),n.offsetX=S(o,"x",0)*t,n.offsetY=S(o,"y",0)*t,n.offsetScaleX=S(o,"scaleX",0),n.offsetScaleY=S(o,"scaleY",0),n.offsetShearY=S(o,"shearY",0),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),n.mixScaleX=S(o,"mixScaleX",1),n.mixScaleY=S(o,"mixScaleY",n.mixScaleX),n.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],n=new Bt(o.name);n.order=S(o,"order",0),n.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}.`);n.bones.push(d)}let a=o.target,l=s.findSlot(a);if(!l)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=l,n.positionMode=P.enumValue(Vt,S(o,"positionMode","Percent")),n.spacingMode=P.enumValue(Lt,S(o,"spacingMode","Length")),n.rotateMode=P.enumValue(Dt,S(o,"rotateMode","Tangent")),n.offsetRotation=S(o,"rotation",0),n.position=S(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=S(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],n=new Is(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);const a=o.bone,l=s.findBone(a);if(l==null)throw new Error("Physics bone not found: "+a);n.bone=l,n.x=S(o,"x",0),n.y=S(o,"y",0),n.rotate=S(o,"rotate",0),n.scaleX=S(o,"scaleX",0),n.shearX=S(o,"shearX",0),n.limit=S(o,"limit",5e3)*t,n.step=1/S(o,"fps",60),n.inertia=S(o,"inertia",1),n.strength=S(o,"strength",100),n.damping=S(o,"damping",1),n.massInverse=1/S(o,"mass",1),n.wind=S(o,"wind",0),n.gravity=S(o,"gravity",0),n.mix=S(o,"mix",1),n.inertiaGlobal=S(o,"inertiaGlobal",!1),n.strengthGlobal=S(o,"strengthGlobal",!1),n.dampingGlobal=S(o,"dampingGlobal",!1),n.massGlobal=S(o,"massGlobal",!1),n.windGlobal=S(o,"windGlobal",!1),n.gravityGlobal=S(o,"gravityGlobal",!1),n.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],n=new De(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let l=o.bones[a],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let l=o.ik[a],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let l=o.transform[a],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let l=o.path[a],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let l=o.physics[a],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let l=s.findSlot(a);if(!l)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let f in c){let d=this.readAttachment(c[f],n,l.index,f,s);d&&n.setAttachment(l.index,f,d)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let l=a.getAttachment(n.slotIndex,n.parent);if(!l)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?l:n.mesh,n.mesh.setParentMesh(l),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],n=new Rt(h);n.intValue=S(o,"int",0),n.floatValue=S(o,"float",0),n.stringValue=S(o,"string",""),n.audioPath=S(o,"audio",null),n.audioPath&&(n.volume=S(o,"volume",1),n.balance=S(o,"balance",0)),s.events.push(n)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,r,i){let h=this.scale;switch(r=S(e,"name",r),S(e,"type","region")){case"region":{let o=S(e,"path",r),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,r,o,n);if(!a)return null;a.path=o,a.x=S(e,"x",0)*h,a.y=S(e,"y",0)*h,a.scaleX=S(e,"scaleX",1),a.scaleY=S(e,"scaleY",1),a.rotation=S(e,"rotation",0),a.width=e.width*h,a.height=e.height*h,a.sequence=n;let l=S(e,"color",null);return l&&a.color.setFromString(l),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=S(e,"path",r),n=this.readSequence(S(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,r,o,n);if(!a)return null;a.path=o;let l=S(e,"color",null);l&&a.color.setFromString(l),a.width=S(e,"width",0)*h,a.height=S(e,"height",0)*h,a.sequence=n;let c=S(e,"parent",null);if(c)return this.linkedMeshes.push(new Ui(a,S(e,"skin",null),s,c,S(e,"timelines",!0))),a;let f=e.uvs;return this.readVertices(e,a,f.length),a.triangles=e.triangles,a.regionUVs=f,a.region!=null&&a.updateRegion(),a.edges=S(e,"edges",null),a.hullLength=S(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=S(e,"closed",!1),o.constantSpeed=S(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=P.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*h;o.lengths=a;let l=S(e,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=S(e,"x",0)*h,o.y=S(e,"y",0)*h,o.rotation=S(e,"rotation",0);let n=S(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let n=S(e,"end",null);n&&(o.endSlot=i.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<1);let l=S(e,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(e){if(e==null)return null;let t=new ts(S(e,"count",0));return t.start=S(e,"start",1),t.digits=S(e,"digits",0),t.setupIndex=S(e,"setup",0),t}readVertices(e,t,s){let r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let n=P.toFloatArray(i);if(r!=1)for(let a=0,l=i.length;a<l;a++)n[a]*=r;t.vertices=n;return}let h=new Array,o=new Array;for(let n=0,a=i.length;n<a;){let l=i[n++];o.push(l);for(let c=n+l*4;n<c;n+=4)o.push(i[n]),h.push(i[n+1]*r),h.push(i[n+2]*r),h.push(i[n+3])}t.bones=o,t.vertices=P.toFloatArray(h)}readAnimation(e,t,s){let r=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let l=a.index;for(let c in n){let f=n[c];if(!f)continue;let d=f.length;if(c=="attachment"){let m=new ue(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 rt(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=z(A,m,g,b,0,w,y,p.r,v.r,1),g=z(A,m,g,b,1,w,y,p.g,v.g,1),g=z(A,m,g,b,2,w,y,p.b,v.b,1),g=z(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 nt(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=z(A,m,g,b,0,w,y,p.r,v.r,1),g=z(A,m,g,b,1,w,y,p.g,v.g,1),g=z(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(re(f,new at(d,d,l),0,1));else if(c=="rgba2"){let m=new lt(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),C=q.fromString(y.dark),I=u.curve;I&&(x=z(I,m,x,g,0,w,v,p.r,A.r,1),x=z(I,m,x,g,1,w,v,p.g,A.g,1),x=z(I,m,x,g,2,w,v,p.b,A.b,1),x=z(I,m,x,g,3,w,v,p.a,A.a,1),x=z(I,m,x,g,4,w,v,b.r,C.r,1),x=z(I,m,x,g,5,w,v,b.g,C.g,1),x=z(I,m,x,g,6,w,v,b.b,C.b,1)),w=v,p=A,b=C,u=y}i.push(m)}else if(c=="rgb2"){let m=new ot(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),C=q.fromString(y.dark),I=u.curve;I&&(x=z(I,m,x,g,0,w,v,p.r,A.r,1),x=z(I,m,x,g,1,w,v,p.g,A.g,1),x=z(I,m,x,g,2,w,v,p.b,A.b,1),x=z(I,m,x,g,3,w,v,b.r,C.r,1),x=z(I,m,x,g,4,w,v,b.g,C.g,1),x=z(I,m,x,g,5,w,v,b.b,C.b,1)),w=v,p=A,b=C,u=y}i.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let l=a.index;for(let c in n){let f=n[c],d=f.length;if(d!=0){if(c==="rotate")i.push(re(f,new ye(d,d,l),0,1));else if(c==="translate"){let m=new $e(d,d<<1,l);i.push(Gt(f,m,"x","y",0,r))}else if(c==="translatex"){let m=new je(d,d,l);i.push(re(f,m,0,r))}else if(c==="translatey"){let m=new Je(d,d,l);i.push(re(f,m,0,r))}else if(c==="scale"){let m=new Ke(d,d<<1,l);i.push(Gt(f,m,"x","y",1,1))}else if(c==="scalex"){let m=new Qe(d,d,l);i.push(re(f,m,1,1))}else if(c==="scaley"){let m=new Ze(d,d,l);i.push(re(f,m,1,1))}else if(c==="shear"){let m=new et(d,d<<1,l);i.push(Gt(f,m,"x","y",0,1))}else if(c==="shearx"){let m=new tt(d,d,l);i.push(re(f,m,0,1))}else if(c==="sheary"){let m=new st(d,d,l);i.push(re(f,m,0,1))}else if(c==="inherit"){let m=new it(d,a.index);for(let u=0;u<f.length;u++){let w=f[u];m.setFrame(u,S(w,"time",0),P.enumValue(Ve,S(w,"inherit","Normal")))}i.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),f=new ct(n.length,n.length<<1,c),d=S(a,"time",0),m=S(a,"mix",1),u=S(a,"softness",0)*r;for(let w=0,p=0;;w++){f.setFrame(w,d,m,u,S(a,"bendPositive",!0)?1:-1,S(a,"compress",!1),S(a,"stretch",!1));let b=n[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=a.curve;v&&(p=z(v,f,p,w,0,d,g,m,x,1),p=z(v,f,p,w,1,d,g,u,y,r)),d=g,m=x,u=y,a=b}i.push(f)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),f=new dt(n.length,n.length*6,c),d=S(a,"time",0),m=S(a,"mixRotate",1),u=S(a,"mixX",1),w=S(a,"mixY",u),p=S(a,"mixScaleX",1),b=S(a,"mixScaleY",p),g=S(a,"mixShearY",1);for(let x=0,y=0;;x++){f.setFrame(x,d,m,u,w,p,b,g);let v=n[x+1];if(!v){f.shrink(y);break}let A=S(v,"time",0),C=S(v,"mixRotate",1),I=S(v,"mixX",1),T=S(v,"mixY",I),M=S(v,"mixScaleX",1),Y=S(v,"mixScaleY",M),F=S(v,"mixShearY",1),R=a.curve;R&&(y=z(R,f,y,x,0,d,A,m,C,1),y=z(R,f,y,x,1,d,A,u,I,1),y=z(R,f,y,x,2,d,A,w,T,1),y=z(R,f,y,x,3,d,A,p,M,1),y=z(R,f,y,x,4,d,A,b,Y,1),y=z(R,f,y,x,5,d,A,g,F,1)),d=A,m=C,u=I,w=T,p=M,b=Y,p=M,a=v}i.push(f)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(a);for(let c in n){let f=n[c],d=f[0];if(!d)continue;let m=f.length;if(c==="position"){let u=new ft(m,m,l);i.push(re(f,u,0,a.positionMode==0?r:1))}else if(c==="spacing"){let u=new ut(m,m,l);i.push(re(f,u,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(c==="mix"){let u=new mt(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),C=S(v,"mixRotate",1),I=S(v,"mixX",1),T=S(v,"mixY",I),M=d.curve;M&&(y=z(M,u,y,x,0,w,A,p,C,1),y=z(M,u,y,x,1,w,A,b,I,1),y=z(M,u,y,x,2,w,A,g,T,1)),w=A,p=C,b=I,g=T,d=v}i.push(u)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(l)}for(let l in n){let c=n[l],f=c[0];if(!f)continue;let d=c.length;if(l=="reset"){const u=new At(d,a);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 gt(d,d,a);else if(l=="strength")m=new xt(d,d,a);else if(l=="damping")m=new wt(d,d,a);else if(l=="mass")m=new pt(d,d,a);else if(l=="wind")m=new bt(d,d,a);else if(l=="gravity")m=new yt(d,d,a);else if(l=="mix")m=new vt(d,d,a);else continue;i.push(re(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let l in n){let c=n[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=a.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 ht(b.length,b.length,d,w),C=S(g,"time",0);for(let I=0,T=0;;I++){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,O=V+Y.length;V<O;V++)M[V]*=r;if(!x)for(let V=0;V<v;V++)M[V]+=y[V]}A.setFrame(I,C,M);let F=b[I+1];if(!F){A.shrink(T);break}let R=S(F,"time",0),k=g.curve;k&&(T=z(k,A,T,I,0,C,R,0,1,1)),C=R,g=F}i.push(A)}else if(p=="sequence"){let x=new St(b.length,d,w),y=0;for(let v=0;v<b.length;v++){let A=S(g,"delay",y),C=S(g,"time",0),I=ss[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,C,I,T,A),y=A,g=b[v+1]}i.push(x)}}}}}}if(e.drawOrder){let o=new ge(e.drawOrder.length),n=s.slots.length,a=0;for(let l=0;l<e.drawOrder.length;l++,a++){let c=e.drawOrder[l],f=null,d=S(c,"offsets",null);if(d){f=P.newArray(n,-1);let m=P.newArray(n-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<n;)m[w++]=u++;for(let p=n-1;p>=0;p--)f[p]==-1&&(f[p]=m[--w])}o.setFrame(a,S(c,"time",0),f)}i.push(o)}if(e.events){let o=new Ye(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let l=e.events[a],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let f=new Et(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(n,f)}i.push(o)}let h=0;for(let o=0,n=i.length;o<n;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new ke(t,i,h))}},Ui=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 re(e,t,s,r){let i=e[0],h=S(i,"time",0),o=S(i,"value",s)*r,n=0;for(let a=0;;a++){t.setFrame(a,h,o);let l=e[a+1];if(!l)return t.shrink(n),t;let c=S(l,"time",0),f=S(l,"value",s)*r;i.curve&&(n=z(i.curve,t,n,a,0,h,c,o,f,r)),h=c,o=f,i=l}}function Gt(e,t,s,r,i,h){let o=e[0],n=S(o,"time",0),a=S(o,s,i)*h,l=S(o,r,i)*h,c=0;for(let f=0;;f++){t.setFrame(f,n,a,l);let d=e[f+1];if(!d)return t.shrink(c),t;let m=S(d,"time",0),u=S(d,s,i)*h,w=S(d,r,i)*h,p=o.curve;p&&(c=z(p,t,c,f,0,n,m,a,u,h),c=z(p,t,c,f,1,n,m,l,w,h)),n=m,a=u,l=w,o=d}}function z(e,t,s,r,i,h,o,n,a,l){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,f=e[c],d=e[c+1]*l,m=e[c+2],u=e[c+3]*l;return t.setBezier(s,r,i,h,n,f,d,m,u,o,a),s+1}function S(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))),Le.yDown=!0;function Wi(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 Xs(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 zi=class _s extends Mt{getImage(){return this._image}setFilters(){}setWraps(){}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 o=new Map,n=[];for(const a of[0,1,2,3]){const l=new t.Paint,c=h.makeShaderOptions(t.TileMode.Clamp,t.TileMode.Clamp,t.FilterMode.Linear,t.MipmapMode.Linear);l.setShader(c),l.setBlendMode(Wi(t,a)),o.set(a,l),n.push(c)}return new _s({shaders:n,paintPerBlendMode:o,image:h})}};async function _i(e,t,s){const r=new Pe(Xs(await s(t))),i=t.lastIndexOf("/"),h=i>=0?t.substring(0,i+1):"";for(const o of r.pages){const n=await zi.fromFile(e,h+o.name,s);o.setTexture(n)}return r}async function Gi(e,t,s,r=1){const i=new ws(t),h=e.endsWith(".json")?new _t(i):new Ts(i);h.scale=r;const o=await s(e);return h instanceof _t?h.readSkeletonData(Xs(o)):h.readSkeletonData(o)}var Fs=class{skeleton;animationState;constructor(e){this.skeleton=new Le(e),this.animationState=new as(new fs(e))}update(e,t=2){this.animationState.update(e),this.skeleton.update(e),this.animationState.apply(this.skeleton),this.skeleton.updateWorldTransform(t)}},Hi=class Gs{constructor(t){this.ck=t}clipper=new Ys;static QUAD_TRIANGLES=[0,1,2,2,3,0];scratchPositions=P.newFloatArray(100);scratchUVs=P.newFloatArray(100);scratchColors=new Uint32Array(100/4);render(t,s){s instanceof Fs&&(s=s.skeleton);const r=this.clipper,i=s.drawOrder,h=s.color;for(let o=0,n=i.length;o<n;o++){const a=i[o];if(!a.bone.active){r.clipEndWithSlot(a);continue}const l=a.getAttachment();let c=this.scratchPositions,f,d=4;if(l instanceof Be)l.computeWorldVertices(a,c,0,2),f=Gs.QUAD_TRIANGLES;else if(l instanceof ve)c.length<l.worldVerticesLength&&(this.scratchPositions=P.newFloatArray(l.worldVerticesLength),c=this.scratchPositions),d=l.worldVerticesLength>>1,l.computeWorldVertices(a,0,l.worldVerticesLength,c,0,2),f=l.triangles;else if(l instanceof Ee){r.clipStart(a,l);continue}else{r.clipEndWithSlot(a);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(a);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=a.color,C=(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]=C;const I=this.ck.MakeVertices(this.ck.VertexMode.Triangles,c,w,p,f,!1),T=b.paintPerBlendMode.get(a.data.blendMode);T&&t.drawVertices(I,this.ck.BlendMode.Modulate,T),I.delete()}r.clipEndWithSlot(a)}r.clipEnd()}};return Qs(Qt)})();