@esotericsoftware/spine-canvas 4.2.115 → 4.3.0

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 We=Object.defineProperty,Os=Object.getOwnPropertyDescriptor,qs=Object.getOwnPropertyNames,Us=Object.prototype.hasOwnProperty,Ws=(e,t)=>{for(var s in t)We(e,s,{get:t[s],enumerable:!0})},zs=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qs(t))!Us.call(e,r)&&r!==s&&We(e,r,{get:()=>t[r],enumerable:!(i=Os(t,r))||i.enumerable});return e},_s=e=>zs(We({},"__esModule",{value:!0}),e),Qt={};Ws(Qt,{AlphaTimeline:()=>rt,Animation:()=>Me,AnimationState:()=>Ks,AnimationStateAdapter:()=>Qs,AnimationStateData:()=>Zs,AssetCache:()=>xs,AssetManager:()=>qi,AssetManagerBase:()=>gs,AtlasAttachmentLoader:()=>si,Attachment:()=>_e,AttachmentTimeline:()=>me,BinaryInput:()=>Cs,BlendMode:()=>Wt,Bone:()=>Ft,BoneData:()=>Xt,BoundingBoxAttachment:()=>It,CURRENT:()=>cs,CanvasTexture:()=>Ts,ClippingAttachment:()=>Tt,Color:()=>D,ConstraintData:()=>Ce,CurveTimeline:()=>re,CurveTimeline1:()=>ie,CurveTimeline2:()=>Ye,DebugUtils:()=>$s,DeformTimeline:()=>lt,Downloader:()=>Et,DrawOrderTimeline:()=>xe,Event:()=>Rt,EventData:()=>Pt,EventQueue:()=>ls,EventTimeline:()=>Xe,EventType:()=>os,FIRST:()=>At,FakeTexture:()=>ei,HOLD_FIRST:()=>Ee,HOLD_MIX:()=>hs,HOLD_SUBSEQUENT:()=>St,IkConstraint:()=>ws,IkConstraintData:()=>Bt,IkConstraintTimeline:()=>ot,Inherit:()=>Pe,InheritTimeline:()=>tt,IntSet:()=>Gs,Interpolation:()=>Zt,MathUtils:()=>R,MeshAttachment:()=>Ae,MixBlend:()=>rs,MixDirection:()=>as,PathAttachment:()=>Se,PathConstraint:()=>bs,PathConstraintData:()=>Vt,PathConstraintMixTimeline:()=>ft,PathConstraintPositionTimeline:()=>ct,PathConstraintSpacingTimeline:()=>dt,Physics:()=>As,PhysicsConstraintDampingTimeline:()=>gt,PhysicsConstraintGravityTimeline:()=>bt,PhysicsConstraintInertiaTimeline:()=>ut,PhysicsConstraintMassTimeline:()=>xt,PhysicsConstraintMixTimeline:()=>pt,PhysicsConstraintResetTimeline:()=>yt,PhysicsConstraintStrengthTimeline:()=>mt,PhysicsConstraintTimeline:()=>de,PhysicsConstraintWindTimeline:()=>wt,PointAttachment:()=>ms,Pool:()=>ye,PositionMode:()=>Lt,Pow:()=>es,PowOut:()=>Hs,RGB2Timeline:()=>nt,RGBA2Timeline:()=>at,RGBATimeline:()=>st,RGBTimeline:()=>it,RegionAttachment:()=>$,RotateMode:()=>Nt,RotateTimeline:()=>ve,SETUP:()=>Ct,SUBSEQUENT:()=>Fe,ScaleTimeline:()=>je,ScaleXTimeline:()=>Je,ScaleYTimeline:()=>Ke,SequenceTimeline:()=>vt,ShearTimeline:()=>Qe,ShearXTimeline:()=>Ze,ShearYTimeline:()=>et,Skeleton:()=>vs,SkeletonBinary:()=>ri,SkeletonBounds:()=>Li,SkeletonClipping:()=>Di,SkeletonData:()=>Ot,SkeletonJson:()=>Ni,SkeletonRenderer:()=>Wi,Skin:()=>Be,SkinEntry:()=>qt,Slot:()=>ps,SlotData:()=>Ut,SpacingMode:()=>Dt,StringSet:()=>ze,Texture:()=>kt,TextureAtlas:()=>Mt,TextureAtlasPage:()=>us,TextureAtlasRegion:()=>Yt,TextureFilter:()=>Re,TextureRegion:()=>fs,TextureWrap:()=>ds,TimeKeeper:()=>js,Timeline:()=>j,TrackEntry:()=>ns,TransformConstraint:()=>ys,TransformConstraintData:()=>zt,TransformConstraintTimeline:()=>ht,TranslateTimeline:()=>Ge,TranslateXTimeline:()=>He,TranslateYTimeline:()=>$e,Triangulator:()=>Is,Utils:()=>P,Vector2:()=>ke,VertexAttachment:()=>oe,WindowedMean:()=>Js});var Gs=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}},ze=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},D=class ge{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new ge(1,1,1,1);static RED=new ge(1,0,0,1);static GREEN=new ge(0,1,0,1);static BLUE=new ge(0,0,1,1);static MAGENTA=new ge(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,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,i,r){return this.r+=t,this.g+=s,this.b+=i,this.a+=r,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 ge){return s.setFromString(t)}},R=class le{static PI=3.1415927;static PI2=le.PI*2;static invPI2=1/le.PI2;static radiansToDegrees=180/le.PI;static radDeg=le.radiansToDegrees;static degreesToRadians=le.PI/180;static degRad=le.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*le.degRad)}static sinDeg(t){return Math.sin(t*le.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*le.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 le.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),h=s-t;return r<=(i-t)/h?t+Math.sqrt(r*h*(i-t)):s-Math.sqrt((1-r)*h*(s-i))}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}},Hs=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,i,r,h){for(let o=s,a=r;o<s+h;o++,a++)i[a]=t[o]}static arrayFill(t,s,i,r){for(let h=s;h<i;h++)t[h]=r}static setArraySize(t,s,i=0){let r=t.length;if(r==s)return t;if(t.length=s,r<s)for(let h=r;h<s;h++)t[h]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:pe.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r<t;r++)i[r]=s;return i}static newFloatArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=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,i=!0){for(var r=0;r<t.length;r++)if(t[r]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},$s=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},ye=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}},ke=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}},js=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Js=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},_e=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},oe=class Fs extends _e{static nextID=0;id=Fs.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,i,r,h,o){i=h+(i>>1)*o;let a=t.bone.skeleton,n=t.deform,l=this.vertices,c=this.bones;if(!c){n.length>0&&(l=n);let u=t.bone,x=u.worldX,b=u.worldY,p=u.a,g=u.b,w=u.c,y=u.d;for(let v=s,A=h;A<i;v+=2,A+=o){let S=l[v],I=l[v+1];r[A]=S*p+I*g+x,r[A+1]=S*w+I*y+b}return}let d=0,f=0;for(let u=0;u<s;u+=2){let x=c[d];d+=x+1,f+=x}let m=a.bones;if(n.length==0)for(let u=h,x=f*3;u<i;u+=o){let b=0,p=0,g=c[d++];for(g+=d;d<g;d++,x+=3){let w=m[c[d]],y=l[x],v=l[x+1],A=l[x+2];b+=(y*w.a+v*w.b+w.worldX)*A,p+=(y*w.c+v*w.d+w.worldY)*A}r[u]=b,r[u+1]=p}else{let u=n;for(let x=h,b=f*3,p=f<<1;x<i;x+=o){let g=0,w=0,y=c[d++];for(y+=d;d<y;d++,b+=3,p+=2){let v=m[c[d]],A=l[b]+u[p],S=l[b+1]+u[p+1],I=l[b+2];g+=(A*v.a+S*v.b+v.worldX)*I,w+=(A*v.c+S*v.d+v.worldY)*I}r[x]=g,r[x+1]=w}}}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 Ne{static _nextID=0;id=Ne.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Ne(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 i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(t,s){let i=t,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return Ne._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],Me=class{name;timelines=[];timelineIds=new ze;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,r,h,o,a){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let n=this.timelines;for(let l=0,c=n.length;l<c;l++)n[l].apply(e,t,s,r,h,o,a)}},rs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(rs||{}),as=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(as||{}),N={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},j=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=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 i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}},re=class extends j{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,i,r,h,o,a,n,l,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+a)*.03,u=(r-o*2+n)*.03,x=((h-a)*3-i+l)*.006,b=((o-n)*3-r+c)*.006,p=m*2+x,g=u*2+b,w=(h-i)*.3+m+x*.16666667,y=(o-r)*.3+u+b*.16666667,v=i+w,A=r+y;for(let S=f+18;f<S;f+=2)d[f]=v,d[f+1]=A,w+=p,y+=g,p+=x,g+=b,v+=w,A+=y}getBezierValue(e,t,s,i){let r=this.curves;if(r[i]>e){let n=this.frames[t],l=this.frames[t+s];return l+(e-n)/(r[i]-n)*(r[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=e){let n=r[i-2],l=r[i-1];return l+(e-n)/(r[i]-n)*(r[i+1]-l)}t+=this.getFrameEntries();let o=r[h-2],a=r[h-1];return a+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-a)}},ie=class extends re{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],h=t[s+1];return h+(e-r)/(t[s+2]-r)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return r+h*t;case 1:case 2:h+=r-i}return i+h*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);return s==0?r+(h-r)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,r,h){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}return s==0?r+(h-r)*t:i+(h-i)*t}getScaleValue(e,t,s,i,r,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return r+(h-r)*t}return r}let a=this.getCurveValue(e)*h;if(t==1)return s==3?r+a-h:a;if(i==1)switch(s){case 0:return h+(Math.abs(a)*R.signum(h)-h)*t;case 1:case 2:return r+(Math.abs(a)*R.signum(r)-r)*t}else{let n=0;switch(s){case 0:return n=Math.abs(h)*R.signum(a),n+(a-n)*t;case 1:case 2:return n=Math.abs(r)*R.signum(a),n+(a-n)*t}}return r+(a-h)*t}},Ye=class extends re{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},ve=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.rotation=this.getRelativeValue(s,r,h,a.rotation,a.data.rotation))}},Ge=class extends Ye{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.x=a.data.x,a.y=a.data.y;return;case 1:a.x+=(a.data.x-a.x)*r,a.y+=(a.data.y-a.y)*r}return}let l=0,c=0,d=j.search(n,s,3),f=this.curves[d/3];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+3]-m);l+=(n[d+3+1]-l)*u,c+=(n[d+3+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(h){case 0:a.x=a.data.x+l*r,a.y=a.data.y+c*r;break;case 1:case 2:a.x+=(a.data.x+l-a.x)*r,a.y+=(a.data.y+c-a.y)*r;break;case 3:a.x+=l*r,a.y+=c*r}}},He=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.x=this.getRelativeValue(s,r,h,a.x,a.data.x))}},$e=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.y=this.getRelativeValue(s,r,h,a.y,a.data.y))}},je=class extends Ye{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case 1:a.scaleX+=(a.data.scaleX-a.scaleX)*r,a.scaleY+=(a.data.scaleY-a.scaleY)*r}return}let l,c,d=j.search(n,s,3),f=this.curves[d/3];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+3]-m);l+=(n[d+3+1]-l)*u,c+=(n[d+3+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(l*=a.data.scaleX,c*=a.data.scaleY,r==1)h==3?(a.scaleX+=l-a.data.scaleX,a.scaleY+=c-a.data.scaleY):(a.scaleX=l,a.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=a.data.scaleX,u=a.data.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*r,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*r;break;case 1:case 2:m=a.scaleX,u=a.scaleY,a.scaleX=m+(Math.abs(l)*R.signum(m)-m)*r,a.scaleY=u+(Math.abs(c)*R.signum(u)-u)*r;break;case 3:a.scaleX+=(l-a.data.scaleX)*r,a.scaleY+=(c-a.data.scaleY)*r}else switch(h){case 0:m=Math.abs(a.data.scaleX)*R.signum(l),u=Math.abs(a.data.scaleY)*R.signum(c),a.scaleX=m+(l-m)*r,a.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(a.scaleX)*R.signum(l),u=Math.abs(a.scaleY)*R.signum(c),a.scaleX=m+(l-m)*r,a.scaleY=u+(c-u)*r;break;case 3:a.scaleX+=(l-a.data.scaleX)*r,a.scaleY+=(c-a.data.scaleY)*r}}}},Je=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.scaleX=this.getScaleValue(s,r,h,o,a.scaleX,a.data.scaleX))}},Ke=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.scaleY=this.getScaleValue(s,r,h,o,a.scaleY,a.data.scaleY))}},Qe=class extends Ye{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case 1:a.shearX+=(a.data.shearX-a.shearX)*r,a.shearY+=(a.data.shearY-a.shearY)*r}return}let l=0,c=0,d=j.search(n,s,3),f=this.curves[d/3];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+3]-m);l+=(n[d+3+1]-l)*u,c+=(n[d+3+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(h){case 0:a.shearX=a.data.shearX+l*r,a.shearY=a.data.shearY+c*r;break;case 1:case 2:a.shearX+=(a.data.shearX+l-a.shearX)*r,a.shearY+=(a.data.shearY+c-a.shearY)*r;break;case 3:a.shearX+=l*r,a.shearY+=c*r}}},Ze=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.shearX=this.getRelativeValue(s,r,h,a.shearX,a.data.shearX))}},et=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];a.active&&(a.shearY=this.getRelativeValue(s,r,h,a.shearY,a.data.shearY))}},tt=class extends j{boneIndex=0;constructor(e,t){super(e,[N.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,r,h,o){let a=e.bones[this.boneIndex];if(!a.active)return;if(o==1){h==0&&(a.inherit=a.data.inherit);return}let n=this.frames;if(s<n[0]){(h==0||h==1)&&(a.inherit=a.data.inherit);return}a.inherit=this.frames[j.search(n,s,2)+1]}},st=class extends re{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,r,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let b=a.data.color;switch(h){case 0:l.setFromColor(b);return;case 1:l.add((b.r-l.r)*r,(b.g-l.g)*r,(b.b-l.b)*r,(b.a-l.a)*r)}return}let c=0,d=0,f=0,m=0,u=j.search(n,s,5),x=this.curves[u/5];switch(x){case 0:let b=n[u];c=n[u+1],d=n[u+2],f=n[u+3],m=n[u+4];let p=(s-b)/(n[u+5]-b);c+=(n[u+5+1]-c)*p,d+=(n[u+5+2]-d)*p,f+=(n[u+5+3]-f)*p,m+=(n[u+5+4]-m)*p;break;case 1:c=n[u+1],d=n[u+2],f=n[u+3],m=n[u+4];break;default:c=this.getBezierValue(s,u,1,x-2),d=this.getBezierValue(s,u,2,x+18-2),f=this.getBezierValue(s,u,3,x+18*2-2),m=this.getBezierValue(s,u,4,x+18*3-2)}r==1?l.set(c,d,f,m):(h==0&&l.setFromColor(a.data.color),l.add((c-l.r)*r,(d-l.g)*r,(f-l.b)*r,(m-l.a)*r))}},it=class extends re{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color;if(s<n[0]){let x=a.data.color;switch(h){case 0:l.r=x.r,l.g=x.g,l.b=x.b;return;case 1:l.r+=(x.r-l.r)*r,l.g+=(x.g-l.g)*r,l.b+=(x.b-l.b)*r}return}let c=0,d=0,f=0,m=j.search(n,s,4),u=this.curves[m>>2];switch(u){case 0:let x=n[m];c=n[m+1],d=n[m+2],f=n[m+3];let b=(s-x)/(n[m+4]-x);c+=(n[m+4+1]-c)*b,d+=(n[m+4+2]-d)*b,f+=(n[m+4+3]-f)*b;break;case 1:c=n[m+1],d=n[m+2],f=n[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)l.r=c,l.g=d,l.b=f;else{if(h==0){let x=a.data.color;l.r=x.r,l.g=x.g,l.b=x.b}l.r+=(c-l.r)*r,l.g+=(d-l.g)*r,l.b+=(f-l.b)*r}}},rt=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,N.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=a.color;if(s<this.frames[0]){let c=a.data.color;switch(h){case 0:n.a=c.a;return;case 1:n.a+=(c.a-n.a)*r}return}let l=this.getCurveValue(s);r==1?n.a=l:(h==0&&(n.a=a.data.color.a),n.a+=(l-n.a)*r)}},at=class extends re{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.alpha+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,r,h,o,a,n){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=a,this.frames[e+7]=n}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*r,(y.g-l.g)*r,(y.b-l.b)*r,(y.a-l.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,f=0,m=0,u=0,x=0,b=0,p=0,g=j.search(n,s,8),w=this.curves[g>>3];switch(w){case 0:let y=n[g];d=n[g+1],f=n[g+2],m=n[g+3],u=n[g+4],x=n[g+5],b=n[g+6],p=n[g+7];let v=(s-y)/(n[g+8]-y);d+=(n[g+8+1]-d)*v,f+=(n[g+8+2]-f)*v,m+=(n[g+8+3]-m)*v,u+=(n[g+8+4]-u)*v,x+=(n[g+8+5]-x)*v,b+=(n[g+8+6]-b)*v,p+=(n[g+8+7]-p)*v;break;case 1:d=n[g+1],f=n[g+2],m=n[g+3],u=n[g+4],x=n[g+5],b=n[g+6],p=n[g+7];break;default:d=this.getBezierValue(s,g,1,w-2),f=this.getBezierValue(s,g,2,w+18-2),m=this.getBezierValue(s,g,3,w+18*2-2),u=this.getBezierValue(s,g,4,w+18*3-2),x=this.getBezierValue(s,g,5,w+18*4-2),b=this.getBezierValue(s,g,6,w+18*5-2),p=this.getBezierValue(s,g,7,w+18*6-2)}if(r==1)l.set(d,f,m,u),c.r=x,c.g=b,c.b=p;else{if(h==0){l.setFromColor(a.data.color);let y=a.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*r,(f-l.g)*r,(m-l.b)*r,(u-l.a)*r),c.r+=(x-c.r)*r,c.g+=(b-c.g)*r,c.b+=(p-c.b)*r}}},nt=class extends re{slotIndex=0;constructor(e,t,s){super(e,t,[N.rgb+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,o,a){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=a}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=this.frames,l=a.color,c=a.darkColor;if(s<n[0]){let y=a.data.color,v=a.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*r,l.g+=(y.g-l.g)*r,l.b+=(y.b-l.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,f=0,m=0,u=0,x=0,b=0,p=0,g=j.search(n,s,7),w=this.curves[g/7];switch(w){case 0:let y=n[g];d=n[g+1],f=n[g+2],m=n[g+3],x=n[g+4],b=n[g+5],p=n[g+6];let v=(s-y)/(n[g+7]-y);d+=(n[g+7+1]-d)*v,f+=(n[g+7+2]-f)*v,m+=(n[g+7+3]-m)*v,x+=(n[g+7+4]-x)*v,b+=(n[g+7+5]-b)*v,p+=(n[g+7+6]-p)*v;break;case 1:d=n[g+1],f=n[g+2],m=n[g+3],x=n[g+4],b=n[g+5],p=n[g+6];break;default:d=this.getBezierValue(s,g,1,w-2),f=this.getBezierValue(s,g,2,w+18-2),m=this.getBezierValue(s,g,3,w+18*2-2),x=this.getBezierValue(s,g,4,w+18*3-2),b=this.getBezierValue(s,g,5,w+18*4-2),p=this.getBezierValue(s,g,6,w+18*5-2)}if(r==1)l.r=d,l.g=f,l.b=m,c.r=x,c.g=b,c.b=p;else{if(h==0){let y=a.data.color,v=a.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(d-l.r)*r,l.g+=(f-l.g)*r,l.b+=(m-l.b)*r,c.r+=(x-c.r)*r,c.g+=(b-c.g)*r,c.b+=(p-c.b)*r}}},me=class extends j{slotIndex=0;attachmentNames;constructor(e,t){super(e,[N.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(a.bone.active){if(o==1){h==0&&this.setAttachment(e,a,a.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,a,a.data.attachmentName);return}this.setAttachment(e,a,this.attachmentNames[j.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},lt=class extends re{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[N.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,r,h,o,a,n,l,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+a)*.03,u=n*.03-o*.06,x=((h-a)*3-i+l)*.006,b=(o-n+.33333333)*.018,p=m*2+x,g=u*2+b,w=(h-i)*.3+m+x*.16666667,y=o*.3+u+b*.16666667,v=i+w,A=y;for(let S=f+18;f<S;f+=2)d[f]=v,d[f+1]=A,w+=p,y+=g,p+=x,g+=b,v+=w,A+=y}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let a=this.frames[t];return(e-a)/(this.frames[t+this.getFrameEntries()]-a);case 1:return 0}if(i-=2,s[i]>e){let a=this.frames[t];return s[i+1]*(e-a)/(s[i]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=e){let a=s[i-2],n=s[i-1];return n+(e-a)/(s[i]-a)*(s[i+1]-n)}let h=s[r-2],o=s[r-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,r,h,o){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let n=a.getAttachment();if(!n||!(n instanceof oe)||n.timelineAttachment!=this.attachment)return;let l=a.deform;l.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(h){case 0:l.length=0;return;case 1:if(r==1){l.length=0;return}l.length=d;let g=n;if(g.bones){r=1-r;for(var m=0;m<d;m++)l[m]*=r}else{let w=g.vertices;for(var m=0;m<d;m++)l[m]+=(w[m]-l[m])*r}}return}if(l.length=d,s>=f[f.length-1]){let g=c[f.length-1];if(r==1)if(h==3){let w=n;if(w.bones)for(let y=0;y<d;y++)l[y]+=g[y];else{let y=w.vertices;for(let v=0;v<d;v++)l[v]+=g[v]-y[v]}}else P.arrayCopy(g,0,l,0,d);else switch(h){case 0:{let y=n;if(y.bones)for(let v=0;v<d;v++)l[v]=g[v]*r;else{let v=y.vertices;for(let A=0;A<d;A++){let S=v[A];l[A]=S+(g[A]-S)*r}}break}case 1:case 2:for(let y=0;y<d;y++)l[y]+=(g[y]-l[y])*r;break;case 3:let w=n;if(w.bones)for(let y=0;y<d;y++)l[y]+=g[y]*r;else{let y=w.vertices;for(let v=0;v<d;v++)l[v]+=(g[v]-y[v])*r}}return}let u=j.search1(f,s),x=this.getCurvePercent(s,u),b=c[u],p=c[u+1];if(r==1)if(h==3){let g=n;if(g.bones)for(let w=0;w<d;w++){let y=b[w];l[w]+=y+(p[w]-y)*x}else{let w=g.vertices;for(let y=0;y<d;y++){let v=b[y];l[y]+=v+(p[y]-v)*x-w[y]}}}else for(let g=0;g<d;g++){let w=b[g];l[g]=w+(p[g]-w)*x}else switch(h){case 0:{let w=n;if(w.bones)for(let y=0;y<d;y++){let v=b[y];l[y]=(v+(p[y]-v)*x)*r}else{let y=w.vertices;for(let v=0;v<d;v++){let A=b[v],S=y[v];l[v]=S+(A+(p[v]-A)*x-S)*r}}break}case 1:case 2:for(let w=0;w<d;w++){let y=b[w];l[w]+=(y+(p[w]-y)*x-l[w])*r}break;case 3:let g=n;if(g.bones)for(let w=0;w<d;w++){let y=b[w];l[w]+=(y+(p[w]-y)*x)*r}else{let w=g.vertices;for(let y=0;y<d;y++){let v=b[y];l[y]+=(v+(p[y]-v)*x-w[y])*r}}}}},Xe=class Es extends j{static propertyIds=[""+N.event];events;constructor(t){super(t,Es.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,i,r,h,o,a){if(!r)return;let n=this.frames,l=this.frames.length;if(s>i)this.apply(t,s,Number.MAX_VALUE,r,h,o,a),s=-1;else if(s>=n[l-1])return;if(i<n[0])return;let c=0;if(s<n[0])c=0;else{c=j.search1(n,s)+1;let d=n[c];for(;c>0&&n[c-1]==d;)c--}for(;c<l&&i>=n[c];c++)r.push(this.events[c])}},xe=class Rs extends j{static propertyIds=[""+N.drawOrder];drawOrders;constructor(t){super(t,Rs.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,h,o,a){if(a==1){o==0&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(o==0||o==1)&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let n=j.search1(this.frames,i),l=this.drawOrders[n];if(!l)P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,d=t.slots;for(let f=0,m=l.length;f<m;f++)c[f]=d[l[f]]}}},ot=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,[N.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,r,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,r,h,o){let a=e.ikConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case 1:a.mix+=(a.data.mix-a.mix)*r,a.softness+=(a.data.softness-a.softness)*r,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let l=0,c=0,d=j.search(n,s,6),f=this.curves[d/6];switch(f){case 0:let m=n[d];l=n[d+1],c=n[d+2];let u=(s-m)/(n[d+6]-m);l+=(n[d+6+1]-l)*u,c+=(n[d+6+2]-c)*u;break;case 1:l=n[d+1],c=n[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}h==0?(a.mix=a.data.mix+(l-a.data.mix)*r,a.softness=a.data.softness+(c-a.data.softness)*r,o==1?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=n[d+3],a.compress=n[d+4]!=0,a.stretch=n[d+5]!=0)):(a.mix+=(l-a.mix)*r,a.softness+=(c-a.softness)*r,o==0&&(a.bendDirection=n[d+3],a.compress=n[d+4]!=0,a.stretch=n[d+5]!=0))}},ht=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,[N.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,o,a){let n=this.frames;e*=7,n[e]=t,n[e+1]=s,n[e+2]=i,n[e+3]=r,n[e+4]=h,n[e+5]=o,n[e+6]=a}apply(e,t,s,i,r,h,o){let a=e.transformConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){let p=a.data;switch(h){case 0:a.mixRotate=p.mixRotate,a.mixX=p.mixX,a.mixY=p.mixY,a.mixScaleX=p.mixScaleX,a.mixScaleY=p.mixScaleY,a.mixShearY=p.mixShearY;return;case 1:a.mixRotate+=(p.mixRotate-a.mixRotate)*r,a.mixX+=(p.mixX-a.mixX)*r,a.mixY+=(p.mixY-a.mixY)*r,a.mixScaleX+=(p.mixScaleX-a.mixScaleX)*r,a.mixScaleY+=(p.mixScaleY-a.mixScaleY)*r,a.mixShearY+=(p.mixShearY-a.mixShearY)*r}return}let l,c,d,f,m,u,x=j.search(n,s,7),b=this.curves[x/7];switch(b){case 0:let p=n[x];l=n[x+1],c=n[x+2],d=n[x+3],f=n[x+4],m=n[x+5],u=n[x+6];let g=(s-p)/(n[x+7]-p);l+=(n[x+7+1]-l)*g,c+=(n[x+7+2]-c)*g,d+=(n[x+7+3]-d)*g,f+=(n[x+7+4]-f)*g,m+=(n[x+7+5]-m)*g,u+=(n[x+7+6]-u)*g;break;case 1:l=n[x+1],c=n[x+2],d=n[x+3],f=n[x+4],m=n[x+5],u=n[x+6];break;default:l=this.getBezierValue(s,x,1,b-2),c=this.getBezierValue(s,x,2,b+18-2),d=this.getBezierValue(s,x,3,b+18*2-2),f=this.getBezierValue(s,x,4,b+18*3-2),m=this.getBezierValue(s,x,5,b+18*4-2),u=this.getBezierValue(s,x,6,b+18*5-2)}if(h==0){let p=a.data;a.mixRotate=p.mixRotate+(l-p.mixRotate)*r,a.mixX=p.mixX+(c-p.mixX)*r,a.mixY=p.mixY+(d-p.mixY)*r,a.mixScaleX=p.mixScaleX+(f-p.mixScaleX)*r,a.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*r,a.mixShearY=p.mixShearY+(u-p.mixShearY)*r}else a.mixRotate+=(l-a.mixRotate)*r,a.mixX+=(c-a.mixX)*r,a.mixY+=(d-a.mixY)*r,a.mixScaleX+=(f-a.mixScaleX)*r,a.mixScaleY+=(m-a.mixScaleY)*r,a.mixShearY+=(u-a.mixShearY)*r}},ct=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,o){let a=e.pathConstraints[this.constraintIndex];a.active&&(a.position=this.getAbsoluteValue(s,r,h,a.position,a.data.position))}},dt=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,o){let a=e.pathConstraints[this.constraintIndex];a.active&&(a.spacing=this.getAbsoluteValue(s,r,h,a.spacing,a.data.spacing))}},ft=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,[N.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=r}apply(e,t,s,i,r,h,o){let a=e.pathConstraints[this.constraintIndex];if(!a.active)return;let n=this.frames;if(s<n[0]){switch(h){case 0:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case 1:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*r,a.mixX+=(a.data.mixX-a.mixX)*r,a.mixY+=(a.data.mixY-a.mixY)*r}return}let l,c,d,f=j.search(n,s,4),m=this.curves[f>>2];switch(m){case 0:let u=n[f];l=n[f+1],c=n[f+2],d=n[f+3];let x=(s-u)/(n[f+4]-u);l+=(n[f+4+1]-l)*x,c+=(n[f+4+2]-c)*x,d+=(n[f+4+3]-d)*x;break;case 1:l=n[f+1],c=n[f+2],d=n[f+3];break;default:l=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(h==0){let u=a.data;a.mixRotate=u.mixRotate+(l-u.mixRotate)*r,a.mixX=u.mixX+(c-u.mixX)*r,a.mixY=u.mixY+(d-u.mixY)*r}else a.mixRotate+=(l-a.mixRotate)*r,a.mixX+=(c-a.mixX)*r,a.mixY+=(d-a.mixY)*r}},de=class extends ie{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,o){let a;if(this.constraintIndex==-1){const n=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,r,h,this.get(l),this.setup(l),n))}else a=e.physicsConstraints[this.constraintIndex],a.active&&this.set(a,this.getAbsoluteValue(s,r,h,this.get(a),this.setup(a)))}},ut=class extends de{constructor(e,t,s){super(e,t,s,N.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},mt=class extends de{constructor(e,t,s){super(e,t,s,N.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},gt=class extends de{constructor(e,t,s){super(e,t,s,N.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},xt=class extends de{constructor(e,t,s){super(e,t,s,N.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}},wt=class extends de{constructor(e,t,s){super(e,t,s,N.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},bt=class extends de{constructor(e,t,s){super(e,t,s,N.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},pt=class extends de{constructor(e,t,s){super(e,t,s,N.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},yt=class Ps extends j{static propertyIds=[N.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Ps.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,h,o,a){let n;if(this.constraintIndex!=-1&&(n=t.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],h,o,a),s=-1;else if(s>=l[l.length-1])return;if(!(i<l[0])&&(s<l[0]||i>=l[j.search1(l,s)+1]))if(n!=null)n.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},vt=class fe extends j{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[N.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return fe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,h){let o=this.frames;t*=fe.ENTRIES,o[t]=s,o[t+fe.MODE]=i|r<<4,o[t+fe.DELAY]=h}apply(t,s,i,r,h,o,a){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,c=this.attachment;if(l!=c&&(!(l instanceof oe)||l.timelineAttachment!=c))return;if(a==1){o==0&&(n.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==0||o==1)&&(n.sequenceIndex=-1);return}let f=j.search(d,i,fe.ENTRIES),m=d[f],u=d[f+fe.MODE],x=d[f+fe.DELAY];if(!this.attachment.sequence)return;let b=u>>4,p=this.attachment.sequence.regions.length,g=is[u&15];if(g!=0)switch(b+=(i-m)/x+1e-5|0,g){case 1:b=Math.min(p-1,b);break;case 2:b%=p;break;case 3:{let w=(p<<1)-2;b=w==0?0:b%w,b>=p&&(b=w-b);break}case 4:b=Math.max(p-1-b,0);break;case 5:b=p-1-b%p;break;case 6:{let w=(p<<1)-2;b=w==0?0:(b+p-1)%w,b>=p&&(b=w-b)}}n.sequenceIndex=b}},Ks=class Oe{static _emptyAnimation=new Me("<empty>",[],0);static emptyAnimation(){return Oe._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ls(this);propertyIDs=new ze;animationsChanged=!1;trackEntryPool=new ye(()=>new ns);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let h=s[i];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 a=h.next;if(a){let n=h.trackLast-a.delay;if(n>=0){for(a.delay=0,a.trackTime+=h.timeScale==0?0:(n/h.timeScale+t)*a.timeScale,h.trackTime+=o,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let n=h.mixingFrom;for(h.mixingFrom=null,n&&(n.mixingTo=null);n;)this.queue.end(n),n=n.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;r=!0;let x=f==0?1:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,t,x):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let p=b>=u.alphaAttachmentThreshold,g=u.animationLast,w=u.getAnimationTime(),y=w,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,S=A.length;if(f==0&&b==1||x==3){f==0&&(p=!0);for(let I=0;I<S;I++){P.webkit602BugfixHelper(b,x);var h=A[I];h instanceof me?this.applyAttachmentTimeline(h,t,y,x,p):h.apply(t,g,y,v,b,x,0)}}else{let I=u.timelineMode,k=u.shortestRotation,Y=!k&&u.timelinesRotation.length!=S<<1;Y&&(u.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let F=A[M],E=I[M]==Fe?x:0;!k&&F instanceof ve?this.applyRotateTimeline(F,t,y,b,E,u.timelinesRotation,M<<1,Y):F instanceof me?this.applyAttachmentTimeline(F,t,y,x,p):(P.webkit602BugfixHelper(b,x),F.apply(t,g,y,v,b,E,0))}}this.queueEvents(u,w),s.length=0,u.nextAnimationLast=w,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Ct,a=t.slots,n=0,l=t.slots.length;n<l;n++){var c=a[n];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,s,i){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;t.mixDuration==0?(h=1,i==1&&(i=0)):(h=t.mixTime/t.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let o=h<r.mixAttachmentThreshold,a=h<r.mixDrawOrderThreshold,n=r.animation.timelines,l=n.length,c=r.alpha*t.interruptAlpha,d=c*(1-h),f=r.animationLast,m=r.getAnimationTime(),u=m,x=null;if(r.reverse?u=r.animation.duration-u:h<r.eventThreshold&&(x=this.events),i==3)for(let b=0;b<l;b++)n[b].apply(s,f,u,x,d,i,1);else{let b=r.timelineMode,p=r.timelineHoldMix,g=r.shortestRotation,w=!g&&r.timelinesRotation.length!=l<<1;w&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let y=0;y<l;y++){let v=n[y],A=1,S,I=0;switch(b[y]){case Fe:if(!a&&v instanceof xe)continue;S=i,I=d;break;case At:S=0,I=d;break;case St:S=i,I=c;break;case Ee:S=0,I=c;break;default:S=0;let k=p[y];I=c*Math.max(0,1-k.mixTime/k.mixDuration);break}r.totalAlpha+=I,!g&&v instanceof ve?this.applyRotateTimeline(v,s,u,I,S,r.timelinesRotation,y<<1,w):v instanceof me?this.applyAttachmentTimeline(v,s,u,S,o&&I>=r.alphaAttachmentThreshold):(P.webkit602BugfixHelper(I,i),a&&v instanceof xe&&S==0&&(A=0),v.apply(s,f,u,x,I,S,A))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(t,s,i,r,h){var o=s.slots[t.slotIndex];o.bone.active&&(i<t.frames[0]?(r==0||r==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,t.attachmentNames[j.search1(t.frames,i)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Ct))}setAttachment(t,s,i,r){s.setAttachment(i?t.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+cs)}applyRotateTimeline(t,s,i,r,h,o,a,n){if(n&&(o[a]=0),r==1){t.apply(s,0,i,null,1,h,0);return}let l=s.bones[t.boneIndex];if(!l.active)return;let c=t.frames,d=0,f=0;if(i<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:d=l.rotation,f=l.data.rotation}else d=h==0?l.data.rotation:l.rotation,f=l.data.rotation+t.getCurveValue(i);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[a];else{let x=0,b=0;n?(x=0,b=u):(x=o[a],b=o[a+1]);let p=x-x%360;m=u+p;let g=u>=0,w=x>=0;Math.abs(b)<=90&&R.signum(b)!=R.signum(u)&&(Math.abs(x-p)>180?(m+=360*R.signum(x),w=g):p!=0?m-=360*R.signum(x):w=g),w!=g&&(m+=360*R.signum(x)),o[a]=m}o[a+1]=u,l.rotation=d+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,h=r-i,o=t.trackLast%h,a=this.events,n=0,l=a.length;for(;n<l;n++){let d=a[n];if(d.time<o)break;d.time>r||this.queue.event(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=r&&t.animationLast<r;for(c&&this.queue.complete(t);n<l;n++){let d=a[n];d.time<i||this.queue.event(t,d)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;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 i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!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,r=!1):this.clearNext(h));let o=this.trackEntry(t,s,i,h);return this.setCurrent(t,o,r),this.queue.drain(),o}addAnimation(t,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,i,r)}addAnimationWith(t,s,i=!1,r=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,i,h);return h?(h.next=o,o.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,Oe.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,Oe.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let h=this.tracks[i];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,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,h.animation=s,h.loop=i,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=r?this.data.getMix(r.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,i=t.length;s<i;s++){let r=t[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let s=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,h=t.timelineMode;h.length=r;let o=t.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(s&&s.holdPrevious){for(let n=0;n<r;n++)h[n]=a.addAll(i[n].getPropertyIds())?Ee:St;return}e:for(let n=0;n<r;n++){let l=i[n],c=l.getPropertyIds();if(!a.addAll(c))h[n]=Fe;else if(!s||l instanceof me||l instanceof xe||l instanceof Xe||!s.animation.hasTimeline(c))h[n]=At;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(t.mixDuration>0){h[n]=hs,o[n]=d;continue e}break}h[n]=Ee}}}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()}},ns=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}},ls=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;for(let t=0;t<e.length;t+=2){let s=e[t],i=e[t+1],r=this.animState.listeners.slice();switch(s){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<r.length;o++){let a=r[o];a.start&&a.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<r.length;o++){let a=r[o];a.interrupt&&a.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<r.length;o++){let a=r[o];a.end&&a.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<r.length;o++){let a=r[o];a.dispose&&a.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<r.length;o++){let a=r[o];a.complete&&a.complete(i)}break;case 5:let h=e[t+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<r.length;o++){let a=r[o];a.event&&a.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},os=(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))(os||{}),Qs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Fe=0,At=1,St=2,Ee=3,hs=4,Ct=1,cs=2,Zs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},It=class Bs extends oe{color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Bs(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Tt=class Vs extends oe{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Vs(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},kt=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||{}),ds=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ds||{}),fs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ei=class extends kt{setFilters(e,t){}setWraps(e,t){}dispose(){}},Mt=class{pages=new Array;regions=new Array;constructor(e){let t=new ti(e),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=P.enumValue(Re,s[1]),l.magFilter=P.enumValue(Re,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},i.pma=l=>{l.pma=s[1]=="true"};var r={};r.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},r.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},r.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},r.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},r.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},r.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,a=null,n=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 d=r[s[0]];if(d)d(l);else{a||(a=[]),n||(n=[]),a.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));n.push(f)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),a&&a.length>0&&n&&n.length>0&&(l.names=a,l.values=n,a=null,n=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new us(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=i[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()}},ti=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=t.indexOf(",",r);if(h==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},us=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 fs{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)}},Ae=class jt extends oe{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(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,i=this.uvs.length,r=this.region.u,h=this.region.v,o=0,a=0;if(this.region instanceof Yt){let n=this.region,l=n.page,c=l.width,d=l.height;switch(n.degrees){case 90:r-=(n.originalHeight-n.offsetY-n.height)/c,h-=(n.originalWidth-n.offsetX-n.width)/d,o=n.originalHeight/c,a=n.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+t[f+1]*o,s[f+1]=h+(1-t[f])*a;return;case 180:r-=(n.originalWidth-n.offsetX-n.width)/c,h-=n.offsetY/d,o=n.originalWidth/c,a=n.originalHeight/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f])*o,s[f+1]=h+(1-t[f+1])*a;return;case 270:r-=n.offsetY/c,h-=n.offsetX/d,o=n.originalHeight/c,a=n.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f+1])*o,s[f+1]=h+t[f]*a;return}r-=n.offsetX/c,h-=(n.originalHeight-n.offsetY-n.height)/d,o=n.originalWidth/c,a=n.originalHeight/d}else this.region?(o=this.region.u2-r,a=this.region.v2-h):(r=h=0,o=a=1);for(let n=0;n<i;n+=2)s[n]=r+t[n]*o,s[n+1]=h+t[n+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new 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,i,r,h,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,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}},Se=class Ls extends oe{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Ls(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}},ms=class Ds extends oe{x=0;y=0;rotation=0;color=new D(.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*R.degRad,i=Math.cos(s),r=Math.sin(s),h=i*t.a+r*t.b,o=i*t.c+r*t.d;return R.atan2Deg(o,h)}copy(){let t=new Ds(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},$=class Ns extends _e{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new D(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 i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,a=h+this.region.width*i,n=o+this.region.height*r,l=this.rotation*R.degRad,c=Math.cos(l),d=Math.sin(l),f=this.x,m=this.y,u=h*c+f,x=h*d,b=o*c+m,p=o*d,g=a*c+f,w=a*d,y=n*c+m,v=n*d,A=this.offset;A[0]=u-p,A[1]=b+x,A[2]=u-v,A[3]=y+x,A[4]=g-v,A[5]=y+w,A[6]=g-p,A[7]=b+w,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,i,r){this.sequence!=null&&this.sequence.apply(t,this);let h=t.bone,o=this.offset,a=h.worldX,n=h.worldY,l=h.a,c=h.b,d=h.c,f=h.d,m=0,u=0;m=o[0],u=o[1],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n,i+=r,m=o[2],u=o[3],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n,i+=r,m=o[4],u=o[5],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n,i+=r,m=o[6],u=o[7],s[i]=m*l+u*c+a,s[i+1]=m*d+u*f+n}copy(){let t=new Ns(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},si=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let o=s.getPath(t,r),a=this.atlas.findRegion(o);if(a==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[r]=a}}newRegionAttachment(e,t,s,i){let r=new $(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=h}return r}newMeshAttachment(e,t,s,i){let r=new Ae(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=h}return r}newBoundingBoxAttachment(e,t){return new It(t)}newPathAttachment(e,t){return new Se(t)}newPointAttachment(e,t){return new ms(t)}newClippingAttachment(e,t){return new Tt(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 D;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Pe=(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))(Pe||{}),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,i,r,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=o;let a=this.parent;if(!a){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,x=(s+h)*R.degRad,b=(s+90+o)*R.degRad;this.a=Math.cos(x)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(x)*i*u,this.d=Math.sin(b)*r*u,this.worldX=e*m+f.x,this.worldY=t*u+f.y;return}let n=a.a,l=a.b,c=a.c,d=a.d;switch(this.worldX=n*e+l*t+a.worldX,this.worldY=c*e+d*t+a.worldY,this.inherit){case 0:{const f=(s+h)*R.degRad,m=(s+90+o)*R.degRad,u=Math.cos(f)*i,x=Math.cos(m)*r,b=Math.sin(f)*i,p=Math.sin(m)*r;this.a=n*u+l*b,this.b=n*x+l*p,this.c=c*u+d*b,this.d=c*x+d*p;return}case 1:{const f=(s+h)*R.degRad,m=(s+90+o)*R.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;break}case 2:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;n*=f,c*=m;let u=n*n+c*c,x=0;u>1e-4?(u=Math.abs(n*d*m-l*f*c)/u,l=c*u,d=n*u,x=Math.atan2(c,n)*R.radDeg):(n=0,c=0,x=90-Math.atan2(d,l)*R.radDeg);const b=(s+h-x)*R.degRad,p=(s+o-x+90)*R.degRad,g=Math.cos(b)*i,w=Math.cos(p)*r,y=Math.sin(b)*i,v=Math.sin(p)*r;this.a=n*g-l*y,this.b=n*w-l*v,this.c=c*g+d*y,this.d=c*w+d*v;break}case 3:case 4:{s*=R.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(n*f+l*m)/this.skeleton.scaleX,x=(c*f+d*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+x*x);b>1e-5&&(b=1/b),u*=b,x*=b,b=Math.sqrt(u*u+x*x),this.inherit==3&&n*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(x,u);const p=Math.cos(s)*b,g=Math.sin(s)*b;h*=R.degRad,o=(90+o)*R.degRad;const w=Math.cos(h)*i,y=Math.cos(o)*r,v=Math.sin(h)*i,A=Math.sin(o)*r;this.a=u*w+p*v,this.b=u*y+p*A,this.c=x*w+g*v,this.d=x*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)*R.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)*R.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,h=1/(t*r-s*i),o=r*h,a=s*h,n=i*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*o-d*a,this.ay=d*l-c*n;let f,m,u,x;if(this.inherit==1)f=this.a,m=this.b,u=this.c,x=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*r-s*i),o=r*h,a=s*h;break}case 3:case 4:let b=R.cosDeg(this.rotation),p=R.sinDeg(this.rotation);t=(t*b+s*p)/this.skeleton.scaleX,i=(i*b+r*p)/this.skeleton.scaleY;let g=Math.sqrt(t*t+i*i);g>1e-5&&(g=1/g),t*=g,i*=g,g=Math.sqrt(t*t+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let w=R.PI/2+Math.atan2(i,t);s=Math.cos(w)*g,r=Math.sin(w)*g,h=1/(t*r-s*i),o=r*h,a=s*h,n=i*h,l=t*h}f=o*this.a-a*this.c,m=o*this.b-a*this.d,u=l*this.c-n*this.a,x=l*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let b=f*x-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*x,b)*R.radDeg,this.arotation=Math.atan2(u,f)*R.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,m)*R.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*R.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=R.sinDeg(e),s=R.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*R.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=R.sinDeg(e),s=R.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*R.radDeg}rotateWorld(e){e*=R.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},Ce=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},gs=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Et,i=new xs){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}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 i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),i(h)},(h,o)=>{const a=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,a),r(a)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),i(h)},(h,o)=>{const a=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,a),r(a)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[e],r=i!==void 0;return r&&(this.cache.assetsLoaded[e]=i.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))),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(a=>{if(a.ok)return a.blob();const n=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(n)}).then(a=>a?createImageBitmap(a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(a=>{if(a){const n=this.createTexture(e,a);this.success(t,e,n),i(n)}});else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const n=this.createTexture(e,a);this.success(t,e,n),i(n)},a.onerror=()=>{const n=`Couldn't load image: ${e}`;this.error(s,e,n),r(n)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),a.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),h=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,a)=>{this.downloader.downloadText(e,n=>{try{const l=this.createTextureAtlas(e,n);let c=l.pages.length,d=!1;if(c===0){this.success(t,e,l),o(l);return}for(let f of l.pages)this.loadTexture(i?i[f.name]:h+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(t,e,l),o(l)))},(m,u)=>{if(!d){const x=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,x),a(x)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),a(c)}},(n,l)=>{const c=`Couldn't load texture atlas ${e}: status ${n}, ${l}`;this.error(s,e,c),a(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,h)=>{this.downloader.downloadText(e,o=>{try{const a=this.createTextureAtlas(e,o);this.success(t,e,a),r(a)}catch(a){const n=`Couldn't parse texture atlas ${e}: ${a.message}`;this.error(s,e,n),h(n)}},(o,a)=>{const n=`Couldn't load texture atlas ${e}: status ${o}, ${a}`;this.error(s,e,n),h(n)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(r))})}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 Mt){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 Mt(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&i()},s}},xs=class qe{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=qe.AVAILABLE_CACHES.get(t);if(s)return s;const i=new qe;return qe.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Et=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let h=()=>{this.finish(e,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let h=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let h=r.length-1,o=i.length;h<o;h+=2)i[h].apply(null,r)}},Rt=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Pt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ws=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,h,o){let a=e.parent;if(!a)throw new Error("IK bone must have parent.");let n=a.a,l=a.b,c=a.c,d=a.d,f=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*R.signum(e.skeleton.scaleX),u=(s-e.worldY)*R.signum(e.skeleton.scaleY);break;case 2:let p=Math.abs(n*d-l*c)/Math.max(1e-4,n*n+c*c),g=n/e.skeleton.scaleX,w=c/e.skeleton.scaleY;l=-w*p*e.skeleton.scaleX,d=g*p*e.skeleton.scaleY,f+=Math.atan2(w,g)*R.radDeg;default:let y=t-a.worldX,v=s-a.worldY,A=n*d-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*d-v*l)/A-e.ax,u=(v*n-y*c)/A-e.ay)}f+=Math.atan2(u,m)*R.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=e.ascaleX,b=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const p=e.data.length*x;if(p>1e-4){const g=m*m+u*u;if(i&&g<p*p||r&&g>p*p){const w=(Math.sqrt(g)/p-1)*o+1;x*=w,h&&(b*=w)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,x,b,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,h,o,a,n){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,u=f,x=t.ascaleX,b=0,p=0,g=0;d<0?(d=-d,b=180,g=-1):(b=0,g=1),f<0&&(f=-f,g=-g),x<0?(x=-x,p=180):p=0;let w=t.ax,y=0,v=0,A=0,S=e.a,I=e.b,k=e.c,Y=e.d,M=Math.abs(d-f)<=1e-4;!M||h?(y=0,v=S*w+e.worldX,A=k*w+e.worldY):(y=t.ay,v=S*w+I*y+e.worldX,A=k*w+Y*y+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,I=F.b,k=F.c,Y=F.d;let E=S*Y-I*k,T=v-F.worldX,X=A-F.worldY;E=Math.abs(E)<=1e-4?0:1/E;let B=(T*Y-X*I)*E-l,O=(X*S-T*k)*E-c,L=Math.sqrt(B*B+O*O),q=t.data.length*x,H,_;if(L<1e-4){this.apply1(e,s,i,!1,h,!1,n),t.updateWorldTransformWith(w,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}T=s-F.worldX,X=i-F.worldY;let J=(T*Y-X*I)*E-l,V=(X*S-T*k)*E-c,U=J*J+V*V;if(a!=0){a*=d*(x+1)*.5;let K=Math.sqrt(U),Z=K-L-q*d+a;if(Z>0){let ee=Math.min(1,Z/(a*2))-1;ee=(Z-a*(1-ee*ee))/K,J-=ee*J,V-=ee*V,U=J*J+V*V}}e:if(M){q*=d;let K=(U-L*L-q*q)/(2*L*q);K<-1?(K=-1,_=Math.PI*r):K>1?(K=1,_=0,h&&(S=(Math.sqrt(U)/(L+q)-1)*n+1,m*=S,o&&(u*=S))):_=Math.acos(K)*r,S=L+q*K,I=q*Math.sin(_),H=Math.atan2(V*S-J*I,J*S+V*I)}else{S=d*q,I=f*q;let K=S*S,Z=I*I,ee=Math.atan2(V,J);k=Z*L*L+K*U-K*Z;let ne=-2*Z*L,we=Z-K;if(Y=ne*ne-4*we*k,Y>=0){let be=Math.sqrt(Y);ne<0&&(be=-be),be=-(ne+be)*.5;let Te=be/we,Xs=k/be,De=Math.abs(Te)<Math.abs(Xs)?Te:Xs;if(Te=U-De*De,Te>=0){X=Math.sqrt(Te)*r,H=ee-Math.atan2(X,De),_=Math.atan2(X/f,(De-L)/d);break e}}let Ie=R.PI,Ve=L-S,Ht=Ve*Ve,ks=0,Ms=0,Le=L+S,$t=Le*Le,Ys=0;k=-S*L/(K-Z),k>=-1&&k<=1&&(k=Math.acos(k),T=S*Math.cos(k)+L,X=I*Math.sin(k),Y=T*T+X*X,Y<Ht&&(Ie=k,Ht=Y,Ve=T,ks=X),Y>$t&&(Ms=k,$t=Y,Le=T,Ys=X)),U<=(Ht+$t)*.5?(H=ee-Math.atan2(ks*r,Ve),_=Ie*r):(H=ee-Math.atan2(Ys*r,Le),_=Ms*r)}let G=Math.atan2(y,w)*g,te=e.arotation;H=(H-G)*R.radDeg+b-te,H>180?H-=360:H<-180&&(H+=360),e.updateWorldTransformWith(l,c,te+H*n,m,u,0,0),te=t.arotation,_=((_+G)*R.radDeg-t.ashearX)*g+p-te,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(w,y,te+_*n,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Bt=class extends Ce{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},Vt=class extends Ce{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Lt=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Lt||{}),Dt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Dt||{}),Nt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Nt||{}),bs=class ue{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 r=0,h=t.bones.length;r<h;r++){let o=s.findBone(t.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,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 Se))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==0&&h==0)return;let o=this.data,a=o.rotateMode==0,n=o.rotateMode==2,l=this.bones,c=l.length,d=a?c:c+1,f=P.setArraySize(this.spaces,d),m=n?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(n)for(let A=0,S=d-1;A<S;A++){let I=l[A],k=I.data.length,Y=k*I.a,M=k*I.c;m[A]=Math.sqrt(Y*Y+M*M)}P.arrayFill(f,1,d,u);break;case 3:let y=0;for(let A=0,S=d-1;A<S;){let I=l[A],k=I.data.length;if(k<ue.epsilon)n&&(m[A]=0),f[++A]=u;else{let Y=k*I.a,M=k*I.c,F=Math.sqrt(Y*Y+M*M);n&&(m[A]=F),f[++A]=F,y+=F}}if(y>0){y=d/y*u;for(let A=1;A<d;A++)f[A]*=y}break;default:let v=o.spacingMode==0;for(let A=0,S=d-1;A<S;){let I=l[A],k=I.data.length;if(k<ue.epsilon)n&&(m[A]=0),f[++A]=u;else{let Y=k*I.a,M=k*I.c,F=Math.sqrt(Y*Y+M*M);n&&(m[A]=F),f[++A]=(v?k+u:u)*F/k}}}let x=this.computeWorldPositions(s,d,a),b=x[0],p=x[1],g=o.offsetRotation,w=!1;if(g==0)w=o.rotateMode==1;else{w=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?R.degRad:-R.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(b-A.worldX)*r,A.worldY+=(p-A.worldY)*h;let S=x[v],I=x[v+1],k=S-b,Y=I-p;if(n){let M=m[y];if(M!=0){let F=(Math.sqrt(k*k+Y*Y)/M-1)*i+1;A.a*=F,A.c*=F}}if(b=S,p=I,i>0){let M=A.a,F=A.b,E=A.c,T=A.d,X=0,B=0,O=0;if(a?X=x[v-1]:f[y+1]==0?X=x[v+2]:X=Math.atan2(Y,k),X-=Math.atan2(E,M),w){B=Math.cos(X),O=Math.sin(X);let L=A.data.length;b+=(L*(B*M-O*E)-k)*i,p+=(L*(O*M+B*E)-Y)*i}else X+=g;X>R.PI?X-=R.PI2:X<-R.PI&&(X+=R.PI2),X*=i,B=Math.cos(X),O=Math.sin(X),A.a=B*M-O*E,A.b=B*F-O*T,A.c=O*M+B*E,A.d=O*F+B*T}A.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,h=this.position,o=this.spaces,a=P.setArraySize(this.positions,s*3+2),n=this.world,l=t.closed,c=t.worldVerticesLength,d=c/6,f=ue.NONE;if(!t.constantSpeed){let L=t.lengths;d-=l?1:2;let q=L[d];this.data.positionMode==1&&(h*=q);let H;switch(this.data.spacingMode){case 2:H=q;break;case 3:H=q/s;break;default:H=1}n=P.setArraySize(this.world,8);for(let _=0,J=0,V=0;_<s;_++,J+=3){let U=o[_]*H;h+=U;let G=h;if(l)G%=q,G<0&&(G+=q),V=0;else if(G<0){f!=ue.BEFORE&&(f=ue.BEFORE,t.computeWorldVertices(r,2,4,n,0,2)),this.addBeforePosition(G,n,0,a,J);continue}else if(G>q){f!=ue.AFTER&&(f=ue.AFTER,t.computeWorldVertices(r,c-6,4,n,0,2)),this.addAfterPosition(G-q,n,0,a,J);continue}for(;;V++){let te=L[V];if(!(G>te)){if(V==0)G/=te;else{let K=L[V-1];G=(G-K)/(te-K)}break}}V!=f&&(f=V,l&&V==d?(t.computeWorldVertices(r,c-4,4,n,0,2),t.computeWorldVertices(r,0,4,n,4,2)):t.computeWorldVertices(r,V*6+2,8,n,0,2)),this.addCurvePosition(G,n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],a,J,i||_>0&&U==0)}return a}l?(c+=2,n=P.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,n,0,2),t.computeWorldVertices(r,0,2,n,c-4,2),n[c-2]=n[0],n[c-1]=n[1]):(d--,c-=4,n=P.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,n,0,2));let m=P.setArraySize(this.curves,d),u=0,x=n[0],b=n[1],p=0,g=0,w=0,y=0,v=0,A=0,S=0,I=0,k=0,Y=0,M=0,F=0,E=0,T=0;for(let L=0,q=2;L<d;L++,q+=6)p=n[q],g=n[q+1],w=n[q+2],y=n[q+3],v=n[q+4],A=n[q+5],S=(x-p*2+w)*.1875,I=(b-g*2+y)*.1875,k=((p-w)*3-x+v)*.09375,Y=((g-y)*3-b+A)*.09375,M=S*2+k,F=I*2+Y,E=(p-x)*.75+S+k*.16666667,T=(g-b)*.75+I+Y*.16666667,u+=Math.sqrt(E*E+T*T),E+=M,T+=F,M+=k,F+=Y,u+=Math.sqrt(E*E+T*T),E+=M,T+=F,u+=Math.sqrt(E*E+T*T),E+=M+k,T+=F+Y,u+=Math.sqrt(E*E+T*T),m[L]=u,x=v,b=A;this.data.positionMode==1&&(h*=u);let X;switch(this.data.spacingMode){case 2:X=u;break;case 3:X=u/s;break;default:X=1}let B=this.segments,O=0;for(let L=0,q=0,H=0,_=0;L<s;L++,q+=3){let J=o[L]*X;h+=J;let V=h;if(l)V%=u,V<0&&(V+=u),H=0;else if(V<0){this.addBeforePosition(V,n,0,a,q);continue}else if(V>u){this.addAfterPosition(V-u,n,c-4,a,q);continue}for(;;H++){let U=m[H];if(!(V>U)){if(H==0)V/=U;else{let G=m[H-1];V=(V-G)/(U-G)}break}}if(H!=f){f=H;let U=H*6;for(x=n[U],b=n[U+1],p=n[U+2],g=n[U+3],w=n[U+4],y=n[U+5],v=n[U+6],A=n[U+7],S=(x-p*2+w)*.03,I=(b-g*2+y)*.03,k=((p-w)*3-x+v)*.006,Y=((g-y)*3-b+A)*.006,M=S*2+k,F=I*2+Y,E=(p-x)*.3+S+k*.16666667,T=(g-b)*.3+I+Y*.16666667,O=Math.sqrt(E*E+T*T),B[0]=O,U=1;U<8;U++)E+=M,T+=F,M+=k,F+=Y,O+=Math.sqrt(E*E+T*T),B[U]=O;E+=M,T+=F,O+=Math.sqrt(E*E+T*T),B[8]=O,E+=M+k,T+=F+Y,O+=Math.sqrt(E*E+T*T),B[9]=O,_=0}for(V*=O;;_++){let U=B[_];if(!(V>U)){if(_==0)V/=U;else{let G=B[_-1];V=_+(V-G)/(U-G)}break}}this.addCurvePosition(V*.1,x,b,p,g,w,y,v,A,a,q,i||L>0&&J==0)}return a}addBeforePosition(t,s,i,r,h){let o=s[i],a=s[i+1],n=s[i+2]-o,l=s[i+3]-a,c=Math.atan2(l,n);r[h]=o+t*Math.cos(c),r[h+1]=a+t*Math.sin(c),r[h+2]=c}addAfterPosition(t,s,i,r,h){let o=s[i+2],a=s[i+3],n=o-s[i],l=a-s[i+1],c=Math.atan2(l,n);r[h]=o+t*Math.cos(c),r[h+1]=a+t*Math.sin(c),r[h+2]=c}addCurvePosition(t,s,i,r,h,o,a,n,l,c,d,f){if(t==0||isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=t*t,u=m*t,x=1-t,b=x*x,p=b*x,g=x*t,w=g*3,y=x*w,v=w*t,A=s*p+r*y+o*v+n*u,S=i*p+h*y+a*v+l*u;c[d]=A,c[d+1]=S,f&&(t<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(S-(i*b+h*g*2+a*m),A-(s*b+r*g*2+o*m)))}},ii=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,a=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const n=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=n.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let f=this.remaining,m=this.inertia,u=this.data.step,x=this.skeleton.data.referenceScale,b=-1,p=this.data.limit*l,g=p*Math.abs(n.scaleY);if(p*=Math.abs(n.scaleX),s||i){if(s){const w=(this.ux-c)*m;this.xOffset+=w>p?p:w<-p?-p:w,this.ux=c}if(i){const w=(this.uy-d)*m;this.yOffset+=w>g?g:w<-g?-g:w,this.uy=d}if(f>=u){b=Math.pow(this.damping,60*u);const w=this.massInverse*u,y=this.strength,v=this.wind*x*n.scaleX,A=this.gravity*x*n.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*w,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),i&&(this.yVelocity-=(A+this.yOffset*y)*w,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),f-=u;while(f>=u)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r||h){let w=Math.atan2(o.c,o.a),y=0,v=0,A=0,S=this.cx-o.worldX,I=this.cy-o.worldY;if(S>p?S=p:S<-p&&(S=-p),I>g?I=g:I<-g&&(I=-g),r){A=(this.data.rotate+this.data.shearX)*t;let k=Math.atan2(I+this.ty,S+this.tx)-w-this.rotateOffset*A;this.rotateOffset+=(k-Math.ceil(k*R.invPI2-.5)*R.PI2)*m,k=this.rotateOffset*A+w,y=Math.cos(k),v=Math.sin(k),h&&(k=a*o.getWorldScaleX(),k>0&&(this.scaleOffset+=(S*y+I*v)*m/k))}else{y=Math.cos(w),v=Math.sin(w);const k=a*o.getWorldScaleX();k>0&&(this.scaleOffset+=(S*y+I*v)*m/k)}if(f=this.remaining,f>=u){b==-1&&(b=Math.pow(this.damping,60*u));const k=this.massInverse*u,Y=this.strength,M=this.wind,F=vs.yDown?-this.gravity:this.gravity,E=a/x;for(;;)if(f-=u,h&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*k,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+F*y)*E+this.rotateOffset*Y)*k,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,f<u)break;const T=this.rotateOffset*A+w;y=Math.cos(T),v=Math.sin(T)}else if(f<u)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(r){let n=this.rotateOffset*t,l=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=n*this.data.rotate,l=Math.sin(f),c=Math.cos(f),d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d),f+=n*this.data.shearX,l=Math.sin(f),c=Math.cos(f),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c}else n*=this.data.rotate,l=Math.sin(n),c=Math.cos(n),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c,d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d}if(h){const n=1+this.scaleOffset*t*this.data.scaleX;o.a*=n,o.c*=n}e!=3&&(this.tx=a*o.a,this.ty=a*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*R.degRad,r=Math.cos(i),h=Math.sin(i),o=this.cx-e,a=this.cy-t;this.translate(o*r-a*h-o,o*h+a*r-a)}},ps=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof oe)||!(this.attachment instanceof oe)||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}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new ke;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,d=a.d,f=n*d-l*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,x=this.bones;for(let b=0,p=x.length;b<p;b++){let g=x[b];if(e!=0){let w=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)-Math.atan2(v,w)+m;S>R.PI?S-=R.PI2:S<-R.PI&&(S+=R.PI2),S*=e;let I=Math.cos(S),k=Math.sin(S);g.a=I*w-k*v,g.b=I*y-k*A,g.c=k*w+I*v,g.d=k*y+I*A}if(o){let w=this.temp;a.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(w.x-g.worldX)*t,g.worldY+=(w.y-g.worldY)*s}if(i!=0){let w=Math.sqrt(g.a*g.a+g.c*g.c);w!=0&&(w=(w+(Math.sqrt(n*n+c*c)-w+this.data.offsetScaleX)*i)/w),g.a*=w,g.c*=w}if(r!=0){let w=Math.sqrt(g.b*g.b+g.d*g.d);w!=0&&(w=(w+(Math.sqrt(l*l+d*d)-w+this.data.offsetScaleY)*r)/w),g.b*=w,g.d*=w}if(h>0){let w=g.b,y=g.d,v=Math.atan2(y,w),A=Math.atan2(d,l)-Math.atan2(c,n)-(v-Math.atan2(g.c,g.a));A>R.PI?A-=R.PI2:A<-R.PI&&(A+=R.PI2),A=v+(A+u)*h;let S=Math.sqrt(w*w+y*y);g.b=Math.cos(A)*S,g.d=Math.sin(A)*S}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,a=this.target,n=a.a,l=a.b,c=a.c,d=a.d,f=n*d-l*c>0?R.degRad:-R.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,x=this.bones;for(let b=0,p=x.length;b<p;b++){let g=x[b];if(e!=0){let w=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,n)+m;S>R.PI?S-=R.PI2:S<-R.PI&&(S+=R.PI2),S*=e;let I=Math.cos(S),k=Math.sin(S);g.a=I*w-k*v,g.b=I*y-k*A,g.c=k*w+I*v,g.d=k*y+I*A}if(o){let w=this.temp;a.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),g.worldX+=w.x*t,g.worldY+=w.y*s}if(i!=0){let w=(Math.sqrt(n*n+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=w,g.c*=w}if(r!=0){let w=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=w,g.d*=w}if(h>0){let w=Math.atan2(d,l)-Math.atan2(c,n);w>R.PI?w-=R.PI2:w<-R.PI&&(w+=R.PI2);let y=g.b,v=g.d;w=Math.atan2(v,y)+(w-R.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(w)*A,g.d=Math.sin(w)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],d=c.arotation;e!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*e);let f=c.ax,m=c.ay;f+=(o.ax-f+this.data.offsetX)*t,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,x=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*r)/x);let b=c.ashearY;h!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*h),c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=this.target,a=this.bones;for(let n=0,l=a.length;n<l;n++){let c=a[n],d=c.arotation+(o.arotation+this.data.offsetRotation)*e,f=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)*i+1),x=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,b)}}},vs=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 i=t.bones[s],r;if(!i.parent)r=new Ft(i,this,null);else{let h=this.bones[i.parent.index];r=new Ft(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let i=t.slots[s],r=this.bones[i.boneData.index],h=new ps(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let i=t.ikConstraints[s];this.ikConstraints.push(new ws(i,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let i=t.transformConstraints[s];this.transformConstraints.push(new ys(i,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let i=t.pathConstraints[s];this.pathConstraints.push(new bs(i,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let i=t.physicsConstraints[s];this.physicsConstraints.push(new ii(i,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let f=0,m=s.length;f<m;f++){let u=s[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let x=this.bones[f[m].index];do x.sorted=!1,x.active=!0,x=x.parent;while(x)}}let i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,a=i.length,n=r.length,l=h.length,c=this.physicsConstraints.length,d=a+n+l+c;e:for(let f=0;f<d;f++){for(let m=0;m<a;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let m=0;m<n;m++){let u=r[m];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let m=0;m<l;m++){let u=h[m];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}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 i=t.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(r.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,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let n=0,l=this.data.skins.length;n<l;n++)this.sortPathConstraintAttachment(this.data.skins[n],i,r);let h=s.getAttachment();h instanceof Se&&this.sortPathConstraintAttachmentWith(h,r);let o=t.bones,a=o.length;for(let n=0;n<a;n++)this.sortBone(o[n]);this._updateCache.push(t);for(let n=0;n<a;n++)this.sortReset(o[n].children);for(let n=0;n<a;n++)o[n].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,i=s.length;if(t.data.local)for(let r=0;r<i;r++){let h=s[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(t);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(t,s,i){let r=t.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Se))return;let i=t.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,o=i.length;h<o;){let a=i[h++];for(a+=h;h<a;)this.sortBone(r[i[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,i=t.length;s<i;s++){let r=t[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,h=s.length;r<h;r++){let o=s[r];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 i=this._updateCache;for(let r=0,h=i.length;r<h;r++)i[r].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,p=i.length;b<p;b++){let g=i[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,a=s.c,n=s.d;r.worldX=h*this.x+o*this.y+s.worldX,r.worldY=a*this.x+n*this.y+s.worldY;const l=(r.rotation+r.shearX)*R.degRad,c=(r.rotation+90+r.shearY)*R.degRad,d=Math.cos(l)*r.scaleX,f=Math.cos(c)*r.scaleY,m=Math.sin(l)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(h*d+o*m)*this.scaleX,r.b=(h*f+o*u)*this.scaleX,r.c=(a*d+n*m)*this.scaleY,r.d=(a*f+n*u)*this.scaleY;let x=this._updateCache;for(let b=0,p=x.length;b<p;b++){let g=x[b];g!=r&&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,i=t.length;s<i;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 i=0,r=s.length;i<r;i++){let h=s[i];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 i=0,r=s.length;i<r;i++){let h=s[i];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 i=0,r=s.length;i<r;i++){let h=s[i],o=h.data.attachmentName;if(o){let a=t.getAttachment(i,o);a&&h.setAttachment(a)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,h=i.length;r<h;r++){let o=i[r];if(o.data.name==t){let a=null;if(s&&(a=this.getAttachment(r,s),!a))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(a);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new ke,i=new ke;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=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,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let f=h[c];if(!f.bone.active)continue;let m=0,u=null,x=null,b=f.getAttachment();if(b instanceof $)m=8,u=P.setArraySize(i,m,0),b.computeWorldVertices(f,u,0,2),x=Jt.quadTriangles;else if(b instanceof Ae){let p=b;m=p.worldVerticesLength,u=P.setArraySize(i,m,0),p.computeWorldVertices(f,0,m,u,0,2),x=p.triangles}else if(b instanceof Tt&&r!=null){r.clipStart(f,b);continue}if(u&&x){r!=null&&r.isClipping()&&(r.clipTriangles(u,x,x.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let w=u[p],y=u[p+1];o=Math.min(o,w),a=Math.min(a,y),n=Math.max(n,w),l=Math.max(l,y)}}r?.clipEndWithSlot(f)}r?.clipEnd(),t.set(o,a),s.set(n-o,l-a)}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(t,s)}physicsRotate(t,s,i){const r=this.physicsConstraints;for(let h=0,o=r.length;h<o;h++)r[h].rotate(t,s,i)}},As=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(As||{}),Ss=class extends Ce{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Ot=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}},qt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},Be=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new D(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof Ae?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new qt(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new qt(e,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let r=e.slots[i],h=r.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let a in o){let n=o[a];if(h==n){let l=this.getAttachment(s,a);l&&r.setAttachment(l);break}}}s++}}},Ut=class{index=0;name;boneData;color=new D(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}},Wt=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Wt||{}),zt=class extends Ce{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},ri=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ot;s.name="";let i=new Cs(e),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let a=0;a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[i.readInt(!0)],f=new Xt(l,c,d);f.rotation=i.readFloat(),f.x=i.readFloat()*t,f.y=i.readFloat()*t,f.scaleX=i.readFloat(),f.scaleY=i.readFloat(),f.shearX=i.readFloat(),f.shearY=i.readFloat(),f.length=i.readFloat()*t,f.inherit=i.readByte(),f.skinRequired=i.readBoolean(),o&&(D.rgba8888ToColor(f.color,i.readInt32()),f.icon=i.readString()??void 0,f.visible=i.readBoolean()),s.bones.push(f)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],f=new Ut(l,c,d);D.rgba8888ToColor(f.color,i.readInt32());let m=i.readInt32();m!=-1&&D.rgb888ToColor(f.darkColor=new D,m),f.attachmentName=i.readStringRef(),f.blendMode=i.readInt(!0),o&&(f.visible=i.readBoolean()),s.slots.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Bt(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(f.softness=i.readFloat()*t),s.ikConstraints.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new zt(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=i.readFloat()),(m&16)!=0&&(f.offsetX=i.readFloat()*t),(m&32)!=0&&(f.offsetY=i.readFloat()*t),(m&64)!=0&&(f.offsetScaleX=i.readFloat()),(m&128)!=0&&(f.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(f.offsetShearY=i.readFloat()),(m&2)!=0&&(f.mixRotate=i.readFloat()),(m&4)!=0&&(f.mixX=i.readFloat()),(m&8)!=0&&(f.mixY=i.readFloat()),(m&16)!=0&&(f.mixScaleX=i.readFloat()),(m&32)!=0&&(f.mixScaleY=i.readFloat()),(m&64)!=0&&(f.mixShearY=i.readFloat()),s.transformConstraints.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Vt(d);f.order=i.readInt(!0),f.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.slots[i.readInt(!0)];const m=i.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=i.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}a=i.readInt(!0);for(let l=0,c;l<a;l++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Ss(d);f.order=i.readInt(!0),f.bone=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=i.readFloat()),(m&4)!=0&&(f.y=i.readFloat()),(m&8)!=0&&(f.rotate=i.readFloat()),(m&16)!=0&&(f.scaleX=i.readFloat()),(m&32)!=0&&(f.shearX=i.readFloat()),f.limit=((m&64)!=0?i.readFloat():5e3)*t,f.step=1/i.readUnsignedByte(),f.inertia=i.readFloat(),f.strength=i.readFloat(),f.damping=i.readFloat(),f.massInverse=(m&128)!=0?i.readFloat():1,f.wind=i.readFloat(),f.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(f)}let n=this.readSkin(i,s,!0,o);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(P.setArraySize(s.skins,a=l+i.readInt(!0));l<a;l++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}a=this.linkedMeshes.length;for(let l=0;l<a;l++){let c=this.linkedMeshes[l];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new Pt(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}a=i.readInt(!0);for(let l=0;l<a;l++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let r=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;r=new Be("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Be(o),i&&D.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let a=0,n=r.bones.length;a<n;a++)r.bones[a]=t.bones[e.readInt(!0)];for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let a=0,n=e.readInt(!0);a<n;a++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let a=e.readInt(!0);for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,r,a,c,i);d&&r.setAttachment(a,c,d)}}return r}readAttachment(e,t,s,i,r,h){let o=this.scale,a=e.readByte();const n=(a&8)!=0?e.readStringRef():r;if(!n)throw new Error("Attachment name must not be null");switch(a&7){case 0:{let l=(a&16)!=0?e.readStringRef():null;const c=(a&32)!=0?e.readInt32():4294967295,d=(a&64)!=0?this.readSequence(e):null;let f=(a&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),x=e.readFloat(),b=e.readFloat(),p=e.readFloat(),g=e.readFloat();l||(l=n);let w=this.attachmentLoader.newRegionAttachment(s,n,l,d);return w?(w.path=l,w.x=m*o,w.y=u*o,w.scaleX=x,w.scaleY=b,w.rotation=f,w.width=p*o,w.height=g*o,D.rgba8888ToColor(w.color,c),w.sequence=d,d==null&&w.updateRegion(),w):null}case 1:{let l=this.readVertices(e,(a&16)!=0),c=h?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,n);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&D.rgba8888ToColor(d.color,c),d):null}case 2:{let l=(a&16)!=0?e.readStringRef():n;const c=(a&32)!=0?e.readInt32():4294967295,d=(a&64)!=0?this.readSequence(e):null,f=e.readInt(!0),m=this.readVertices(e,(a&128)!=0),u=this.readFloatArray(e,m.length,1),x=this.readShortArray(e,(m.length-f-2)*3);let b=[],p=0,g=0;h&&(b=this.readShortArray(e,e.readInt(!0)),p=e.readFloat(),g=e.readFloat()),l||(l=n);let w=this.attachmentLoader.newMeshAttachment(s,n,l,d);return w?(w.path=l,D.rgba8888ToColor(w.color,c),w.bones=m.bones,w.vertices=m.vertices,w.worldVerticesLength=m.length,w.triangles=x,w.regionUVs=u,d==null&&w.updateRegion(),w.hullLength=f<<1,w.sequence=d,h&&(w.edges=b,w.width=p*o,w.height=g*o),w):null}case 3:{const l=(a&16)!=0?e.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(a&32)!=0?e.readInt32():4294967295,d=(a&64)!=0?this.readSequence(e):null,f=(a&128)!=0,m=e.readInt(!0),u=e.readStringRef();let x=0,b=0;h&&(x=e.readFloat(),b=e.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,n,l,d);return p?(p.path=l,D.rgba8888ToColor(p.color,c),p.sequence=d,h&&(p.width=x*o,p.height=b*o),this.linkedMeshes.push(new ai(p,m,i,u,f)),p):null}case 4:{const l=(a&16)!=0,c=(a&32)!=0,d=this.readVertices(e,(a&64)!=0),f=P.newArray(d.length/6,0);for(let x=0,b=f.length;x<b;x++)f[x]=e.readFloat()*o;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,n);return u?(u.closed=l,u.constantSpeed=c,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,h&&D.rgba8888ToColor(u.color,m),u):null}case 5:{const l=e.readFloat(),c=e.readFloat(),d=e.readFloat(),f=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);return m?(m.x=c*o,m.y=d*o,m.rotation=l,h&&D.rgba8888ToColor(m.color,f),m):null}case 6:{const l=e.readInt(!0),c=this.readVertices(e,(a&16)!=0);let d=h?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,n);return f?(f.endSlot=t.slots[l],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,h&&D.rgba8888ToColor(f.color,d),f):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,i=e.readInt(!0),r=new ni;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let h=new Array,o=new Array;for(let a=0;a<i;a++){let n=e.readInt(!0);o.push(n);for(let l=0;l<n;l++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return r.vertices=P.toFloatArray(h),r.bones=o,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,r=this.scale;for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0),x=u-1;switch(m){case bi:{let b=new me(u,c);for(let p=0;p<u;p++)b.setFrame(p,e.readFloat(),e.readStringRef());i.push(b);break}case pi:{let b=e.readInt(!0),p=new st(u,b,c),g=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let S=0,I=0;p.setFrame(S,g,w,y,v,A),S!=x;S++){let k=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(S);break;case ce:W(e,p,I++,S,0,g,k,w,Y,1),W(e,p,I++,S,1,g,k,y,M,1),W(e,p,I++,S,2,g,k,v,F,1),W(e,p,I++,S,3,g,k,A,E,1)}g=k,w=Y,y=M,v=F,A=E}i.push(p);break}case yi:{let b=e.readInt(!0),p=new it(u,b,c),g=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,S=0;p.setFrame(A,g,w,y,v),A!=x;A++){let I=e.readFloat(),k=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(A);break;case ce:W(e,p,S++,A,0,g,I,w,k,1),W(e,p,S++,A,1,g,I,y,Y,1),W(e,p,S++,A,2,g,I,v,M,1)}g=I,w=k,y=Y,v=M}i.push(p);break}case vi:{let b=e.readInt(!0),p=new at(u,b,c),g=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let Y=0,M=0;p.setFrame(Y,g,w,y,v,A,S,I,k),Y!=x;Y++){let F=e.readFloat(),E=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(Y);break;case ce:W(e,p,M++,Y,0,g,F,w,E,1),W(e,p,M++,Y,1,g,F,y,T,1),W(e,p,M++,Y,2,g,F,v,X,1),W(e,p,M++,Y,3,g,F,A,B,1),W(e,p,M++,Y,4,g,F,S,O,1),W(e,p,M++,Y,5,g,F,I,L,1),W(e,p,M++,Y,6,g,F,k,q,1)}g=F,w=E,y=T,v=X,A=B,S=O,I=L,k=q}i.push(p);break}case Ai:{let b=e.readInt(!0),p=new nt(u,b,c),g=e.readFloat(),w=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let k=0,Y=0;p.setFrame(k,g,w,y,v,A,S,I),k!=x;k++){let M=e.readFloat(),F=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(k);break;case ce:W(e,p,Y++,k,0,g,M,w,F,1),W(e,p,Y++,k,1,g,M,y,E,1),W(e,p,Y++,k,2,g,M,v,T,1),W(e,p,Y++,k,3,g,M,A,X,1),W(e,p,Y++,k,4,g,M,S,B,1),W(e,p,Y++,k,5,g,M,I,O,1)}g=M,w=F,y=E,v=T,A=X,S=B,I=O}i.push(p);break}case Si:{let b=new rt(u,e.readInt(!0),c),p=e.readFloat(),g=e.readUnsignedByte()/255;for(let w=0,y=0;b.setFrame(w,p,g),w!=x;w++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case he:b.setStepped(w);break;case ce:W(e,b,y++,w,0,p,v,g,A,1)}p=v,g=A}i.push(b)}}}}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0);if(m==wi){let b=new tt(u,c);for(let p=0;p<u;p++)b.setFrame(p,e.readFloat(),e.readByte());i.push(b);continue}let x=e.readInt(!0);switch(m){case li:i.push(Q(e,new ve(u,x,c),1));break;case oi:i.push(_t(e,new Ge(u,x,c),r));break;case hi:i.push(Q(e,new He(u,x,c),r));break;case ci:i.push(Q(e,new $e(u,x,c),r));break;case di:i.push(_t(e,new je(u,x,c),1));break;case fi:i.push(Q(e,new Je(u,x,c),1));break;case ui:i.push(Q(e,new Ke(u,x,c),1));break;case mi:i.push(_t(e,new Qe(u,x,c),1));break;case gi:i.push(Q(e,new Ze(u,x,c),1));break;case xi:i.push(Q(e,new et(u,x,c),1))}}}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new ot(d,e.readInt(!0),c),u=e.readByte(),x=e.readFloat(),b=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,p=(u&4)!=0?e.readFloat()*r:0;for(let g=0,w=0;m.setFrame(g,x,b,p,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=f;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()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(W(e,m,w++,g,0,x,y,b,v,1),W(e,m,w++,g,1,x,y,p,A,r)),x=y,b=v,p=A}i.push(m)}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new ht(d,e.readInt(!0),c),u=e.readFloat(),x=e.readFloat(),b=e.readFloat(),p=e.readFloat(),g=e.readFloat(),w=e.readFloat(),y=e.readFloat();for(let v=0,A=0;m.setFrame(v,u,x,b,p,g,w,y),v!=f;v++){let S=e.readFloat(),I=e.readFloat(),k=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat(),E=e.readFloat();switch(e.readByte()){case he:m.setStepped(v);break;case ce:W(e,m,A++,v,0,u,S,x,I,1),W(e,m,A++,v,1,u,S,b,k,1),W(e,m,A++,v,2,u,S,p,Y,1),W(e,m,A++,v,3,u,S,g,M,1),W(e,m,A++,v,4,u,S,w,F,1),W(e,m,A++,v,5,u,S,y,E,1)}u=S,x=I,b=k,p=Y,g=M,w=F,y=E}i.push(m)}for(let n=0,l=e.readInt(!0);n<l;n++){let c=e.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=e.readInt(!0);f<m;f++){const u=e.readByte(),x=e.readInt(!0),b=e.readInt(!0);switch(u){case Ti:i.push(Q(e,new ct(x,b,c),d.positionMode==0?r:1));break;case ki:i.push(Q(e,new dt(x,b,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case Mi:let p=new ft(x,b,c),g=e.readFloat(),w=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,S=0,I=p.getFrameCount()-1;p.setFrame(A,g,w,y,v),A!=I;A++){let k=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat();switch(e.readByte()){case he:p.setStepped(A);break;case ce:W(e,p,S++,A,0,g,k,w,Y,1),W(e,p,S++,A,1,g,k,y,M,1),W(e,p,S++,A,2,g,k,v,F,1)}g=k,w=Y,y=M,v=F}i.push(p)}}}for(let n=0,l=e.readInt(!0);n<l;n++){const c=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),u=e.readInt(!0);if(m==Vi){const b=new yt(u,c);for(let p=0;p<u;p++)b.setFrame(p,e.readFloat());i.push(b);continue}const x=e.readInt(!0);switch(m){case Yi:i.push(Q(e,new ut(u,x,c),1));break;case Xi:i.push(Q(e,new mt(u,x,c),1));break;case Fi:i.push(Q(e,new gt(u,x,c),1));break;case Ei:i.push(Q(e,new xt(u,x,c),1));break;case Ri:i.push(Q(e,new wt(u,x,c),1));break;case Pi:i.push(Q(e,new bt(u,x,c),1));break;case Bi:i.push(Q(e,new pt(u,x,c),1))}}}for(let n=0,l=e.readInt(!0);n<l;n++){let c=s.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readInt(!0);for(let u=0,x=e.readInt(!0);u<x;u++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,b),g=e.readByte(),w=e.readInt(!0),y=w-1;switch(g){case Ci:{let v=p,A=v.bones,S=v.vertices,I=A?S.length/3*2:S.length,k=e.readInt(!0),Y=new lt(w,k,m,v),M=e.readFloat();for(let F=0,E=0;;F++){let T,X=e.readInt(!0);if(X==0)T=A?P.newFloatArray(I):S;else{T=P.newFloatArray(I);let O=e.readInt(!0);if(X+=O,r==1)for(let L=O;L<X;L++)T[L]=e.readFloat();else for(let L=O;L<X;L++)T[L]=e.readFloat()*r;if(!A)for(let L=0,q=T.length;L<q;L++)T[L]+=S[L]}if(Y.setFrame(F,M,T),F==y)break;let B=e.readFloat();switch(e.readByte()){case he:Y.setStepped(F);break;case ce:W(e,Y,E++,F,0,M,B,0,1,1)}M=B}i.push(Y);break}case Ii:{let v=new vt(w,m,p);for(let A=0;A<w;A++){let S=e.readFloat(),I=e.readInt32();v.setFrame(A,S,is[I&15],I>>4,e.readFloat())}i.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let n=new xe(h),l=s.slots.length;for(let c=0;c<h;c++){let d=e.readFloat(),f=e.readInt(!0),m=P.newArray(l,0);for(let p=l-1;p>=0;p--)m[p]=-1;let u=P.newArray(l-f,0),x=0,b=0;for(let p=0;p<f;p++){let g=e.readInt(!0);for(;x!=g;)u[b++]=x++;m[x+e.readInt(!0)]=x++}for(;x<l;)u[b++]=x++;for(let p=l-1;p>=0;p--)m[p]==-1&&(m[p]=u[--b]);n.setFrame(c,d,m)}i.push(n)}let o=e.readInt(!0);if(o>0){let n=new Xe(o);for(let l=0;l<o;l++){let c=e.readFloat(),d=s.events[e.readInt(!0)],f=new Rt(c,d);f.intValue=e.readInt(!1),f.floatValue=e.readFloat(),f.stringValue=e.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=e.readFloat(),f.balance=e.readFloat()),n.setFrame(l,f)}i.push(n)}let a=0;for(let n=0,l=i.length;n<l;n++)a=Math.max(a,i[n].getDuration());return new Me(t,i,a)}},Cs=class{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=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 i=0;i<e;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},ai=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},ni=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function Q(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let h=0,o=0,a=t.getFrameCount()-1;t.setFrame(h,i,r),h!=a;h++){let n=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case he:t.setStepped(h);break;case ce:W(e,t,o++,h,0,i,n,r,l,s)}i=n,r=l}return t}function _t(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,a=0,n=t.getFrameCount()-1;t.setFrame(o,i,r,h),o!=n;o++){let l=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case he:t.setStepped(o);break;case ce:W(e,t,a++,o,0,i,l,r,c,s),W(e,t,a++,o,1,i,l,h,d,s)}i=l,r=c,h=d}return t}function W(e,t,s,i,r,h,o,a,n,l){t.setBezier(s,i,r,h,a,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,n)}var li=0,oi=1,hi=2,ci=3,di=4,fi=5,ui=6,mi=7,gi=8,xi=9,wi=10,bi=0,pi=1,yi=2,vi=3,Ai=4,Si=5,Ci=0,Ii=1,Ti=0,ki=1,Mi=2,Yi=0,Xi=1,Fi=2,Ei=4,Ri=5,Pi=6,Bi=7,Vi=8,he=1,ce=2,Li=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new ye(()=>P.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=e.slots,o=h.length;s.length=0,r.freeAll(i),i.length=0;for(let a=0;a<o;a++){let n=h[a];if(!n.bone.active)continue;let l=n.getAttachment();if(l instanceof It){let c=l;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=P.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(n,0,c.worldVerticesLength,d,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let h=0,o=r.length;h<o;h++){let a=r[h],n=a;for(let l=0,c=a.length;l<c;l+=2){let d=n[l],f=n[l+1];e=Math.min(e,d),t=Math.min(t,f),s=Math.max(s,d),i=Math.max(i,f)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,h=this.minY,o=this.maxX,a=this.maxY;if(e<=r&&s<=r||t<=h&&i<=h||e>=o&&s>=o||t>=a&&i>=a)return!1;let n=(i-t)/(s-e),l=n*(r-e)+t;if(l>h&&l<a||(l=n*(o-e)+t,l>h&&l<a))return!0;let c=(h-t)/n+e;return c>r&&c<o||(c=(a-t)/n+e,c>r&&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 i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.length,h=r-2,o=!1;for(let a=0;a<r;a+=2){let n=i[a+1],l=i[h+1];if(n<s&&l>=s||l<s&&n>=s){let c=i[a];c+(s-n)/(l-n)*(i[h]-c)<t&&(o=!o)}h=a}return o}intersectsSegment(e,t,s,i){let r=this.polygons;for(let h=0,o=r.length;h<o;h++)if(this.intersectsSegmentPolygon(r[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,r){let h=e,o=e.length,a=t-i,n=s-r,l=t*r-s*i,c=h[o-2],d=h[o-1];for(let f=0;f<o;f+=2){let m=h[f],u=h[f+1],x=c*u-d*m,b=c-m,p=d-u,g=a*p-n*b,w=(l*b-a*x)/g;if((w>=c&&w<=m||w>=m&&w<=c)&&(w>=t&&w<=i||w>=i&&w<=t)){let y=(l*p-n*x)/g;if((y>=d&&y<=u||y>=u&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=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}},Is=class se{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new ye(()=>new Array);polygonIndicesPool=new ye(()=>new Array);triangulate(t){let s=t,i=t.length>>1,r=this.indicesArray;r.length=0;for(let a=0;a<i;a++)r[a]=a;let h=this.isConcaveArray;h.length=0;for(let a=0,n=i;a<n;++a)h[a]=se.isConcave(a,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let a=i-1,n=0,l=1;for(;;){e:if(!h[n]){let f=r[a]<<1,m=r[n]<<1,u=r[l]<<1,x=s[f],b=s[f+1],p=s[m],g=s[m+1],w=s[u],y=s[u+1];for(let v=(l+1)%i;v!=a;v=(v+1)%i){if(!h[v])continue;let A=r[v]<<1,S=s[A],I=s[A+1];if(se.positiveArea(w,y,x,b,S,I)&&se.positiveArea(x,b,p,g,S,I)&&se.positiveArea(p,g,w,y,S,I))break e}break}if(l==0){do{if(!h[n])break;n--}while(n>0);break}a=n,n=l,l=(l+1)%i}o.push(r[(i+n-1)%i]),o.push(r[n]),o.push(r[(n+1)%i]),r.splice(n,1),h.splice(n,1),i--;let c=(i+n-1)%i,d=n==i?0:n;h[c]=se.isConcave(c,i,s,r),h[d]=se.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(t,s){let i=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let n=-1,l=0;for(let c=0,d=s.length;c<d;c+=3){let f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,x=i[f],b=i[f+1],p=i[m],g=i[m+1],w=i[u],y=i[u+1],v=!1;if(n==f){let A=a.length-4,S=se.winding(a[A],a[A+1],a[A+2],a[A+3],w,y),I=se.winding(w,y,a[0],a[1],a[2],a[3]);S==l&&I==l&&(a.push(w),a.push(y),o.push(u),v=!0)}v||(a.length>0?(r.push(a),h.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(x),a.push(b),a.push(p),a.push(g),a.push(w),a.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(m),o.push(u),l=se.winding(x,b,p,g,w,y),n=f)}a.length>0&&(r.push(a),h.push(o));for(let c=0,d=r.length;c<d;c++){if(o=h[c],o.length==0)continue;let f=o[0],m=o[o.length-1];a=r[c];let u=a.length-4,x=a[u],b=a[u+1],p=a[u+2],g=a[u+3],w=a[0],y=a[1],v=a[2],A=a[3],S=se.winding(x,b,p,g,w,y);for(let I=0;I<d;I++){if(I==c)continue;let k=h[I];if(k.length!=3)continue;let Y=k[0],M=k[1],F=k[2],E=r[I],T=E[E.length-2],X=E[E.length-1];if(Y!=f||M!=m)continue;let B=se.winding(x,b,p,g,T,X),O=se.winding(T,X,w,y,v,A);B==S&&O==S&&(E.length=0,k.length=0,a.push(T),a.push(X),o.push(F),x=p,b=g,p=T,g=X,I=0)}}for(let c=r.length-1;c>=0;c--)a=r[c],a.length==0&&(r.splice(c,1),this.polygonPool.free(a),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(t,s,i,r){let h=r[(s+t-1)%s]<<1,o=r[t]<<1,a=r[(t+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[o],i[o+1],i[a],i[a+1])}static positiveArea(t,s,i,r,h,o){return t*(o-r)+i*(s-o)+h*(r-s)>=0}static winding(t,s,i,r,h,o){let a=i-t,n=r-s;return h*n-o*a+a*s-t*n>=0?1:-1}},Di=class Kt{triangulator=new Is;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 i=s.worldVerticesLength,r=P.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let h=this.clippingPolygon;Kt.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let a=0,n=o.length;a<n;a++){let l=o[a];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,i,r,h,o,a,n){let l,c,d,f,m,u;typeof s=="number"?(l=i,c=r,d=h,f=o,m=a,u=n):(l=s,c=i,d=r,f=h,m=o,u=a),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,l,c,d,f,m,u):this.clipTrianglesNoRender(t,l,c)}clipTrianglesNoRender(t,s,i){let r=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,n=a.length,l=0;h.length=0,o.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,f=t[d],m=t[d+1];d=s[c+1]<<1;let u=t[d],x=t[d+1];d=s[c+2]<<1;let b=t[d],p=t[d+1];for(let g=0;g<n;g++){let w=h.length;if(this.clip(f,m,u,x,b,p,a[g],r)){let y=r.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,S=P.setArraySize(h,w+v*2);for(let k=0;k<y;k+=2,w+=2){let Y=A[k],M=A[k+1];S[w]=Y,S[w+1]=M}w=o.length;let I=P.setArraySize(o,w+3*(v-2));v--;for(let k=1;k<v;k++,w+=3)I[w]=l,I[w+1]=l+k,I[w+2]=l+k+1;l+=v+1}else{let y=P.setArraySize(h,w+6);y[w]=f,y[w+1]=m,y[w+2]=u,y[w+3]=x,y[w+4]=b,y[w+5]=p,w=o.length;let v=P.setArraySize(o,w+3);v[w]=l,v[w+1]=l+1,v[w+2]=l+2,l+=3;break}}}}clipTrianglesRender(t,s,i,r,h,o,a){let n=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=a?12:8,u=0;l.length=0,c.length=0;for(let x=0;x<i;x+=3){let b=s[x]<<1,p=t[b],g=t[b+1],w=r[b],y=r[b+1];b=s[x+1]<<1;let v=t[b],A=t[b+1],S=r[b],I=r[b+1];b=s[x+2]<<1;let k=t[b],Y=t[b+1],M=r[b],F=r[b+1];for(let E=0;E<f;E++){let T=l.length;if(this.clip(p,g,v,A,k,Y,d[E],n)){let X=n.length;if(X==0)continue;let B=A-Y,O=k-v,L=p-k,q=Y-g,H=1/(B*L+O*(g-Y)),_=X>>1,J=this.clipOutput,V=P.setArraySize(l,T+_*m);for(let G=0;G<X;G+=2,T+=m){let te=J[G],K=J[G+1];V[T]=te,V[T+1]=K,V[T+2]=h.r,V[T+3]=h.g,V[T+4]=h.b,V[T+5]=h.a;let Z=te-k,ee=K-Y,ne=(B*Z+O*ee)*H,we=(q*Z+L*ee)*H,Ie=1-ne-we;V[T+6]=w*ne+S*we+M*Ie,V[T+7]=y*ne+I*we+F*Ie,a&&(V[T+8]=o.r,V[T+9]=o.g,V[T+10]=o.b,V[T+11]=o.a)}T=c.length;let U=P.setArraySize(c,T+3*(_-2));_--;for(let G=1;G<_;G++,T+=3)U[T]=u,U[T+1]=u+G,U[T+2]=u+G+1;u+=_+1}else{let X=P.setArraySize(l,T+3*m);X[T]=p,X[T+1]=g,X[T+2]=h.r,X[T+3]=h.g,X[T+4]=h.b,X[T+5]=h.a,a?(X[T+6]=w,X[T+7]=y,X[T+8]=o.r,X[T+9]=o.g,X[T+10]=o.b,X[T+11]=o.a,X[T+12]=v,X[T+13]=A,X[T+14]=h.r,X[T+15]=h.g,X[T+16]=h.b,X[T+17]=h.a,X[T+18]=S,X[T+19]=I,X[T+20]=o.r,X[T+21]=o.g,X[T+22]=o.b,X[T+23]=o.a,X[T+24]=k,X[T+25]=Y,X[T+26]=h.r,X[T+27]=h.g,X[T+28]=h.b,X[T+29]=h.a,X[T+30]=M,X[T+31]=F,X[T+32]=o.r,X[T+33]=o.g,X[T+34]=o.b,X[T+35]=o.a):(X[T+6]=w,X[T+7]=y,X[T+8]=v,X[T+9]=A,X[T+10]=h.r,X[T+11]=h.g,X[T+12]=h.b,X[T+13]=h.a,X[T+14]=S,X[T+15]=I,X[T+16]=k,X[T+17]=Y,X[T+18]=h.r,X[T+19]=h.g,X[T+20]=h.b,X[T+21]=h.a,X[T+22]=M,X[T+23]=F),T=c.length;let B=P.setArraySize(c,T+3);B[T]=u,B[T+1]=u+1,B[T+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,i,r){let h=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,n=this.clippedTriangles,l=this.clippingPolygons,c=l.length,d=0;o.length=0,a.length=0,n.length=0;for(let f=0;f<i;f+=3){let m=s[f]<<1,u=t[m],x=t[m+1],b=r[m],p=r[m+1];m=s[f+1]<<1;let g=t[m],w=t[m+1],y=r[m],v=r[m+1];m=s[f+2]<<1;let A=t[m],S=t[m+1],I=r[m],k=r[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(u,x,g,w,A,S,l[Y],h)){let F=h.length;if(F==0)continue;let E=w-S,T=A-g,X=u-A,B=S-x,O=1/(E*X+T*(x-S)),L=F>>1,q=this.clipOutput,H=P.setArraySize(o,M+L*2),_=P.setArraySize(a,M+L*2);for(let V=0;V<F;V+=2,M+=2){let U=q[V],G=q[V+1];H[M]=U,H[M+1]=G;let te=U-A,K=G-S,Z=(E*te+T*K)*O,ee=(B*te+X*K)*O,ne=1-Z-ee;_[M]=b*Z+y*ee+I*ne,_[M+1]=p*Z+v*ee+k*ne}M=n.length;let J=P.setArraySize(n,M+3*(L-2));L--;for(let V=1;V<L;V++,M+=3)J[M]=d,J[M+1]=d+V,J[M+2]=d+V+1;d+=L+1}else{let F=P.setArraySize(o,M+6);F[M]=u,F[M+1]=x,F[M+2]=g,F[M+3]=w,F[M+4]=A,F[M+5]=S;let E=P.setArraySize(a,M+3*2);E[M]=b,E[M+1]=p,E[M+2]=y,E[M+3]=v,E[M+4]=I,E[M+5]=k,M=n.length;let T=P.setArraySize(n,M+3);T[M]=d,T[M+1]=d+1,T[M+2]=d+2,d+=3;break}}}}clip(t,s,i,r,h,o,a,n){let l=n,c=!1,d;a.length%4>=2?(d=n,n=this.scratch):d=this.scratch,d.length=0,d.push(t),d.push(s),d.push(i),d.push(r),d.push(h),d.push(o),d.push(t),d.push(s),n.length=0;let f=a.length-4,m=a;for(let u=0;;u+=2){let x=m[u],b=m[u+1],p=x-m[u+2],g=b-m[u+3],w=n.length,y=d;for(let A=0,S=d.length-2;A<S;){let I=y[A],k=y[A+1];A+=2;let Y=y[A],M=y[A+1],F=g*(x-Y)>p*(b-M),E=g*(x-I)-p*(b-k);if(E>0){if(F){n.push(Y),n.push(M);continue}let T=Y-I,X=M-k,B=E/(T*g-X*p);if(B>=0&&B<=1)n.push(I+T*B),n.push(k+X*B);else{n.push(Y),n.push(M);continue}}else if(F){let T=Y-I,X=M-k,B=E/(T*g-X*p);if(B>=0&&B<=1)n.push(I+T*B),n.push(k+X*B),n.push(Y),n.push(M);else{n.push(Y),n.push(M);continue}}c=!0}if(w==n.length)return l.length=0,!0;if(n.push(n[0]),n.push(n[1]),u==f)break;let v=n;n=d,n.length=0,d=v}if(l!=n){l.length=0;for(let u=0,x=n.length-2;u<x;u++)l[u]=n[u]}else l.length=l.length-2;return c}static makeClockwise(t){let s=t,i=t.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,o=0,a=0,n=0;for(let l=0,c=i-3;l<c;l+=2)h=s[l],o=s[l+1],a=s[l+2],n=s[l+3],r+=h*n-a*o;if(!(r<0))for(let l=0,c=i-2,d=i>>1;l<d;l+=2){let f=s[l],m=s[l+1],u=c-l;s[l]=s[u],s[l+1]=s[u+1],s[u]=f,s[u+1]=m}}},Ni=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ot,i=typeof e=="string"?JSON.parse(e):e,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=C(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let o=i.bones[h],a=null,n=C(o,"parent",null);n&&(a=s.findBone(n));let l=new Xt(s.bones.length,o.name,a);l.length=C(o,"length",0)*t,l.x=C(o,"x",0)*t,l.y=C(o,"y",0)*t,l.rotation=C(o,"rotation",0),l.scaleX=C(o,"scaleX",1),l.scaleY=C(o,"scaleY",1),l.shearX=C(o,"shearX",0),l.shearY=C(o,"shearY",0),l.inherit=P.enumValue(Pe,C(o,"inherit","Normal")),l.skinRequired=C(o,"skin",!1);let c=C(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(i.slots)for(let h=0;h<i.slots.length;h++){let o=i.slots[h],a=o.name,n=s.findBone(o.bone);if(!n)throw new Error(`Couldn't find bone ${o.bone} for slot ${a}`);let l=new Ut(s.slots.length,a,n),c=C(o,"color",null);c&&l.color.setFromString(c);let d=C(o,"dark",null);d&&(l.darkColor=D.fromString(d)),l.attachmentName=C(o,"attachment",null),l.blendMode=P.enumValue(Wt,C(o,"blend","normal")),l.visible=C(o,"visible",!0),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let o=i.ik[h],a=new Bt(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);a.bones.push(c)}let n=s.findBone(o.target);if(!n)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);a.target=n,a.mix=C(o,"mix",1),a.softness=C(o,"softness",0)*t,a.bendDirection=C(o,"bendPositive",!0)?1:-1,a.compress=C(o,"compress",!1),a.stretch=C(o,"stretch",!1),a.uniform=C(o,"uniform",!1),s.ikConstraints.push(a)}if(i.transform)for(let h=0;h<i.transform.length;h++){let o=i.transform[h],a=new zt(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);a.bones.push(f)}let n=o.target,l=s.findBone(n);if(!l)throw new Error(`Couldn't find target bone ${n} for transform constraint ${o.name}.`);a.target=l,a.local=C(o,"local",!1),a.relative=C(o,"relative",!1),a.offsetRotation=C(o,"rotation",0),a.offsetX=C(o,"x",0)*t,a.offsetY=C(o,"y",0)*t,a.offsetScaleX=C(o,"scaleX",0),a.offsetScaleY=C(o,"scaleY",0),a.offsetShearY=C(o,"shearY",0),a.mixRotate=C(o,"mixRotate",1),a.mixX=C(o,"mixX",1),a.mixY=C(o,"mixY",a.mixX),a.mixScaleX=C(o,"mixScaleX",1),a.mixScaleY=C(o,"mixScaleY",a.mixScaleX),a.mixShearY=C(o,"mixShearY",1),s.transformConstraints.push(a)}if(i.path)for(let h=0;h<i.path.length;h++){let o=i.path[h],a=new Vt(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);a.bones.push(f)}let n=o.target,l=s.findSlot(n);if(!l)throw new Error(`Couldn't find target slot ${n} for path constraint ${o.name}.`);a.target=l,a.positionMode=P.enumValue(Lt,C(o,"positionMode","Percent")),a.spacingMode=P.enumValue(Dt,C(o,"spacingMode","Length")),a.rotateMode=P.enumValue(Nt,C(o,"rotateMode","Tangent")),a.offsetRotation=C(o,"rotation",0),a.position=C(o,"position",0),a.positionMode==0&&(a.position*=t),a.spacing=C(o,"spacing",0),(a.spacingMode==0||a.spacingMode==1)&&(a.spacing*=t),a.mixRotate=C(o,"mixRotate",1),a.mixX=C(o,"mixX",1),a.mixY=C(o,"mixY",a.mixX),s.pathConstraints.push(a)}if(i.physics)for(let h=0;h<i.physics.length;h++){const o=i.physics[h],a=new Ss(o.name);a.order=C(o,"order",0),a.skinRequired=C(o,"skin",!1);const n=o.bone,l=s.findBone(n);if(l==null)throw new Error("Physics bone not found: "+n);a.bone=l,a.x=C(o,"x",0),a.y=C(o,"y",0),a.rotate=C(o,"rotate",0),a.scaleX=C(o,"scaleX",0),a.shearX=C(o,"shearX",0),a.limit=C(o,"limit",5e3)*t,a.step=1/C(o,"fps",60),a.inertia=C(o,"inertia",1),a.strength=C(o,"strength",100),a.damping=C(o,"damping",1),a.massInverse=1/C(o,"mass",1),a.wind=C(o,"wind",0),a.gravity=C(o,"gravity",0),a.mix=C(o,"mix",1),a.inertiaGlobal=C(o,"inertiaGlobal",!1),a.strengthGlobal=C(o,"strengthGlobal",!1),a.dampingGlobal=C(o,"dampingGlobal",!1),a.massGlobal=C(o,"massGlobal",!1),a.windGlobal=C(o,"windGlobal",!1),a.gravityGlobal=C(o,"gravityGlobal",!1),a.mixGlobal=C(o,"mixGlobal",!1),s.physicsConstraints.push(a)}if(i.skins)for(let h=0;h<i.skins.length;h++){let o=i.skins[h],a=new Be(o.name);if(o.bones)for(let n=0;n<o.bones.length;n++){let l=o.bones[n],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);a.bones.push(c)}if(o.ik)for(let n=0;n<o.ik.length;n++){let l=o.ik[n],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.transform)for(let n=0;n<o.transform.length;n++){let l=o.transform[n],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.path)for(let n=0;n<o.path.length;n++){let l=o.path[n],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}if(o.physics)for(let n=0;n<o.physics.length;n++){let l=o.physics[n],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);a.constraints.push(c)}for(let n in o.attachments){let l=s.findSlot(n);if(!l)throw new Error(`Couldn't find slot ${n} for skin ${o.name}.`);let c=o.attachments[n];for(let d in c){let f=this.readAttachment(c[d],a,l.index,d,s);f&&a.setAttachment(l.index,d,f)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let a=this.linkedMeshes[h],n=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${a.skin}`);let l=n.getAttachment(a.slotIndex,a.parent);if(!l)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?l:a.mesh,a.mesh.setParentMesh(l),a.mesh.region!=null&&a.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let o=i.events[h],a=new Pt(h);a.intValue=C(o,"int",0),a.floatValue=C(o,"float",0),a.stringValue=C(o,"string",""),a.audioPath=C(o,"audio",null),a.audioPath&&(a.volume=C(o,"volume",1),a.balance=C(o,"balance",0)),s.events.push(a)}if(i.animations)for(let h in i.animations){let o=i.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,i,r){let h=this.scale;switch(i=C(e,"name",i),C(e,"type","region")){case"region":{let o=C(e,"path",i),a=this.readSequence(C(e,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(t,i,o,a);if(!n)return null;n.path=o,n.x=C(e,"x",0)*h,n.y=C(e,"y",0)*h,n.scaleX=C(e,"scaleX",1),n.scaleY=C(e,"scaleY",1),n.rotation=C(e,"rotation",0),n.width=e.width*h,n.height=e.height*h,n.sequence=a;let l=C(e,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let a=C(e,"color",null);return a&&o.color.setFromString(a),o}case"mesh":case"linkedmesh":{let o=C(e,"path",i),a=this.readSequence(C(e,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(t,i,o,a);if(!n)return null;n.path=o;let l=C(e,"color",null);l&&n.color.setFromString(l),n.width=C(e,"width",0)*h,n.height=C(e,"height",0)*h,n.sequence=a;let c=C(e,"parent",null);if(c)return this.linkedMeshes.push(new Oi(n,C(e,"skin",null),s,c,C(e,"timelines",!0))),n;let d=e.uvs;return this.readVertices(e,n,d.length),n.triangles=e.triangles,n.regionUVs=d,n.region!=null&&n.updateRegion(),n.edges=C(e,"edges",null),n.hullLength=C(e,"hull",0)*2,n}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=C(e,"closed",!1),o.constantSpeed=C(e,"constantSpeed",!0);let a=e.vertexCount;this.readVertices(e,o,a<<1);let n=P.newArray(a/3,0);for(let c=0;c<e.lengths.length;c++)n[c]=e.lengths[c]*h;o.lengths=n;let l=C(e,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=C(e,"x",0)*h,o.y=C(e,"y",0)*h,o.rotation=C(e,"rotation",0);let a=C(e,"color",null);return a&&o.color.setFromString(a),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let a=C(e,"end",null);a&&(o.endSlot=r.findSlot(a));let n=e.vertexCount;this.readVertices(e,o,n<<1);let l=C(e,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(e){if(e==null)return null;let t=new ts(C(e,"count",0));return t.start=C(e,"start",1),t.digits=C(e,"digits",0),t.setupIndex=C(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let a=P.toFloatArray(r);if(i!=1)for(let n=0,l=r.length;n<l;n++)a[n]*=i;t.vertices=a;return}let h=new Array,o=new Array;for(let a=0,n=r.length;a<n;){let l=r[a++];o.push(l);for(let c=a+l*4;a<c;a+=4)o.push(r[a]),h.push(r[a+1]*i),h.push(r[a+2]*i),h.push(r[a+3])}t.bones=o,t.vertices=P.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let o in e.slots){let a=e.slots[o],n=s.findSlot(o);if(!n)throw new Error("Slot not found: "+o);let l=n.index;for(let c in a){let d=a[c];if(!d)continue;let f=d.length;if(c=="attachment"){let m=new me(f,l);for(let u=0;u<f;u++){let x=d[u];m.setFrame(u,C(x,"time",0),C(x,"name",null))}r.push(m)}else if(c=="rgba"){let m=new st(f,f<<2,l),u=d[0],x=C(u,"time",0),b=D.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,x,b.r,b.g,b.b,b.a);let w=d[p+1];if(!w){m.shrink(g);break}let y=C(w,"time",0),v=D.fromString(w.color),A=u.curve;A&&(g=z(A,m,g,p,0,x,y,b.r,v.r,1),g=z(A,m,g,p,1,x,y,b.g,v.g,1),g=z(A,m,g,p,2,x,y,b.b,v.b,1),g=z(A,m,g,p,3,x,y,b.a,v.a,1)),x=y,b=v,u=w}r.push(m)}else if(c=="rgb"){let m=new it(f,f*3,l),u=d[0],x=C(u,"time",0),b=D.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,x,b.r,b.g,b.b);let w=d[p+1];if(!w){m.shrink(g);break}let y=C(w,"time",0),v=D.fromString(w.color),A=u.curve;A&&(g=z(A,m,g,p,0,x,y,b.r,v.r,1),g=z(A,m,g,p,1,x,y,b.g,v.g,1),g=z(A,m,g,p,2,x,y,b.b,v.b,1)),x=y,b=v,u=w}r.push(m)}else if(c=="alpha")r.push(ae(d,new rt(f,f,l),0,1));else if(c=="rgba2"){let m=new at(f,f*7,l),u=d[0],x=C(u,"time",0),b=D.fromString(u.light),p=D.fromString(u.dark);for(let g=0,w=0;;g++){m.setFrame(g,x,b.r,b.g,b.b,b.a,p.r,p.g,p.b);let y=d[g+1];if(!y){m.shrink(w);break}let v=C(y,"time",0),A=D.fromString(y.light),S=D.fromString(y.dark),I=u.curve;I&&(w=z(I,m,w,g,0,x,v,b.r,A.r,1),w=z(I,m,w,g,1,x,v,b.g,A.g,1),w=z(I,m,w,g,2,x,v,b.b,A.b,1),w=z(I,m,w,g,3,x,v,b.a,A.a,1),w=z(I,m,w,g,4,x,v,p.r,S.r,1),w=z(I,m,w,g,5,x,v,p.g,S.g,1),w=z(I,m,w,g,6,x,v,p.b,S.b,1)),x=v,b=A,p=S,u=y}r.push(m)}else if(c=="rgb2"){let m=new nt(f,f*6,l),u=d[0],x=C(u,"time",0),b=D.fromString(u.light),p=D.fromString(u.dark);for(let g=0,w=0;;g++){m.setFrame(g,x,b.r,b.g,b.b,p.r,p.g,p.b);let y=d[g+1];if(!y){m.shrink(w);break}let v=C(y,"time",0),A=D.fromString(y.light),S=D.fromString(y.dark),I=u.curve;I&&(w=z(I,m,w,g,0,x,v,b.r,A.r,1),w=z(I,m,w,g,1,x,v,b.g,A.g,1),w=z(I,m,w,g,2,x,v,b.b,A.b,1),w=z(I,m,w,g,3,x,v,p.r,S.r,1),w=z(I,m,w,g,4,x,v,p.g,S.g,1),w=z(I,m,w,g,5,x,v,p.b,S.b,1)),x=v,b=A,p=S,u=y}r.push(m)}}}if(e.bones)for(let o in e.bones){let a=e.bones[o],n=s.findBone(o);if(!n)throw new Error("Bone not found: "+o);let l=n.index;for(let c in a){let d=a[c],f=d.length;if(f!=0){if(c==="rotate")r.push(ae(d,new ve(f,f,l),0,1));else if(c==="translate"){let m=new Ge(f,f<<1,l);r.push(Gt(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new He(f,f,l);r.push(ae(d,m,0,i))}else if(c==="translatey"){let m=new $e(f,f,l);r.push(ae(d,m,0,i))}else if(c==="scale"){let m=new je(f,f<<1,l);r.push(Gt(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Je(f,f,l);r.push(ae(d,m,1,1))}else if(c==="scaley"){let m=new Ke(f,f,l);r.push(ae(d,m,1,1))}else if(c==="shear"){let m=new Qe(f,f<<1,l);r.push(Gt(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Ze(f,f,l);r.push(ae(d,m,0,1))}else if(c==="sheary"){let m=new et(f,f,l);r.push(ae(d,m,0,1))}else if(c==="inherit"){let m=new tt(f,n.index);for(let u=0;u<d.length;u++){let x=d[u];m.setFrame(u,C(x,"time",0),P.enumValue(Pe,C(x,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let o in e.ik){let a=e.ik[o],n=a[0];if(!n)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),d=new ot(a.length,a.length<<1,c),f=C(n,"time",0),m=C(n,"mix",1),u=C(n,"softness",0)*i;for(let x=0,b=0;;x++){d.setFrame(x,f,m,u,C(n,"bendPositive",!0)?1:-1,C(n,"compress",!1),C(n,"stretch",!1));let p=a[x+1];if(!p){d.shrink(b);break}let g=C(p,"time",0),w=C(p,"mix",1),y=C(p,"softness",0)*i,v=n.curve;v&&(b=z(v,d,b,x,0,f,g,m,w,1),b=z(v,d,b,x,1,f,g,u,y,i)),f=g,m=w,u=y,n=p}r.push(d)}if(e.transform)for(let o in e.transform){let a=e.transform[o],n=a[0];if(!n)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),d=new ht(a.length,a.length*6,c),f=C(n,"time",0),m=C(n,"mixRotate",1),u=C(n,"mixX",1),x=C(n,"mixY",u),b=C(n,"mixScaleX",1),p=C(n,"mixScaleY",b),g=C(n,"mixShearY",1);for(let w=0,y=0;;w++){d.setFrame(w,f,m,u,x,b,p,g);let v=a[w+1];if(!v){d.shrink(y);break}let A=C(v,"time",0),S=C(v,"mixRotate",1),I=C(v,"mixX",1),k=C(v,"mixY",I),Y=C(v,"mixScaleX",1),M=C(v,"mixScaleY",Y),F=C(v,"mixShearY",1),E=n.curve;E&&(y=z(E,d,y,w,0,f,A,m,S,1),y=z(E,d,y,w,1,f,A,u,I,1),y=z(E,d,y,w,2,f,A,x,k,1),y=z(E,d,y,w,3,f,A,b,Y,1),y=z(E,d,y,w,4,f,A,p,M,1),y=z(E,d,y,w,5,f,A,g,F,1)),f=A,m=S,u=I,x=k,b=Y,p=M,b=Y,n=v}r.push(d)}if(e.path)for(let o in e.path){let a=e.path[o],n=s.findPathConstraint(o);if(!n)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(n);for(let c in a){let d=a[c],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new ct(m,m,l);r.push(ae(d,u,0,n.positionMode==0?i:1))}else if(c==="spacing"){let u=new dt(m,m,l);r.push(ae(d,u,0,n.spacingMode==0||n.spacingMode==1?i:1))}else if(c==="mix"){let u=new ft(m,m*3,l),x=C(f,"time",0),b=C(f,"mixRotate",1),p=C(f,"mixX",1),g=C(f,"mixY",p);for(let w=0,y=0;;w++){u.setFrame(w,x,b,p,g);let v=d[w+1];if(!v){u.shrink(y);break}let A=C(v,"time",0),S=C(v,"mixRotate",1),I=C(v,"mixX",1),k=C(v,"mixY",I),Y=f.curve;Y&&(y=z(Y,u,y,w,0,x,A,b,S,1),y=z(Y,u,y,w,1,x,A,p,I,1),y=z(Y,u,y,w,2,x,A,g,k,1)),x=A,b=S,p=I,g=k,f=v}r.push(u)}}}if(e.physics)for(let o in e.physics){let a=e.physics[o],n=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);n=s.physicsConstraints.indexOf(l)}for(let l in a){let c=a[l],d=c[0];if(!d)continue;let f=c.length;if(l=="reset"){const u=new yt(f,n);for(let x=0;d!=null;d=c[x+1],x++)u.setFrame(x,C(d,"time",0));r.push(u);continue}let m;if(l=="inertia")m=new ut(f,f,n);else if(l=="strength")m=new mt(f,f,n);else if(l=="damping")m=new gt(f,f,n);else if(l=="mass")m=new xt(f,f,n);else if(l=="wind")m=new wt(f,f,n);else if(l=="gravity")m=new bt(f,f,n);else if(l=="mix")m=new pt(f,f,n);else continue;r.push(ae(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let a=e.attachments[o],n=s.findSkin(o);if(!n)throw new Error("Skin not found: "+o);for(let l in a){let c=a[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let f=d.index;for(let m in c){let u=c[m],x=n.getAttachment(f,m);for(let b in u){let p=u[b],g=p[0];if(g){if(b=="deform"){let w=x.bones,y=x.vertices,v=w?y.length/3*2:y.length,A=new lt(p.length,p.length,f,x),S=C(g,"time",0);for(let I=0,k=0;;I++){let Y,M=C(g,"vertices",null);if(!M)Y=w?P.newFloatArray(v):y;else{Y=P.newFloatArray(v);let X=C(g,"offset",0);if(P.arrayCopy(M,0,Y,X,M.length),i!=1)for(let B=X,O=B+M.length;B<O;B++)Y[B]*=i;if(!w)for(let B=0;B<v;B++)Y[B]+=y[B]}A.setFrame(I,S,Y);let F=p[I+1];if(!F){A.shrink(k);break}let E=C(F,"time",0),T=g.curve;T&&(k=z(T,A,k,I,0,S,E,0,1,1)),S=E,g=F}r.push(A)}else if(b=="sequence"){let w=new vt(p.length,f,x),y=0;for(let v=0;v<p.length;v++){let A=C(g,"delay",y),S=C(g,"time",0),I=ss[C(g,"mode","hold")],k=C(g,"index",0);w.setFrame(v,S,I,k,A),y=A,g=p[v+1]}r.push(w)}}}}}}if(e.drawOrder){let o=new xe(e.drawOrder.length),a=s.slots.length,n=0;for(let l=0;l<e.drawOrder.length;l++,n++){let c=e.drawOrder[l],d=null,f=C(c,"offsets",null);if(f){d=P.newArray(a,-1);let m=P.newArray(a-f.length,0),u=0,x=0;for(let b=0;b<f.length;b++){let p=f[b],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let w=g.index;for(;u!=w;)m[x++]=u++;d[u+p.offset]=u++}for(;u<a;)m[x++]=u++;for(let b=a-1;b>=0;b--)d[b]==-1&&(d[b]=m[--x])}o.setFrame(n,C(c,"time",0),d)}r.push(o)}if(e.events){let o=new Xe(e.events.length),a=0;for(let n=0;n<e.events.length;n++,a++){let l=e.events[n],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Rt(P.toSinglePrecision(C(l,"time",0)),c);d.intValue=C(l,"int",c.intValue),d.floatValue=C(l,"float",c.floatValue),d.stringValue=C(l,"string",c.stringValue),d.data.audioPath&&(d.volume=C(l,"volume",1),d.balance=C(l,"balance",0)),o.setFrame(a,d)}r.push(o)}let h=0;for(let o=0,a=r.length;o<a;o++)h=Math.max(h,r[o].getDuration());s.animations.push(new Me(t,r,h))}},Oi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function ae(e,t,s,i){let r=e[0],h=C(r,"time",0),o=C(r,"value",s)*i,a=0;for(let n=0;;n++){t.setFrame(n,h,o);let l=e[n+1];if(!l)return t.shrink(a),t;let c=C(l,"time",0),d=C(l,"value",s)*i;r.curve&&(a=z(r.curve,t,a,n,0,h,c,o,d,i)),h=c,o=d,r=l}}function Gt(e,t,s,i,r,h){let o=e[0],a=C(o,"time",0),n=C(o,s,r)*h,l=C(o,i,r)*h,c=0;for(let d=0;;d++){t.setFrame(d,a,n,l);let f=e[d+1];if(!f)return t.shrink(c),t;let m=C(f,"time",0),u=C(f,s,r)*h,x=C(f,i,r)*h,b=o.curve;b&&(c=z(b,t,c,d,0,a,m,n,u,h),c=z(b,t,c,d,1,a,m,l,x,h)),a=m,n=u,l=x,o=f}}function z(e,t,s,i,r,h,o,a,n,l){if(e=="stepped")return t.setStepped(i),s;let c=r<<2,d=e[c],f=e[c+1]*l,m=e[c+2],u=e[c+3]*l;return t.setBezier(s,i,r,h,a,d,f,m,u,o,n),s+1}function C(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var Ts=class extends kt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},qi=class extends gs{constructor(e="",t=new Et){super(s=>new Ts(s),e,t)}},Ui=P.newFloatArray(8),Wi=class Ue{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=P.newFloatArray(8*1024);tempColor=new D;constructor(t){this.ctx=t}draw(t){this.triangleRendering?this.drawTriangles(t):this.drawImages(t)}drawImages(t){let s=this.ctx,i=this.tempColor,r=t.color,h=t.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,a=h.length;o<a;o++){let n=h[o],l=n.bone;if(!l.active)continue;let c=n.getAttachment();if(!(c instanceof $))continue;c.computeWorldVertices(n,Ui,0,2);let d=c.region,f=d.texture.getImage(),m=n.color,u=c.color;i.set(r.r*m.r*u.r,r.g*m.g*u.g,r.b*m.b*u.b,r.a*m.a*u.a),s.save(),s.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let x=c.width/d.originalWidth;s.scale(x*c.scaleX,x*c.scaleY);let b=d.width,p=d.height;if(s.translate(b/2,p/2),c.region.degrees==90){let g=b;b=p,p=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-b/2,-p/2),s.globalAlpha=i.a,s.drawImage(f,f.width*d.u,f.height*d.v,b,p,0,0,b,p),this.debugRendering&&s.strokeRect(0,0,b,p),s.restore()}}drawTriangles(t){let s=this.ctx,i=this.tempColor,r=t.color,h=t.drawOrder,o=null,a=this.vertices,n=null;for(let c=0,d=h.length;c<d;c++){let f=h[c],m=f.getAttachment(),u,x;if(m instanceof $){let b=m;a=this.computeRegionVertices(f,b,!1),n=Ue.QUAD_TRIANGLES,u=b.region.texture.getImage()}else if(m instanceof Ae){let b=m;a=this.computeMeshVertices(f,b,!1),n=b.triangles,u=b.region.texture.getImage()}else continue;if(u){f.data.blendMode!=o&&(o=f.data.blendMode);let b=f.color,p=m.color;i.set(r.r*b.r*p.r,r.g*b.g*p.g,r.b*b.b*p.b,r.a*b.a*p.a),s.globalAlpha=i.a;for(var l=0;l<n.length;l+=3){let g=n[l]*8,w=n[l+1]*8,y=n[l+2]*8,v=a[g],A=a[g+1],S=a[g+6],I=a[g+7],k=a[w],Y=a[w+1],M=a[w+6],F=a[w+7],E=a[y],T=a[y+1],X=a[y+6],B=a[y+7];this.drawTriangle(u,v,A,S,I,k,Y,M,F,E,T,X,B),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,A),s.lineTo(k,Y),s.lineTo(E,T),s.lineTo(v,A),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,s,i,r,h,o,a,n,l,c,d,f,m){let u=this.ctx;const x=t.width-1,b=t.height-1;r*=x,h*=b,n*=x,l*=b,f*=x,m*=b,u.beginPath(),u.moveTo(s,i),u.lineTo(o,a),u.lineTo(c,d),u.closePath(),o-=s,a-=i,c-=s,d-=i,n-=r,l-=h,f-=r,m-=h;let p=n*m-f*l;if(p==0)return;p=1/p;const g=(m*o-l*c)*p,w=(m*a-l*d)*p,y=(n*c-f*o)*p,v=(n*d-f*a)*p,A=s-g*r-y*h,S=i-w*r-v*h;u.save(),u.transform(g,w,y,v,A,S),u.clip(),u.drawImage(t,0,0),u.restore()}computeRegionVertices(t,s,i){let r=t.bone.skeleton.color,h=t.color,o=s.color,a=r.a*h.a*o.a,n=i?a:1,l=this.tempColor;l.set(r.r*h.r*o.r*n,r.g*h.g*o.g*n,r.b*h.b*o.b*n,a),s.computeWorldVertices(t,this.vertices,0,Ue.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[$.C1R]=l.r,c[$.C1G]=l.g,c[$.C1B]=l.b,c[$.C1A]=l.a,c[$.U1]=d[0],c[$.V1]=d[1],c[$.C2R]=l.r,c[$.C2G]=l.g,c[$.C2B]=l.b,c[$.C2A]=l.a,c[$.U2]=d[2],c[$.V2]=d[3],c[$.C3R]=l.r,c[$.C3G]=l.g,c[$.C3B]=l.b,c[$.C3A]=l.a,c[$.U3]=d[4],c[$.V3]=d[5],c[$.C4R]=l.r,c[$.C4G]=l.g,c[$.C4B]=l.b,c[$.C4A]=l.a,c[$.U4]=d[6],c[$.V4]=d[7],c}computeMeshVertices(t,s,i){let r=t.bone.skeleton.color,h=t.color,o=s.color,a=r.a*h.a*o.a,n=i?a:1,l=this.tempColor;l.set(r.r*h.r*o.r*n,r.g*h.g*o.g*n,r.b*h.b*o.b*n,a);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=P.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(t,0,s.worldVerticesLength,d,0,Ue.VERTEX_SIZE);let f=s.uvs;for(let m=0,u=0,x=2;m<c;m++)d[x++]=l.r,d[x++]=l.g,d[x++]=l.b,d[x++]=l.a,d[x++]=f[u++],d[x++]=f[u++],x+=2;return d}};return _s(Qt)})();
1
+ "use strict";var spine=(()=>{var Ie=Object.defineProperty,Xn=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyNames,Rn=Object.prototype.hasOwnProperty,Ln=(t,e)=>{for(var s in e)Ie(t,s,{get:e[s],enumerable:!0})},Bn=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vn(e))!Rn.call(t,i)&&i!==s&&Ie(t,i,{get:()=>e[i],enumerable:!(n=Xn(e,i))||n.enumerable});return t},On=t=>Bn(Ie({},"__esModule",{value:!0}),t),Ds={};Ln(Ds,{AlphaTimeline:()=>We,Animation:()=>Kt,AnimationState:()=>Wn,AnimationStateAdapter:()=>Gn,AnimationStateData:()=>Hn,AssetCache:()=>tn,AssetManager:()=>qi,AssetManagerBase:()=>Zs,AtlasAttachmentLoader:()=>jn,Attachment:()=>ke,AttachmentTimeline:()=>Yt,BinaryInput:()=>dn,BlendMode:()=>Ps,Bone:()=>re,BoneData:()=>ps,BonePose:()=>ie,BoneTimeline1:()=>Tt,BoneTimeline2:()=>Qt,BoundingBoxAttachment:()=>gs,CanvasTexture:()=>bn,ClippingAttachment:()=>zt,Color:()=>z,Constraint:()=>Et,ConstraintData:()=>Xt,ConstraintTimeline1:()=>kt,CurveTimeline:()=>vt,CurveTimeline1:()=>Nt,DebugUtils:()=>Un,DeformTimeline:()=>je,Downloader:()=>ms,DrawOrder:()=>sn,DrawOrderFolderTimeline:()=>qt,DrawOrderTimeline:()=>It,Event:()=>ae,EventData:()=>ws,EventQueue:()=>Js,EventTimeline:()=>Zt,EventType:()=>Ks,FIRST:()=>$t,FakeTexture:()=>_n,FromProperty:()=>Ct,FromRotate:()=>me,FromScaleX:()=>be,FromScaleY:()=>xe,FromShearY:()=>we,FromX:()=>ge,FromY:()=>pe,HOLD:()=>_t,HOLD_FIRST:()=>Qs,IkConstraint:()=>nn,IkConstraintData:()=>Wt,IkConstraintPose:()=>oe,IkConstraintTimeline:()=>Ke,Inherit:()=>ne,InheritTimeline:()=>$e,IntSet:()=>Nn,Interpolation:()=>Lt,MathUtils:()=>D,MeshAttachment:()=>yt,PathAttachment:()=>ee,PathConstraint:()=>rn,PathConstraintData:()=>Gt,PathConstraintMixTimeline:()=>es,PathConstraintPose:()=>le,PathConstraintPositionTimeline:()=>Ze,PathConstraintSpacingTimeline:()=>ts,Physics:()=>an,PhysicsConstraint:()=>As,PhysicsConstraintDampingTimeline:()=>is,PhysicsConstraintData:()=>Ht,PhysicsConstraintGravityTimeline:()=>os,PhysicsConstraintInertiaTimeline:()=>ss,PhysicsConstraintMassTimeline:()=>rs,PhysicsConstraintMixTimeline:()=>ls,PhysicsConstraintPose:()=>ce,PhysicsConstraintResetTimeline:()=>cs,PhysicsConstraintStrengthTimeline:()=>ns,PhysicsConstraintTimeline:()=>pt,PhysicsConstraintWindTimeline:()=>as,PointAttachment:()=>en,Pool:()=>Bt,Posed:()=>bs,PosedActive:()=>xs,PosedData:()=>se,PositionMode:()=>vs,Pow:()=>Us,PowOut:()=>Dn,Property:()=>zs,RETAIN:()=>us,RGB2Timeline:()=>He,RGBA2Timeline:()=>Ge,RGBATimeline:()=>_e,RGBTimeline:()=>ze,RegionAttachment:()=>j,RotateMode:()=>Ss,RotateTimeline:()=>Dt,SETUP:()=>fs,SUBSEQUENT:()=>te,ScaleTimeline:()=>Be,ScaleXTimeline:()=>Oe,ScaleYMode:()=>ys,ScaleYTimeline:()=>Ne,Sequence:()=>Ot,SequenceMode:()=>Ee,SequenceModeValues:()=>Xe,SequenceTimeline:()=>Je,ShearTimeline:()=>De,ShearXTimeline:()=>Ue,ShearYTimeline:()=>qe,Skeleton:()=>ln,SkeletonBinary:()=>Jn,SkeletonBounds:()=>Bi,SkeletonClipping:()=>gn,SkeletonData:()=>Is,SkeletonJson:()=>Oi,SkeletonRenderer:()=>_i,SkeletonRendererCore:()=>Di,Skin:()=>fe,SkinEntry:()=>Cs,Slider:()=>cn,SliderData:()=>St,SliderMixTimeline:()=>ds,SliderPose:()=>de,SliderTimeline:()=>hs,Slot:()=>on,SlotCurveTimeline:()=>Ut,SlotData:()=>Ms,SlotPose:()=>he,SpacingMode:()=>Ts,StringSet:()=>Ce,Texture:()=>Pe,TextureAtlas:()=>Fe,TextureAtlasPage:()=>_s,TextureAtlasRegion:()=>Ye,TextureFilter:()=>Jt,TextureRegion:()=>$s,TextureWrap:()=>qs,TimeKeeper:()=>qn,Timeline:()=>Z,ToProperty:()=>Mt,ToRotate:()=>Fs,ToScaleX:()=>Es,ToScaleY:()=>Xs,ToShearY:()=>Vs,ToX:()=>Ys,ToY:()=>ks,TrackEntry:()=>js,TransformConstraint:()=>hn,TransformConstraintData:()=>J,TransformConstraintPose:()=>ue,TransformConstraintTimeline:()=>Qe,TranslateTimeline:()=>Ve,TranslateXTimeline:()=>Re,TranslateYTimeline:()=>Le,Triangulator:()=>mn,Utils:()=>R,Vector2:()=>Me,VertexAttachment:()=>wt,WindowedMean:()=>$n,isBoneTimeline:()=>Gs,isConstraintTimeline:()=>Hs,isSlotTimeline:()=>Ws});var Nn=class{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ce=class{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,n=t.length;s<n;s++)this.add(t[s]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},z=class Pt{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Pt(1,1,1,1);static RED=new Pt(1,0,0,1);static GREEN=new Pt(0,1,0,1);static BLUE=new Pt(0,0,1,1);static MAGENTA=new Pt(1,0,1,1);set(e,s,n,i){return this.r=e,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,n,i){return this.r+=e,this.g+=s,this.b+=n,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${e(this.r)}${e(this.g)}${e(this.b)}`}static fromString(e,s=new Pt){return s.setFromString(e)}},D=class ft{static PI=3.1415927;static PI2=ft.PI*2;static invPI2=1/ft.PI2;static radiansToDegrees=180/ft.PI;static radDeg=ft.radiansToDegrees;static degreesToRadians=ft.PI/180;static degRad=ft.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*ft.degRad)}static sinDeg(e){return Math.sin(e*ft.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ft.radDeg}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){const s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ft.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,n){const i=Math.random(),r=s-e;return i<=(n-e)/r?e+Math.sqrt(i*r*(n-e)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Lt=class Vt{static linear=new class extends Vt{applyInternal(e){return e}};static smooth=new class extends Vt{applyInternal(e){return e*e*(3-2*e)}};static slowFast=new class extends Vt{applyInternal(e){return e*e}};static fastSlow=new class extends Vt{applyInternal(e){return(e-1)*(e-1)*-1+1}};static circle=new class extends Vt{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}};apply(e,s,n){return s===void 0||n===void 0?this.applyInternal(e):e+(s-e)*this.applyInternal(n)}},Us=class extends Lt{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}},Dn=class extends Us{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},R=class Rt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,n,i,r){for(let c=s,l=i;c<s+r;c++,l++)n[l]=e[c]}static arrayFill(e,s,n,i){for(let r=s;r<n;r++)e[r]=i}static setArraySize(e,s,n=0){const i=e.length;if(i===s)return e;if(e.length=s,i<s)for(let r=i;r<s;r++)e[r]=n;return e}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:Rt.setArraySize(e,s,n)}static newArray(e,s){const n=[];for(let i=0;i<e;i++)n[i]=s;return n}static newFloatArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(e){return Rt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Rt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,s,n=!0){for(let i=0;i<e.length;i++)if(e[i]===s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Un=class{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Bt=class{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset?.(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Me=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}},qn=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},$n=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Pe=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Jt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Jt||{}),qs=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(qs||{}),$s=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},_n=class extends Pe{setFilters(t,e){}setWraps(t,e){}dispose(){}},Fe=class{pages=[];regions=[];constructor(t){const e=new zn(t),s=new Array(4),n={};n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.format=()=>{},n.filter=a=>{a.minFilter=R.enumValue(Jt,s[1]),a.magFilter=R.enumValue(Jt,s[2])},n.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},n.pma=a=>{a.pma=s[1]==="true"};var i={};i.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},i.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},i.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},i.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},i.rotate=a=>{const h=s[1];h==="true"?a.degrees=90:h!=="false"&&(a.degrees=parseInt(h))},i.index=a=>{a.index=parseInt(s[1])};let r=e.readLine();for(;r&&r.trim().length===0;)r=e.readLine();for(;!(!r||r.trim().length===0||e.readEntry(s,r)===0);)r=e.readLine();let c=null,l=null,o=null;for(;r!==null;)if(r.trim().length===0)c=null,r=e.readLine();else if(c){const a=new Ye(c,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{l||(l=[]),o||(o=[]),l.push(s[0]);const f=[];for(let m=0;m<h;m++)f.push(parseInt(s[m+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),l&&l.length>0&&o&&o.length>0&&(a.names=l,a.values=o,l=null,o=null),a.u=a.x/c.width,a.v=a.y/c.height,a.degrees===90?(a.u2=(a.x+a.height)/c.width,a.v2=(a.y+a.width)/c.height):(a.u2=(a.x+a.width)/c.width,a.v2=(a.y+a.height)/c.height),this.regions.push(a)}else{for(c=new _s(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(c)}this.pages.push(c)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name===t)return this.regions[e];return null}setTextures(t,e=""){for(const s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},zn=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length===0))return 0;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=e.indexOf(",",i);if(r===-1)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},_s=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}},Ye=class extends $s{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},ke=class xn{static empty=[];name;timelineAttachment;timelineSlots=xn.empty;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,s,n){let i=e[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,c=this.timelineSlots.length;r<c;r++){if(i=e[this.timelineSlots[r]],!i.bone.isActive())continue;const l=(n?i.getAppliedPose():i.getPose()).getAttachment();if(l!=null&&l.timelineAttachment===this)return!0}return!1}},wt=class wn extends ke{static nextID=0;id=wn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,c,l){i=c+(i>>1)*l;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,b=u.a,x=u.b,w=u.c,v=u.d;for(let y=n,T=c;T<i;y+=2,T+=l){const S=a[y],A=a[y+1];r[T]=S*b+A*x+p,r[T+1]=S*w+A*v+g}return}let d=0,f=0;for(let u=0;u<n;u+=2){const p=h[d];d+=p+1,f+=p}const m=e.bones;if(o.length===0)for(let u=c,p=f*3;u<i;u+=l){let g=0,b=0,x=h[d++];for(x+=d;d<x;d++,p+=3){const w=m[h[d]].appliedPose,v=a[p],y=a[p+1],T=a[p+2];g+=(v*w.a+y*w.b+w.worldX)*T,b+=(v*w.c+y*w.d+w.worldY)*T}r[u]=g,r[u+1]=b}else{const u=o;for(let p=c,g=f*3,b=f<<1;p<i;p+=l){let x=0,w=0,v=h[d++];for(v+=d;d<v;d++,g+=3,b+=2){const y=m[h[d]].appliedPose,T=a[g]+u[b],S=a[g+1]+u[b+1],A=a[g+2];x+=(T*y.a+S*y.b+y.worldX)*A,w+=(T*y.c+S*y.d+y.worldY)*A}r[p]=x,r[p+1]=w}}}copyTo(e){this.bones?(e.bones=[],R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment,e.timelineSlots=this.timelineSlots}},yt=class Ls extends wt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new z(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new z(0,0,0,0);constructor(e,s){super(e),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const e=new Ls(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){const e=new Ls(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,s,n){if(!e)throw new Error("Region not set.");const i=n.length;let r=e.u,c=e.v,l=0,o=0;if(e instanceof Ye){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,c-=(e.originalWidth-e.offsetX-e.width)/d,l=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*l,n[f+1]=c+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,c-=e.offsetY/d,l=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*l,n[f+1]=c+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,c-=e.offsetX/d,l=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*l,n[f+1]=c+s[f]*o;return;default:r-=e.offsetX/h,c-=(e.originalHeight-e.offsetY-e.height)/d,l=e.originalWidth/h,o=e.originalHeight/d}}else e?(l=e.u2-r,o=e.v2-c):(r=c=0,l=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*l,n[a+1]=c+s[a+1]*o}},j=class yn extends ke{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new z(1,1,1,1);tempColor=new z(1,1,1,1);constructor(e,s){super(e),this.sequence=s}copy(){const e=new yn(this.name,this.sequence.copy());return e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,e.color.setFromColor(this.color),e}computeWorldVertices(e,s,n,i,r){const c=e.bone.appliedPose,l=c.worldX,o=c.worldY,a=c.a,h=c.b,d=c.c,f=c.d;let m=s[0],u=s[1];n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o,i+=r,m=s[2],u=s[3],n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o,i+=r,m=s[4],u=s[5],n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o,i+=r,m=s[6],u=s[7],n[i]=m*a+u*h+l,n[i+1]=m*d+u*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,c,l,o,a,h){if(!e)throw new Error("Region not set.");const d=l/e.originalWidth*i,f=o/e.originalHeight*r,m=-l/2*i+e.offsetX*d,u=-o/2*r+e.offsetY*f,p=m+e.width*d,g=u+e.height*f,b=c*D.degRad,x=Math.cos(b),w=Math.sin(b),v=m*x+s,y=m*w,T=u*x+n,S=u*w,A=p*x+s,I=p*w,M=g*x+n,P=g*w;a[0]=v-S,a[1]=T+y,a[2]=v-P,a[3]=M+y,a[4]=A-P,a[5]=M+I,a[6]=A-S,a[7]=T+I,e==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.v2))}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},Ot=class ve{static _nextID=0;id=ve.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(e,s){this.regions=new Array(e),this.pathSuffix=s}copy(){const e=this.regions.length,s=new ve(e,this.pathSuffix);if(R.arrayCopy(this.regions,0,s.regions,0,e),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const n=this.uvs[0].length;s.uvs=[];for(let i=0;i<e;i++)s.uvs[i]=R.newFloatArray(n),R.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<e;n++)s.offsets[n]=[],R.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(e){const s=this.regions.length;if(e instanceof j){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=R.newFloatArray(8),this.offsets[n]=[],j.computeUVs(this.regions[n],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[n],this.uvs[n])}else if(e instanceof yt){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=R.newFloatArray(n.length),yt.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(e){let s=e.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,s){if(!this.pathSuffix)return e;let n=e;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return ve._nextID++}},Ee=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(Ee||{}),Xe=[0,1,2,3,4,5,6],Kt=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new Ce,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=t;for(let i=0;i<e;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),Gs(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,n,i,r,c,l,o,a){if(!t)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const h=this.timelines;for(let d=0,f=h.length;d<f;d++)h[d].apply(t,e,s,i,r,c,l,o,a)}},zs=(t=>(t[t.rotate=0]="rotate",t[t.x=1]="x",t[t.y=2]="y",t[t.scaleX=3]="scaleX",t[t.scaleY=4]="scaleY",t[t.shearX=5]="shearX",t[t.shearY=6]="shearY",t[t.inherit=7]="inherit",t[t.rgb=8]="rgb",t[t.alpha=9]="alpha",t[t.rgb2=10]="rgb2",t[t.attachment=11]="attachment",t[t.deform=12]="deform",t[t.event=13]="event",t[t.drawOrder=14]="drawOrder",t[t.ikConstraint=15]="ikConstraint",t[t.transformConstraint=16]="transformConstraint",t[t.pathConstraintPosition=17]="pathConstraintPosition",t[t.pathConstraintSpacing=18]="pathConstraintSpacing",t[t.pathConstraintMix=19]="pathConstraintMix",t[t.physicsConstraintInertia=20]="physicsConstraintInertia",t[t.physicsConstraintStrength=21]="physicsConstraintStrength",t[t.physicsConstraintDamping=22]="physicsConstraintDamping",t[t.physicsConstraintMass=23]="physicsConstraintMass",t[t.physicsConstraintWind=24]="physicsConstraintWind",t[t.physicsConstraintGravity=25]="physicsConstraintGravity",t[t.physicsConstraintMix=26]="physicsConstraintMix",t[t.physicsConstraintReset=27]="physicsConstraintReset",t[t.sequence=28]="sequence",t[t.sliderTime=29]="sliderTime",t[t.sliderMix=30]="sliderMix",t))(zs||{}),Z=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=R.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(t,e,s=1){const n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}};function Ws(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var vt=class extends Z{curves;constructor(t,e,...s){super(t,...s),this.curves=R.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=R.newFloatArray(e);R.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,n,i,r,c,l,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const m=(n-r*2+l)*.03,u=(i-c*2+o)*.03,p=((r-l)*3-n+a)*.006,g=((c-o)*3-i+h)*.006;let b=m*2+p,x=u*2+g,w=(r-n)*.3+m+p*.16666667,v=(c-i)*.3+u+g*.16666667,y=n+w,T=i+v;for(let S=f+18;f<S;f+=2)d[f]=y,d[f+1]=T,w+=b,v+=x,b+=p,x+=g,y+=w,T+=v}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const o=this.frames[e],a=this.frames[e+s];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const o=i[n-2],a=i[n-1];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}e+=this.getFrameEntries();const c=i[r-2],l=i[r-1];return l+(t-c)/(this.frames[e]-c)*(this.frames[e+s]-l)}},Nt=class extends vt{constructor(t,e,s){super(t,e,s)}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=e[s],r=e[s+1];return r+(t-i)/(e[s+2]-i)*(e[s+2+1]-r)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const c=this.getCurveValue(t);return s?r+c*e:i+(n?c:c+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,c){return c===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,c)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const c=this.getCurveValue(t);return s?r+(n?c:c-r)*e:i+(n?c:c-i)*e}getAbsoluteValue2(t,e,s,n,i,r,c){return t<this.frames[0]?s?r:i:s?r+(n?c:c-r)*e:i+(n?c:c-i)*e}getScaleValue(t,e,s,n,i,r,c){if(t<this.frames[0])return s?c:r;const l=this.getCurveValue(t)*c;if(e===1&&!n)return l;let o=s?c:r;return n?o+(l-c)*e:i?o+(Math.abs(l)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(l),o+(l-o)*e)}};function Gs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var Tt=class extends Nt{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,c,l,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,c,l)}},Qt=class extends vt{boneIndex;constructor(t,e,s,n,i){super(t,e,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}apply(t,e,s,n,i,r,c,l,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,c,l)}},Dt=class extends Tt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,c){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Ve=class extends Qt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Z.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];o=l[h+1],a=l[h+2];const m=(s-f)/(l[h+3]-f);o+=(l[h+3+1]-o)*m,a+=(l[h+3+2]-a)*m;break}case 1:o=l[h+1],a=l[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.x=e.x+o*n,t.y=e.y+a*n):r?(t.x+=o*n,t.y+=a*n):(t.x+=(e.x+o-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Re=class extends Tt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,c){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Le=class extends Tt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,c){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Be=class extends Qt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Z.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];o=l[h+1],a=l[h+2];const m=(s-f)/(l[h+3]-f);o+=(l[h+3+1]-o)*m,a+=(l[h+3+2]-a)*m;break}case 1:o=l[h+1],a=l[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(o*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=o,t.scaleY=a;else{let f=0,m=0;i?(f=e.scaleX,m=e.scaleY):(f=t.scaleX,m=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=m+(a-e.scaleY)*n):c?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=m+(Math.abs(a)*Math.sign(m)-m)*n):(f=Math.abs(f)*Math.sign(o),m=Math.abs(m)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=m+(a-m)*n)}}},Oe=class extends Tt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,c){t.scaleX=this.getScaleValue(s,n,i,r,c,t.scaleX,e.scaleX)}},Ne=class extends Tt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,c){t.scaleY=this.getScaleValue(s,n,i,r,c,t.scaleY,e.scaleY)}},De=class extends Qt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Z.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];o=l[h+1],a=l[h+2];const m=(s-f)/(l[h+3]-f);o+=(l[h+3+1]-o)*m,a+=(l[h+3+2]-a)*m;break}case 1:o=l[h+1],a=l[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.shearX=e.shearX+o*n,t.shearY=e.shearY+a*n):r?(t.shearX+=o*n,t.shearY+=a*n):(t.shearX+=(e.shearX+o-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},Ue=class extends Tt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,c){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},qe=class extends Tt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,c){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},$e=class extends Z{boneIndex;constructor(t,e){super(t,`7|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,n,i,r,c,l,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(l)r&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Z.search(d,s,2)+1]}}},Ut=class extends vt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,c,l,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,c)}},_e=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,n,i,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r}apply1(t,e,s,n,i,r){const c=e.color,l=this.frames;if(s<l[0]){i&&c.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Z.search(l,s,5),m=this.curves[f/5];switch(m){case 0:{const u=l[f];o=l[f+1],a=l[f+2],h=l[f+3],d=l[f+4];const p=(s-u)/(l[f+5]-u);o+=(l[f+5+1]-o)*p,a+=(l[f+5+2]-a)*p,h+=(l[f+5+3]-h)*p,d+=(l[f+5+4]-d)*p;break}case 1:o=l[f+1],a=l[f+2],h=l[f+3],d=l[f+4];break;default:o=this.getBezierValue(s,f,1,m-2),a=this.getBezierValue(s,f,2,m+18-2),h=this.getBezierValue(s,f,3,m+18*2-2),d=this.getBezierValue(s,f,4,m+18*3-2)}if(n===1)c.set(o,a,h,d);else if(i){const u=t.data.setupPose.color;c.set(u.r+(o-u.r)*n,u.g+(a-u.g)*n,u.b+(h-u.b)*n,u.a+(d-u.a)*n)}else c.add((o-c.r)*n,(a-c.g)*n,(h-c.b)*n,(d-c.a)*n)}},ze=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(t,e,s,n,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i}apply1(t,e,s,n,i,r){const c=e.color;let l=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const m=t.data.setupPose.color;c.r=m.r,c.g=m.g,c.b=m.b}return}const d=Z.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const m=h[d];l=h[d+1],o=h[d+2],a=h[d+3];const u=(s-m)/(h[d+4]-m);l+=(h[d+4+1]-l)*u,o+=(h[d+4+2]-o)*u,a+=(h[d+4+3]-a)*u;break}case 1:l=h[d+1],o=h[d+2],a=h[d+3];break;default:l=this.getBezierValue(s,d,1,f-2),o=this.getBezierValue(s,d,2,f+18-2),a=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const m=t.data.setupPose.color;l=m.r+(l-m.r)*n,o=m.g+(o-m.g)*n,a=m.b+(a-m.b)*n}else l=c.r+(l-c.r)*n,o=c.g+(o-c.g)*n,a=c.b+(a-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=o<0?0:o>1?1:o,c.b=a<0?0:a>1?1:a}},We=class extends Nt{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,c,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(o?a.appliedPose:a.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const m=a.data.setupPose.color;d=m.a+(d-m.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},Ge=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,c,l,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=c,this.frames[t+6]=l,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const c=e.color,l=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const x=t.data.setupPose;c.setFromColor(x.color);const w=x.darkColor;l.r=w.r,l.g=w.g,l.b=w.b}return}let f=0,m=0,u=0,p=0;const g=Z.search(d,s,8),b=this.curves[g>>3];switch(b){case 0:{const x=d[g];f=d[g+1],m=d[g+2],u=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];const w=(s-x)/(d[g+8]-x);f+=(d[g+8+1]-f)*w,m+=(d[g+8+2]-m)*w,u+=(d[g+8+3]-u)*w,p+=(d[g+8+4]-p)*w,o+=(d[g+8+5]-o)*w,a+=(d[g+8+6]-a)*w,h+=(d[g+8+7]-h)*w;break}case 1:f=d[g+1],m=d[g+2],u=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];break;default:f=this.getBezierValue(s,g,1,b-2),m=this.getBezierValue(s,g,2,b+18-2),u=this.getBezierValue(s,g,3,b+18*2-2),p=this.getBezierValue(s,g,4,b+18*3-2),o=this.getBezierValue(s,g,5,b+18*4-2),a=this.getBezierValue(s,g,6,b+18*5-2),h=this.getBezierValue(s,g,7,b+18*6-2)}if(n===1)c.set(f,m,u,p);else if(i){const x=t.data.setupPose;let w=x.color;c.set(w.r+(f-w.r)*n,w.g+(m-w.g)*n,w.b+(u-w.b)*n,w.a+(p-w.a)*n),w=x.darkColor,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else c.add((f-c.r)*n,(m-c.g)*n,(u-c.b)*n,(p-c.a)*n),o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n;l.r=o<0?0:o>1?1:o,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h}},He=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,c,l){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=c,this.frames[t+6]=l}apply1(t,e,s,n,i,r){const c=e.color,l=e.darkColor;let o=0,a=0,h=0,d=0,f=0,m=0;const u=this.frames;if(s<u[0]){if(i){const b=t.data.setupPose,x=b.color,w=b.darkColor;c.r=x.r,c.g=x.g,c.b=x.b,l.r=w.r,l.g=w.g,l.b=w.b}return}const p=Z.search(u,s,7),g=this.curves[p/7];switch(g){case 0:{const b=u[p];o=u[p+1],a=u[p+2],h=u[p+3],d=u[p+4],f=u[p+5],m=u[p+6];const x=(s-b)/(u[p+7]-b);o+=(u[p+7+1]-o)*x,a+=(u[p+7+2]-a)*x,h+=(u[p+7+3]-h)*x,d+=(u[p+7+4]-d)*x,f+=(u[p+7+5]-f)*x,m+=(u[p+7+6]-m)*x;break}case 1:o=u[p+1],a=u[p+2],h=u[p+3],d=u[p+4],f=u[p+5],m=u[p+6];break;default:o=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),f=this.getBezierValue(s,p,5,g+18*4-2),m=this.getBezierValue(s,p,6,g+18*5-2)}if(n!==1)if(i){const b=t.data.setupPose;let x=b.color;o=x.r+(o-x.r)*n,a=x.g+(a-x.g)*n,h=x.b+(h-x.b)*n,x=b.darkColor,d=x.r+(d-x.r)*n,f=x.g+(f-x.g)*n,m=x.b+(m-x.b)*n}else o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n,d=l.r+(d-l.r)*n,f=l.g+(f-l.g)*n,m=l.b+(m-l.b)*n;c.r=o<0?0:o>1?1:o,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h,l.r=d<0?0:d>1?1:d,l.g=f<0?0:f>1?1:f,l.b=m<0?0:m>1?1:m}},Yt=class extends Z{slotIndex=0;attachmentNames;constructor(t,e){super(t,`11|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,i,r,c,l,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;l||s<this.frames[0]?r&&this.setAttachment(t,h,a.data.attachmentName):this.setAttachment(t,h,this.attachmentNames[Z.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},je=class extends vt{slotIndex;attachment;vertices;constructor(t,e,s,n){super(t,e,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,n,i,r,c,l,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const m=(n-r*2+l)*.03,u=o*.03-c*.06,p=((r-l)*3-n+a)*.006,g=(c-o+.33333333)*.018;let b=m*2+p,x=u*2+g,w=(r-n)*.3+m+p*.16666667,v=c*.3+u+g*.16666667,y=n+w,T=v;for(let S=f+18;f<S;f+=2)d[f]=y,d[f+1]=T,w+=b,v+=x,b+=p,x+=g,y+=w,T+=v}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const l=this.frames[e];return(t-l)/(this.frames[e+this.getFrameEntries()]-l)}case 1:return 0}if(n-=2,s[n]>t){const l=this.frames[e];return s[n+1]*(t-l)/(s[n]-l)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const l=s[n-2],o=s[n-1];return o+(t-l)/(s[n]-l)*(s[n+1]-o)}const r=s[i-2],c=s[i-1];return c+(1-c)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,c,l,o){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,o))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],o,r);for(const g of h)this.applyBeforeFirst(a[g],o,r);return}let f,m,u;if(s>=d[d.length-1])u=0,f=this.vertices[d.length-1],m=null;else{const g=Z.search(d,s);u=this.getCurvePercent(s,g),f=this.vertices[g],m=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],o,f,m,u,p,i,r,c);for(const g of h)this.applyToSlot(a[g],o,f,m,u,p,i,r,c)}applyToSlot(t,e,s,n,i,r,c,l,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const h=a.attachment,d=a.deform;if(d.length===0&&(l=!0),d.length=r,n===null)if(c===1)if(o&&!l)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let m=0;m<r;m++)d[m]+=s[m]-f[m]}else R.arrayCopy(s,0,d,0,r);else if(l)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*c;else{const f=h.vertices;for(let m=0;m<r;m++){const u=f[m];d[m]=u+(s[m]-u)*c}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*c;else{const f=h.vertices;for(let m=0;m<r;m++)d[m]+=(s[m]-f[m])*c}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*c;else if(c===1)if(o&&!l)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]+=m+(n[f]-m)*i}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m];d[m]+=u+(n[m]-u)*i-f[m]}}else if(i===0)R.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const m=s[f];d[f]=m+(n[f]-m)*i}else if(l)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]=(m+(n[f]-m)*i)*c}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m],p=f[m];d[m]=p+(u+(n[m]-u)*i-p)*c}}else if(o)if(h.bones)for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(n[f]-m)*i)*c}else{const f=h.vertices;for(let m=0;m<r;m++){const u=s[m];d[m]+=(u+(n[m]-u)*i-f[m])*c}}else for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(n[f]-m)*i-d[f])*c}}applyBeforeFirst(t,e,s){if(!t.bone.active)return;const n=e?t.appliedPose:t.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},Je=class At extends Z{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`28|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return At.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const c=this.frames;e*=At.ENTRIES,c[e]=s,c[e+At.MODE]=n|i<<4,c[e+At.DELAY]=r}apply(e,s,n,i,r,c,l,o,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,f=this.frames;if(o||n<f[0]){if(c){this.setupPose(h[this.slotIndex],a);for(const b of d)this.setupPose(h[b],a)}return}const m=Z.search(f,n,At.ENTRIES),u=f[m],p=f[m+At.MODE],g=f[m+At.DELAY];this.applyToSlot(h[this.slotIndex],a,n,u,p,g);for(const b of d)this.applyToSlot(h[b],a,n,u,p,g)}setupPose(e,s){if(!e.bone.active)return;const n=s?e.appliedPose:e.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(e,s,n,i,r,c){if(!e.bone.active)return;const l=s?e.appliedPose:e.pose;if(l.attachment===null||l.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=l.attachment.sequence.regions.length;const h=Xe[r&15];if(h!==0)switch(o+=(n-i)/c+1e-5|0,h){case 1:o=Math.min(a-1,o);break;case 2:o%=a;break;case 3:{const d=(a<<1)-2;o=d===0?0:o%d,o>=a&&(o=d-o);break}case 4:o=Math.max(a-1-o,0);break;case 5:o=a-1-o%a;break;case 6:{const d=(a<<1)-2;o=d===0?0:(o+a-1)%d,o>=a&&(o=d-o)}}l.sequenceIndex=o}},Zt=class vn extends Z{static propertyIds=["13"];events;constructor(e){super(e,...vn.propertyIds),this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,n,i,r,c,l,o,a){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,!1,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let f=0;if(s<h[0])f=0;else{f=Z.search(h,s)+1;const m=h[f];for(;f>0&&h[f-1]===m;)f--}for(;f<d&&n>=h[f];f++)i.push(this.events[f])}},It=class Bs extends Z{static propertyID="14";static propertyIds=[Bs.propertyID];drawOrders;constructor(e){super(e,...Bs.propertyIds),this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,c,l,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){c&&R.arrayCopy(d,0,h,0,e.slots.length);return}const f=this.drawOrders[Z.search(this.frames,n)];if(!f)R.arrayCopy(d,0,h,0,e.slots.length);else for(let m=0,u=f.length;m<u;m++)h[m]=d[f[m]]}},qt=class Tn extends Z{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...Tn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(e),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(e){const s=e.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`d${e[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,c,l,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])c&&this.setup(h,d);else{const f=this.drawOrders[Z.search(this.frames,n)];if(!f)this.setup(h,d);else{const m=this.inFolder,u=this.slots;for(let p=0,g=0,b=u.length;!(m[h[p].data.index]&&(h[p]=d[u[f[g]]],++g===b));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,c=0,l=i.length;!(n[e[r].data.index]&&(e[r]=s[i[c]],++c===l));r++);}};function Hs(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Ke=class extends vt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,c){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r?1:0,this.frames[t+5]=c?1:0}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;h.mix=b.mix,h.softness=b.softness,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch}return}let f=0,m=0;const u=Z.search(d,s,6),p=this.curves[u/6];switch(p){case 0:{const b=d[u];f=d[u+1],m=d[u+2];const x=(s-b)/(d[u+6]-b);f+=(d[u+6+1]-f)*x,m+=(d[u+6+2]-m)*x;break}case 1:f=d[u+1],m=d[u+2];break;default:f=this.getBezierValue(s,u,1,p-2),m=this.getBezierValue(s,u,2,p+18-2)}const g=r?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(m-g.softness)*i,l?r&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[u+3],h.compress=d[u+4]!==0,h.stretch=d[u+5]!==0)}},Qe=class extends vt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,c,l){const o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=n,o[t+3]=i,o[t+4]=r,o[t+5]=c,o[t+6]=l}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.data.setupPose;h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY}return}let f,m,u,p,g,b;const x=Z.search(d,s,7),w=this.curves[x/7];switch(w){case 0:{const y=d[x];f=d[x+1],m=d[x+2],u=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];const T=(s-y)/(d[x+7]-y);f+=(d[x+7+1]-f)*T,m+=(d[x+7+2]-m)*T,u+=(d[x+7+3]-u)*T,p+=(d[x+7+4]-p)*T,g+=(d[x+7+5]-g)*T,b+=(d[x+7+6]-b)*T;break}case 1:f=d[x+1],m=d[x+2],u=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];break;default:f=this.getBezierValue(s,x,1,w-2),m=this.getBezierValue(s,x,2,w+18-2),u=this.getBezierValue(s,x,3,w+18*2-2),p=this.getBezierValue(s,x,4,w+18*3-2),g=this.getBezierValue(s,x,5,w+18*4-2),b=this.getBezierValue(s,x,6,w+18*5-2)}const v=r?a.data.setupPose:h;c?(h.mixRotate=v.mixRotate+f*i,h.mixX=v.mixX+m*i,h.mixY=v.mixY+u*i,h.mixScaleX=v.mixScaleX+p*i,h.mixScaleY=v.mixScaleY+g*i,h.mixShearY=v.mixShearY+b*i):(h.mixRotate=v.mixRotate+(f-v.mixRotate)*i,h.mixX=v.mixX+(m-v.mixX)*i,h.mixY=v.mixY+(u-v.mixY)*i,h.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*i,h.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*i,h.mixShearY=v.mixShearY+(b-v.mixShearY)*i)}},kt=class extends Nt{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Ze=class extends kt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,c,h.position,a.data.setupPose.position)}}},ts=class extends kt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},es=class extends vt{constraintIndex;constructor(t,e,s){super(t,e,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){const r=this.frames;t<<=2,r[t]=e,r[t+1]=s,r[t+2]=n,r[t+3]=i}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.data.setupPose;h.mixRotate=x.mixRotate,h.mixX=x.mixX,h.mixY=x.mixY}return}let f,m,u;const p=Z.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const x=d[p];f=d[p+1],m=d[p+2],u=d[p+3];const w=(s-x)/(d[p+4]-x);f+=(d[p+4+1]-f)*w,m+=(d[p+4+2]-m)*w,u+=(d[p+4+3]-u)*w;break}case 1:f=d[p+1],m=d[p+2],u=d[p+3];break;default:f=this.getBezierValue(s,p,1,g-2),m=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+18*2-2)}const b=r?a.data.setupPose:h;c?(h.mixRotate=b.mixRotate+f*i,h.mixX=b.mixX+m*i,h.mixY=b.mixY+u*i):(h.mixRotate=b.mixRotate+(f-b.mixRotate)*i,h.mixX=b.mixX+(m-b.mixX)*i,h.mixY=b.mixY+(u-b.mixY)*i)}},pt=class extends kt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,c,l,o){if(c&&!this.additive&&(c=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,h=t.physics;for(const d of h)if(d.active&&this.global(d.data)){const f=o?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,c,this.get(f),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,c,this.get(h),this.get(a.data.setupPose)))}}}},ss=class extends pt{constructor(t,e,s){super(t,e,s,20)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ns=class extends pt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},is=class extends pt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},rs=class extends pt{constructor(t,e,s){super(t,e,s,23)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},as=class extends pt{constructor(t,e,s){super(t,e,s,24),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},os=class extends pt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},ls=class extends pt{constructor(t,e,s){super(t,e,s,26)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},cs=class Sn extends Z{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...Sn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,n,i,r,c,l,o,a){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(e,s,Number.MAX_VALUE,[],r,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[Z.search(d,s)+1]))if(h!=null)h.reset(e);else for(const f of e.physics)f.active&&f.reset(e)}},hs=class extends kt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,c,h.time,a.data.setupPose.time)}}},ds=class extends kt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,c,l,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,c,h.mix,a.data.setupPose.mix)}}},Wn=class Os{static emptyAnimation=new Kt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Js(this);propertyIds=new Ce;animationsChanged=!1;trackEntryPool=new Bt(()=>new js);constructor(e){this.data=e}update(e){e*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n<i;n++){const r=s[n];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let c=e*r.timeScale;if(r.delay>0){if(r.delay-=c,r.delay>0)continue;c=-r.delay,r.delay=0}let l=r.next;if(l){const o=r.trackLast-l.delay;if(o>=0){for(l.delay=0,l.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*l.timeScale,r.trackTime+=c,this.setTrack(n,l,!0);l.mixingFrom;)l.mixTime+=e,l=l.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=c}this.queue.drain()}updateMixingFrom(e,s){const n=e.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(n.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=e),n.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,e.mixTime+=s,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let l=0,o=n.length;l<o;l++){const a=n[l];if(!a||a.delay>0)continue;i=!0;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,e):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,f=a.getAnimationTime(),m=f,u=s;a.reverse&&(m=a.animation.duration-m,u=null);const p=a.animation.timelines,g=p.length;if(l===0&&h===1)for(let b=0;b<g;b++){R.webkit602BugfixHelper(h);const x=p[b];x instanceof Yt?this.applyAttachmentTimeline(x,e,m,!0,!0):x.apply(e,d,m,u,h,!0,!1,!1,!1)}else{const b=a.timelineMode,x=h>=a.alphaAttachmentThreshold,w=a.additive,v=w||a.shortestRotation,y=!v&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const S=p[T],A=(b[T]&$t)!==0;!v&&S instanceof Dt?this.applyRotateTimeline(S,e,m,h,A,a.timelinesRotation,T<<1,y):S instanceof Yt?this.applyAttachmentTimeline(S,e,m,A,x):(R.webkit602BugfixHelper(h),S.apply(e,d,m,u,h,A,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,f),this.queueEvents(a,f),s.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+fs,c=e.slots;for(let l=0,o=e.slots.length;l<o;l++){const a=c[l];if(a.attachmentState===r){const h=a.data.attachmentName;a.pose.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s){const n=e.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=e.mix(),c=n.alpha*i,l=1-r*e.alpha,o=c*(1-r),a=l>0?o/l:c,h=n.animation.timelines,d=h.length,f=n.timelineMode,m=n.timelineHoldMix,u=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,b=g||n.shortestRotation,x=!b&&n.timelinesRotation.length!==d<<1;x&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let v=n.animationLast,y=n.getAnimationTime(),T=y,S=null;n.reverse?T=n.animation.duration-T:r<n.eventThreshold&&(S=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const I=h[A],M=f[A];let P=0;if((M&_t)!==0){const E=m[A];P=E==null?a:a*(1-E.mix())}else{if(!p&&I instanceof It)continue;P=o}n.totalAlpha+=P;const k=(M&$t)!==0;if(!b&&I instanceof Dt)this.applyRotateTimeline(I,s,T,P,k,w,A<<1,x);else if(I instanceof Yt)this.applyAttachmentTimeline(I,s,T,k,u&&P>=n.alphaAttachmentThreshold);else{const E=!p||!(I instanceof It)||!k;I.apply(s,v,T,S,P,k,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,v,y),e.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,s,n,i,r){const c=s.slots[e.slotIndex];if(!c.bone.active||!r&&c.attachmentState===this.unkeyedState+us)return;let l=n<e.frames[0],o=null;if(l||(o=e.attachmentNames[Z.search(e.frames,n)],l=!r&&o==null),l){if(!i)return;o=c.data.attachmentName}c.pose.setAttachment(o==null?null:s.getAttachment(c.data.index,o)),r?c.attachmentState=this.unkeyedState+us:l||(c.attachmentState=this.unkeyedState+fs)}applyRotateTimeline(e,s,n,i,r,c,l,o){if(o&&(c[l]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,f=e.frames;if(n<f[0]){r&&(h.rotation=d.rotation);return}const m=r?d.rotation:h.rotation,u=d.rotation+e.getCurveValue(n);let p=0,g=u-m;if(g-=Math.ceil(g/360-.5)*360,g===0)p=c[l];else{let b=0,x=0;o?(b=0,x=g):(b=c[l],x=c[l+1]);const w=b-b%360;p=g+w;let v=g>=0,y=b>=0;Math.abs(x)<=90&&D.signum(x)!==D.signum(g)&&(Math.abs(b-w)>180?(p+=360*D.signum(b),y=v):w!==0?p-=360*D.signum(b):y=v),y!==v&&(p+=360*D.signum(b)),c[l]=p}c[l+1]=g,h.rotation=m+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,c=e.reverse;let l=e.trackLast%r;c&&(l=r-l);const o=this.events;let a=0,h=o.length;for(;a<h;a++){const f=o[a];if(f.time<l!==c)break;f.time>=n&&f.time<=i&&this.queue.event(e,f)}let d=!1;if(e.loop)if(r===0)d=!0;else{const f=Math.floor(e.trackTime/r);d=f>0&&f>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const f=o[a];f.time>=n&&f.time<=i&&this.queue.event(e,f)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,c=i-n,l=e.animation.timelines;for(let o=0,a=e.animation.timelines.length;o<a;o++){const h=l[o];if(!(h instanceof Zt))continue;const d=h.events,f=h.frames,m=f.length;if(r>=c){for(let u=0;u<m;u++)if(!(f[u]<c)){if(f[u]>=r)break;this.events.push(d[u])}}else{for(let p=0;p<m&&!(f[p]>=r);p++)this.events.push(d[p]);let u=0;for(;u<m&&!(f[u]>=c);u++);for(;u<m;u++)this.events.push(d[u])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const c=this.trackEntry(e,s,n,r);return this.setTrack(e,c,i),this.queue.drain(),c}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const c=this.trackEntry(e,s,n,r);return r?(r.next=c,c.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-c.mixDuration,0))):(this.setTrack(e,c,!0),this.queue.drain(),i<0&&(i=0)),c.delay=i,c}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Os.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Os.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do this.computeHold(i),i=i.mixingTo;while(i)}}this.propertyIds.clear()}computeHold(e){const s=e.animation.timelines,n=e.animation.timelines.length,i=e.timelineMode;i.length=n;const r=e.timelineHoldMix;r.length=0;const c=this.propertyIds,l=e.additive,o=e.keepHold,a=e.mixingTo;t:for(let h=0;h<n;h++){const d=s[h],f=d.propertyIds,m=c.addAll(f)&&!(d instanceof qt&&c.contains(It.propertyID));if(l&&d.additive){i[h]=m?$t:te;continue}for(let p=e.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(f)){i[h]=te;continue t}let u;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(f))u=m?$t:te;else{u=m?Qs:_t;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(f)){p.mixDuration>0&&(r[h]=p);break}}o&&(u=u&~_t|i[h]&_t),i[h]=u}}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},js=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!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;totalAlpha=0;mixInterpolation=Lt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Lt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Lt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Js=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const c=i[r];c.start&&c.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const c=i[r];c.interrupt&&c.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const c=i[r];c.end&&c.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const c=i[r];c.dispose&&c.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const c=i[r];c.complete&&c.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let c=0;c<i.length;c++){const l=i[c];l.event&&l.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Ks=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(Ks||{}),Gn=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},te=0,$t=1,_t=2,Qs=3,fs=1,us=2,Hn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Zs=class{constructor(t,e="",s=new ms,n=new tn){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,c)=>{const l=`Couldn't load binary ${t}: status ${r}, ${c}`;this.error(s,t,l),i(l)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,c)=>{const l=`Couldn't load JSON ${t}: status ${r}, ${c}`;this.error(s,t,l),i(l)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(o=>{if(o.ok)return o.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(o=>o?createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(o=>{if(o){const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)}});else{const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)},o.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),o.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((c,l)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(o,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),c(a);return}for(const f of a.pages)this.loadTexture(this.texturePath(r,f.name,n),(m,u)=>{d||(f.setTexture(u),--h===0&&(this.success(e,t,a),c(a)))},(m,u)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),l(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),l(h)}},(o,a)=>{const h=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,h),l(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,c)=>{this.downloader.downloadText(t,l=>{try{const o=this.createTextureAtlas(l,i,t);this.success(e,t,o),r(o)}catch(o){const a=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,a),c(a)}},(l,o)=>{const a=`Couldn't load texture atlas ${t}: status ${l}, ${o}`;this.error(s,t,a),c(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
2
+ ${s}`:""}`)}remove(t){t=this.pathPrefix+t;const e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(const t in this.cache.assets){const e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Fe){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,s,n){const i=new Fe(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const c=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+c]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},tn=class Te{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Te.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Te;return Te.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},ms=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!==-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=e.charCodeAt(i);return n}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e===-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(c){this.finish(t,400,JSON.stringify(c))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(c){this.finish(t,400,JSON.stringify(c))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},gs=class An extends wt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new An(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},zt=class In extends wt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new In(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},ee=class Cn extends wt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Cn(this.name);return this.copyTo(e),e.lengths=[],R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},en=class Mn extends wt{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*D.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,c=n*e.c+i*e.d;return D.atan2Deg(c,r)}copy(){const e=new Mn(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},jn=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new j(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new yt(s,i)}newBoundingBoxAttachment(t,e,s){return new gs(s)}newPathAttachment(t,e,s){return new ee(s)}newPointAttachment(t,e,s){return new en(s)}newClippingAttachment(t,e,s){return new zt(s)}},se=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},ps=class Pn extends se{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new ie),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new Pn(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ne=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(ne||{}),ie=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,f=t.scaleY,m=(e+i)*D.degRad,u=(e+90+r)*D.degRad;this.a=Math.cos(m)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(m)*s*f,this.d=Math.sin(u)*n*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const c=this.bone.parent.appliedPose;let l=c.a,o=c.b,a=c.c,h=c.d;switch(this.worldX=l*this.x+o*this.y+c.worldX,this.worldY=a*this.x+h*this.y+c.worldY,this.inherit){case 0:{const d=(e+i)*D.degRad,f=(e+90+r)*D.degRad,m=Math.cos(d)*s,u=Math.cos(f)*n,p=Math.sin(d)*s,g=Math.sin(f)*n;this.a=l*m+o*p,this.b=l*u+o*g,this.c=a*m+h*p,this.d=a*u+h*g;return}case 1:{const d=(e+i)*D.degRad,f=(e+90+r)*D.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(f)*n,this.c=Math.sin(d)*s,this.d=Math.sin(f)*n;break}case 2:{const d=1/t.scaleX,f=1/t.scaleY;l*=d,a*=f;let m=l*l+a*a,u=0;m>1e-4?(m=Math.abs(l*h*f-o*d*a)/m,o=a*m,h=l*m,u=D.atan2Deg(a,l)):(l=0,a=0,u=90-D.atan2Deg(h,o));const p=(e+i-u)*D.degRad,g=(e+r-u+90)*D.degRad,b=Math.cos(p)*s,x=Math.cos(g)*n,w=Math.sin(p)*s,v=Math.sin(g)*n;this.a=l*b-o*w,this.b=l*x-o*v,this.c=a*b+h*w,this.d=a*x+h*v;break}case 3:case 4:{let d=e*D.degRad,f=Math.cos(d),m=Math.sin(d),u=(l*f+o*m)/t.scaleX,p=(a*f+h*m)/t.scaleY,g=Math.sqrt(u*u+p*p);g>1e-5&&(g=1/g),u*=g,p*=g,g=Math.sqrt(u*u+p*p),this.inherit===3&&l*h-o*a<0!=(t.scaleX<0!=t.scaleY<0)&&(g=-g),d=Math.PI/2+Math.atan2(p,u);const b=Math.cos(d)*g,x=Math.sin(d)*g,w=i*D.degRad,v=(90+r)*D.degRad,y=Math.cos(w)*s,T=Math.cos(v)*n,S=Math.sin(w)*s,A=Math.sin(v)*n;this.a=u*y+b*S,this.b=u*T+b*A,this.c=p*y+x*S,this.d=p*T+x*A;break}}this.a*=t.scaleX,this.b*=t.scaleX,this.c*=t.scaleY,this.d*=t.scaleY}updateLocalTransform(t){if(this.local=0,this.world=t._update,!this.bone.parent){this.x=this.worldX-t.x,this.y=this.worldY-t.y;const b=this.a,x=this.b,w=this.c,v=this.d;this.rotation=D.atan2Deg(w,b),this.scaleX=Math.sqrt(b*b+w*w),this.scaleY=Math.sqrt(x*x+v*v),this.shearX=0,this.shearY=D.atan2Deg(b*x+w*v,b*v-x*w);return}const e=this.bone.parent.appliedPose;let s=e.a,n=e.b,i=e.c,r=e.d,c=1/(s*r-n*i),l=r*c,o=n*c,a=i*c,h=s*c;const d=this.worldX-e.worldX,f=this.worldY-e.worldY;this.x=d*l-f*o,this.y=f*h-d*a;let m,u,p,g;if(this.inherit===1)m=this.a,u=this.b,p=this.c,g=this.d;else{switch(this.inherit){case 2:{const b=Math.abs(s*r-n*i)/(s*s+i*i);n=-i*t.scaleX*b/t.scaleY,r=s*t.scaleY*b/t.scaleX,c=1/(s*r-n*i),l=r*c,o=n*c;break}case 3:case 4:{let b=this.rotation*D.degRad,x=Math.cos(b),w=Math.sin(b);s=(s*x+n*w)/t.scaleX,i=(i*x+r*w)/t.scaleY;let v=Math.sqrt(s*s+i*i);v>1e-5&&(v=1/v),s*=v,i*=v,v=Math.sqrt(s*s+i*i),this.inherit===3&&c<0!=(t.scaleX<0!=t.scaleY<0)&&(v=-v),b=D.PI/2+Math.atan2(i,s),n=Math.cos(b)*v,r=Math.sin(b)*v,c=1/(s*r-n*i),l=r*c,o=n*c,a=i*c,h=s*c}}m=l*this.a-o*this.c,u=l*this.b-o*this.d,p=h*this.c-a*this.a,g=h*this.d-a*this.b}if(this.shearX=0,this.scaleX=Math.sqrt(m*m+p*p),this.scaleX>1e-4){const b=m*g-u*p;this.scaleY=b/this.scaleX,this.shearY=-D.atan2Deg(m*u+p*g,b),this.rotation=D.atan2Deg(p,m)}else this.scaleX=0,this.scaleY=Math.sqrt(u*u+g*g),this.shearY=0,this.rotation=90-D.atan2Deg(g,u)}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t._update)}modifyWorld(t){this.local=t,this.world=t,this.resetWorld(t)}resetWorld(t){const e=this.bone.children;for(let s=0,n=e.length;s<n;s++){const i=e[s].appliedPose;i.world===t&&(i.world=0,i.local=0,i.resetWorld(t))}}getWorldRotationX(){return D.atan2Deg(this.c,this.a)}getWorldRotationY(){return D.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=D.degRad;const e=Math.sin(t),s=Math.cos(t);return D.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*D.degRad;const e=Math.sin(t),s=Math.cos(t);return D.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=D.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},bs=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},xs=class extends bs{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},re=class Fn extends xs{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new ie,new ie),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Fn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends xs{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},sn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,R.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,R.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends se{constructor(t,e){super(t,e)}},ae=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},ws=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new ae(-1,this);constructor(t){this.name=t}},oe=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},Wt=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new oe)}create(t){return new nn(this,t)}},ys=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(ys||{}),nn=class Ft extends Et{bones;target;constructor(e,s){if(super(e,new oe,new oe),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Ft(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Ft.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Ft.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,c,l,o,a,h){typeof n=="number"?Ft.apply1(e,s,n,i,r,c,l,o):Ft.apply2(e,s,n,i,r,c,l,o,a,h)}static apply1(e,s,n,i,r,c,l,o){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,f=a.c,m=a.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*D.signum(e.scaleX),g=(i-s.worldY)*D.signum(e.scaleY);break;case 2:{const b=Math.abs(h*m-d*f)/Math.max(1e-4,h*h+f*f),x=h/e.scaleX,w=f/e.scaleY;d=-w*b*e.scaleX,m=x*b*e.scaleY,u+=D.atan2Deg(w,x)}default:{const b=n-a.worldX,x=i-a.worldY,w=h*m-d*f;Math.abs(w)<=1e-4?(p=0,g=0):(p=(b*m-x*d)/w-s.x,g=(x*h-b*f)/w-s.y)}}if(u+=D.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360),s.rotation+=u*o,r||c){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const b=s.bone.data.length*s.scaleX;if(b>1e-4){const x=p*p+g*g;if(r&&x<b*b||c&&x>b*b){const w=(Math.sqrt(x)/b-1)*o+1;switch(s.scaleX*=w,l){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w}}}}}static apply2(e,s,n,i,r,c,l,o,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,f=s.y,m=s.scaleX,u=s.scaleY,p=n.scaleX,g=0,b=0,x=0;m<0?(m=-m,g=180,x=-1):(g=0,x=1),u<0&&(u=-u,x=-x),p<0?(p=-p,b=180):b=0;let w=0,v=0,y=s.a,T=s.b,S=s.c,A=s.d;const I=Math.abs(m-u)<=1e-4;!I||l?(n.y=0,w=y*n.x+s.worldX,v=S*n.x+s.worldY):(w=y*n.x+T*n.y+s.worldX,v=S*n.x+A*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,T=M.b,S=M.c,A=M.d;let P=y*A-T*S,k=w-M.worldX,E=v-M.worldY;P=Math.abs(P)<=1e-4?0:1/P;const X=(k*A-E*T)*P-d,V=(E*y-k*S)*P-f;let O=Math.sqrt(X*X+V*V),$=n.bone.data.length*p,B,Y;if(O<1e-4){Ft.apply(e,s,i,r,!1,l,0,h),n.rotation=0;return}k=i-M.worldX,E=r-M.worldY;let F=(k*A-E*T)*P-d,U=(E*y-k*S)*P-f,N=F*F+U*U;if(a!==0){a*=m*(p+1)*.5;const L=Math.sqrt(N),_=L-O-$*m+a;if(_>0){let q=Math.min(1,_/(a*2))-1;q=(_-a*(1-q*q))/L,F-=q*F,U-=q*U,N=F*F+U*U}}t:if(I){$*=m;let L=(N-O*O-$*$)/(2*O*$);if(L<-1)L=-1,Y=Math.PI*c;else if(L>1){if(L=1,Y=0,l)switch(y=(Math.sqrt(N)/(O+$)-1)*h+1,s.scaleX*=y,o){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y}}else Y=Math.acos(L)*c;y=O+$*L,T=$*Math.sin(Y),B=Math.atan2(U*y-F*T,F*y+U*T)}else{y=m*$,T=u*$;const L=y*y,_=T*T,q=Math.atan2(U,F);S=_*O*O+L*N-L*_;const K=-2*_*O,et=_-L;if(A=K*K-4*et*S,A>=0){let gt=Math.sqrt(A);K<0&&(gt=-gt),gt=-(K+gt)*.5;let bt=gt/et,jt=S/gt;const ye=Math.abs(bt)<Math.abs(jt)?bt:jt;if(bt=N-ye*ye,bt>=0){E=Math.sqrt(bt)*c,B=q-Math.atan2(E,ye),Y=Math.atan2(E/u,(ye-O)/m);break t}}let Q=D.PI,st=O-y,it=st*st,nt=0,ht=0,rt=O+y,at=rt*rt,dt=0;S=-y*O/(L-_),S>=-1&&S<=1&&(S=Math.acos(S),k=y*Math.cos(S)+O,E=T*Math.sin(S),A=k*k+E*E,A<it&&(Q=S,it=A,st=k,nt=E),A>at&&(ht=S,at=A,rt=k,dt=E)),N<=(it+at)*.5?(B=q-Math.atan2(nt*c,st),Y=Q*c):(B=q-Math.atan2(dt*c,rt),Y=ht*c)}const W=Math.atan2(n.y,n.x)*x;B=(B-W)*D.radDeg+g-s.rotation,B>180?B-=360:B<-180&&(B+=360),s.rotation+=B*h,Y=((Y+W)*D.radDeg-n.shearX)*x+b-n.rotation,Y>180?Y-=360:Y<-180&&(Y+=360),n.rotation+=Y*h}},le=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Gt=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new le)}create(t){return new rn(this,t)}},vs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(vs||{}),Ts=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ts||{}),Ss=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Ss||{}),rn=class xt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new le,new le),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new xt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof ee))return;const i=this.appliedPose,r=i.mixRotate,c=i.mixX,l=i.mixY;if(r===0&&c===0&&l===0)return;const o=this.data,a=o.rotateMode===0,h=o.rotateMode===2,d=this.bones,f=d.length,m=a?f:f+1,u=R.setArraySize(this.spaces,m),p=h?this.lengths=R.setArraySize(this.lengths,f):[],g=i.spacing;switch(o.spacingMode){case 2:if(h)for(let T=0,S=m-1;T<S;T++){const A=d[T],I=A.bone.data.length,M=I*A.a,P=I*A.c;p[T]=Math.sqrt(M*M+P*P)}R.arrayFill(u,1,m,g);break;case 3:{let T=0;for(let S=0,A=m-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<xt.epsilon)h&&(p[S]=0),u[++S]=g;else{const P=M*I.a,k=M*I.c,E=Math.sqrt(P*P+k*k);h&&(p[S]=E),u[++S]=E,T+=E}}if(T>0){T=m/T*g;for(let S=1;S<m;S++)u[S]*=T}break}default:{const T=o.spacingMode===0;for(let S=0,A=m-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<xt.epsilon)h&&(p[S]=0),u[++S]=g;else{const P=M*I.a,k=M*I.c,E=Math.sqrt(P*P+k*k);h&&(p[S]=E),u[++S]=(T?Math.max(0,M+g):g)*E/M}}}}const b=this.computeWorldPositions(e,n,m,a);let x=b[0],w=b[1],v=o.offsetRotation,y=!1;if(v===0)y=o.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?D.degRad:-D.degRad}for(let T=0,S=3,A=e._update;T<f;T++,S+=3){const I=d[T];I.worldX+=(x-I.worldX)*c,I.worldY+=(w-I.worldY)*l;const M=b[S],P=b[S+1],k=M-x,E=P-w;if(h){const X=p[T];if(X!==0){const V=(Math.sqrt(k*k+E*E)/X-1)*r+1;I.a*=V,I.c*=V}}if(x=M,w=P,r>0){let X=I.a,V=I.b,O=I.c,$=I.d,B=0,Y=0,F=0;if(a?B=b[S-1]:u[T+1]===0?B=b[S+2]:B=Math.atan2(E,k),B-=Math.atan2(O,X),y){Y=Math.cos(B),F=Math.sin(B);const U=I.bone.data.length;x+=(U*(Y*X-F*O)-k)*r,w+=(U*(F*X+Y*O)-E)*r}else B+=v;B>D.PI?B-=D.PI2:B<-D.PI&&(B+=D.PI2),B*=r,Y=Math.cos(B),F=Math.sin(B),I.a=Y*X-F*O,I.b=Y*V-F*$,I.c=F*X+Y*O,I.d=F*V+Y*$}I.modifyWorld(A)}}computeWorldPositions(e,s,n,i){const r=this.slot;let c=this.appliedPose.position,l=this.spaces,o=R.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,f=d/6,m=xt.NONE;if(!s.constantSpeed){const Y=s.lengths;f-=h?1:2;const F=Y[f];this.data.positionMode===1&&(c*=F);let U;switch(this.data.spacingMode){case 2:U=F;break;case 3:U=F/n;break;default:U=1}a=R.setArraySize(this.world,8);for(let N=0,W=0,L=0;N<n;N++,W+=3){const _=l[N]*U;c+=_;let q=c;if(h)q%=F,q<0&&(q+=F),L=0;else if(q<0){m!==xt.BEFORE&&(m=xt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition(q,a,0,o,W);continue}else if(q>F){m!==xt.AFTER&&(m=xt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition(q-F,a,0,o,W);continue}for(;;L++){const K=Y[L];if(!(q>K)){if(L===0)q/=K;else{const et=Y[L-1];q=(q-et)/(K-et)}break}}L!==m&&(m=L,h&&L===f?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*6+2,8,a,0,2)),this.addCurvePosition(q,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],o,W,i||N>0&&_===0)}return o}h?(d+=2,a=R.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(f--,d-=4,a=R.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const u=R.setArraySize(this.curves,f);let p=0,g=a[0],b=a[1],x=0,w=0,v=0,y=0,T=0,S=0,A=0,I=0,M=0,P=0,k=0,E=0,X=0,V=0;for(let Y=0,F=2;Y<f;Y++,F+=6)x=a[F],w=a[F+1],v=a[F+2],y=a[F+3],T=a[F+4],S=a[F+5],A=(g-x*2+v)*.1875,I=(b-w*2+y)*.1875,M=((x-v)*3-g+T)*.09375,P=((w-y)*3-b+S)*.09375,k=A*2+M,E=I*2+P,X=(x-g)*.75+A+M*.16666667,V=(w-b)*.75+I+P*.16666667,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,k+=M,E+=P,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,p+=Math.sqrt(X*X+V*V),X+=k+M,V+=E+P,p+=Math.sqrt(X*X+V*V),u[Y]=p,g=T,b=S;this.data.positionMode===1&&(c*=p);let O;switch(this.data.spacingMode){case 2:O=p;break;case 3:O=p/n;break;default:O=1}const $=this.segments;let B=0;for(let Y=0,F=0,U=0,N=0;Y<n;Y++,F+=3){const W=l[Y]*O;c+=W;let L=c;if(h)L%=p,L<0&&(L+=p),U=0,N=0;else if(L<0){this.addBeforePosition(L,a,0,o,F);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,o,F);continue}for(;;U++){const _=u[U];if(!(L>_)){if(U===0)L/=_;else{const q=u[U-1];L=(L-q)/(_-q)}break}}if(U!==m){m=U;let _=U*6;for(g=a[_],b=a[_+1],x=a[_+2],w=a[_+3],v=a[_+4],y=a[_+5],T=a[_+6],S=a[_+7],A=(g-x*2+v)*.03,I=(b-w*2+y)*.03,M=((x-v)*3-g+T)*.006,P=((w-y)*3-b+S)*.006,k=A*2+M,E=I*2+P,X=(x-g)*.3+A+M*.16666667,V=(w-b)*.3+I+P*.16666667,B=Math.sqrt(X*X+V*V),$[0]=B,_=1;_<8;_++)X+=k,V+=E,k+=M,E+=P,B+=Math.sqrt(X*X+V*V),$[_]=B;X+=k,V+=E,B+=Math.sqrt(X*X+V*V),$[8]=B,X+=k+M,V+=E+P,B+=Math.sqrt(X*X+V*V),$[9]=B,N=0}for(L*=B;;N++){const _=$[N];if(!(L>_)){if(N===0)L/=_;else{const q=$[N-1];L=N+(L-q)/(_-q)}break}}this.addCurvePosition(L*.1,g,b,x,w,v,y,T,S,o,F,i||Y>0&&W===0)}return o}addBeforePosition(e,s,n,i,r){const c=s[n],l=s[n+1],o=s[n+2]-c,a=s[n+3]-l,h=Math.atan2(a,o);i[r]=c+e*Math.cos(h),i[r+1]=l+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const c=s[n+2],l=s[n+3],o=c-s[n],a=l-s[n+1],h=Math.atan2(a,o);i[r]=c+e*Math.cos(h),i[r+1]=l+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,c,l,o,a,h,d,f){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const m=e*e,u=m*e,p=1-e,g=p*p,b=g*p,x=p*e,w=x*3,v=p*w,y=w*e,T=s*b+i*v+c*y+o*u,S=n*b+r*v+l*y+a*u;h[d]=T,h[d+1]=S,f&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*x*2+l*m),T-(s*g+i*x*2+c*m)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let c=0;c<r;c++){const l=i[c].bone;e.sortBone(l),e.constrained(l)}e._updateCache.push(this);for(let c=0;c<r;c++)e.sortReset(i[c].bone.children);for(let c=0;c<r;c++)i[c].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let c=0,l=r.length;c<l;c++){const o=r[c];o.slotIndex===n&&this.sortPath(e,o.attachment,i)}}sortPath(e,s,n){if(!(s instanceof ee))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let c=0,l=i.length;c<l;){let o=i[c++];for(o+=c;c<o;)e.sortBone(r[i[c++]])}}}isSourceActive(){return this.slot.bone.active}},an=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(an||{}),ce=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}},he=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof wt)||!(this.attachment instanceof wt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},on=class Yn extends bs{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new he,new he),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new Yn(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},ln=class Se{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Se.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Se.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new re(n,null);else{const r=this.bones[n.parent.index];i=new re(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new on(s,this));this.drawOrder=new sn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof As&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let c=0,l=e.length;c<l;c++)e[c].unconstrained();const s=this.bones,n=s.length;for(let c=0,l=n;c<l;c++){const o=s[c];o.sorted=o.data.skinRequired,o.active=!o.sorted,o.unconstrained()}if(this.skin){const c=this.skin.bones;for(let l=0,o=this.skin.bones.length;l<o;l++){let a=this.bones[c[l].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let c=0;c<r;c++)i[c].unconstrained();for(let c=0;c<r;c++){const l=i[c];l.active=l.isSourceActive()&&(!l.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(l.data)),l.active&&l.sort(this)}for(let c=0;c<n;c++)this.sortBone(s[c]);r=this._updateCache.length;for(let c=0;c<r;c++){const l=this._updateCache[c];l instanceof re&&(this._updateCache[c]=l.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],c=r.data.attachmentName;if(c){const l=e.getAttachment(n,c);l&&r.pose.setAttachment(l)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const c=n[i];if(c instanceof s&&c.data.name===e)return c}return null}getBoundsRect(e){const s=new Me,n=new Me;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(e,s,n=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,c=r;let l=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,f=r.length;d<f;d++){const m=c[d];if(!m.bone.active)continue;let u=0,p=null,g=null;const b=m.appliedPose.attachment;if(b){if(b instanceof j)u=8,p=R.setArraySize(n,u,0),b.computeWorldVertices(m,b.getOffsets(m.appliedPose),p,0,2),g=Se.quadTriangles;else if(b instanceof yt)u=b.worldVerticesLength,p=R.setArraySize(n,u,0),b.computeWorldVertices(this,m,0,u,p,0,2),g=b.triangles;else if(b instanceof zt&&i){i.clipEnd(m),i.clipStart(this,m,b);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,u=i.clippedVertices.length);for(let x=0,w=p.length;x<w;x+=2){const v=p[x],y=p[x+1];l=Math.min(l,v),o=Math.min(o,y),a=Math.max(a,v),h=Math.max(h,y)}}}i&&i.clipEnd(m)}i&&i.clipEnd(),e.set(l,o),s.set(a-l,h-o)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,c=i.length;r<c;r++)i[r].rotate(e,s,n)}},As=class kn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new ce,new ce),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new kn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*D.degRad,r=Math.cos(i),c=Math.sin(i),l=this.cx-e,o=this.cy-s;this.translate(l*r-o*c-l,l*c+o*r-o)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,c=this.data.y>0,l=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,f=0;switch(s){case 0:return;case 1:this.reset(e);case 2:{const m=Math.max(e.time-this.lastTime,0),u=this.remaining;this.remaining+=m,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let b=this.remaining,x=n.inertia,w=e.data.referenceScale,v=-1,y=0,T=0,S=this.data.limit*m,A=S*Math.abs(e.scaleY);if(S*=Math.abs(e.scaleX),r||c){if(r){const I=(this.ux-p)*x;this.xOffset+=I>S?S:I<-S?-S:I,this.ux=p}if(c){const I=(this.uy-g)*x;this.yOffset+=I>A?A:I<-A?-A:I,this.uy=g}if(b>=d){const I=this.xOffset,M=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,T=n.strength;const P=w*n.wind,k=w*n.gravity,E=(P*e.windX+k*e.gravityX)*e.scaleX,X=(P*e.windY+k*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),c&&(this.yVelocity-=(X+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),b-=d;while(b>=d);this.xLag=this.xOffset-I,this.yLag=this.yOffset-M}f=Math.max(0,1-b/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),c&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(l||o){let I=Math.atan2(a.c,a.a),M=0,P=0,k=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>S?E=S:E<-S&&(E=-S),X>A?X=A:X<-A&&(X=-A),b=this.remaining,l){k=(this.data.rotate+this.data.shearX)*i,f=this.rotateLag*Math.max(0,1-u/d);let V=Math.atan2(X+this.ty,E+this.tx)-I-(this.rotateOffset-f)*k;this.rotateOffset+=(V-Math.ceil(V*D.invPI2-.5)*D.PI2)*x,V=(this.rotateOffset-f)*k+I,M=Math.cos(V),P=Math.sin(V),o&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*P)*x/V))}else{M=Math.cos(I),P=Math.sin(I);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);V>0&&(this.scaleOffset+=(E*M+X*P)*x/V)}if(b>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,T=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,O=(n.wind*e.windY+n.gravity*e.gravityY)*ln.yDir,$=this.rotateOffset,B=this.scaleOffset,Y=h/w;for(;;)if(b-=d,o&&(this.scaleVelocity+=(V*M-O*P-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),l){if(this.rotateVelocity-=((V*P+O*M)*Y+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,b<d)break;const F=this.rotateOffset*k+I;M=Math.cos(F),P=Math.sin(F)}else if(b<d)break;this.rotateLag=this.rotateOffset-$,this.scaleLag=this.scaleOffset-B}f=Math.max(0,1-b/d)}this.remaining=b}this.cx=a.worldX,this.cy=a.worldY;break}case 3:f=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),c&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(l){let m=(this.rotateOffset-this.rotateLag*f)*i,u=0,p=0,g=0;if(this.data.shearX>0){let b=0;this.data.rotate>0&&(b=m*this.data.rotate,u=Math.sin(b),p=Math.cos(b),g=a.b,a.b=p*g-u*a.d,a.d=u*g+p*a.d),b+=m*this.data.shearX,u=Math.sin(b),p=Math.cos(b),g=a.a,a.a=p*g-u*a.c,a.c=u*g+p*a.c}else m*=this.data.rotate,u=Math.sin(m),p=Math.cos(m),g=a.a,a.a=p*g-u*a.c,a.c=u*g+p*a.c,g=a.b,a.b=p*g-u*a.d,a.d=u*g+p*a.d}if(o){const m=1+(this.scaleOffset-this.scaleLag*f)*i*this.data.scaleX;a.a*=m,a.c*=m}s!==3&&(this.tx=h*a.a,this.ty=h*a.c),a.modifyWorld(e._update)}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},Ht=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,new ce)}create(t){return new As(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var de=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},cn=class Ns extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Ns(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,c=this.bone;if(c!==null){if(!c.active)return;i.local&&c.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,c.appliedPose,i.local,Ns.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const l=e.bones,o=r.bones;for(let a=0,h=r.bones.length;a<h;a++)l[o[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,!1,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const m=i[r[d]];m.sorted=!1,e.sortReset(m.children),e.constrained(m)}const c=n.animation.timelines,l=e.slots,o=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const m=c[d];if(Ws(m))e.constrained(l[m.slotIndex]);else if(m instanceof It||m instanceof qt)e.drawOrder.constrained();else if(m instanceof pt)if(m.constraintIndex===-1)for(let u=0;u<h;u++)e.constrained(a[u]);else e.constrained(o[m.constraintIndex]);else if(Hs(m)){const u=m.constraintIndex;u!==-1&&e.constrained(o[u])}}}},St=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(t){super(t,new de)}create(t){return new cn(this,t)}},Is=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof St&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},Cs=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},fe=class{name;attachments=[];bones=[];constraints=[];color=new z(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof yt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new Cs(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new Cs(t,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const c=e.attachments[s];for(const l in c){const o=c[l];if(r===o){const a=this.getAttachment(s,l);a&&i.pose.setAttachment(a);break}}}s++}}},Ms=class extends se{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new he),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Ps=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Ps||{}),ue=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},hn=class En extends Et{bones;source;constructor(e,s){if(super(e,new ue,new ue),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new En(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,c=i.localTarget,l=i.additive,o=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,f=i.properties.length,m=e._update,u=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const b=u[p];c?b.modifyLocal(e):b.modifyWorld(m);for(let x=0;x<f;x++){const w=d[x],v=w.value(e,h,r,a)-w.offset,y=w.to;for(let T=0,S=w.to.length;T<S;T++){const A=y[T];if(A.mix(n)!==0){let I=A.offset+v*A.scale;o&&(A.offset<A.max?I=D.clamp(I,A.offset,A.max):I=D.clamp(I,A.max,A.offset)),A.apply(e,n,b,I,c,l)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const c=s[r].bone;e.sortReset(c.children),e.constrained(c)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},J=class ct extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new ue)}create(e){return new hn(this,e)}getOffsetRotation(){return this.offsets[ct.ROTATION]}setOffsetRotation(e){this.offsets[ct.ROTATION]=e}getOffsetX(){return this.offsets[ct.X]}setOffsetX(e){this.offsets[ct.X]=e}getOffsetY(){return this.offsets[ct.Y]}setOffsetY(e){this.offsets[ct.Y]=e}getOffsetScaleX(){return this.offsets[ct.SCALEX]}setOffsetScaleX(e){this.offsets[ct.SCALEX]=e}getOffsetScaleY(){return this.offsets[ct.SCALEY]}setOffsetScaleY(e){this.offsets[ct.SCALEY]=e}getOffsetShearY(){return this.offsets[ct.SHEARY]}setOffsetShearY(e){this.offsets[ct.SHEARY]=e}},Ct=class{offset=0;to=[]},Mt=class{offset=0;max=0;scale=0},me=class extends Ct{value(t,e,s,n){if(s)return e.rotation+n[J.ROTATION];const i=t.scaleX,r=t.scaleY;let c=Math.atan2(e.c/r,e.a/i)*D.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[J.ROTATION]:-n[J.ROTATION]);return c<0&&(c+=360),c}},Fs=class extends Mt{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const c=t.scaleX,l=t.scaleY,o=1/c,a=1/l,h=s.a*o,d=s.b*o,f=s.c*a,m=s.d*a;n*=D.degRad,r||(n-=Math.atan2(f,h)),n>D.PI?n-=D.PI2:n<-D.PI&&(n+=D.PI2),n*=e.mixRotate;const u=Math.cos(n),p=Math.sin(n);s.a=(u*h-p*f)*c,s.b=(u*d-p*m)*c,s.c=(p*h+u*f)*l,s.d=(p*d+u*m)*l}}},ge=class extends Ct{value(t,e,s,n){return s?e.x+n[J.X]:(n[J.X]*e.a+n[J.Y]*e.b+e.worldX)/t.scaleX}},Ys=class extends Mt{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},pe=class extends Ct{value(t,e,s,n){return s?e.y+n[J.Y]:(n[J.X]*e.c+n[J.Y]*e.d+e.worldY)/t.scaleY}},ks=class extends Mt{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},be=class extends Ct{value(t,e,s,n){if(s)return e.scaleX+n[J.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[J.SCALEX]}},Es=class extends Mt{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const c=1+(n-1)*e.mixScaleX;s.a*=c,s.c*=c}else{let c=s.a/t.scaleX,l=s.c/t.scaleY,o=Math.sqrt(c*c+l*l);o!==0&&(o=1+(n-o)*e.mixScaleX/o,s.a*=o,s.c*=o)}}},xe=class extends Ct{value(t,e,s,n){if(s)return e.scaleY+n[J.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[J.SCALEY]}},Xs=class extends Mt{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const c=1+(n-1)*e.mixScaleY;s.b*=c,s.d*=c}else{let c=s.b/t.scaleX,l=s.d/t.scaleY,o=Math.sqrt(c*c+l*l);o!==0&&(o=1+(n-o)*e.mixScaleY/o,s.b*=o,s.d*=o)}}},we=class extends Ct{value(t,e,s,n){if(s)return e.shearY+n[J.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*D.radDeg-90+n[J.SHEARY]}},Vs=class extends Mt{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const c=t.scaleX,l=t.scaleY,o=s.b/c,a=s.d/l,h=Math.atan2(a,o);n=(n+90)*D.degRad,r?n-=D.PI/2:(n-=h-Math.atan2(s.c/c,s.a/l),n>D.PI?n-=D.PI2:n<-D.PI&&(n+=D.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(o*o+a*a);s.b=Math.cos(n)*d*l,s.d=Math.sin(n)*d*c}}},Jn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Is;s.name="";const n=new dn(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const c=n.readBoolean();c&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}const o=s.bones;l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Bone name must not be null.");const p=m===0?null:o[n.readInt(!0)],g=new ps(m,u,p),b=g.setupPose;b.rotation=n.readFloat(),b.x=n.readFloat()*e,b.y=n.readFloat()*e,b.scaleX=n.readFloat(),b.scaleY=n.readFloat(),b.shearX=n.readFloat(),b.shearY=n.readFloat(),b.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),c&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),o.push(g)}l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Slot name must not be null.");const p=o[n.readInt(!0)],g=new Ms(m,u,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const b=n.readInt32();b!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,b),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),c&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let m=0;m<h;m++){const u=n.readString();if(!u)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case bi:{const g=new Wt(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.target=o[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const x=g.setupPose;x.bendDirection=(b&4)!==0?-1:1,x.compress=(b&8)!==0,x.stretch=(b&16)!==0,(b&32)!==0&&(x.mix=(b&64)!==0?n.readFloat():1),(b&128)!==0&&(x.softness=n.readFloat()*e),a.push(g);break}case wi:{const g=new J(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.source=o[n.readInt(!0)];let b=n.readUnsignedByte();g.skinRequired=(b&1)!==0,g.localSource=(b&2)!==0,g.localTarget=(b&4)!==0,g.additive=(b&8)!==0,g.clamp=(b&16)!==0,p=b>>5;for(let w=0,v;w<p;w++){let y=1,T;switch(n.readByte()){case 0:T=new me;break;case 1:{y=e,T=new ge;break}case 2:{y=e,T=new pe;break}case 3:T=new be;break;case 4:T=new xe;break;case 5:T=new we;break;default:T=null}if(T){T.offset=n.readFloat()*y,v=n.readByte();for(let S=0;S<v;S++){let A=1,I;switch(n.readByte()){case 0:I=new Fs;break;case 1:{A=e,I=new Ys;break}case 2:{A=e,I=new ks;break}case 3:I=new Es;break;case 4:I=new Xs;break;case 5:I=new Vs;break;default:I=null}I&&(I.offset=n.readFloat()*A,I.max=n.readFloat()*A,I.scale=n.readFloat()*A/y,T.to[S]=I)}g.properties[w]=T}}b=n.readByte(),(b&1)!==0&&(g.offsets[J.ROTATION]=n.readFloat()),(b&2)!==0&&(g.offsets[J.X]=n.readFloat()*e),(b&4)!==0&&(g.offsets[J.Y]=n.readFloat()*e),(b&8)!==0&&(g.offsets[J.SCALEX]=n.readFloat()),(b&16)!==0&&(g.offsets[J.SCALEY]=n.readFloat()),(b&32)!==0&&(g.offsets[J.SHEARY]=n.readFloat()),b=n.readByte();const x=g.setupPose;(b&1)!==0&&(x.mixRotate=n.readFloat()),(b&2)!==0&&(x.mixX=n.readFloat()),(b&4)!==0&&(x.mixY=n.readFloat()),(b&8)!==0&&(x.mixScaleX=n.readFloat()),(b&16)!==0&&(x.mixScaleY=n.readFloat()),(b&32)!==0&&(x.mixShearY=n.readFloat()),a.push(g);break}case xi:{const g=new Gt(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,g.positionMode=b>>1&1,g.spacingMode=b>>2&3,g.rotateMode=b>>4&3,(b&128)!==0&&(g.offsetRotation=n.readFloat());const x=g.setupPose;x.position=n.readFloat(),g.positionMode===0&&(x.position*=e),x.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(x.spacing*=e),x.mixRotate=n.readFloat(),x.mixX=n.readFloat(),x.mixY=n.readFloat(),a.push(g);break}case yi:{const g=new Ht(u);g.bone=o[n.readInt(!0)];let b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.x=n.readFloat()),(b&4)!==0&&(g.y=n.readFloat()),(b&8)!==0&&(g.rotate=n.readFloat()),(b&16)!==0&&(g.scaleX=n.readFloat()),(b&32)!==0&&(g.shearX=n.readFloat()),g.limit=((b&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const x=g.setupPose;x.inertia=n.readFloat(),x.strength=n.readFloat(),x.damping=n.readFloat(),x.massInverse=(b&128)!==0?n.readFloat():1,x.wind=n.readFloat(),x.gravity=n.readFloat(),b=n.readByte(),(b&1)!==0&&(g.inertiaGlobal=!0),(b&2)!==0&&(g.strengthGlobal=!0),(b&4)!==0&&(g.dampingGlobal=!0),(b&8)!==0&&(g.massGlobal=!0),(b&16)!==0&&(g.windGlobal=!0),(b&32)!==0&&(g.gravityGlobal=!0),(b&64)!==0&&(g.mixGlobal=!0),x.mix=(b&128)!==0?n.readFloat():1,a.push(g);break}case vi:{const g=new St(u),b=n.readByte();if(g.skinRequired=(b&1)!==0,g.loop=(b&2)!==0,g.additive=(b&4)!==0,(b&8)!==0&&(g.setupPose.time=n.readFloat()),(b&16)!==0&&(g.setupPose.mix=(b&32)!==0?n.readFloat():1),(b&64)!==0){g.local=(b&128)!==0,g.bone=o[n.readInt(!0)];const x=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new me;break;case 1:{w=e,g.property=new ge;break}case 2:{w=e,g.property=new pe;break}case 3:g.property=new be;break;case 4:g.property=new xe;break;case 5:g.property=new we;break;default:continue}g.property.offset=x*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,c);d&&(s.defaultSkin=d,s.skins.push(d));{let m=s.skins.length;for(R.setArraySize(s.skins,l=m+n.readInt(!0));m<l;m++){const u=this.readSkin(n,s,!1,c);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[m]=u}}l=this.linkedMeshes.length;for(let m=0;m<l;m++){const u=this.linkedMeshes[m],p=s.skins[u.skinIndex];if(!u.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(u.sourceIndex,u.source);if(!g)throw new Error(`Source mesh not found: ${u.source}`);u.mesh.timelineAttachment=u.inheritTimelines?g:u.mesh,u.mesh.setSourceMesh(g),u.mesh.updateSequence()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Event data name must not be null");const p=new ws(u),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const f=s.animations;l=n.readInt(!0);for(let m=0;m<l;m++){const u=n.readString();if(!u)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,u,s,c))}for(let m=0;m<h;m++){const u=a[m];u instanceof St&&(u.animation=f[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new fe("default")}else{const c=t.readString();if(!c)throw new Error("Skin name must not be null.");i=new fe(c),n&&z.rgba8888ToColor(i.color,t.readInt32());let l=t.readInt(!0),o=e.bones,a=i.bones;for(let h=0;h<l;h++)a[h]=o[t.readInt(!0)];l=t.readInt(!0),o=e.constraints,a=i.constraints;for(let h=0;h<l;h++)a[h]=o[t.readInt(!0)];r=t.readInt(!0)}for(let c=0;c<r;c++){const l=t.readInt(!0);for(let o=0,a=t.readInt(!0);o<a;o++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,l,h,n);d&&i.setAttachment(l,h,d)}}return i}readAttachment(t,e,s,n,i,r){const c=this.scale,l=t.readByte(),o=(l&8)!==0?t.readStringRef():i;if(!o)throw new Error("Attachment name must not be null");switch(l&7){case 0:{let a=(l&16)!==0?t.readStringRef():null;const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),f=(l&128)!==0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat();a||(a=o);const w=this.attachmentLoader.newRegionAttachment(s,i,o,a,d);return w?(w.path=a,w.x=m*c,w.y=u*c,w.scaleX=p,w.scaleY=g,w.rotation=f,w.width=b*c,w.height=x*c,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(l&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,o);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(l&16)!==0?t.readStringRef():o;const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),f=t.readInt(!0),m=this.readVertices(t,(l&128)!==0),u=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-f-2)*3),g=t.readInt(!0);let b=null;if(g>0){b=[];for(let T=0;T<g;T++)b[T]=t.readInt(!0)}let x=[],w=0,v=0;r&&(x=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),v=t.readFloat()),a||(a=o);const y=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=f<<1,y.bones=m.bones,y.vertices=m.vertices,y.worldVerticesLength=m.length,y.regionUVs=u,y.triangles=p,b&&(y.timelineSlots=b),r&&(y.edges=x,y.width=w*c,y.height=v*c),y.updateSequence(),y):null}case 3:{const a=(l&16)!==0?t.readStringRef():o;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),f=(l&128)!==0,m=t.readInt(!0),u=t.readInt(!0),p=t.readStringRef();let g=0,b=0;r&&(g=t.readFloat(),b=t.readFloat());const x=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return x?(x.path=a,z.rgba8888ToColor(x.color,h),r&&(x.width=g*c,x.height=b*c),this.linkedMeshes.push(new Kn(x,u,n,m,p,f)),x):null}case 4:{const a=(l&16)!==0,h=(l&32)!==0,d=this.readVertices(t,(l&64)!==0),f=this.readFloatArray(t,d.length/6,c),m=r?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,i,o);return u?(u.closed=a,u.constantSpeed=h,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,r&&z.rgba8888ToColor(u.color,m),u):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=r?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,i,o);return m?(m.x=h*c,m.y=d*c,m.rotation=a,r&&z.rgba8888ToColor(m.color,f),m):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(l&16)!==0),d=r?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,i,o);return f?(f.endSlot=e.slots[a],f.convex=(l&32)!==0,f.inverse=(l&64)!==0,f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,r&&z.rgba8888ToColor(f.color,d),f):null}}}readSequence(t,e){if(!e)return new Ot(1,!1);const s=new Ot(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new fn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),c=[],l=[];for(let o=0,a=0;o<r;){const h=t.readInt(!0);c[o++]=h;for(let d=0;d<h;d++,a+=3)c[o++]=t.readInt(!0),l[a]=t.readFloat()*s,l[a+1]=t.readFloat()*s,l[a+2]=t.readFloat()}return new fn(c,R.toFloatArray(l),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=x-1;switch(b){case di:{const v=new Yt(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readStringRef());i.push(v);break}case fi:{const v=t.readInt(!0),y=new _e(x,v,u);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let P=0,k=0;y.setFrame(P,T,S,A,I,M),P!==w;P++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(P);break;case mt:G(t,y,k++,P,0,T,E,S,X,1),G(t,y,k++,P,1,T,E,A,V,1),G(t,y,k++,P,2,T,E,I,O,1),G(t,y,k++,P,3,T,E,M,$,1)}T=E,S=X,A=V,I=O,M=$}i.push(y);break}case ui:{const v=t.readInt(!0),y=new ze(x,v,u);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,P=0;y.setFrame(M,T,S,A,I),M!==w;M++){const k=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(M);break;case mt:G(t,y,P++,M,0,T,k,S,E,1),G(t,y,P++,M,1,T,k,A,X,1),G(t,y,P++,M,2,T,k,I,V,1)}T=k,S=E,A=X,I=V}i.push(y);break}case mi:{const v=t.readInt(!0),y=new Ge(x,v,u);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,T,S,A,I,M,P,k,E),X!==w;X++){const O=t.readFloat(),$=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(X);break;case mt:G(t,y,V++,X,0,T,O,S,$,1),G(t,y,V++,X,1,T,O,A,B,1),G(t,y,V++,X,2,T,O,I,Y,1),G(t,y,V++,X,3,T,O,M,F,1),G(t,y,V++,X,4,T,O,P,U,1),G(t,y,V++,X,5,T,O,k,N,1),G(t,y,V++,X,6,T,O,E,W,1)}T=O,S=$,A=B,I=Y,M=F,P=U,k=N,E=W}i.push(y);break}case gi:{const v=t.readInt(!0),y=new He(x,v,u);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,T,S,A,I,M,P,k),E!==w;E++){const V=t.readFloat(),O=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case ut:y.setStepped(E);break;case mt:G(t,y,X++,E,0,T,V,S,O,1),G(t,y,X++,E,1,T,V,A,$,1),G(t,y,X++,E,2,T,V,I,B,1),G(t,y,X++,E,3,T,V,M,Y,1),G(t,y,X++,E,4,T,V,P,F,1),G(t,y,X++,E,5,T,V,k,U,1)}T=V,S=O,A=$,I=B,M=Y,P=F,k=U}i.push(y);break}case pi:{const v=new We(x,t.readInt(!0),u);let y=t.readFloat(),T=t.readUnsignedByte()/255;for(let S=0,A=0;v.setFrame(S,y,T),S!==w;S++){const I=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ut:v.setStepped(S);break;case mt:G(t,v,A++,S,0,y,I,T,M,1)}y=I,T=M}i.push(v)}}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===hi){const v=new $e(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readByte());i.push(v);continue}const w=t.readInt(!0);switch(b){case ti:tt(t,i,new Dt(x,w,u),1);break;case ei:tt(t,i,new Ve(x,w,u),r);break;case si:tt(t,i,new Re(x,w,u),r);break;case ni:tt(t,i,new Le(x,w,u),r);break;case ii:tt(t,i,new Be(x,w,u),1);break;case ri:tt(t,i,new Oe(x,w,u),1);break;case ai:tt(t,i,new Ne(x,w,u),1);break;case oi:tt(t,i,new De(x,w,u),1);break;case li:tt(t,i,new Ue(x,w,u),1);break;case ci:tt(t,i,new qe(x,w,u),1);break}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Ke(p,t.readInt(!0),u);let x=t.readByte(),w=t.readFloat(),v=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,y=(x&4)!==0?t.readFloat()*r:0;for(let T=0,S=0;b.setFrame(T,w,v,y,(x&8)!==0?1:-1,(x&16)!==0,(x&32)!==0),T!==g;T++){x=t.readByte();const A=t.readFloat(),I=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,M=(x&4)!==0?t.readFloat()*r:0;(x&64)!==0?b.setStepped(T):(x&128)!==0&&(G(t,b,S++,T,0,w,A,v,I,1),G(t,b,S++,T,1,w,A,y,M,r)),w=A,v=I,y=M}i.push(b)}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Qe(p,t.readInt(!0),u);let x=t.readFloat(),w=t.readFloat(),v=t.readFloat(),y=t.readFloat(),T=t.readFloat(),S=t.readFloat(),A=t.readFloat();for(let I=0,M=0;b.setFrame(I,x,w,v,y,T,S,A),I!==g;I++){const P=t.readFloat(),k=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),O=t.readFloat(),$=t.readFloat();switch(t.readByte()){case ut:b.setStepped(I);break;case mt:G(t,b,M++,I,0,x,P,w,k,1),G(t,b,M++,I,1,x,P,v,E,1),G(t,b,M++,I,2,x,P,y,X,1),G(t,b,M++,I,3,x,P,T,V,1),G(t,b,M++,I,4,x,P,S,O,1),G(t,b,M++,I,5,x,P,A,$,1)}x=P,w=k,v=E,y=X,T=V,S=O,A=$}i.push(b)}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0),p=s.constraints[u];for(let g=0,b=t.readInt(!0);g<b;g++){const x=t.readByte(),w=t.readInt(!0),v=t.readInt(!0);switch(x){case Ai:tt(t,i,new Ze(w,v,u),p.positionMode===0?r:1);break;case Ii:tt(t,i,new ts(w,v,u),p.spacingMode===0||p.spacingMode===1?r:1);break;case Ci:{const y=new es(w,v,u);let T=t.readFloat(),S=t.readFloat(),A=t.readFloat(),I=t.readFloat();for(let M=0,P=0,k=y.getFrameCount()-1;y.setFrame(M,T,S,A,I),M!==k;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),O=t.readFloat();switch(t.readByte()){case ut:y.setStepped(M);break;case mt:G(t,y,P++,M,0,T,E,S,X,1),G(t,y,P++,M,1,T,E,A,V,1),G(t,y,P++,M,2,T,E,I,O,1)}T=E,S=X,A=V,I=O}i.push(y)}}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===Vi){const v=new cs(x,u);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat());i.push(v);continue}const w=t.readInt(!0);switch(b){case Mi:tt(t,i,new ss(x,w,u),1);break;case Pi:tt(t,i,new ns(x,w,u),1);break;case Fi:tt(t,i,new is(x,w,u),1);break;case Yi:tt(t,i,new rs(x,w,u),1);break;case ki:tt(t,i,new as(x,w,u),1);break;case Ei:tt(t,i,new os(x,w,u),1);break;case Xi:tt(t,i,new ls(x,w,u),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=t.readInt(!0);switch(b){case Ri:tt(t,i,new hs(x,w,u),1);break;case Li:tt(t,i,new ds(x,w,u),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let f=0,m=t.readInt(!0);f<m;f++){const u=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readInt(!0);for(let x=0,w=t.readInt(!0);x<w;x++){const v=t.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=u.getAttachment(b,v),T=t.readByte(),S=t.readInt(!0),A=S-1;switch(T){case Ti:{const I=y,M=I.bones,P=I.vertices,k=M?P.length/3*2:P.length,E=t.readInt(!0),X=new je(S,E,b,I);let V=t.readFloat();for(let O=0,$=0;;O++){let B,Y=t.readInt(!0);if(Y===0)B=M?R.newFloatArray(k):P;else{B=R.newFloatArray(k);const U=t.readInt(!0);if(Y+=U,r===1)for(let N=U;N<Y;N++)B[N]=t.readFloat();else for(let N=U;N<Y;N++)B[N]=t.readFloat()*r;if(!M)for(let N=0,W=B.length;N<W;N++)B[N]+=P[N]}if(X.setFrame(O,V,B),O===A)break;const F=t.readFloat();switch(t.readByte()){case ut:X.setStepped(O);break;case mt:G(t,X,$++,O,0,V,F,0,1,1)}V=F}i.push(X);break}case Si:{const I=new Je(S,b,y);for(let M=0;M<S;M++){const P=t.readFloat(),k=t.readInt32();I.setFrame(M,P,Xe[k&15],k>>4,t.readFloat())}i.push(I);break}}}}}const c=s.slots.length,l=t.readInt(!0);if(l>0){const f=new It(l);for(let m=0;m<l;m++)f.setFrame(m,t.readFloat(),un(t,c));i.push(f)}const o=t.readInt(!0);for(let f=0;f<o;f++){const m=t.readInt(!0),u=new Array(m);for(let b=0;b<m;b++)u[b]=t.readInt(!0);const p=t.readInt(!0),g=new qt(p,u,c);for(let b=0;b<p;b++)g.setFrame(b,t.readFloat(),un(t,m));i.push(g)}const a=t.readInt(!0);if(a>0){const f=new Zt(a);for(let m=0;m<a;m++){const u=t.readFloat(),p=s.events[t.readInt(!0)],g=new ae(u,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),f.setFrame(m,g)}i.push(f)}let h=0;for(let f=0,m=i.length;f<m;f++)h=Math.max(h,i[f].getDuration());const d=new Kt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},dn=class{constructor(t,e=[],s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},Kn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},fn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function tt(t,e,s,n){s instanceof Nt?Qn(t,e,s,n):Zn(t,e,s,n)}function Qn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let c=0,l=0,o=s.getFrameCount()-1;s.setFrame(c,i,r),c!==o;c++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ut:s.setStepped(c);break;case mt:G(t,s,l++,c,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function Zn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,c=t.readFloat()*n;for(let l=0,o=0,a=s.getFrameCount()-1;s.setFrame(l,i,r,c),l!==a;l++){const h=t.readFloat(),d=t.readFloat()*n,f=t.readFloat()*n;switch(t.readByte()){case ut:s.setStepped(l);break;case mt:G(t,s,o++,l,0,i,h,r,d,n),G(t,s,o++,l,1,i,h,c,f,n)}i=h,r=d,c=f}e.push(s)}function un(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,c=0;for(let l=0;l<s;l++){const o=t.readInt(!0);for(;r!==o;)i[c++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[c++]=r++;for(let l=e-1;l>=0;l--)n[l]===-1&&(n[l]=i[--c]);return n}function G(t,e,s,n,i,r,c,l,o,a){e.setBezier(s,n,i,r,l,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,c,o)}var ti=0,ei=1,si=2,ni=3,ii=4,ri=5,ai=6,oi=7,li=8,ci=9,hi=10,di=0,fi=1,ui=2,mi=3,gi=4,pi=5,bi=0,xi=1,wi=2,yi=3,vi=4,Ti=0,Si=1,Ai=0,Ii=1,Ci=2,Mi=0,Pi=1,Fi=2,Yi=4,ki=5,Ei=6,Xi=7,Vi=8,Ri=0,Li=1,ut=1,mt=2,Bi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Bt(()=>R.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,c=r.length;s.length=0,i.freeAll(n),n.length=0;for(let l=0;l<c;l++){const o=r[l];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof gs){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=R.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,o,0,a.worldVerticesLength,h,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,c=i.length;r<c;r++){const l=i[r],o=l;for(let a=0,h=l.length;a<h;a+=2){const d=o[a],f=o[a+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),n=Math.max(n,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){const i=this.minX,r=this.minY,c=this.maxX,l=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=c&&s>=c||e>=l&&n>=l)return!1;const o=(n-e)/(s-t);let a=o*(i-t)+e;if(a>r&&a<l||(a=o*(c-t)+e,a>r&&a<l))return!0;let h=(r-e)/o+t;return h>i&&h<c||(h=(l-e)/o+t,h>i&&h<c)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){const n=t,i=t.length;let r=i-2,c=!1;for(let l=0;l<i;l+=2){const o=n[l+1],a=n[r+1];if(o<s&&a>=s||a<s&&o>=s){const h=n[l];h+(s-o)/(a-o)*(n[r]-h)<e&&(c=!c)}r=l}return c}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,c=i.length;r<c;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,c=t.length,l=e-n,o=s-i,a=e*i-s*n;let h=r[c-2],d=r[c-1];for(let f=0;f<c;f+=2){const m=r[f],u=r[f+1],p=h*u-d*m,g=h-m,b=d-u,x=l*b-o*g,w=(a*g-l*p)/x;if((w>=h&&w<=m||w>=m&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const v=(a*b-o*p)/x;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=m,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},mn=class ot{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Bt(()=>[]);polygonIndicesPool=new Bt(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let l=0;l<n;l++)i[l]=l;const r=this.isConcaveArray;r.length=0;for(let l=0;l<n;l++)r[l]=ot.isConcave(l,n,s,i);const c=this.triangles;for(c.length=0;n>3;){let l=n-1,o=0,a=1;for(;;){t:if(!r[o]){const f=i[l]<<1,m=i[o]<<1,u=i[a]<<1,p=s[f],g=s[f+1],b=s[m],x=s[m+1],w=s[u],v=s[u+1];for(let y=a+1<n?a+1:0;y!==l;){if(r[y]){const T=i[y]<<1,S=s[T],A=s[T+1];if(ot.positiveArea(w,v,p,g,S,A)&&ot.positiveArea(p,g,b,x,S,A)&&ot.positiveArea(b,x,w,v,S,A))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[o])break;o--}while(o>0);l=o>0?o-1:n-1,a=o+1<n?o+1:0;break}l=o,o=a,++a===n&&(a=0)}c.push(i[l],i[o],i[a]),i.splice(o,1),r.splice(o,1),n--;const h=o>0?o-1:n-1,d=o<n?o:0;r[h]=ot.isConcave(h,n,s,i),r[d]=ot.isConcave(d,n,s,i)}return n===3&&c.push(i[2],i[0],i[1]),c}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let l=this.polygonPool.obtain();l.length=0;let o=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const f=s[h]<<1,m=s[h+1]<<1,u=s[h+2]<<1,p=n[f],g=n[f+1],b=n[m],x=n[m+1],w=n[u],v=n[u+1];if(o===f){const y=l.length-4;if(ot.winding(l[y],l[y+1],l[y+2],l[y+3],w,v)===a&&ot.winding(w,v,l[0],l[1],l[2],l[3])===a){l.push(w,v),c.push(u);continue}}l.length>0&&(i.push(l),r.push(c),l=this.polygonPool.obtain(),c=this.polygonIndicesPool.obtain()),l.length=0,l.push(p,g,b,x),l.push(w,v),c.length=0,c.push(f,m,u),a=ot.winding(p,g,b,x,w,v),o=f}l.length>0&&(i.push(l),r.push(c));for(let h=0,d=i.length;h<d;h++){if(c=r[h],c.length===0)continue;const f=c[0];let m=c[c.length-1];l=i[h];const u=l.length-4;let p=l[u],g=l[u+1],b=l[u+2],x=l[u+3];const w=l[0],v=l[1],y=l[2],T=l[3],S=ot.winding(p,g,b,x,w,v);for(let A=0;A<d;A++){if(A===h)continue;const I=r[A];if(I.length!==3)continue;const M=I[0],P=I[1],k=I[2],E=i[A],X=E[E.length-2],V=E[E.length-1];M!==f||P!==m||ot.winding(p,g,b,x,X,V)===S&&ot.winding(X,V,w,v,y,T)===S&&(E.length=0,I.length=0,l.push(X,V),c.push(k),m=k,p=b,g=x,b=X,x=V,A=-1)}}for(let h=i.length-1;h>=0;h--)l=i[h],l.length===0?(i.splice(h,1),this.polygonPool.free(l),c=r[h],r.splice(h,1),this.polygonIndicesPool.free(c)):l.push(l[0],l[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,c=i[e]<<1,l=i[e+1<s?e+1:0]<<1;return!ot.positiveArea(n[r],n[r+1],n[c],n[c+1],n[l],n[l+1])}static positiveArea(e,s,n,i,r,c){return e*(c-i)+n*(s-c)+r*(i-s)>=0}static winding(e,s,n,i,r,c){return e*(c-i)+n*(s-c)+r*(i-s)>=0?1:-1}},gn=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=R.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,c=this.makeClockwise(r);c||this.inverse||s.convex?(c||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new mn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,c,l){return n&&i&&r&&typeof c=="boolean"&&typeof l=="number"?this.clipTrianglesRender(t,e,s,n,i,r,c,l):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let f=e[d]<<1;const m=t[f],u=t[f+1];f=e[d+1]<<1;const p=t[f],g=t[f+1];f=e[d+2]<<1;const b=t[f],x=t[f+1];this.clipInverse(m,u,p,g,b,x,h);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=w[v++];let S=T>>1,A=n.length;const I=R.setArraySize(n,A+T);R.arrayCopy(w,v,I,A,T),A=i.length;const M=R.setArraySize(i,A+3*(S-2));for(let P=1;P<S-1;P++,A+=3)M[A]=r,M[A+1]=r+P,M[A+2]=r+P+1;r+=S,v+=T}}return!0}const c=this.clipOutput,l=this.clippingPolygons,o=l.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const f=t[d],m=t[d+1];d=e[h+1]<<1;const u=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],b=t[d+1];for(let x=0;x<o;x++){let w=n.length;if(this.clip(f,m,u,p,g,b,l[x])){a=this.clipOutput;const v=c.length;if(v===0)continue;let y=v>>1;const T=R.setArraySize(n,w+v);R.arrayCopy(a,0,T,w,v),w=i.length;const S=R.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)S[w]=r,S[w+1]=r+A,S[w+2]=r+A+1;r+=y}else{const v=R.setArraySize(n,w+6);v[w]=f,v[w+1]=m,v[w+2]=u,v[w+3]=p,v[w+4]=g,v[w+5]=b,w=i.length;const y=R.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,c,l){const o=this.clippedVertices;o.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let b=e[g],x=e[g+1],w=e[g+2];const v=t[b*l],y=t[b*l+1],T=t[x*l],S=t[x*l+1],A=t[w*l],I=t[w*l+1];this.clipInverse(v,y,T,S,A,I,p);const M=this.inverseVertices.length;if(M===0)continue;const P=n[b<<=1],k=n[b+1],E=n[x<<=1],X=n[x+1],V=n[w<<=1],O=n[w+1],$=S-I,B=A-T,Y=v-A,F=I-y,U=1/($*Y+B*(y-I)),N=this.inverseVertices;for(let W=0;W<M;){const L=N[W++],_=L>>1;let q=o.length;const K=R.setArraySize(o,q+_*l);for(let Q=0;Q<L;Q+=2,q+=l){const st=N[W+Q],it=N[W+Q+1];K[q]=st,K[q+1]=it,K[q+2]=i.r,K[q+3]=i.g,K[q+4]=i.b,K[q+5]=i.a;const nt=st-A,ht=it-I,rt=($*nt+B*ht)*U,at=(F*nt+Y*ht)*U,dt=1-rt-at;K[q+6]=P*rt+E*at+V*dt,K[q+7]=k*rt+X*at+O*dt,c&&(K[q+8]=r.r,K[q+9]=r.g,K[q+10]=r.b,K[q+11]=r.a)}q=a.length;const et=R.setArraySize(a,q+3*(_-2));for(let Q=1;Q<_-1;Q++,q+=3)et[q]=h,et[q+1]=h+Q,et[q+2]=h+Q+1;h+=_,W+=L}}return!0}const d=this.clipOutput,f=this.clippingPolygons,m=this.clippingPolygons.length;let u=null;for(let p=0;p<s;p+=3){let g=e[p];const b=t[g*l],x=t[g*l+1],w=n[g<<1],v=n[(g<<1)+1];g=e[p+1];const y=t[g*l],T=t[g*l+1],S=n[g<<1],A=n[(g<<1)+1];g=e[p+2];const I=t[g*l],M=t[g*l+1],P=n[g<<1],k=n[(g<<1)+1],E=T-M,X=I-y,V=b-I,O=M-x,$=1/(E*V+X*(x-M));for(let B=0;B<m;B++){let Y=o.length;if(this.clip(b,x,y,T,I,M,f[B])){u=this.clipOutput;const F=d.length;if(F===0)continue;let U=F>>1;const N=R.setArraySize(o,Y+U*l);for(let L=0;L<F;L+=2,Y+=l){const _=u[L],q=u[L+1];N[Y]=_,N[Y+1]=q,N[Y+2]=i.r,N[Y+3]=i.g,N[Y+4]=i.b,N[Y+5]=i.a;const K=_-I,et=q-M,Q=(E*K+X*et)*$,st=(O*K+V*et)*$,it=1-Q-st;N[Y+6]=w*Q+S*st+P*it,N[Y+7]=v*Q+A*st+k*it,c&&(N[Y+8]=r.r,N[Y+9]=r.g,N[Y+10]=r.b,N[Y+11]=r.a)}Y=a.length;const W=R.setArraySize(a,Y+3*(U-2));U--;for(let L=1;L<U;L++,Y+=3)W[Y]=h,W[Y+1]=h+L,W[Y+2]=h+L+1;h+=U+1}else{const F=R.setArraySize(o,Y+3*l);F[Y]=b,F[Y+1]=x,F[Y+2]=i.r,F[Y+3]=i.g,F[Y+4]=i.b,F[Y+5]=i.a,c?(F[Y+6]=w,F[Y+7]=v,F[Y+8]=r.r,F[Y+9]=r.g,F[Y+10]=r.b,F[Y+11]=r.a,F[Y+12]=y,F[Y+13]=T,F[Y+14]=i.r,F[Y+15]=i.g,F[Y+16]=i.b,F[Y+17]=i.a,F[Y+18]=S,F[Y+19]=A,F[Y+20]=r.r,F[Y+21]=r.g,F[Y+22]=r.b,F[Y+23]=r.a,F[Y+24]=I,F[Y+25]=M,F[Y+26]=i.r,F[Y+27]=i.g,F[Y+28]=i.b,F[Y+29]=i.a,F[Y+30]=P,F[Y+31]=k,F[Y+32]=r.r,F[Y+33]=r.g,F[Y+34]=r.b,F[Y+35]=r.a):(F[Y+6]=w,F[Y+7]=v,F[Y+8]=y,F[Y+9]=T,F[Y+10]=i.r,F[Y+11]=i.g,F[Y+12]=i.b,F[Y+13]=i.a,F[Y+14]=S,F[Y+15]=A,F[Y+16]=I,F[Y+17]=M,F[Y+18]=i.r,F[Y+19]=i.g,F[Y+20]=i.b,F[Y+21]=i.a,F[Y+22]=P,F[Y+23]=k),Y=a.length;const U=R.setArraySize(a,Y+3);U[Y]=h,U[Y+1]=h+1,U[Y+2]=h+2,h+=3;break}}}return u!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let c=this._clippedVerticesTyped,l=this._clippedUVsTyped,o=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const u=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const b=t[e+g],x=t[e+g+1];let w=s[p]<<1;const v=i[w],y=i[w+1];g=s[p+1]*r;const T=t[e+g],S=t[e+g+1];w=s[p+1]<<1;const A=i[w],I=i[w+1];g=s[p+2]*r;const M=t[e+g],P=t[e+g+1];w=s[p+2]<<1;const k=i[w],E=i[w+1];this.clipInverse(b,x,T,S,M,P,u);const X=this.inverseVertices.length;if(X===0)continue;const V=S-P,O=M-T,$=b-M,B=P-x,Y=1/(V*$+O*(x-P)),F=this.inverseVertices;for(let U=0;U<X;){const N=F[U++],W=N>>1;let L=this.clippedVerticesLength;const _=L+W*r,q=this.clippedUVsLength+W*2;c.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(c.subarray(0,L)),c=this._clippedVerticesTyped),l.length<q&&(this._clippedUVsTyped=new Float32Array(q*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),l=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=q;const K=this._clippedVerticesTyped,et=this._clippedUVsTyped;let Q=q-W*2;for(let nt=0;nt<N;nt+=2,L+=r,Q+=2){const ht=F[U+nt],rt=F[U+nt+1];K[L]=ht,K[L+1]=rt;const at=ht-M,dt=rt-P,gt=(V*at+O*dt)*Y,bt=(B*at+$*dt)*Y,jt=1-gt-bt;et[Q]=v*gt+A*bt+k*jt,et[Q+1]=y*gt+I*bt+E*jt}L=this.clippedTrianglesLength;const st=L+3*(W-2);o.length<st&&(this._clippedTrianglesTyped=new Uint16Array(st*2),this._clippedTrianglesTyped.set(o.subarray(0,L)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=st;const it=o;for(let nt=1;nt<W-1;nt++,L+=3)it[L]=a,it[L+1]=a+nt,it[L+2]=a+nt+1;a+=W,U+=N}}return!0}const h=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let m=null;for(let u=0;u<n;u+=3){let p=s[u],g=p*r;const b=t[e+g],x=t[e+g+1];let w=p<<1;const v=i[w],y=i[w+1];p=s[u+1],g=p*r;const T=t[e+g],S=t[e+g+1];w=p<<1;const A=i[w],I=i[w+1];p=s[u+2],g=p*r;const M=t[e+g],P=t[e+g+1];w=p<<1;const k=i[w],E=i[w+1],X=S-P,V=M-T,O=b-M,$=P-x,B=1/(X*O+V*(x-P));for(let Y=0;Y<f;Y++){let F=this.clippedVerticesLength;if(this.clip(b,x,T,S,M,P,d[Y])){m=h;const U=h.length;if(U===0)continue;let N=U>>1;const W=F+N*r;c.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(c.subarray(0,F)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+N*2)*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),c=this._clippedVerticesTyped,l=this._clippedUVsTyped);const L=c,_=l;this.clippedVerticesLength=W;let q=this.clippedUVsLength;this.clippedUVsLength=q+N*2;for(let Q=0;Q<U;Q+=2,F+=r,q+=2){const st=m[Q],it=m[Q+1];L[F]=st,L[F+1]=it;const nt=st-M,ht=it-P,rt=(X*nt+V*ht)*B,at=($*nt+O*ht)*B,dt=1-rt-at;_[q]=v*rt+A*at+k*dt,_[q+1]=y*rt+I*at+E*dt}F=this.clippedTrianglesLength;const K=F+3*(N-2);o.length<K&&(this._clippedTrianglesTyped=new Uint16Array(K*2),this._clippedTrianglesTyped.set(o.subarray(0,F)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=K;const et=o;N--;for(let Q=1;Q<N;Q++,F+=3)et[F]=a,et[F+1]=a+Q,et[F+2]=a+Q+1;a+=N+1}else{let U=F+3*r;c.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(c.subarray(0,F)),c=this._clippedVerticesTyped),c[F]=b,c[F+1]=x,c[F+r]=T,c[F+r+1]=S,c[F+r*2]=M,c[F+r*2+1]=P;const N=this.clippedUVsLength+3*2;l.length<N&&(this._clippedUVsTyped=new Float32Array(N*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),l=this._clippedUVsTyped);const W=this.clippedUVsLength;l[W]=v,l[W+1]=y,l[W+2]=A,l[W+3]=I,l[W+4]=k,l[W+5]=E,this.clippedVerticesLength=U,this.clippedUVsLength=N,F=this.clippedTrianglesLength,U=F+3,o.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(o.subarray(0,F)),o=this._clippedTrianglesTyped);const L=o;L[F]=a,L[F+1]=a+1,L[F+2]=a+2,a+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),m!==null}clip(t,e,s,n,i,r,c){const l=this.clipOutput;let o=!1,a,h;c.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=c;a.length=8;const f=a;f[0]=t,f[1]=e,f[2]=s,f[3]=n,f[4]=i,f[5]=r,f[6]=t,f[7]=e,h.length=0;const m=c.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],b=p-d[u+2],x=g-d[u+3],w=h.length,v=a;for(let T=0,S=a.length-2;T<S;){t=v[T],e=v[T+1],T+=2,s=v[T],n=v[T+1];const A=x*(p-s)>b*(g-n),I=x*(p-t)-b*(g-e);if(I>0)if(A)h.push(s,n);else{const M=s-t,P=n-e,k=I/(M*x-P*b);k>=0&&k<=1?(h.push(t+M*k,e+P*k),o=!0):h.push(s,n)}else if(A){const M=s-t,P=n-e,k=I/(M*x-P*b);k>=0&&k<=1?(h.push(t+M*k,e+P*k,s,n),o=!0):h.push(s,n)}else o=!0}if(w===h.length)return l.length=0,!0;if(h.push(h[0],h[1]),u===m)break;const y=h;h=a,h.length=0,a=y}if(l!==h){l.length=0;for(let u=0,p=h.length-2;u<p;u++)l[u]=h[u]}else l.length=l.length-2;return o}clipInverse(t,e,s,n,i,r,c){this.inverseVertices.length=0;const l=c.length-4;let o,a;c.length%4>=2?(o=this.clipOutput,a=this.scratch):(o=this.scratch,a=this.clipOutput),o.length=8;let h=c,d=o;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let f=0;;f+=2){const m=h[f],u=h[f+1],p=m-h[f+2],g=u-h[f+3],b=a.length,x=this.inverseVertices.length;this.inverseVertices.push(0),d=o;for(let y=0,T=o.length-2;y<T;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const S=g*(m-s)>p*(u-n),A=g*(m-t)-p*(u-e);if(A>0)if(S)a.push(s,n);else{const I=s-t,M=n-e,P=A/(I*g-M*p);if(P>=0&&P<=1){const k=t+I*P,E=e+M*P;a.push(k,E),this.inverseVertices.push(k,E,s,n)}else a.push(s,n)}else if(S){const I=s-t,M=n-e,P=A/(I*g-M*p);if(P>=0&&P<=1){const k=t+I*P,E=e+M*P;this.inverseVertices.push(k,E),a.push(k,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-x-1;if(w>=6?this.inverseVertices[x]=w:this.inverseVertices.length=x,b===a.length||(a.push(a[0],a[1]),f===l))break;const v=a;a=o,a.length=0,o=v}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,c=e[s-2],l=e[s-1],o=e[0],a=e[1];for(let d=2;d<s;d+=2){const f=e[d],m=e[d+1];r+=o*m-f*a;const u=(o-c)*(m-a)-(a-l)*(f-o);i=i&&u<=0,n=n&&u>=0,c=o,l=a,o=f,a=m}r+=o*e[1]-e[0]*a;const h=(o-c)*(e[1]-a)-(a-l)*(e[0]-o);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,f=s-2,m=s>>1;d<m;d+=2){const u=e[d],p=e[d+1],g=f-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=u,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let c=2;c<e;c+=2){const l=s[c],o=s[c+1];let a=c-2;for(;a>=0&&(n[a]>l||n[a]===l&&n[a+1]>o);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=l,n[a+3]=o}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let c=4;c<e;c+=2,i+=2){const l=n[c],o=n[c+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(l-s[i-4])>=0&&(i-=2,i!==2););s[i]=l,s[i+1]=o}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let c=e-6;c>=0;c-=2,i+=2){const l=n[c],o=n[c+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(l-s[i-4])>=0&&(i-=2,i!==r););s[i]=l,s[i+1]=o}t.length=i-2}},Oi=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Is,n=typeof t=="string"?JSON.parse(t):t,i=n.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=C(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const c=n.bones[r];let l=null;const o=C(c,"parent",null);o&&(l=s.findBone(o));const a=new ps(s.bones.length,c.name,l);a.length=C(c,"length",0)*e;const h=a.setupPose;h.x=C(c,"x",0)*e,h.y=C(c,"y",0)*e,h.rotation=C(c,"rotation",0),h.scaleX=C(c,"scaleX",1),h.scaleY=C(c,"scaleY",1),h.shearX=C(c,"shearX",0),h.shearY=C(c,"shearY",0),h.inherit=R.enumValue(ne,C(c,"inherit","Normal")),a.skinRequired=C(c,"skin",!1);const d=C(c,"color",null);d&&a.color.setFromString(d),a.icon=C(c,"icon",void 0),a.iconSize=C(c,"iconSize",1),a.iconRotation=C(c,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const c=n.slots[r],l=c.name,o=s.findBone(c.bone);if(!o)throw new Error(`Couldn't find bone ${c.bone} for slot ${l}`);const a=new Ms(s.slots.length,l,o),h=C(c,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(c,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(c,"attachment",null),a.blendMode=R.enumValue(Ps,C(c,"blend","normal")),a.visible=C(c,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const c=r.name,l=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const o=new Wt(c);o.skinRequired=l;for(let m=0;m<r.bones.length;m++){const u=s.findBone(r.bones[m]);if(!u)throw new Error(`Couldn't find bone ${r.bones[m]} for IK constraint ${c}.`);o.bones.push(u)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${c}.`);o.target=h;const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=R.enumValue(ys,d));const f=o.setupPose;f.mix=C(r,"mix",1),f.softness=C(r,"softness",0)*e,f.bendDirection=C(r,"bendPositive",!0)?1:-1,f.compress=C(r,"compress",!1),f.stretch=C(r,"stretch",!1),s.constraints.push(o);break}case"transform":{const o=new J(c);o.skinRequired=l;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);o.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);o.source=h,o.localSource=C(r,"localSource",!1),o.localTarget=C(r,"localTarget",!1),o.additive=C(r,"additive",!1),o.clamp=C(r,"clamp",!1);let d=!1,f=!1,m=!1,u=!1,p=!1,g=!1;const b=Object.entries(C(r,"properties",{}));for(const[w,v]of b){const y=this.fromProperty(w),T=this.propertyScale(w,e);y.offset=C(v,"offset",0)*T;const S=Object.entries(C(v,"to",{}));for(const[A,I]of S){let M=1,P;switch(A){case"rotate":{d=!0,P=new Fs;break}case"x":{f=!0,P=new Ys,M=e;break}case"y":{m=!0,P=new ks,M=e;break}case"scaleX":{u=!0,P=new Es;break}case"scaleY":{p=!0,P=new Xs;break}case"shearY":{g=!0,P=new Vs;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}P.offset=C(I,"offset",0)*M,P.max=C(I,"max",1)*M,P.scale=C(I,"scale",1)*M/T,y.to.push(P)}y.to.length>0&&o.properties.push(y)}o.offsets[J.ROTATION]=C(r,"rotation",0),o.offsets[J.X]=C(r,"x",0)*e,o.offsets[J.Y]=C(r,"y",0)*e,o.offsets[J.SCALEX]=C(r,"scaleX",0),o.offsets[J.SCALEY]=C(r,"scaleY",0),o.offsets[J.SHEARY]=C(r,"shearY",0);const x=o.setupPose;d&&(x.mixRotate=C(r,"mixRotate",1)),f&&(x.mixX=C(r,"mixX",1)),m&&(x.mixY=C(r,"mixY",x.mixX)),u&&(x.mixScaleX=C(r,"mixScaleX",1)),p&&(x.mixScaleY=C(r,"mixScaleY",x.mixScaleX)),g&&(x.mixShearY=C(r,"mixShearY",1)),s.constraints.push(o);break}case"path":{const o=new Gt(c);o.skinRequired=l;for(let f=0;f<r.bones.length;f++){const m=r.bones[f],u=s.findBone(m);if(!u)throw new Error(`Couldn't find bone ${m} for path constraint ${r.name}.`);o.bones.push(u)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);o.slot=h,o.positionMode=R.enumValue(vs,C(r,"positionMode","Percent")),o.spacingMode=R.enumValue(Ts,C(r,"spacingMode","Length")),o.rotateMode=R.enumValue(Ss,C(r,"rotateMode","Tangent")),o.offsetRotation=C(r,"rotation",0);const d=o.setupPose;d.position=C(r,"position",0),o.positionMode===0&&(d.position*=e),d.spacing=C(r,"spacing",0),(o.spacingMode===0||o.spacingMode===1)&&(d.spacing*=e),d.mixRotate=C(r,"mixRotate",1),d.mixX=C(r,"mixX",1),d.mixY=C(r,"mixY",d.mixX),s.constraints.push(o);break}case"physics":{const o=new Ht(c);o.skinRequired=l;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);o.bone=h,o.x=C(r,"x",0),o.y=C(r,"y",0),o.rotate=C(r,"rotate",0),o.scaleX=C(r,"scaleX",0),o.shearX=C(r,"shearX",0),o.limit=C(r,"limit",5e3)*e,o.step=1/C(r,"fps",60);const d=o.setupPose;d.inertia=C(r,"inertia",.5),d.strength=C(r,"strength",100),d.damping=C(r,"damping",.85),d.massInverse=1/C(r,"mass",1),d.wind=C(r,"wind",0),d.gravity=C(r,"gravity",0),d.mix=C(r,"mix",1),o.inertiaGlobal=C(r,"inertiaGlobal",!1),o.strengthGlobal=C(r,"strengthGlobal",!1),o.dampingGlobal=C(r,"dampingGlobal",!1),o.massGlobal=C(r,"massGlobal",!1),o.windGlobal=C(r,"windGlobal",!1),o.gravityGlobal=C(r,"gravityGlobal",!1),o.mixGlobal=C(r,"mixGlobal",!1),s.constraints.push(o);break}case"slider":{const o=new St(c);o.skinRequired=l,o.additive=C(r,"additive",!1),o.loop=C(r,"loop",!1),o.setupPose.time=C(r,"time",0),o.setupPose.mix=C(r,"mix",1);const a=r.bone;if(a){if(o.bone=s.findBone(a),!o.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;o.property=this.fromProperty(h);const d=this.propertyScale(h,e);o.property.offset=C(r,"from",0)*d,o.offset=C(r,"to",0),o.scale=C(r,"scale",1)/d,o.local=C(r,"local",!1)}s.constraints.push(o);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const c=n.skins[r],l=new fe(c.name);if(c.bones)for(let o=0;o<c.bones.length;o++){const a=c.bones[o],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${c.name}.`);l.bones.push(h)}if(c.ik)for(let o=0;o<c.ik.length;o++){const a=c.ik[o],h=s.findConstraint(a,Wt);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.transform)for(let o=0;o<c.transform.length;o++){const a=c.transform[o],h=s.findConstraint(a,J);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.path)for(let o=0;o<c.path.length;o++){const a=c.path[o],h=s.findConstraint(a,Gt);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.physics)for(let o=0;o<c.physics.length;o++){const a=c.physics[o],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}if(c.slider)for(let o=0;o<c.slider.length;o++){const a=c.slider[o],h=s.findConstraint(a,St);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${c.name}.`);l.constraints.push(h)}for(const o in c.attachments){const a=s.findSlot(o);if(!a)throw new Error(`Couldn't find skin slot ${o} for skin ${c.name}.`);const h=c.attachments[o];for(const d in h){const f=this.readAttachment(h[d],l,a.index,d,s);f&&l.setAttachment(a.index,d,f)}}s.skins.push(l),l.name==="default"&&(s.defaultSkin=l)}for(let r=0,c=this.linkedMeshes.length;r<c;r++){const l=this.linkedMeshes[r],o=l.skin?s.findSkin(l.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${l.skin}`);const a=o.getAttachment(l.sourceIndex,l.source);if(!a)throw new Error(`Source mesh not found: ${l.source}`);l.mesh.timelineAttachment=l.inheritTimelines?a:l.mesh,l.mesh.setSourceMesh(a),l.mesh.updateSequence();t:if(l.inheritTimelines&&l.slotIndex!==l.sourceIndex){const h=a.timelineSlots;for(const f of h)if(f===l.slotIndex)break t;const d=[...h];d[h.length]=l.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const c=n.events[r],l=new ws(r),o=l.setupPose;o.intValue=C(c,"int",0),o.floatValue=C(c,"float",0),o.stringValue=C(c,"string",""),l._audioPath=C(c,"audio",null),l.audioPath&&(o.volume=C(c,"volume",o.volume),o.balance=C(c,"balance",o.balance)),s.events.push(l)}if(n.animations)for(const r in n.animations){const c=n.animations[r];this.readAnimation(c,r,s)}if(n.constraints)for(const r in n.constraints){const c=n.constraints[r];if(c.type==="slider"){const l=s.findConstraint(c.name,St),o=c.animation,a=s.findAnimation(o);if(!a)throw new Error(`Slider animation not found: ${o}`);l.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new me;break;case"x":e=new ge;break;case"y":e=new pe;break;case"scaleX":e=new be;break;case"scaleY":e=new xe;break;case"shearY":e=new we;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,c=C(t,"name",n);switch(C(t,"type","region")){case"region":{const l=C(t,"path",c),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,c,l,o);if(!a)return null;a.path=l,a.x=C(t,"x",0)*r,a.y=C(t,"y",0)*r,a.scaleX=C(t,"scaleX",1),a.scaleY=C(t,"scaleY",1),a.rotation=C(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=C(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const l=this.attachmentLoader.newBoundingBoxAttachment(e,n,c);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);const o=C(t,"color",null);return o&&l.color.setFromString(o),l}case"mesh":case"linkedmesh":{const l=C(t,"path",c),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,c,l,o);if(!a)return null;a.path=l;const h=C(t,"color",null);h&&a.color.setFromString(h),a.width=C(t,"width",0)*r,a.height=C(t,"height",0)*r;const d=C(t,"source",null);if(d){let m=s;const u=C(t,"slot",null);if(u){const p=i.findSlot(u);if(!p)throw new Error(`Source mesh slot not found: ${u}`);m=p.index}return this.linkedMeshes.push(new Ni(a,C(t,"skin",null),s,m,d,C(t,"timelines",!0))),a}const f=t.uvs;return this.readVertices(t,a,f.length),a.triangles=t.triangles,a.regionUVs=f,a.edges=C(t,"edges",null),a.hullLength=C(t,"hull",0)*2,a.updateSequence(),a}case"path":{const l=this.attachmentLoader.newPathAttachment(e,n,c);if(!l)return null;l.closed=C(t,"closed",!1),l.constantSpeed=C(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,l,o<<1);const a=R.newArray(o/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;l.lengths=a;const h=C(t,"color",null);return h&&l.color.setFromString(h),l}case"point":{const l=this.attachmentLoader.newPointAttachment(e,n,c);if(!l)return null;l.x=C(t,"x",0)*r,l.y=C(t,"y",0)*r,l.rotation=C(t,"rotation",0);const o=C(t,"color",null);return o&&l.color.setFromString(o),l}case"clipping":{const l=this.attachmentLoader.newClippingAttachment(e,n,c);if(!l)return null;const o=C(t,"end",null);o&&(l.endSlot=i.findSlot(o)),l.convex=C(t,"convex",!1),l.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,l,a<<1);const h=C(t,"color",null);return h&&l.color.setFromString(h),l}}return null}readSequence(t){if(t==null)return new Ot(1,!1);const e=new Ot(C(t,"count",0),!0);return e.start=C(t,"start",1),e.digits=C(t,"digits",0),e.setupIndex=C(t,"setup",0),e}readVertices(t,e,s){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const l=R.toFloatArray(i);if(n!==1)for(let o=0,a=i.length;o<a;o++)l[o]*=n;e.vertices=l;return}const r=[],c=[];for(let l=0,o=i.length;l<o;){const a=i[l++];c.push(a);for(let h=l+a*4;l<h;l+=4)c.push(i[l]),r.push(i[l+1]*n),r.push(i[l+2]*n),r.push(i[l+3])}e.bones=c,e.vertices=R.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const o in t.slots){const a=t.slots[o],h=s.findSlot(o);if(!h)throw new Error(`Slot not found: ${o}`);const d=h.index;for(const f in a){const m=a[f];if(!m)continue;const u=m.length;switch(f){case"attachment":{const p=new Yt(u,d);for(let g=0;g<u;g++){const b=m[g];p.setFrame(g,C(b,"time",0),C(b,"name",null))}i.push(p);break}case"rgba":{const p=new _e(u,u<<2,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b,x.a);const y=m[w+1];if(!y){p.shrink(v);break}const T=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(v=H(A,p,v,w,0,b,T,x.r,S.r,1),v=H(A,p,v,w,1,b,T,x.g,S.g,1),v=H(A,p,v,w,2,b,T,x.b,S.b,1),v=H(A,p,v,w,3,b,T,x.a,S.a,1)),b=T,x=S,g=y}i.push(p);break}case"rgb":{const p=new ze(u,u*3,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b);const y=m[w+1];if(!y){p.shrink(v);break}const T=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(v=H(A,p,v,w,0,b,T,x.r,S.r,1),v=H(A,p,v,w,1,b,T,x.g,S.g,1),v=H(A,p,v,w,2,b,T,x.b,S.b,1)),b=T,x=S,g=y}i.push(p);break}case"alpha":{lt(i,m,new We(u,u,d),0,1);break}case"rgba2":{const p=new Ge(u,u*7,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,x.a,w.r,w.g,w.b);const T=m[v+1];if(!T){p.shrink(y);break}const S=C(T,"time",0),A=z.fromString(T.light),I=z.fromString(T.dark),M=g.curve;M&&(y=H(M,p,y,v,0,b,S,x.r,A.r,1),y=H(M,p,y,v,1,b,S,x.g,A.g,1),y=H(M,p,y,v,2,b,S,x.b,A.b,1),y=H(M,p,y,v,3,b,S,x.a,A.a,1),y=H(M,p,y,v,4,b,S,w.r,I.r,1),y=H(M,p,y,v,5,b,S,w.g,I.g,1),y=H(M,p,y,v,6,b,S,w.b,I.b,1)),b=S,x=A,w=I,g=T}i.push(p);break}case"rgb2":{const p=new He(u,u*6,d);let g=m[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,w.r,w.g,w.b);const T=m[v+1];if(!T){p.shrink(y);break}const S=C(T,"time",0),A=z.fromString(T.light),I=z.fromString(T.dark),M=g.curve;M&&(y=H(M,p,y,v,0,b,S,x.r,A.r,1),y=H(M,p,y,v,1,b,S,x.g,A.g,1),y=H(M,p,y,v,2,b,S,x.b,A.b,1),y=H(M,p,y,v,3,b,S,w.r,I.r,1),y=H(M,p,y,v,4,b,S,w.g,I.g,1),y=H(M,p,y,v,5,b,S,w.b,I.b,1)),b=S,x=A,w=I,g=T}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${m.name} (${a.name})`)}}}if(t.bones)for(const o in t.bones){const a=t.bones[o],h=s.findBone(o);if(!h)throw new Error(`Bone not found: ${o}`);const d=h.index;for(const f in a){const m=a[f],u=m.length;if(u!==0)switch(f){case"rotate":lt(i,m,new Dt(u,u,d),0,1);break;case"translate":Rs(i,m,new Ve(u,u<<1,d),"x","y",0,n);break;case"translatex":lt(i,m,new Re(u,u,d),0,n);break;case"translatey":lt(i,m,new Le(u,u,d),0,n);break;case"scale":Rs(i,m,new Be(u,u<<1,d),"x","y",1,1);break;case"scalex":lt(i,m,new Oe(u,u,d),1,1);break;case"scaley":lt(i,m,new Ne(u,u,d),1,1);break;case"shear":Rs(i,m,new De(u,u<<1,d),"x","y",0,1);break;case"shearx":lt(i,m,new Ue(u,u,d),0,1);break;case"sheary":lt(i,m,new qe(u,u,d),0,1);break;case"inherit":{const p=new $e(u,h.index);for(let g=0;g<m.length;g++){const b=m[g];p.setFrame(g,C(b,"time",0),R.enumValue(ne,C(b,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${m.name} (${a.name})`)}}}if(t.ik)for(const o in t.ik){const a=t.ik[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,Wt);if(!d)throw new Error(`IK Constraint not found: ${o}`);const f=new Ke(a.length,a.length<<1,s.constraints.indexOf(d));let m=C(h,"time",0),u=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,b=0;;g++){f.setFrame(g,m,u,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const x=a[g+1];if(!x){f.shrink(b);break}const w=C(x,"time",0),v=C(x,"mix",1),y=C(x,"softness",0)*n,T=h.curve;T&&(b=H(T,f,b,g,0,m,w,u,v,1),b=H(T,f,b,g,1,m,w,p,y,n)),m=w,u=v,p=y,h=x}i.push(f)}if(t.transform)for(const o in t.transform){const a=t.transform[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,J);if(!d)throw new Error(`Transform constraint not found: ${o}`);const f=new Qe(a.length,a.length*6,s.constraints.indexOf(d));let m=C(h,"time",0),u=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),b=C(h,"mixScaleX",1),x=C(h,"mixScaleY",1);const w=C(h,"mixShearY",1);for(let v=0,y=0;;v++){f.setFrame(v,m,u,p,g,b,x,w);const T=a[v+1];if(!T){f.shrink(y);break}const S=C(T,"time",0),A=C(T,"mixRotate",1),I=C(T,"mixX",1),M=C(T,"mixY",I),P=C(T,"mixScaleX",1),k=C(T,"mixScaleY",1),E=C(T,"mixShearY",1),X=h.curve;X&&(y=H(X,f,y,v,0,m,S,u,A,1),y=H(X,f,y,v,1,m,S,p,I,1),y=H(X,f,y,v,2,m,S,g,M,1),y=H(X,f,y,v,3,m,S,b,P,1),y=H(X,f,y,v,4,m,S,x,k,1),y=H(X,f,y,v,5,m,S,w,E,1)),m=S,u=A,p=I,g=M,b=P,x=k,b=P,h=T}i.push(f)}if(t.path)for(const o in t.path){const a=t.path[o],h=s.findConstraint(o,Gt);if(!h)throw new Error(`Path constraint not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const m=a[f];let u=m[0];if(!u)continue;const p=m.length;switch(f){case"position":{const g=new Ze(p,p,d);lt(i,m,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new ts(p,p,d);lt(i,m,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new es(p,p*3,d);let b=C(u,"time",0),x=C(u,"mixRotate",1),w=C(u,"mixX",1),v=C(u,"mixY",w);for(let y=0,T=0;;y++){g.setFrame(y,b,x,w,v);const S=m[y+1];if(!S){g.shrink(T);break}const A=C(S,"time",0),I=C(S,"mixRotate",1),M=C(S,"mixX",1),P=C(S,"mixY",M),k=u.curve;k&&(T=H(k,g,T,y,0,b,A,x,I,1),T=H(k,g,T,y,1,b,A,w,M,1),T=H(k,g,T,y,2,b,A,v,P,1)),b=A,x=I,w=M,v=P,u=S}i.push(g);break}}}}if(t.physics)for(const o in t.physics){const a=t.physics[o];let h=-1;if(o.length>0){const d=s.findConstraint(o,Ht);if(!d)throw new Error(`Physics constraint not found: ${o}`);h=s.constraints.indexOf(d)}for(const d in a){const f=a[d];let m=f[0];if(!m)continue;const u=f.length;let p,g=0;if(d==="reset"){const b=new cs(u,h);for(let x=0;m!=null;m=f[x+1],x++)b.setFrame(x,C(m,"time",0));i.push(b);continue}switch(d){case"inertia":p=new ss(u,u,h);break;case"strength":p=new ns(u,u,h);break;case"damping":p=new is(u,u,h);break;case"mass":p=new rs(u,u,h);break;case"wind":p=new as(u,u,h);break;case"gravity":p=new os(u,u,h);break;case"mix":{g=1,p=new ls(u,u,h);break}default:continue}lt(i,f,p,g,1)}}if(t.slider)for(const o in t.slider){const a=t.slider[o],h=s.findConstraint(o,St);if(!h)throw new Error(`Slider not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const m=a[f];if(!m[0])continue;const p=m.length;switch(f){case"time":lt(i,m,new hs(p,p,d),1,1);break;case"mix":lt(i,m,new ds(p,p,d),1,1);break}}}if(t.attachments)for(const o in t.attachments){const a=t.attachments[o],h=s.findSkin(o);if(!h)throw new Error(`Skin not found: ${o}`);for(const d in a){const f=a[d],m=s.findSlot(d);if(!m)throw new Error(`Attachment slot not found: ${d}`);const u=m.index;for(const p in f){const g=f[p],b=h.getAttachment(u,p);if(!b)throw new Error(`Timeline attachment not found: ${p}`);for(const x in g){const w=g[x];let v=w[0];if(v){if(x==="deform"){const y=b.bones,T=b.vertices,S=y?T.length/3*2:T.length,A=new je(w.length,w.length,u,b);let I=C(v,"time",0);for(let M=0,P=0;;M++){let k;const E=C(v,"vertices",null);if(!E)k=y?R.newFloatArray(S):T;else{k=R.newFloatArray(S);const $=C(v,"offset",0);if(R.arrayCopy(E,0,k,$,E.length),n!==1)for(let B=$,Y=B+E.length;B<Y;B++)k[B]*=n;if(!y)for(let B=0;B<S;B++)k[B]+=T[B]}A.setFrame(M,I,k);const X=w[M+1];if(!X){A.shrink(P);break}const V=C(X,"time",0),O=v.curve;O&&(P=H(O,A,P,M,0,I,V,0,1,1)),I=V,v=X}i.push(A)}else if(x==="sequence"){const y=new Je(w.length,u,b);let T=0;for(let S=0;S<w.length;S++){const A=C(v,"delay",T),I=C(v,"time",0),M=Ee[C(v,"mode","hold")],P=C(v,"index",0);y.setFrame(S,I,M,P,A),T=A,v=w[S+1]}i.push(y)}}}}}}if(t.drawOrder){const o=new It(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)o.setFrame(h++,C(d,"time",0),pn(s,d,a,null));i.push(o)}if(t.drawOrderFolder)for(const o of t.drawOrderFolder){const a=C(o,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const f=C(o,"keys",[]),m=new qt(f.length,h,s.slots.length);let u=0;for(const p of f)m.setFrame(u++,C(p,"time",0),pn(s,p,h.length,h));i.push(m)}if(t.events){const o=new Zt(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],f=s.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const m=f.setupPose,u=new ae(R.toSinglePrecision(C(d,"time",0)),f);u.intValue=C(d,"int",m.intValue),u.floatValue=C(d,"float",m.floatValue),u.stringValue=C(d,"string",m.stringValue),u.data.audioPath&&(u.volume=C(d,"volume",m.volume),u.balance=C(d,"balance",m.volume)),o.setFrame(a,u)}i.push(o)}let r=0;for(let o=0,a=i.length;o<a;o++)r=Math.max(r,i[o].getDuration());const c=new Kt(e,i,r),l=C(t,"color",null);l!==null&&c.color.setFromString(l),s.animations.push(c)}},Ni=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function lt(t,e,s,n,i){let r=e[0],c=r.time??0,l=(r.value??n)*i,o=0;for(let a=0;;a++){s.setFrame(a,c,l);const h=e[a+1];if(!h){s.shrink(o),t.push(s);return}const d=h.time??0,f=(h.value??n)*i;r.curve&&(o=H(r.curve,s,o,a,0,c,d,l,f,i)),c=d,l=f,r=h}}function Rs(t,e,s,n,i,r,c){let l=e[0],o=l.time??0,a=(l[n]??r)*c,h=(l[i]??r)*c,d=0;for(let f=0;;f++){s.setFrame(f,o,a,h);const m=e[f+1];if(!m){s.shrink(d),t.push(s);return}const u=m.time??0,p=(m[n]??r)*c,g=(m[i]??r)*c,b=l.curve;b&&(d=H(b,s,d,f,0,o,u,a,p,c),d=H(b,s,d,f,1,o,u,h,g,c)),o=u,a=p,h=g,l=m}}function pn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),c=new Array(s-i.length);let l=0,o=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let f=0;f<s;f++)if(n[f]===h.index){d=f;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;l!==d;)c[o++]=l++;r[l+a.offset]=l++}for(;l<s;)c[o++]=l++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=c[--o]);return r}function H(t,e,s,n,i,r,c,l,o,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],f=t[h+1]*a,m=t[h+2],u=t[h+3]*a;return e.setBezier(s,n,i,r,l,d,f,m,u,c,o),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var Di=class{commandPool=new Ui;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new gn;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let c=0;c<t.slots.length;c++){const l=r[c],o=l.appliedPose.attachment;if(!o){i.clipEnd(l);continue}const a=l.appliedPose,h=a.color;if((h.a===0||!l.bone.active)&&!(o instanceof zt)){i.clipEnd(l);continue}let f,m,u,p,g,b,x;if(o instanceof j){if(b=o.color,b.a===0){i.clipEnd(l);continue}const S=o.sequence,A=S.resolveIndex(a);o.computeWorldVertices(l,o.getOffsets(a),this.worldVertices,0,n),f=this.worldVertices,m=4,u=S.getUVs(A),p=this.quadIndices,g=6,x=S.regions[A]?.texture}else if(o instanceof yt){if(b=o.color,b.a===0){i.clipEnd(l);continue}this.worldVertices.length<o.worldVerticesLength&&(this.worldVertices=new Float32Array(o.worldVerticesLength)),o.computeWorldVertices(t,l,0,o.worldVerticesLength,this.worldVertices,0,n),f=this.worldVertices,m=o.worldVerticesLength>>1;const S=o.sequence,A=S.resolveIndex(a);u=S.getUVs(A),p=o.triangles,g=p.length,x=S.regions[A]?.texture}else if(o instanceof zt){i.clipStart(t,l,o);continue}else continue;const w=t.color;let v,y;if(e){let S;if(s){S=Math.floor(s[3]*w.a*h.a*b.a*255);const A=Math.floor(S*s[0]*w.r*h.r*b.r),I=Math.floor(S*s[1]*w.g*h.g*b.g),M=Math.floor(S*s[2]*w.b*h.b*b.b);v=S<<24|A<<16|I<<8|M}else{S=Math.floor(w.a*h.a*b.a*255);const A=Math.floor(S*w.r*h.r*b.r),I=Math.floor(S*w.g*h.g*b.g),M=Math.floor(S*w.b*h.b*b.b);v=S<<24|A<<16|I<<8|M}if(y=4278190080,a.darkColor){const{r:A,g:I,b:M}=a.darkColor;y=4278190080|Math.floor(A*S)<<16|Math.floor(I*S)<<8|Math.floor(M*S)}}else{if(s){const S=Math.floor(s[3]*w.a*h.a*b.a*255),A=Math.floor(s[0]*w.r*h.r*b.r*255),I=Math.floor(s[1]*w.g*h.g*b.g*255),M=Math.floor(s[2]*w.b*h.b*b.b*255);v=S<<24|A<<16|I<<8|M}else{const S=Math.floor(w.a*h.a*b.a*255),A=Math.floor(w.r*h.r*b.r*255),I=Math.floor(w.g*h.g*b.g*255),M=Math.floor(w.b*h.b*b.b*255);v=S<<24|A<<16|I<<8|M}if(y=0,a.darkColor){const{r:S,g:A,b:I}=a.darkColor;y=Math.floor(S*255)<<16|Math.floor(A*255)<<8|Math.floor(I*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(f,0,p,g,u,n),f=i.clippedVerticesTyped,m=i.clippedVerticesLength/n,u=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const T=this.commandPool.getCommand(m,g,n);T.blendMode=l.data.blendMode,T.texture=x,T.positions.set(f.subarray(0,m*n)),T.uvs.set(u.subarray(0,m<<1));for(let S=0;S<m;S++)T.colors[S]=v,T.darkColors[S]=y;p instanceof Uint16Array?T.indices.set(p.subarray(0,g)):T.indices.set(p.slice(0,g)),this.renderCommands.push(T),i.clipEnd(l)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const c=t[e],l=this.commandPool.getCommand(n,i,r);l.blendMode=c.blendMode,l.texture=c.texture;let o=0,a=0,h=0,d=0,f=0;for(let m=e;m<=s;m++){const u=t[m];l.positions.set(u.positions,o),o+=u.numVertices*r,l.uvs.set(u.uvs,a),a+=u.numVertices<<1,l.colors.set(u.colors,h),l.darkColors.set(u.darkColors,h),h+=u.numVertices;for(let p=0;p<u.numIndices;p++)l.indices[d+p]=u.indices[p]+f;d+=u.numIndices,f+=u.numVertices}return l}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,c=n.numVertices,l=n.numIndices;for(;r<=this.renderCommands.length;){const o=r<this.renderCommands.length?this.renderCommands[r]:null;if(o&&o.numVertices===0&&o.numIndices===0){r++;continue}if(o!==null&&o.texture===n.texture&&o.blendMode===n.blendMode&&o.colors[0]===n.colors[0]&&o.darkColors[0]===n.darkColors[0]&&l+o.numIndices<65535)c+=o.numVertices,l+=o.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,c,l,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,c=n.numVertices,l=n.numIndices}r++}return e}},Ui=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),c=new Uint32Array(t),l=new Uint32Array(t),o=new Uint16Array(e);n={positions:i,uvs:r,colors:c,darkColors:l,indices:o,_positions:i,_uvs:r,_colors:c,_darkColors:l,_indices:o,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},bn=class extends Pe{constructor(t){super(t)}setFilters(t,e){}setWraps(t,e){}dispose(){}},qi=class extends Zs{constructor(t="",e=new ms){super(s=>new bn(s),t,e)}},$i=R.newFloatArray(8),_i=class Ae{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=R.newFloatArray(8*1024);tempColor=new z;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){const s=this.ctx,n=this.tempColor,i=e.color,r=e.drawOrder.appliedPose;this.debugRendering&&(s.strokeStyle="green");for(let c=0,l=r.length;c<l;c++){const o=r[c],a=o.bone;if(!a.active)continue;const h=o.appliedPose,d=h.attachment;if(!(d instanceof j))continue;const f=d.sequence,m=f.resolveIndex(h);d.computeWorldVertices(o,d.getOffsets(h),$i,0,2);const u=f.regions[m],p=u.texture.getImage(),g=h.color,b=d.color;n.set(i.r*g.r*b.r,i.g*g.g*b.g,i.b*g.b*b.b,i.a*g.a*b.a),s.save();const x=a.appliedPose;s.transform(x.a,x.c,x.b,x.d,x.worldX,x.worldY);const w=d.getOffsets(h);s.translate(w[0],w[1]),s.rotate(d.rotation*Math.PI/180);const v=d.width/u.originalWidth;s.scale(v*d.scaleX,v*d.scaleY);let y=u.width,T=u.height;if(s.translate(y/2,T/2),u.degrees===90){const S=y;y=T,T=S,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-y/2,-T/2),s.globalAlpha=n.a,s.drawImage(p,p.width*u.u,p.height*u.v,y,T,0,0,y,T),this.debugRendering&&s.strokeRect(0,0,y,T),s.restore()}}drawTriangles(e){const s=this.ctx,n=this.tempColor,i=e.color,r=e.drawOrder.appliedPose;let c=null,l=this.vertices,o=null;for(let a=0,h=r.length;a<h;a++){const d=r[a],f=d.appliedPose,m=f.attachment;let u;if(m instanceof j){const p=m.sequence,g=p.resolveIndex(f),b=p.getUVs(g),x=m.getOffsets(f);l=this.computeRegionVertices(d,m,x,b,!1),o=Ae.QUAD_TRIANGLES,u=(p.regions[g]?.texture).getImage()}else if(m instanceof yt){const p=m.sequence,g=p.resolveIndex(f),b=p.getUVs(g);l=this.computeMeshVertices(d,m,b,!1),o=m.triangles,u=(p.regions[g]?.texture).getImage()}else continue;if(u){d.data.blendMode!==c&&(c=d.data.blendMode);const p=f.color,g=m.color;n.set(i.r*p.r*g.r,i.g*p.g*g.g,i.b*p.b*g.b,i.a*p.a*g.a),s.globalAlpha=n.a;for(let b=0;b<o.length;b+=3){const x=o[b]*8,w=o[b+1]*8,v=o[b+2]*8,y=l[x],T=l[x+1],S=l[x+6],A=l[x+7],I=l[w],M=l[w+1],P=l[w+6],k=l[w+7],E=l[v],X=l[v+1],V=l[v+6],O=l[v+7];this.drawTriangle(u,y,T,S,A,I,M,P,k,E,X,V,O),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(y,T),s.lineTo(I,M),s.lineTo(E,X),s.lineTo(y,T),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,n,i,r,c,l,o,a,h,d,f,m){const u=this.ctx,p=e.width-1,g=e.height-1;i*=p,r*=g,o*=p,a*=g,f*=p,m*=g,u.beginPath(),u.moveTo(s,n),u.lineTo(c,l),u.lineTo(h,d),u.closePath(),c-=s,l-=n,h-=s,d-=n,o-=i,a-=r,f-=i,m-=r;let b=o*m-f*a;if(b===0)return;b=1/b;const x=(m*c-a*h)*b,w=(m*l-a*d)*b,v=(o*h-f*c)*b,y=(o*d-f*l)*b,T=s-x*i-v*r,S=n-w*i-y*r;u.save(),u.transform(x,w,v,y,T,S),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,n,i,r){const c=e.skeleton.color,l=e.appliedPose.color,o=s.color,a=c.a*l.a*o.a,h=r?a:1,d=this.tempColor;d.set(c.r*l.r*o.r*h,c.g*l.g*o.g*h,c.b*l.b*o.b*h,a),s.computeWorldVertices(e,n,this.vertices,0,Ae.VERTEX_SIZE);const f=this.vertices;return f[j.C1R]=d.r,f[j.C1G]=d.g,f[j.C1B]=d.b,f[j.C1A]=d.a,f[j.U1]=i[0],f[j.V1]=i[1],f[j.C2R]=d.r,f[j.C2G]=d.g,f[j.C2B]=d.b,f[j.C2A]=d.a,f[j.U2]=i[2],f[j.V2]=i[3],f[j.C3R]=d.r,f[j.C3G]=d.g,f[j.C3B]=d.b,f[j.C3A]=d.a,f[j.U3]=i[4],f[j.V3]=i[5],f[j.C4R]=d.r,f[j.C4G]=d.g,f[j.C4B]=d.b,f[j.C4A]=d.a,f[j.U4]=i[6],f[j.V4]=i[7],f}computeMeshVertices(e,s,n,i){const r=e.skeleton,c=r.color,l=e.appliedPose.color,o=s.color,a=c.a*l.a*o.a,h=i?a:1,d=this.tempColor;d.set(c.r*l.r*o.r*h,c.g*l.g*o.g*h,c.b*l.b*o.b*h,a);const f=s.worldVerticesLength/2;let m=this.vertices;m.length<s.worldVerticesLength&&(this.vertices=m=R.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(r,e,0,s.worldVerticesLength,m,0,Ae.VERTEX_SIZE);for(let u=0,p=0,g=2;u<f;u++)m[g++]=d.r,m[g++]=d.g,m[g++]=d.b,m[g++]=d.a,m[g++]=n[p++],m[g++]=n[p++],g+=2;return m}};return On(Ds)})();