@esotericsoftware/spine-canvas 4.2.81 → 4.2.82
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 Ee=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,Ls=Object.getOwnPropertyNames,Ds=Object.prototype.hasOwnProperty,Ns=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Os=(e,t)=>{for(var s in t)Ee(e,s,{get:t[s],enumerable:!0})},_s=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ls(t))!Ds.call(e,n)&&n!==s&&Ee(e,n,{get:()=>t[n],enumerable:!(r=Vs(t,n))||r.enumerable});return e},qs=e=>_s(Ee({},"__esModule",{value:!0}),e),B=(e,t,s)=>(Ns(e,typeof t!="symbol"?t+"":t,s),s),ss={};Os(ss,{AlphaTimeline:()=>xt,Animation:()=>Ve,AnimationState:()=>us,AnimationStateAdapter:()=>$s,AnimationStateData:()=>js,AssetManager:()=>Vi,AssetManagerBase:()=>As,AtlasAttachmentLoader:()=>Qs,Attachment:()=>st,AttachmentTimeline:()=>pe,BinaryInput:()=>Ys,BlendMode:()=>Je,Bone:()=>Nt,BoneData:()=>Dt,BoundingBoxAttachment:()=>qe,CURRENT:()=>bs,CanvasTexture:()=>Xs,ClippingAttachment:()=>Ue,Color:()=>O,ConstraintData:()=>Xe,CurveTimeline:()=>oe,CurveTimeline1:()=>re,CurveTimeline2:()=>Le,DebugUtils:()=>zs,DeformTimeline:()=>wt,Downloader:()=>Ot,DrawOrderTimeline:()=>we,Event:()=>_t,EventData:()=>qt,EventQueue:()=>gs,EventTimeline:()=>Me,EventType:()=>te,FIRST:()=>Rt,FakeTexture:()=>Js,HOLD_FIRST:()=>_e,HOLD_MIX:()=>xs,HOLD_SUBSEQUENT:()=>Et,IkConstraint:()=>Cs,IkConstraintData:()=>Ut,IkConstraintTimeline:()=>yt,Inherit:()=>Ye,InheritTimeline:()=>ut,IntSet:()=>Us,Interpolation:()=>is,MathUtils:()=>F,MeshAttachment:()=>ye,MixBlend:()=>os,MixDirection:()=>hs,PathAttachment:()=>Ae,PathConstraint:()=>Ce,PathConstraintData:()=>Wt,PathConstraintMixTimeline:()=>Ct,PathConstraintPositionTimeline:()=>St,PathConstraintSpacingTimeline:()=>At,Physics:()=>Ts,PhysicsConstraintDampingTimeline:()=>Tt,PhysicsConstraintGravityTimeline:()=>Xt,PhysicsConstraintInertiaTimeline:()=>It,PhysicsConstraintMassTimeline:()=>Mt,PhysicsConstraintMixTimeline:()=>Ft,PhysicsConstraintResetTimeline:()=>De,PhysicsConstraintStrengthTimeline:()=>kt,PhysicsConstraintTimeline:()=>fe,PhysicsConstraintWindTimeline:()=>Yt,PointAttachment:()=>Lt,Pool:()=>ke,PositionMode:()=>ze,Pow:()=>rs,PowOut:()=>Ws,RGB2Timeline:()=>pt,RGBA2Timeline:()=>bt,RGBATimeline:()=>mt,RGBTimeline:()=>gt,RegionAttachment:()=>V,RotateMode:()=>He,RotateTimeline:()=>Te,SETUP:()=>Pt,SUBSEQUENT:()=>Oe,ScaleTimeline:()=>lt,ScaleXTimeline:()=>ot,ScaleYTimeline:()=>ht,SequenceTimeline:()=>Se,ShearTimeline:()=>ct,ShearXTimeline:()=>dt,ShearYTimeline:()=>ft,Skeleton:()=>$e,SkeletonBinary:()=>ei,SkeletonBounds:()=>Ei,SkeletonClipping:()=>Kt,SkeletonData:()=>Gt,SkeletonJson:()=>Pi,SkeletonRenderer:()=>Zt,Skin:()=>je,SkinEntry:()=>Ht,Slot:()=>Is,SlotData:()=>$t,SpacingMode:()=>Ge,StringSet:()=>tt,Texture:()=>Bt,TextureAtlas:()=>ys,TextureAtlasPage:()=>vs,TextureAtlasRegion:()=>Vt,TextureFilter:()=>We,TextureRegion:()=>ws,TextureWrap:()=>ps,TimeKeeper:()=>Gs,Timeline:()=>J,TrackEntry:()=>ms,TransformConstraint:()=>ks,TransformConstraintData:()=>jt,TransformConstraintTimeline:()=>vt,TranslateTimeline:()=>rt,TranslateXTimeline:()=>nt,TranslateYTimeline:()=>at,Triangulator:()=>se,Utils:()=>E,Vector2:()=>Pe,VertexAttachment:()=>le,WindowedMean:()=>Hs});var Us=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}},tt=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,r=0){this.r=e,this.g=t,this.b=s,this.a=r}set(e,t,s,r){return this.r=e,this.g=t,this.b=s,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,r){return this.r+=e,this.g+=t,this.b+=s,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(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new be().setFromString(e)}},O=be;B(O,"WHITE",new be(1,1,1,1)),B(O,"RED",new be(1,0,0,1)),B(O,"GREEN",new be(0,1,0,1)),B(O,"BLUE",new be(0,0,1,1)),B(O,"MAGENTA",new be(1,0,1,1));var ae=class{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ae.degRad)}static sinDeg(e){return Math.sin(e*ae.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ae.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ae.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let r=Math.random(),n=t-e;return r<=(s-e)/n?e+Math.sqrt(r*n*(s-e)):t-Math.sqrt((1-r)*n*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},F=ae;B(F,"PI",3.1415927),B(F,"PI2",ae.PI*2),B(F,"invPI2",1/ae.PI2),B(F,"radiansToDegrees",180/ae.PI),B(F,"radDeg",ae.radiansToDegrees),B(F,"degreesToRadians",ae.PI/180),B(F,"degRad",ae.degreesToRadians);var is=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},rs=class extends is{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}},Ws=class extends rs{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},ve=class{static arrayCopy(e,t,s,r,n){for(let c=t,o=r;c<t+n;c++,o++)s[o]=e[c]}static arrayFill(e,t,s,r){for(let n=t;n<s;n++)e[n]=r}static setArraySize(e,t,s=0){let r=e.length;if(r==t)return e;if(e.length=t,r<t)for(let n=r;n<t;n++)e[n]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:ve.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t;return s}static newFloatArray(e){if(ve.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(ve.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return ve.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return ve.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},E=ve;B(E,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var zs=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)}}},ke=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}},Pe=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}},Gs=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)}},Hs=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}},st=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ns=class extends st{id=ns.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,r,n,c){s=n+(s>>1)*c;let o=e.bone.skeleton,i=e.deform,l=this.vertices,a=this.bones;if(!a){i.length>0&&(l=i);let f=e.bone,m=f.worldX,x=f.worldY,w=f.a,p=f.b,g=f.c,b=f.d;for(let v=t,y=n;y<s;v+=2,y+=c){let S=l[v],A=l[v+1];r[y]=S*w+A*p+m,r[y+1]=S*g+A*b+x}return}let h=0,u=0;for(let f=0;f<t;f+=2){let m=a[h];h+=m+1,u+=m}let d=o.bones;if(i.length==0)for(let f=n,m=u*3;f<s;f+=c){let x=0,w=0,p=a[h++];for(p+=h;h<p;h++,m+=3){let g=d[a[h]],b=l[m],v=l[m+1],y=l[m+2];x+=(b*g.a+v*g.b+g.worldX)*y,w+=(b*g.c+v*g.d+g.worldY)*y}r[f]=x,r[f+1]=w}else{let f=i;for(let m=n,x=u*3,w=u<<1;m<s;m+=c){let p=0,g=0,b=a[h++];for(b+=h;h<b;h++,x+=3,w+=2){let v=d[a[h]],y=l[x]+f[w],S=l[x+1]+f[w+1],A=l[x+2];p+=(y*v.a+S*v.b+v.worldX)*A,g+=(y*v.c+S*v.d+v.worldY)*A}r[m]=p,r[m+1]=g}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},le=ns;B(le,"nextID",0);var Be=class{id=Be.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Be(this.regions.length);return E.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];t.region!=r&&(t.region=r,t.updateRegion())}getPath(e,t){let s=e,r=(this.start+t).toString();for(let n=this.digits-r.length;n>0;n--)s+="0";return s+=r,s}static nextID(){return Be._nextID++}},it=Be;B(it,"_nextID",0);var as=(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))(as||{}),ls=[0,1,2,3,4,5,6],Ve=class{name;timelines=[];timelineIds=new tt;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,n,c,o,i){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let a=0,h=l.length;a<h;a++)l[a].apply(e,t,s,n,c,o,i)}},os=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(os||{}),hs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(hs||{}),_={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=E.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let n=s;n<r;n+=s)if(e[n]>t)return n-s;return r-s}},oe=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=E.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=E.newFloatArray(t);E.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,n,c,o,i,l,a,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(r-c*2+i)*.03,m=(n-o*2+l)*.03,x=((c-i)*3-r+a)*.006,w=((o-l)*3-n+h)*.006,p=f*2+x,g=m*2+w,b=(c-r)*.3+f+x*.16666667,v=(o-n)*.3+m+w*.16666667,y=r+b,S=n+v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=p,v+=g,p+=x,g+=w,y+=b,S+=v}getBezierValue(e,t,s,r){let n=this.curves;if(n[r]>e){let l=this.frames[t],a=this.frames[t+s];return a+(e-l)/(n[r]-l)*(n[r+1]-a)}let c=r+18;for(r+=2;r<c;r+=2)if(n[r]>=e){let l=n[r-2],a=n[r-1];return a+(e-l)/(n[r]-l)*(n[r+1]-a)}t+=this.getFrameEntries();let o=n[c-2],i=n[c-1];return i+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-i)}},re=class extends oe{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let n=2;n<=s;n+=2)if(t[n]>e){s=n-2;break}let r=this.curves[s>>1];switch(r){case 0:let n=t[s],c=t[s+1];return c+(e-n)/(t[s+2]-n)*(t[s+2+1]-c);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,n){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}let c=this.getCurveValue(e);switch(s){case 0:return n+c*t;case 1:case 2:c+=n-r}return r+c*t}getAbsoluteValue(e,t,s,r,n){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}let c=this.getCurveValue(e);return s==0?n+(c-n)*t:r+(c-r)*t}getAbsoluteValue2(e,t,s,r,n,c){if(e<this.frames[0]){switch(s){case 0:return n;case 1:return r+(n-r)*t}return r}return s==0?n+(c-n)*t:r+(c-r)*t}getScaleValue(e,t,s,r,n,c){const o=this.frames;if(e<o[0]){switch(s){case 0:return c;case 1:return n+(c-n)*t}return n}let i=this.getCurveValue(e)*c;if(t==1)return s==3?n+i-c:i;if(r==1)switch(s){case 0:return c+(Math.abs(i)*F.signum(c)-c)*t;case 1:case 2:return n+(Math.abs(i)*F.signum(n)-n)*t}else{let l=0;switch(s){case 0:return l=Math.abs(c)*F.signum(i),l+(i-l)*t;case 1:case 2:return l=Math.abs(n)*F.signum(i),l+(i-l)*t}}return n+(i-c)*t}},Le=class extends oe{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},Te=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.rotation=this.getRelativeValue(s,n,c,i.rotation,i.data.rotation))}},rt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:i.x=i.data.x,i.y=i.data.y;return;case 1:i.x+=(i.data.x-i.x)*n,i.y+=(i.data.y-i.y)*n}return}let a=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,h+=(l[u+3+2]-h)*m;break;case 1:a=l[u+1],h=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:i.x=i.data.x+a*n,i.y=i.data.y+h*n;break;case 1:case 2:i.x+=(i.data.x+a-i.x)*n,i.y+=(i.data.y+h-i.y)*n;break;case 3:i.x+=a*n,i.y+=h*n}}},nt=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.x=this.getRelativeValue(s,n,c,i.x,i.data.x))}},at=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.y=this.getRelativeValue(s,n,c,i.y,i.data.y))}},lt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:i.scaleX=i.data.scaleX,i.scaleY=i.data.scaleY;return;case 1:i.scaleX+=(i.data.scaleX-i.scaleX)*n,i.scaleY+=(i.data.scaleY-i.scaleY)*n}return}let a,h,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,h+=(l[u+3+2]-h)*m;break;case 1:a=l[u+1],h=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}if(a*=i.data.scaleX,h*=i.data.scaleY,n==1)c==3?(i.scaleX+=a-i.data.scaleX,i.scaleY+=h-i.data.scaleY):(i.scaleX=a,i.scaleY=h);else{let f=0,m=0;if(o==1)switch(c){case 0:f=i.data.scaleX,m=i.data.scaleY,i.scaleX=f+(Math.abs(a)*F.signum(f)-f)*n,i.scaleY=m+(Math.abs(h)*F.signum(m)-m)*n;break;case 1:case 2:f=i.scaleX,m=i.scaleY,i.scaleX=f+(Math.abs(a)*F.signum(f)-f)*n,i.scaleY=m+(Math.abs(h)*F.signum(m)-m)*n;break;case 3:i.scaleX+=(a-i.data.scaleX)*n,i.scaleY+=(h-i.data.scaleY)*n}else switch(c){case 0:f=Math.abs(i.data.scaleX)*F.signum(a),m=Math.abs(i.data.scaleY)*F.signum(h),i.scaleX=f+(a-f)*n,i.scaleY=m+(h-m)*n;break;case 1:case 2:f=Math.abs(i.scaleX)*F.signum(a),m=Math.abs(i.scaleY)*F.signum(h),i.scaleX=f+(a-f)*n,i.scaleY=m+(h-m)*n;break;case 3:i.scaleX+=(a-i.data.scaleX)*n,i.scaleY+=(h-i.data.scaleY)*n}}}},ot=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.scaleX=this.getScaleValue(s,n,c,o,i.scaleX,i.data.scaleX))}},ht=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.scaleY=this.getScaleValue(s,n,c,o,i.scaleY,i.data.scaleY))}},ct=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:i.shearX=i.data.shearX,i.shearY=i.data.shearY;return;case 1:i.shearX+=(i.data.shearX-i.shearX)*n,i.shearY+=(i.data.shearY-i.shearY)*n}return}let a=0,h=0,u=J.search(l,s,3),d=this.curves[u/3];switch(d){case 0:let f=l[u];a=l[u+1],h=l[u+2];let m=(s-f)/(l[u+3]-f);a+=(l[u+3+1]-a)*m,h+=(l[u+3+2]-h)*m;break;case 1:a=l[u+1],h=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}switch(c){case 0:i.shearX=i.data.shearX+a*n,i.shearY=i.data.shearY+h*n;break;case 1:case 2:i.shearX+=(i.data.shearX+a-i.shearX)*n,i.shearY+=(i.data.shearY+h-i.shearY)*n;break;case 3:i.shearX+=a*n,i.shearY+=h*n}}},dt=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.shearX=this.getRelativeValue(s,n,c,i.shearX,i.data.shearX))}},ft=class extends re{boneIndex=0;constructor(e,t,s){super(e,t,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];i.active&&(i.shearY=this.getRelativeValue(s,n,c,i.shearY,i.data.shearY))}},ut=class extends J{boneIndex=0;constructor(e,t){super(e,[_.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,r,n,c,o){let i=e.bones[this.boneIndex];if(!i.active)return;if(o==1){c==0&&(i.inherit=i.data.inherit);return}let l=this.frames;if(s<l[0]){(c==0||c==1)&&(i.inherit=i.data.inherit);return}i.inherit=this.frames[J.search(l,s,2)+1]}},mt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,r,n,c){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=c}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color;if(s<l[0]){let w=i.data.color;switch(c){case 0:a.setFromColor(w);return;case 1:a.add((w.r-a.r)*n,(w.g-a.g)*n,(w.b-a.b)*n,(w.a-a.a)*n)}return}let h=0,u=0,d=0,f=0,m=J.search(l,s,5),x=this.curves[m/5];switch(x){case 0:let w=l[m];h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];let p=(s-w)/(l[m+5]-w);h+=(l[m+5+1]-h)*p,u+=(l[m+5+2]-u)*p,d+=(l[m+5+3]-d)*p,f+=(l[m+5+4]-f)*p;break;case 1:h=l[m+1],u=l[m+2],d=l[m+3],f=l[m+4];break;default:h=this.getBezierValue(s,m,1,x-2),u=this.getBezierValue(s,m,2,x+18-2),d=this.getBezierValue(s,m,3,x+18*2-2),f=this.getBezierValue(s,m,4,x+18*3-2)}n==1?a.set(h,u,d,f):(c==0&&a.setFromColor(i.data.color),a.add((h-a.r)*n,(u-a.g)*n,(d-a.b)*n,(f-a.a)*n))}},gt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,n){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color;if(s<l[0]){let x=i.data.color;switch(c){case 0:a.r=x.r,a.g=x.g,a.b=x.b;return;case 1:a.r+=(x.r-a.r)*n,a.g+=(x.g-a.g)*n,a.b+=(x.b-a.b)*n}return}let h=0,u=0,d=0,f=J.search(l,s,4),m=this.curves[f>>2];switch(m){case 0:let x=l[f];h=l[f+1],u=l[f+2],d=l[f+3];let w=(s-x)/(l[f+4]-x);h+=(l[f+4+1]-h)*w,u+=(l[f+4+2]-u)*w,d+=(l[f+4+3]-d)*w;break;case 1:h=l[f+1],u=l[f+2],d=l[f+3];break;default:h=this.getBezierValue(s,f,1,m-2),u=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(n==1)a.r=h,a.g=u,a.b=d;else{if(c==0){let x=i.data.color;a.r=x.r,a.g=x.g,a.b=x.b}a.r+=(h-a.r)*n,a.g+=(u-a.g)*n,a.b+=(d-a.b)*n}}},xt=class extends re{slotIndex=0;constructor(e,t,s){super(e,t,_.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.color;if(s<this.frames[0]){let h=i.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*n}return}let a=this.getCurveValue(s);n==1?l.a=a:(c==0&&(l.a=i.data.color.a),l.a+=(a-l.a)*n)}},bt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,r,n,c,o,i,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=i,this.frames[e+7]=l}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color,h=i.darkColor;if(s<l[0]){let v=i.data.color,y=i.data.darkColor;switch(c){case 0:a.setFromColor(v),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:a.add((v.r-a.r)*n,(v.g-a.g)*n,(v.b-a.b)*n,(v.a-a.a)*n),h.r+=(y.r-h.r)*n,h.g+=(y.g-h.g)*n,h.b+=(y.b-h.b)*n}return}let u=0,d=0,f=0,m=0,x=0,w=0,p=0,g=J.search(l,s,8),b=this.curves[g>>3];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],w=l[g+6],p=l[g+7];let y=(s-v)/(l[g+8]-v);u+=(l[g+8+1]-u)*y,d+=(l[g+8+2]-d)*y,f+=(l[g+8+3]-f)*y,m+=(l[g+8+4]-m)*y,x+=(l[g+8+5]-x)*y,w+=(l[g+8+6]-w)*y,p+=(l[g+8+7]-p)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],m=l[g+4],x=l[g+5],w=l[g+6],p=l[g+7];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),m=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2),p=this.getBezierValue(s,g,7,b+18*6-2)}if(n==1)a.set(u,d,f,m),h.r=x,h.g=w,h.b=p;else{if(c==0){a.setFromColor(i.data.color);let v=i.data.darkColor;h.r=v.r,h.g=v.g,h.b=v.b}a.add((u-a.r)*n,(d-a.g)*n,(f-a.b)*n,(m-a.a)*n),h.r+=(x-h.r)*n,h.g+=(w-h.g)*n,h.b+=(p-h.b)*n}}},pt=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,n,c,o,i){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=i}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=this.frames,a=i.color,h=i.darkColor;if(s<l[0]){let v=i.data.color,y=i.data.darkColor;switch(c){case 0:a.r=v.r,a.g=v.g,a.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:a.r+=(v.r-a.r)*n,a.g+=(v.g-a.g)*n,a.b+=(v.b-a.b)*n,h.r+=(y.r-h.r)*n,h.g+=(y.g-h.g)*n,h.b+=(y.b-h.b)*n}return}let u=0,d=0,f=0,m=0,x=0,w=0,p=0,g=J.search(l,s,7),b=this.curves[g/7];switch(b){case 0:let v=l[g];u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],w=l[g+5],p=l[g+6];let y=(s-v)/(l[g+7]-v);u+=(l[g+7+1]-u)*y,d+=(l[g+7+2]-d)*y,f+=(l[g+7+3]-f)*y,x+=(l[g+7+4]-x)*y,w+=(l[g+7+5]-w)*y,p+=(l[g+7+6]-p)*y;break;case 1:u=l[g+1],d=l[g+2],f=l[g+3],x=l[g+4],w=l[g+5],p=l[g+6];break;default:u=this.getBezierValue(s,g,1,b-2),d=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),w=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2)}if(n==1)a.r=u,a.g=d,a.b=f,h.r=x,h.g=w,h.b=p;else{if(c==0){let v=i.data.color,y=i.data.darkColor;a.r=v.r,a.g=v.g,a.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b}a.r+=(u-a.r)*n,a.g+=(d-a.g)*n,a.b+=(f-a.b)*n,h.r+=(x-h.r)*n,h.g+=(w-h.g)*n,h.b+=(p-h.b)*n}}},pe=class extends J{slotIndex=0;attachmentNames;constructor(e,t){super(e,[_.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(i.bone.active){if(o==1){c==0&&this.setAttachment(e,i,i.data.attachmentName);return}if(s<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,i,i.data.attachmentName);return}this.setAttachment(e,i,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},wt=class extends oe{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[_.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,r,n,c,o,i,l,a,h){let u=this.curves,d=this.getFrameCount()+e*18;s==0&&(u[t]=2+d);let f=(r-c*2+i)*.03,m=l*.03-o*.06,x=((c-i)*3-r+a)*.006,w=(o-l+.33333333)*.018,p=f*2+x,g=m*2+w,b=(c-r)*.3+f+x*.16666667,v=o*.3+m+w*.16666667,y=r+b,S=v;for(let A=d+18;d<A;d+=2)u[d]=y,u[d+1]=S,b+=p,v+=g,p+=x,g+=w,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let i=this.frames[t];return(e-i)/(this.frames[t+this.getFrameEntries()]-i);case 1:return 0}if(r-=2,s[r]>e){let i=this.frames[t];return s[r+1]*(e-i)/(s[r]-i)}let n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=e){let i=s[r-2],l=s[r-1];return l+(e-i)/(s[r]-i)*(s[r+1]-l)}let c=s[n-2],o=s[n-1];return o+(1-o)*(e-c)/(this.frames[t+this.getFrameEntries()]-c)}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.getAttachment();if(!l||!(l instanceof le)||l.timelineAttachment!=this.attachment)return;let a=i.deform;a.length==0&&(c=0);let h=this.vertices,u=h[0].length,d=this.frames;if(s<d[0]){switch(c){case 0:a.length=0;return;case 1:if(n==1){a.length=0;return}a.length=u;let g=l;if(g.bones){n=1-n;for(var f=0;f<u;f++)a[f]*=n}else{let b=g.vertices;for(var f=0;f<u;f++)a[f]+=(b[f]-a[f])*n}}return}if(a.length=u,s>=d[d.length-1]){let g=h[d.length-1];if(n==1)if(c==3){let b=l;if(b.bones)for(let v=0;v<u;v++)a[v]+=g[v];else{let v=b.vertices;for(let y=0;y<u;y++)a[y]+=g[y]-v[y]}}else E.arrayCopy(g,0,a,0,u);else switch(c){case 0:{let v=l;if(v.bones)for(let y=0;y<u;y++)a[y]=g[y]*n;else{let y=v.vertices;for(let S=0;S<u;S++){let A=y[S];a[S]=A+(g[S]-A)*n}}break}case 1:case 2:for(let v=0;v<u;v++)a[v]+=(g[v]-a[v])*n;break;case 3:let b=l;if(b.bones)for(let v=0;v<u;v++)a[v]+=g[v]*n;else{let v=b.vertices;for(let y=0;y<u;y++)a[y]+=(g[y]-v[y])*n}}return}let m=J.search1(d,s),x=this.getCurvePercent(s,m),w=h[m],p=h[m+1];if(n==1)if(c==3){let g=l;if(g.bones)for(let b=0;b<u;b++){let v=w[b];a[b]+=v+(p[b]-v)*x}else{let b=g.vertices;for(let v=0;v<u;v++){let y=w[v];a[v]+=y+(p[v]-y)*x-b[v]}}}else for(let g=0;g<u;g++){let b=w[g];a[g]=b+(p[g]-b)*x}else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<u;v++){let y=w[v];a[v]=(y+(p[v]-y)*x)*n}else{let v=b.vertices;for(let y=0;y<u;y++){let S=w[y],A=v[y];a[y]=A+(S+(p[y]-S)*x-A)*n}}break}case 1:case 2:for(let b=0;b<u;b++){let v=w[b];a[b]+=(v+(p[b]-v)*x-a[b])*n}break;case 3:let g=l;if(g.bones)for(let b=0;b<u;b++){let v=w[b];a[b]+=(v+(p[b]-v)*x)*n}else{let b=g.vertices;for(let v=0;v<u;v++){let y=w[v];a[v]+=(y+(p[v]-y)*x-b[v])*n}}}}},cs=class extends J{events;constructor(e){super(e,cs.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,r,n,c,o){if(!r)return;let i=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,r,n,c,o),t=-1;else if(t>=i[l-1])return;if(s<i[0])return;let a=0;if(t<i[0])a=0;else{a=J.search1(i,t)+1;let h=i[a];for(;a>0&&i[a-1]==h;)a--}for(;a<l&&s>=i[a];a++)r.push(this.events[a])}},Me=cs;B(Me,"propertyIds",[""+_.event]);var ds=class extends J{drawOrders;constructor(e){super(e,ds.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,r,n,c,o){if(o==1){c==0&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(c==0||c==1)&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let i=J.search1(this.frames,s),l=this.drawOrders[i];if(!l)E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let a=e.drawOrder,h=e.slots;for(let u=0,d=l.length;u<d;u++)a[u]=h[l[u]]}}},we=ds;B(we,"propertyIds",[""+_.drawOrder]);var yt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,r,n,c,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=n,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,n,c,o){let i=e.ikConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:i.mix=i.data.mix,i.softness=i.data.softness,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch;return;case 1:i.mix+=(i.data.mix-i.mix)*n,i.softness+=(i.data.softness-i.softness)*n,i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch}return}let a=0,h=0,u=J.search(l,s,6),d=this.curves[u/6];switch(d){case 0:let f=l[u];a=l[u+1],h=l[u+2];let m=(s-f)/(l[u+6]-f);a+=(l[u+6+1]-a)*m,h+=(l[u+6+2]-h)*m;break;case 1:a=l[u+1],h=l[u+2];break;default:a=this.getBezierValue(s,u,1,d-2),h=this.getBezierValue(s,u,2,d+18-2)}c==0?(i.mix=i.data.mix+(a-i.data.mix)*n,i.softness=i.data.softness+(h-i.data.softness)*n,o==1?(i.bendDirection=i.data.bendDirection,i.compress=i.data.compress,i.stretch=i.data.stretch):(i.bendDirection=l[u+3],i.compress=l[u+4]!=0,i.stretch=l[u+5]!=0)):(i.mix+=(a-i.mix)*n,i.softness+=(h-i.softness)*n,o==0&&(i.bendDirection=l[u+3],i.compress=l[u+4]!=0,i.stretch=l[u+5]!=0))}},vt=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,n,c,o,i){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=r,l[e+3]=n,l[e+4]=c,l[e+5]=o,l[e+6]=i}apply(e,t,s,r,n,c,o){let i=e.transformConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){let p=i.data;switch(c){case 0:i.mixRotate=p.mixRotate,i.mixX=p.mixX,i.mixY=p.mixY,i.mixScaleX=p.mixScaleX,i.mixScaleY=p.mixScaleY,i.mixShearY=p.mixShearY;return;case 1:i.mixRotate+=(p.mixRotate-i.mixRotate)*n,i.mixX+=(p.mixX-i.mixX)*n,i.mixY+=(p.mixY-i.mixY)*n,i.mixScaleX+=(p.mixScaleX-i.mixScaleX)*n,i.mixScaleY+=(p.mixScaleY-i.mixScaleY)*n,i.mixShearY+=(p.mixShearY-i.mixShearY)*n}return}let a,h,u,d,f,m,x=J.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let p=l[x];a=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];let g=(s-p)/(l[x+7]-p);a+=(l[x+7+1]-a)*g,h+=(l[x+7+2]-h)*g,u+=(l[x+7+3]-u)*g,d+=(l[x+7+4]-d)*g,f+=(l[x+7+5]-f)*g,m+=(l[x+7+6]-m)*g;break;case 1:a=l[x+1],h=l[x+2],u=l[x+3],d=l[x+4],f=l[x+5],m=l[x+6];break;default:a=this.getBezierValue(s,x,1,w-2),h=this.getBezierValue(s,x,2,w+18-2),u=this.getBezierValue(s,x,3,w+18*2-2),d=this.getBezierValue(s,x,4,w+18*3-2),f=this.getBezierValue(s,x,5,w+18*4-2),m=this.getBezierValue(s,x,6,w+18*5-2)}if(c==0){let p=i.data;i.mixRotate=p.mixRotate+(a-p.mixRotate)*n,i.mixX=p.mixX+(h-p.mixX)*n,i.mixY=p.mixY+(u-p.mixY)*n,i.mixScaleX=p.mixScaleX+(d-p.mixScaleX)*n,i.mixScaleY=p.mixScaleY+(f-p.mixScaleY)*n,i.mixShearY=p.mixShearY+(m-p.mixShearY)*n}else i.mixRotate+=(a-i.mixRotate)*n,i.mixX+=(h-i.mixX)*n,i.mixY+=(u-i.mixY)*n,i.mixScaleX+=(d-i.mixScaleX)*n,i.mixScaleY+=(f-i.mixScaleY)*n,i.mixShearY+=(m-i.mixShearY)*n}},St=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,c,o){let i=e.pathConstraints[this.constraintIndex];i.active&&(i.position=this.getAbsoluteValue(s,n,c,i.position,i.data.position))}},At=class extends re{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,c,o){let i=e.pathConstraints[this.constraintIndex];i.active&&(i.spacing=this.getAbsoluteValue(s,n,c,i.spacing,i.data.spacing))}},Ct=class extends oe{constraintIndex=0;constructor(e,t,s){super(e,t,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,r,n){let c=this.frames;e<<=2,c[e]=t,c[e+1]=s,c[e+2]=r,c[e+3]=n}apply(e,t,s,r,n,c,o){let i=e.pathConstraints[this.constraintIndex];if(!i.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:i.mixRotate=i.data.mixRotate,i.mixX=i.data.mixX,i.mixY=i.data.mixY;return;case 1:i.mixRotate+=(i.data.mixRotate-i.mixRotate)*n,i.mixX+=(i.data.mixX-i.mixX)*n,i.mixY+=(i.data.mixY-i.mixY)*n}return}let a,h,u,d=J.search(l,s,4),f=this.curves[d>>2];switch(f){case 0:let m=l[d];a=l[d+1],h=l[d+2],u=l[d+3];let x=(s-m)/(l[d+4]-m);a+=(l[d+4+1]-a)*x,h+=(l[d+4+2]-h)*x,u+=(l[d+4+3]-u)*x;break;case 1:a=l[d+1],h=l[d+2],u=l[d+3];break;default:a=this.getBezierValue(s,d,1,f-2),h=this.getBezierValue(s,d,2,f+18-2),u=this.getBezierValue(s,d,3,f+18*2-2)}if(c==0){let m=i.data;i.mixRotate=m.mixRotate+(a-m.mixRotate)*n,i.mixX=m.mixX+(h-m.mixX)*n,i.mixY=m.mixY+(u-m.mixY)*n}else i.mixRotate+=(a-i.mixRotate)*n,i.mixX+=(h-i.mixX)*n,i.mixY+=(u-i.mixY)*n}},fe=class extends re{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,n,c,o){let i;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const a of e.physicsConstraints)a.active&&this.global(a.data)&&this.set(a,this.getAbsoluteValue2(s,n,c,this.get(a),this.setup(a),l))}else i=e.physicsConstraints[this.constraintIndex],i.active&&this.set(i,this.getAbsoluteValue(s,n,c,this.get(i),this.setup(i)))}},It=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},kt=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Tt=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Mt=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Yt=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Xt=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Ft=class extends fe{constructor(e,t,s){super(e,t,s,_.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},fs=class extends J{constraintIndex;constructor(e,t){super(e,fs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,r,n,c,o){let i;if(this.constraintIndex!=-1&&(i=e.physicsConstraints[this.constraintIndex],!i.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],n,c,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(i!=null)i.reset();else for(const a of e.physicsConstraints)a.active&&a.reset()}},De=fs;B(De,"propertyIds",[_.physicsConstraintReset.toString()]);var ue=class extends J{slotIndex;attachment;constructor(e,t,s){super(e,[_.sequence+"|"+t+"|"+s.sequence.id]),this.slotIndex=t,this.attachment=s}getFrameEntries(){return ue.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,s,r,n){let c=this.frames;e*=ue.ENTRIES,c[e]=t,c[e+ue.MODE]=s|r<<4,c[e+ue.DELAY]=n}apply(e,t,s,r,n,c,o){let i=e.slots[this.slotIndex];if(!i.bone.active)return;let l=i.attachment,a=this.attachment;if(l!=a&&(!(l instanceof le)||l.timelineAttachment!=a))return;if(o==1){c==0&&(i.sequenceIndex=-1);return}let h=this.frames;if(s<h[0]){(c==0||c==1)&&(i.sequenceIndex=-1);return}let u=J.search(h,s,ue.ENTRIES),d=h[u],f=h[u+ue.MODE],m=h[u+ue.DELAY];if(!this.attachment.sequence)return;let x=f>>4,w=this.attachment.sequence.regions.length,p=ls[f&15];if(p!=0)switch(x+=(s-d)/m+1e-5|0,p){case 1:x=Math.min(w-1,x);break;case 2:x%=w;break;case 3:{let g=(w<<1)-2;x=g==0?0:x%g,x>=w&&(x=g-x);break}case 4:x=Math.max(w-1-x,0);break;case 5:x=w-1-x%w;break;case 6:{let g=(w<<1)-2;x=g==0?0:(x+w-1)%g,x>=w&&(x=g-x)}}i.sequenceIndex=x}},Se=ue;B(Se,"ENTRIES",3),B(Se,"MODE",1),B(Se,"DELAY",2);var Ne=class{static emptyAnimation(){return Ne._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new gs(this);propertyIDs=new tt;animationsChanged=!1;trackEntryPool=new ke(()=>new ms);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let c=e*n.timeScale;if(n.delay>0){if(n.delay-=c,n.delay>0)continue;c=-n.delay,n.delay=0}let o=n.next;if(o){let i=n.trackLast-o.delay;if(i>=0){for(o.delay=0,o.trackTime+=n.timeScale==0?0:(i/n.timeScale+e)*o.timeScale,n.trackTime+=c,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){t[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,e)){let i=n.mixingFrom;for(n.mixingFrom=null,i&&(i.mixingTo=null);i;)this.queue.end(i),i=i.mixingFrom}n.trackTime+=c}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,r=!1;for(let u=0,d=s.length;u<d;u++){let f=s[u];if(!f||f.delay>0)continue;r=!0;let m=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,m):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let w=x>=f.alphaAttachmentThreshold,p=f.animationLast,g=f.getAnimationTime(),b=g,v=t;f.reverse&&(b=f.animation.duration-b,v=null);let y=f.animation.timelines,S=y.length;if(u==0&&x==1||m==3){u==0&&(w=!0);for(let A=0;A<S;A++){E.webkit602BugfixHelper(x,m);var n=y[A];n instanceof pe?this.applyAttachmentTimeline(n,e,b,m,w):n.apply(e,p,b,v,x,m,0)}}else{let A=f.timelineMode,k=f.shortestRotation,M=!k&&f.timelinesRotation.length!=S<<1;M&&(f.timelinesRotation.length=S<<1);for(let T=0;T<S;T++){let R=y[T],X=A[T]==Oe?m:0;!k&&R instanceof Te?this.applyRotateTimeline(R,e,b,x,X,f.timelinesRotation,T<<1,M):R instanceof pe?this.applyAttachmentTimeline(R,e,b,m,w):(E.webkit602BugfixHelper(x,m),R.apply(e,p,b,v,x,X,0))}}this.queueEvents(f,g),t.length=0,f.nextAnimationLast=g,f.nextTrackLast=f.trackTime}for(var c=this.unkeyedState+Pt,o=e.slots,i=0,l=e.slots.length;i<l;i++){var a=o[i];if(a.attachmentState==c){var h=a.data.attachmentName;a.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,t,s){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,t,s);let n=0;e.mixDuration==0?(n=1,s==1&&(s=0)):(n=e.mixTime/e.mixDuration,n>1&&(n=1),s!=1&&(s=r.mixBlend));let c=n<r.mixAttachmentThreshold,o=n<r.mixDrawOrderThreshold,i=r.animation.timelines,l=i.length,a=r.alpha*e.interruptAlpha,h=a*(1-n),u=r.animationLast,d=r.getAnimationTime(),f=d,m=null;if(r.reverse?f=r.animation.duration-f:n<r.eventThreshold&&(m=this.events),s==3)for(let x=0;x<l;x++)i[x].apply(t,u,f,m,h,s,1);else{let x=r.timelineMode,w=r.timelineHoldMix,p=r.shortestRotation,g=!p&&r.timelinesRotation.length!=l<<1;g&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let b=0;b<l;b++){let v=i[b],y=1,S,A=0;switch(x[b]){case Oe:if(!o&&v instanceof we)continue;S=s,A=h;break;case Rt:S=0,A=h;break;case Et:S=s,A=a;break;case _e:S=0,A=a;break;default:S=0;let k=w[b];A=a*Math.max(0,1-k.mixTime/k.mixDuration);break}r.totalAlpha+=A,!p&&v instanceof Te?this.applyRotateTimeline(v,t,f,A,S,r.timelinesRotation,b<<1,g):v instanceof pe?this.applyAttachmentTimeline(v,t,f,S,c&&A>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(A,s),o&&v instanceof we&&S==0&&(y=0),v.apply(t,u,f,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(r,d),this.events.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime,n}applyAttachmentTimeline(e,t,s,r,n){var c=t.slots[e.slotIndex];c.bone.active&&(s<e.frames[0]?(r==0||r==1)&&this.setAttachment(t,c,c.data.attachmentName,n):this.setAttachment(t,c,e.attachmentNames[J.search1(e.frames,s)],n),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+Pt))}setAttachment(e,t,s,r){t.setAttachment(s?e.getAttachment(t.data.index,s):null),r&&(t.attachmentState=this.unkeyedState+bs)}applyRotateTimeline(e,t,s,r,n,c,o,i){if(i&&(c[o]=0),r==1){e.apply(t,0,s,null,1,n,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let a=e.frames,h=0,u=0;if(s<a[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,u=l.data.rotation}else h=n==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(s);let d=0,f=u-h;if(f-=Math.ceil(f/360-.5)*360,f==0)d=c[o];else{let m=0,x=0;i?(m=0,x=f):(m=c[o],x=c[o+1]);let w=m-m%360;d=f+w;let p=f>=0,g=m>=0;Math.abs(x)<=90&&F.signum(x)!=F.signum(f)&&(Math.abs(m-w)>180?(d+=360*F.signum(m),g=p):w!=0?d-=360*F.signum(m):g=p),g!=p&&(d+=360*F.signum(m)),c[o]=d}c[o+1]=f,l.rotation=h+d*r}queueEvents(e,t){let s=e.animationStart,r=e.animationEnd,n=r-s,c=e.trackLast%n,o=this.events,i=0,l=o.length;for(;i<l;i++){let h=o[i];if(h.time<c)break;h.time>r||this.queue.event(e,h)}let a=!1;if(e.loop)if(n==0)a=!0;else{const h=Math.floor(e.trackTime/n);a=h>0&&h>Math.floor(e.trackLast/n)}else a=t>=r&&e.animationLast<r;for(a&&this.queue.complete(e);i<l;i++){let h=o[i];h.time<s||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let r=s.mixingFrom;if(!r)break;this.queue.end(r),s.mixingFrom=null,s.mixingTo=null,s=r}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let r=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,r&&(s&&this.queue.interrupt(r),t.mixingFrom=r,r.mixingTo=t,t.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(t.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,r,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(e);n&&(n.nextTrackLast==-1?(this.tracks[e]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,r=!1):this.clearNext(n));let c=this.trackEntry(e,t,s,n);return this.setCurrent(e,c,r),this.queue.drain(),c}addAnimation(e,t,s=!1,r=0){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,n,s,r)}addAnimationWith(e,t,s=!1,r=0){if(!t)throw new Error("animation cannot be null.");let n=this.expandToIndex(e);if(n)for(;n.next;)n=n.next;let c=this.trackEntry(e,t,s,n);return n?(n.next=c,c.previous=n,r<=0&&(r=Math.max(r+n.getTrackComplete()-c.mixDuration,0))):(this.setCurrent(e,c,!0),this.queue.drain(),r<0&&(r=0)),c.delay=r,c}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,Ne.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let r=this.addAnimationWith(e,Ne.emptyAnimation(),!1,s);return s<=0&&(r.delay=Math.max(r.delay+r.mixDuration-t,0)),r.mixDuration=t,r.trackEnd=t,r}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++){let n=this.tracks[s];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(E.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,r){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=e,n.animation=t,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=t.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=r?this.data.getMix(r.animation,t):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let r=e[t];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,r=e.animation.timelines.length,n=e.timelineMode;n.length=r;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let i=0;i<r;i++)n[i]=o.addAll(s[i].getPropertyIds())?_e:Et;return}e:for(let i=0;i<r;i++){let l=s[i],a=l.getPropertyIds();if(!o.addAll(a))n[i]=Oe;else if(!t||l instanceof pe||l instanceof we||l instanceof Me||!t.animation.hasTimeline(a))n[i]=Rt;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(a)){if(e.mixDuration>0){n[i]=xs,c[i]=h;continue e}break}n[i]=_e}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},us=Ne;B(us,"_emptyAnimation",new Ve("<empty>",[],0));var ms=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}},gs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(te.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(te.interrupt),this.objects.push(e)}end(e){this.objects.push(te.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(te.dispose),this.objects.push(e)}complete(e){this.objects.push(te.complete),this.objects.push(e)}event(e,t){this.objects.push(te.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let r=e[s],n=e[s+1];switch(r){case te.start:n.listener&&n.listener.start&&n.listener.start(n);for(let o=0;o<t.length;o++){let i=t[o];i.start&&i.start(n)}break;case te.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let o=0;o<t.length;o++){let i=t[o];i.interrupt&&i.interrupt(n)}break;case te.end:n.listener&&n.listener.end&&n.listener.end(n);for(let o=0;o<t.length;o++){let i=t[o];i.end&&i.end(n)}case te.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let o=0;o<t.length;o++){let i=t[o];i.dispose&&i.dispose(n)}this.animState.trackEntryPool.free(n);break;case te.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let o=0;o<t.length;o++){let i=t[o];i.complete&&i.complete(n)}break;case te.event:let c=e[s+++2];n.listener&&n.listener.event&&n.listener.event(n,c);for(let o=0;o<t.length;o++){let i=t[o];i.event&&i.event(n,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},te=(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))(te||{}),$s=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Oe=0,Rt=1,Et=2,_e=3,xs=4,Pt=1,bs=2,js=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);this.setMixWith(r,n,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},qe=class extends le{color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new qe(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ue=class extends le{endSlot=null;color=new O(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Ue(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Bt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},We=(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))(We||{}),ps=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ps||{}),ws=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Js=class extends Bt{setFilters(e,t){}setWraps(e,t){}dispose(){}},ys=class{pages=new Array;regions=new Array;constructor(e){let t=new Ks(e),s=new Array(4),r={};r.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},r.format=()=>{},r.filter=a=>{a.minFilter=E.enumValue(We,s[1]),a.magFilter=E.enumValue(We,s[2])},r.repeat=a=>{s[1].indexOf("x")!=-1&&(a.uWrap=10497),s[1].indexOf("y")!=-1&&(a.vWrap=10497)},r.pma=a=>{a.pma=s[1]=="true"};var n={};n.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},n.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},n.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},n.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},n.rotate=a=>{let h=s[1];h=="true"?a.degrees=90:h!="false"&&(a.degrees=parseInt(h))},n.index=a=>{a.index=parseInt(s[1])};let c=t.readLine();for(;c&&c.trim().length==0;)c=t.readLine();for(;!(!c||c.trim().length==0||t.readEntry(s,c)==0);)c=t.readLine();let o=null,i=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=t.readLine();else if(o){let a=new Vt(o,c);for(;;){let h=t.readEntry(s,c=t.readLine());if(h==0)break;let u=n[s[0]];if(u)u(a);else{i||(i=[]),l||(l=[]),i.push(s[0]);let d=[];for(let f=0;f<h;f++)d.push(parseInt(s[f+1]));l.push(d)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height),i&&i.length>0&&l&&l.length>0&&(a.names=i,a.values=l,i=null,l=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees==90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new vs(c.trim());t.readEntry(s,c=t.readLine())!=0;){let a=r[s[0]];a&&a(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()}},Ks=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let r=1,n=s+1;;r++){let c=t.indexOf(",",n);if(c==-1)return e[r]=t.substr(n).trim(),r;if(e[r]=t.substr(n,c-n).trim(),n=c+1,r==4)return 4}}},vs=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}},Vt=class extends ws{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends le{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new O(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new O(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=E.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,r=this.region.u,n=this.region.v,c=0,o=0;if(this.region instanceof Vt){let i=this.region,l=i.page,a=l.width,h=l.height;switch(i.degrees){case 90:r-=(i.originalHeight-i.offsetY-i.height)/a,n-=(i.originalWidth-i.offsetX-i.width)/h,c=i.originalHeight/a,o=i.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=r+e[u+1]*c,t[u+1]=n+(1-e[u])*o;return;case 180:r-=(i.originalWidth-i.offsetX-i.width)/a,n-=i.offsetY/h,c=i.originalWidth/a,o=i.originalHeight/h;for(let u=0;u<s;u+=2)t[u]=r+(1-e[u])*c,t[u+1]=n+(1-e[u+1])*o;return;case 270:r-=i.offsetY/a,n-=i.offsetX/h,c=i.originalHeight/a,o=i.originalWidth/h;for(let u=0;u<s;u+=2)t[u]=r+(1-e[u+1])*c,t[u+1]=n+e[u]*o;return}r-=i.offsetX/a,n-=(i.originalHeight-i.offsetY-i.height)/h,c=i.originalWidth/a,o=i.originalHeight/h}else this.region?(c=this.region.u2-r,o=this.region.v2-n):(r=n=0,c=o=1);for(let i=0;i<s;i+=2)t[i]=r+e[i]*c,t[i+1]=n+e[i+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),E.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,r,n,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,r,n,c)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ae=class extends le{lengths=[];closed=!1;constantSpeed=!1;color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ae(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Lt=class extends le{x=0;y=0;rotation=0;color=new O(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*F.degRad,s=Math.cos(t),r=Math.sin(t),n=s*e.a+r*e.b,c=s*e.c+r*e.d;return F.atan2Deg(c,n)}copy(){let e=new Lt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Ss=class extends st{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new O(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new O(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,c=-this.height/2*this.scaleY+this.region.offsetY*r,o=n+this.region.width*s,i=c+this.region.height*r,l=this.rotation*F.degRad,a=Math.cos(l),h=Math.sin(l),u=this.x,d=this.y,f=n*a+u,m=n*h,x=c*a+d,w=c*h,p=o*a+u,g=o*h,b=i*a+d,v=i*h,y=this.offset;y[0]=f-w,y[1]=x+m,y[2]=f-v,y[3]=b+m,y[4]=p-v,y[5]=b+g,y[6]=p-w,y[7]=x+g,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,r){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,c=this.offset,o=n.worldX,i=n.worldY,l=n.a,a=n.b,h=n.c,u=n.d,d=0,f=0;d=c[0],f=c[1],t[s]=d*l+f*a+o,t[s+1]=d*h+f*u+i,s+=r,d=c[2],f=c[3],t[s]=d*l+f*a+o,t[s+1]=d*h+f*u+i,s+=r,d=c[4],f=c[5],t[s]=d*l+f*a+o,t[s+1]=d*h+f*u+i,s+=r,d=c[6],f=c[7],t[s]=d*l+f*a+o,t[s+1]=d*h+f*u+i}copy(){let e=new Ss(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,E.arrayCopy(this.uvs,0,e.uvs,0,8),E.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},V=Ss;B(V,"X1",0),B(V,"Y1",1),B(V,"C1R",2),B(V,"C1G",3),B(V,"C1B",4),B(V,"C1A",5),B(V,"U1",6),B(V,"V1",7),B(V,"X2",8),B(V,"Y2",9),B(V,"C2R",10),B(V,"C2G",11),B(V,"C2B",12),B(V,"C2A",13),B(V,"U2",14),B(V,"V2",15),B(V,"X3",16),B(V,"Y3",17),B(V,"C3R",18),B(V,"C3G",19),B(V,"C3B",20),B(V,"C3A",21),B(V,"U3",22),B(V,"V3",23),B(V,"X4",24),B(V,"Y4",25),B(V,"C4R",26),B(V,"C4G",27),B(V,"C4B",28),B(V,"C4A",29),B(V,"U4",30),B(V,"V4",31);var Qs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let n=0,c=r.length;n<c;n++){let o=s.getPath(t,n),i=this.atlas.findRegion(o);if(i==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[n]=i}}newRegionAttachment(e,t,s,r){let n=new V(t,s);if(r!=null)this.loadSequence(t,s,r);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");n.region=c}return n}newMeshAttachment(e,t,s,r){let n=new ye(t,s);if(r!=null)this.loadSequence(t,s,r);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");n.region=c}return n}newBoundingBoxAttachment(e,t){return new qe(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new Lt(t)}newClippingAttachment(e,t){return new Ue(t)}},Dt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Ye.Normal;skinRequired=!1;color=new O;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}},Ye=(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))(Ye||{}),Nt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,r,n,c,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=c,this.ashearY=o;let i=this.parent;if(!i){let d=this.skeleton;const f=d.scaleX,m=d.scaleY,x=(s+c)*F.degRad,w=(s+90+o)*F.degRad;this.a=Math.cos(x)*r*f,this.b=Math.cos(w)*n*f,this.c=Math.sin(x)*r*m,this.d=Math.sin(w)*n*m,this.worldX=e*f+d.x,this.worldY=t*m+d.y;return}let l=i.a,a=i.b,h=i.c,u=i.d;switch(this.worldX=l*e+a*t+i.worldX,this.worldY=h*e+u*t+i.worldY,this.inherit){case 0:{const d=(s+c)*F.degRad,f=(s+90+o)*F.degRad,m=Math.cos(d)*r,x=Math.cos(f)*n,w=Math.sin(d)*r,p=Math.sin(f)*n;this.a=l*m+a*w,this.b=l*x+a*p,this.c=h*m+u*w,this.d=h*x+u*p;return}case 1:{const d=(s+c)*F.degRad,f=(s+90+o)*F.degRad;this.a=Math.cos(d)*r,this.b=Math.cos(f)*n,this.c=Math.sin(d)*r,this.d=Math.sin(f)*n;break}case 2:{let d=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;l*=d,h*=f;let m=l*l+h*h,x=0;m>1e-4?(m=Math.abs(l*u*f-a*d*h)/m,a=h*m,u=l*m,x=Math.atan2(h,l)*F.radDeg):(l=0,h=0,x=90-Math.atan2(u,a)*F.radDeg);const w=(s+c-x)*F.degRad,p=(s+o-x+90)*F.degRad,g=Math.cos(w)*r,b=Math.cos(p)*n,v=Math.sin(w)*r,y=Math.sin(p)*n;this.a=l*g-a*v,this.b=l*b-a*y,this.c=h*g+u*v,this.d=h*b+u*y;break}case 3:case 4:{s*=F.degRad;const d=Math.cos(s),f=Math.sin(s);let m=(l*d+a*f)/this.skeleton.scaleX,x=(h*d+u*f)/this.skeleton.scaleY,w=Math.sqrt(m*m+x*x);w>1e-5&&(w=1/w),m*=w,x*=w,w=Math.sqrt(m*m+x*x),this.inherit==3&&l*u-a*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(x,m);const p=Math.cos(s)*w,g=Math.sin(s)*w;c*=F.degRad,o=(90+o)*F.degRad;const b=Math.cos(c)*r,v=Math.cos(o)*n,y=Math.sin(c)*r,S=Math.sin(o)*n;this.a=m*b+p*y,this.b=m*v+p*S,this.c=x*b+g*y,this.d=x*v+g*S;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*F.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)*F.radDeg;return}let t=e.a,s=e.b,r=e.c,n=e.d,c=1/(t*n-s*r),o=n*c,i=s*c,l=r*c,a=t*c,h=this.worldX-e.worldX,u=this.worldY-e.worldY;this.ax=h*o-u*i,this.ay=u*a-h*l;let d,f,m,x;if(this.inherit==1)d=this.a,f=this.b,m=this.c,x=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*n-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*v/this.skeleton.scaleY,n=t*this.skeleton.scaleY*v/this.skeleton.scaleX,c=1/(t*n-s*r),o=n*c,i=s*c;break}case 3:case 4:let w=F.cosDeg(this.rotation),p=F.sinDeg(this.rotation);t=(t*w+s*p)/this.skeleton.scaleX,r=(r*w+n*p)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=F.PI/2+Math.atan2(r,t);s=Math.cos(b)*g,n=Math.sin(b)*g,c=1/(t*n-s*r),o=n*c,i=s*c,l=r*c,a=t*c}d=o*this.a-i*this.c,f=o*this.b-i*this.d,m=a*this.c-l*this.a,x=a*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let w=d*x-f*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(d*f+m*x,w)*F.radDeg,this.arotation=Math.atan2(m,d)*F.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,f)*F.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*F.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*F.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=F.sinDeg(e),s=F.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*F.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=F.sinDeg(e),s=F.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*F.radDeg}rotateWorld(e){e*=F.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,n=this.b;this.a=s*r-t*this.c,this.b=s*n-t*this.d,this.c=t*r+s*this.c,this.d=t*n+s*this.d}},Xe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},As=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Ot){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load binary ${e}: status ${r}, ${n}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${n}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,r=>{this.success(t,e,r)},(r,n)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${r}, ${n}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(t,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(t,e,this.textureLoader(c))},c.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let n=e.lastIndexOf("/"),c=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let i=new ys(o),l=i.pages.length,a=!1;for(let h of i.pages)this.loadTexture(r?r[h.name]:c+h.name,(u,d)=>{a||(h.setTexture(d),--l==0&&this.success(t,e,i))},(u,d)=>{a||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${u}`),a=!0})}catch(i){this.error(s,e,`Couldn't parse texture atlas ${e}: ${i.message}`)}},(o,i)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${i}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
-
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Ot=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,r=new Uint8Array(s),n=0;n<s;n++)r[n]=t.charCodeAt(n);return r}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",e,!0);let n=()=>{this.finish(e,r.status,r.responseText)};r.onload=n,r.onerror=n,r.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer";let n=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):n()},r.onerror=n,r.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let n=t==200||t==0?[s]:[t,s];for(let c=n.length-1,o=r.length;c<o;c+=2)r[c].apply(null,n)}},_t=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},qt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},Cs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let n=t.findBone(e.bones[r].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(n)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,r,n,c,o){let i=e.parent;if(!i)throw new Error("IK bone must have parent.");let l=i.a,a=i.b,h=i.c,u=i.d,d=-e.ashearX-e.arotation,f=0,m=0;switch(e.inherit){case 1:f=(t-e.worldX)*F.signum(e.skeleton.scaleX),m=(s-e.worldY)*F.signum(e.skeleton.scaleY);break;case 2:let p=Math.abs(l*u-a*h)/Math.max(1e-4,l*l+h*h),g=l/e.skeleton.scaleX,b=h/e.skeleton.scaleY;a=-b*p*e.skeleton.scaleX,u=g*p*e.skeleton.scaleY,d+=Math.atan2(b,g)*F.radDeg;default:let v=t-i.worldX,y=s-i.worldY,S=l*u-a*h;Math.abs(S)<=1e-4?(f=0,m=0):(f=(v*u-y*a)/S-e.ax,m=(y*l-v*h)/S-e.ay)}d+=Math.atan2(m,f)*F.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,w=e.ascaleY;if(r||n){switch(e.inherit){case 3:case 4:f=t-e.worldX,m=s-e.worldY}const p=e.data.length*x;if(p>1e-4){const g=f*f+m*m;if(r&&g<p*p||n&&g>p*p){const b=(Math.sqrt(g)/p-1)*o+1;x*=b,c&&(w*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,x,w,e.ashearX,e.ashearY)}apply2(e,t,s,r,n,c,o,i,l){if(e.inherit!=0||t.inherit!=0)return;let a=e.ax,h=e.ay,u=e.ascaleX,d=e.ascaleY,f=u,m=d,x=t.ascaleX,w=0,p=0,g=0;u<0?(u=-u,w=180,g=-1):(w=0,g=1),d<0&&(d=-d,g=-g),x<0?(x=-x,p=180):p=0;let b=t.ax,v=0,y=0,S=0,A=e.a,k=e.b,M=e.c,T=e.d,R=Math.abs(u-d)<=1e-4;!R||c?(v=0,y=A*b+e.worldX,S=M*b+e.worldY):(v=t.ay,y=A*b+k*v+e.worldX,S=M*b+T*v+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,k=X.b,M=X.c,T=X.d;let I=A*T-k*M,Y=y-X.worldX,P=S-X.worldY;I=Math.abs(I)<=1e-4?0:1/I;let N=(Y*T-P*k)*I-a,q=(P*A-Y*M)*I-h,D=Math.sqrt(N*N+q*q),H=t.data.length*x,$,j;if(D<1e-4){this.apply1(e,s,r,!1,c,!1,l),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}Y=s-X.worldX,P=r-X.worldY;let L=(Y*T-P*k)*I-a,U=(P*A-Y*M)*I-h,W=L*L+U*U;if(i!=0){i*=u*(x+1)*.5;let K=Math.sqrt(W),Z=K-D-H*u+i;if(Z>0){let ee=Math.min(1,Z/(i*2))-1;ee=(Z-i*(1-ee*ee))/K,L-=ee*L,U-=ee*U,W=L*L+U*U}}e:if(R){H*=u;let K=(W-D*D-H*H)/(2*D*H);K<-1?(K=-1,j=Math.PI*n):K>1?(K=1,j=0,c&&(A=(Math.sqrt(W)/(D+H)-1)*l+1,f*=A,o&&(m*=A))):j=Math.acos(K)*n,A=D+H*K,k=H*Math.sin(j),$=Math.atan2(U*A-L*k,L*A+U*k)}else{A=u*H,k=d*H;let K=A*A,Z=k*k,ee=Math.atan2(U,L);M=Z*D*D+K*W-K*Z;let xe=-2*Z*D,Fe=Z-K;if(T=xe*xe-4*Fe*M,T>=0){let Ie=Math.sqrt(T);xe<0&&(Ie=-Ie),Ie=-(xe+Ie)*.5;let Re=Ie/Fe,Bs=M/Ie,et=Math.abs(Re)<Math.abs(Bs)?Re:Bs;if(Re=W-et*et,Re>=0){P=Math.sqrt(Re)*n,$=ee-Math.atan2(P,et),j=Math.atan2(P/d,(et-D)/u);break e}}let Fs=F.PI,Qe=D-A,es=Qe*Qe,Rs=0,Es=0,Ze=D+A,ts=Ze*Ze,Ps=0;M=-A*D/(K-Z),M>=-1&&M<=1&&(M=Math.acos(M),Y=A*Math.cos(M)+D,P=k*Math.sin(M),T=Y*Y+P*P,T<es&&(Fs=M,es=T,Qe=Y,Rs=P),T>ts&&(Es=M,ts=T,Ze=Y,Ps=P)),W<=(es+ts)*.5?($=ee-Math.atan2(Rs*n,Qe),j=Fs*n):($=ee-Math.atan2(Ps*n,Ze),j=Es*n)}let ne=Math.atan2(v,b)*g,ie=e.arotation;$=($-ne)*F.radDeg+w-ie,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(a,h,ie+$*l,f,m,0,0),ie=t.arotation,j=((j+ne)*F.radDeg-t.ashearX)*g+p-ie,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(b,v,ie+j*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ut=class extends Xe{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)}},Wt=class extends Xe{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=ze.Fixed;spacingMode=Ge.Fixed;rotateMode=He.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},ze=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(ze||{}),Ge=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Ge||{}),He=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(He||{}),me=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,n=e.bones.length;r<n;r++){let c=t.findBone(e.bones[r].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(c)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ae))return;let s=this.mixRotate,r=this.mixX,n=this.mixY;if(s==0&&r==0&&n==0)return;let c=this.data,o=c.rotateMode==0,i=c.rotateMode==2,l=this.bones,a=l.length,h=o?a:a+1,u=E.setArraySize(this.spaces,h),d=i?this.lengths=E.setArraySize(this.lengths,a):[],f=this.spacing;switch(c.spacingMode){case 2:if(i)for(let y=0,S=h-1;y<S;y++){let A=l[y],k=A.data.length,M=k*A.a,T=k*A.c;d[y]=Math.sqrt(M*M+T*T)}E.arrayFill(u,1,h,f);break;case 3:let b=0;for(let y=0,S=h-1;y<S;){let A=l[y],k=A.data.length;if(k<me.epsilon)i&&(d[y]=0),u[++y]=f;else{let M=k*A.a,T=k*A.c,R=Math.sqrt(M*M+T*T);i&&(d[y]=R),u[++y]=R,b+=R}}if(b>0){b=h/b*f;for(let y=1;y<h;y++)u[y]*=b}break;default:let v=c.spacingMode==0;for(let y=0,S=h-1;y<S;){let A=l[y],k=A.data.length;if(k<me.epsilon)i&&(d[y]=0),u[++y]=f;else{let M=k*A.a,T=k*A.c,R=Math.sqrt(M*M+T*T);i&&(d[y]=R),u[++y]=(v?k+f:f)*R/k}}}let m=this.computeWorldPositions(t,h,o),x=m[0],w=m[1],p=c.offsetRotation,g=!1;if(p==0)g=c.rotateMode==1;else{g=!1;let b=this.target.bone;p*=b.a*b.d-b.b*b.c>0?F.degRad:-F.degRad}for(let b=0,v=3;b<a;b++,v+=3){let y=l[b];y.worldX+=(x-y.worldX)*r,y.worldY+=(w-y.worldY)*n;let S=m[v],A=m[v+1],k=S-x,M=A-w;if(i){let T=d[b];if(T!=0){let R=(Math.sqrt(k*k+M*M)/T-1)*s+1;y.a*=R,y.c*=R}}if(x=S,w=A,s>0){let T=y.a,R=y.b,X=y.c,I=y.d,Y=0,P=0,N=0;if(o?Y=m[v-1]:u[b+1]==0?Y=m[v+2]:Y=Math.atan2(M,k),Y-=Math.atan2(X,T),g){P=Math.cos(Y),N=Math.sin(Y);let q=y.data.length;x+=(q*(P*T-N*X)-k)*s,w+=(q*(N*T+P*X)-M)*s}else Y+=p;Y>F.PI?Y-=F.PI2:Y<-F.PI&&(Y+=F.PI2),Y*=s,P=Math.cos(Y),N=Math.sin(Y),y.a=P*T-N*X,y.b=P*R-N*I,y.c=N*T+P*X,y.d=N*R+P*I}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let r=this.target,n=this.position,c=this.spaces,o=E.setArraySize(this.positions,t*3+2),i=this.world,l=e.closed,a=e.worldVerticesLength,h=a/6,u=me.NONE;if(!e.constantSpeed){let q=e.lengths;h-=l?1:2;let D=q[h];this.data.positionMode==1&&(n*=D);let H;switch(this.data.spacingMode){case 2:H=D;break;case 3:H=D/t;break;default:H=1}i=E.setArraySize(this.world,8);for(let $=0,j=0,L=0;$<t;$++,j+=3){let U=c[$]*H;n+=U;let W=n;if(l)W%=D,W<0&&(W+=D),L=0;else if(W<0){u!=me.BEFORE&&(u=me.BEFORE,e.computeWorldVertices(r,2,4,i,0,2)),this.addBeforePosition(W,i,0,o,j);continue}else if(W>D){u!=me.AFTER&&(u=me.AFTER,e.computeWorldVertices(r,a-6,4,i,0,2)),this.addAfterPosition(W-D,i,0,o,j);continue}for(;;L++){let ne=q[L];if(!(W>ne)){if(L==0)W/=ne;else{let ie=q[L-1];W=(W-ie)/(ne-ie)}break}}L!=u&&(u=L,l&&L==h?(e.computeWorldVertices(r,a-4,4,i,0,2),e.computeWorldVertices(r,0,4,i,4,2)):e.computeWorldVertices(r,L*6+2,8,i,0,2)),this.addCurvePosition(W,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],o,j,s||$>0&&U==0)}return o}l?(a+=2,i=E.setArraySize(this.world,a),e.computeWorldVertices(r,2,a-4,i,0,2),e.computeWorldVertices(r,0,2,i,a-4,2),i[a-2]=i[0],i[a-1]=i[1]):(h--,a-=4,i=E.setArraySize(this.world,a),e.computeWorldVertices(r,2,a,i,0,2));let d=E.setArraySize(this.curves,h),f=0,m=i[0],x=i[1],w=0,p=0,g=0,b=0,v=0,y=0,S=0,A=0,k=0,M=0,T=0,R=0,X=0,I=0;for(let q=0,D=2;q<h;q++,D+=6)w=i[D],p=i[D+1],g=i[D+2],b=i[D+3],v=i[D+4],y=i[D+5],S=(m-w*2+g)*.1875,A=(x-p*2+b)*.1875,k=((w-g)*3-m+v)*.09375,M=((p-b)*3-x+y)*.09375,T=S*2+k,R=A*2+M,X=(w-m)*.75+S+k*.16666667,I=(p-x)*.75+A+M*.16666667,f+=Math.sqrt(X*X+I*I),X+=T,I+=R,T+=k,R+=M,f+=Math.sqrt(X*X+I*I),X+=T,I+=R,f+=Math.sqrt(X*X+I*I),X+=T+k,I+=R+M,f+=Math.sqrt(X*X+I*I),d[q]=f,m=v,x=y;this.data.positionMode==1&&(n*=f);let Y;switch(this.data.spacingMode){case 2:Y=f;break;case 3:Y=f/t;break;default:Y=1}let P=this.segments,N=0;for(let q=0,D=0,H=0,$=0;q<t;q++,D+=3){let j=c[q]*Y;n+=j;let L=n;if(l)L%=f,L<0&&(L+=f),H=0;else if(L<0){this.addBeforePosition(L,i,0,o,D);continue}else if(L>f){this.addAfterPosition(L-f,i,a-4,o,D);continue}for(;;H++){let U=d[H];if(!(L>U)){if(H==0)L/=U;else{let W=d[H-1];L=(L-W)/(U-W)}break}}if(H!=u){u=H;let U=H*6;for(m=i[U],x=i[U+1],w=i[U+2],p=i[U+3],g=i[U+4],b=i[U+5],v=i[U+6],y=i[U+7],S=(m-w*2+g)*.03,A=(x-p*2+b)*.03,k=((w-g)*3-m+v)*.006,M=((p-b)*3-x+y)*.006,T=S*2+k,R=A*2+M,X=(w-m)*.3+S+k*.16666667,I=(p-x)*.3+A+M*.16666667,N=Math.sqrt(X*X+I*I),P[0]=N,U=1;U<8;U++)X+=T,I+=R,T+=k,R+=M,N+=Math.sqrt(X*X+I*I),P[U]=N;X+=T,I+=R,N+=Math.sqrt(X*X+I*I),P[8]=N,X+=T+k,I+=R+M,N+=Math.sqrt(X*X+I*I),P[9]=N,$=0}for(L*=N;;$++){let U=P[$];if(!(L>U)){if($==0)L/=U;else{let W=P[$-1];L=$+(L-W)/(U-W)}break}}this.addCurvePosition(L*.1,m,x,w,p,g,b,v,y,o,D,s||q>0&&j==0)}return o}addBeforePosition(e,t,s,r,n){let c=t[s],o=t[s+1],i=t[s+2]-c,l=t[s+3]-o,a=Math.atan2(l,i);r[n]=c+e*Math.cos(a),r[n+1]=o+e*Math.sin(a),r[n+2]=a}addAfterPosition(e,t,s,r,n){let c=t[s+2],o=t[s+3],i=c-t[s],l=o-t[s+1],a=Math.atan2(l,i);r[n]=c+e*Math.cos(a),r[n+1]=o+e*Math.sin(a),r[n+2]=a}addCurvePosition(e,t,s,r,n,c,o,i,l,a,h,u){if(e==0||isNaN(e)){a[h]=t,a[h+1]=s,a[h+2]=Math.atan2(n-s,r-t);return}let d=e*e,f=d*e,m=1-e,x=m*m,w=x*m,p=m*e,g=p*3,b=m*g,v=g*e,y=t*w+r*b+c*v+i*f,S=s*w+n*b+o*v+l*f;a[h]=y,a[h+1]=S,u&&(e<.001?a[h+2]=Math.atan2(n-s,r-t):a[h+2]=Math.atan2(S-(s*x+n*p*2+o*d),y-(t*x+r*p*2+c*d)))}},Ce=me;B(Ce,"NONE",-1),B(Ce,"BEFORE",-2),B(Ce,"AFTER",-3),B(Ce,"epsilon",1e-5);var Zs=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,r=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,c=this.data.scaleX>0,o=this.bone,i=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const l=this.skeleton,a=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=a,this.lastTime=l.time;const h=o.worldX,u=o.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=u;else{let d=this.remaining,f=this.inertia,m=this.data.step,x=this.skeleton.data.referenceScale,w=-1,p=this.data.limit*a,g=p*Math.abs(l.scaleY);if(p*=Math.abs(l.scaleX),s||r){if(s){const b=(this.ux-h)*f;this.xOffset+=b>p?p:b<-p?-p:b,this.ux=h}if(r){const b=(this.uy-u)*f;this.yOffset+=b>g?g:b<-g?-g:b,this.uy=u}if(d>=m){w=Math.pow(this.damping,60*m);const b=this.massInverse*m,v=this.strength,y=this.wind*x*l.scaleX,S=this.gravity*x*l.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*b,this.xOffset+=this.xVelocity*m,this.xVelocity*=w),r&&(this.yVelocity-=(S+this.yOffset*v)*b,this.yOffset+=this.yVelocity*m,this.yVelocity*=w),d-=m;while(d>=m)}s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(n||c){let b=Math.atan2(o.c,o.a),v=0,y=0,S=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>p?A=p:A<-p&&(A=-p),k>g?k=g:k<-g&&(k=-g),n){S=(this.data.rotate+this.data.shearX)*t;let M=Math.atan2(k+this.ty,A+this.tx)-b-this.rotateOffset*S;this.rotateOffset+=(M-Math.ceil(M*F.invPI2-.5)*F.PI2)*f,M=this.rotateOffset*S+b,v=Math.cos(M),y=Math.sin(M),c&&(M=i*o.getWorldScaleX(),M>0&&(this.scaleOffset+=(A*v+k*y)*f/M))}else{v=Math.cos(b),y=Math.sin(b);const M=i*o.getWorldScaleX();M>0&&(this.scaleOffset+=(A*v+k*y)*f/M)}if(d=this.remaining,d>=m){w==-1&&(w=Math.pow(this.damping,60*m));const M=this.massInverse*m,T=this.strength,R=this.wind,X=$e.yDown?-this.gravity:this.gravity,I=i/x;for(;;)if(d-=m,c&&(this.scaleVelocity+=(R*v-X*y-this.scaleOffset*T)*M,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=w),n){if(this.rotateVelocity-=((R*y+X*v)*I+this.rotateOffset*T)*M,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=w,d<m)break;const Y=this.rotateOffset*S+b;v=Math.cos(Y),y=Math.sin(Y)}else if(d<m)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(n){let l=this.rotateOffset*t,a=0,h=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,a=Math.sin(d),h=Math.cos(d),u=o.b,o.b=h*u-a*o.d,o.d=a*u+h*o.d),d+=l*this.data.shearX,a=Math.sin(d),h=Math.cos(d),u=o.a,o.a=h*u-a*o.c,o.c=a*u+h*o.c}else l*=this.data.rotate,a=Math.sin(l),h=Math.cos(l),u=o.a,o.a=h*u-a*o.c,o.c=a*u+h*o.c,u=o.b,o.b=h*u-a*o.d,o.d=a*u+h*o.d}if(c){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=i*o.a,this.ty=i*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*F.degRad,n=Math.cos(r),c=Math.sin(r),o=this.cx-e,i=this.cy-t;this.translate(o*n-i*c-o,o*c+i*n-i)}},Is=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 O,this.darkColor=e.darkColor?new O:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof le)||!(this.attachment instanceof le)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ks=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Pe;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let n=t.findBone(e.bones[r].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(n)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,i=this.target,l=i.a,a=i.b,h=i.c,u=i.d,d=l*u-a*h>0?F.degRad:-F.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let w=0,p=x.length;w<p;w++){let g=x[w];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(h,l)-Math.atan2(y,b)+f;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let k=Math.cos(A),M=Math.sin(A);g.a=k*b-M*y,g.b=k*v-M*S,g.c=M*b+k*y,g.d=M*v+k*S}if(o){let b=this.temp;i.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*t,g.worldY+=(b.y-g.worldY)*s}if(r!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(l*l+h*h)-b+this.data.offsetScaleX)*r)/b),g.a*=b,g.c*=b}if(n!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(a*a+u*u)-b+this.data.offsetScaleY)*n)/b),g.b*=b,g.d*=b}if(c>0){let b=g.b,v=g.d,y=Math.atan2(v,b),S=Math.atan2(u,a)-Math.atan2(h,l)-(y-Math.atan2(g.c,g.a));S>F.PI?S-=F.PI2:S<-F.PI&&(S+=F.PI2),S=y+(S+m)*c;let A=Math.sqrt(b*b+v*v);g.b=Math.cos(S)*A,g.d=Math.sin(S)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,i=this.target,l=i.a,a=i.b,h=i.c,u=i.d,d=l*u-a*h>0?F.degRad:-F.degRad,f=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let w=0,p=x.length;w<p;w++){let g=x[w];if(e!=0){let b=g.a,v=g.b,y=g.c,S=g.d,A=Math.atan2(h,l)+f;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let k=Math.cos(A),M=Math.sin(A);g.a=k*b-M*y,g.b=k*v-M*S,g.c=M*b+k*y,g.d=M*v+k*S}if(o){let b=this.temp;i.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*t,g.worldY+=b.y*s}if(r!=0){let b=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*r+1;g.a*=b,g.c*=b}if(n!=0){let b=(Math.sqrt(a*a+u*u)-1+this.data.offsetScaleY)*n+1;g.b*=b,g.d*=b}if(c>0){let b=Math.atan2(u,a)-Math.atan2(h,l);b>F.PI?b-=F.PI2:b<-F.PI&&(b+=F.PI2);let v=g.b,y=g.d;b=Math.atan2(y,v)+(b-F.PI/2+m)*c;let S=Math.sqrt(v*v+y*y);g.b=Math.cos(b)*S,g.d=Math.sin(b)*S}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,o=this.target,i=this.bones;for(let l=0,a=i.length;l<a;l++){let h=i[l],u=h.arotation;e!=0&&(u+=(o.arotation-u+this.data.offsetRotation)*e);let d=h.ax,f=h.ay;d+=(o.ax-d+this.data.offsetX)*t,f+=(o.ay-f+this.data.offsetY)*s;let m=h.ascaleX,x=h.ascaleY;r!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*r)/m),n!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*n)/x);let w=h.ashearY;c!=0&&(w+=(o.ashearY-w+this.data.offsetShearY)*c),h.updateWorldTransformWith(d,f,u,m,x,h.ashearX,w)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,o=this.target,i=this.bones;for(let l=0,a=i.length;l<a;l++){let h=i[l],u=h.arotation+(o.arotation+this.data.offsetRotation)*e,d=h.ax+(o.ax+this.data.offsetX)*t,f=h.ay+(o.ay+this.data.offsetY)*s,m=h.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*r+1),x=h.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*n+1),w=h.ashearY+(o.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(d,f,u,m,x,h.ashearX,w)}}},zt=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return zt.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],r;if(!s.parent)r=new Nt(s,this,null);else{let n=this.bones[s.parent.index];r=new Nt(s,this,n),n.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],r=this.bones[s.boneData.index],n=new Is(s,r);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new Cs(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new ks(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ce(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new Zs(s,this))}this.color=new O(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let u=0,d=t.length;u<d;u++){let f=t[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let d=0,f=this.skin.bones.length;d<f;d++){let m=this.bones[u[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,r=this.transformConstraints,n=this.pathConstraints,c=this.physicsConstraints,o=s.length,i=r.length,l=n.length,a=this.physicsConstraints.length,h=o+i+l+a;e:for(let u=0;u<h;u++){for(let d=0;d<o;d++){let f=s[d];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let d=0;d<i;d++){let f=r[d];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let d=0;d<l;d++){let f=n[d];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let d=0;d<a;d++){const f=c[d];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,d=t.length;u<d;u++)this.sortBone(t[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,r=s[0];if(this.sortBone(r),s.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let n=s[s.length-1];this.sortBone(n),this._updateCache.push(e),this.sortReset(r.children),n.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,r=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let i=0,l=this.data.skins.length;i<l;i++)this.sortPathConstraintAttachment(this.data.skins[i],s,r);let n=t.getAttachment();n instanceof Ae&&this.sortPathConstraintAttachmentWith(n,r);let c=e.bones,o=c.length;for(let i=0;i<o;i++)this.sortBone(c[i]);this._updateCache.push(e);for(let i=0;i<o;i++)this.sortReset(c[i].children);for(let i=0;i<o;i++)c[i].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let r=0;r<s;r++){let n=t[r];this.sortBone(n.parent),this.sortBone(n)}else for(let r=0;r<s;r++)this.sortBone(t[r]);this._updateCache.push(e);for(let r=0;r<s;r++)this.sortReset(t[r].children);for(let r=0;r<s;r++)t[r].sorted=!0}sortPathConstraintAttachment(e,t,s){let r=e.attachments[t];if(r)for(let n in r)this.sortPathConstraintAttachmentWith(r[n],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ae))return;let s=e.bones;if(!s)this.sortBone(t);else{let r=this.bones;for(let n=0,c=s.length;n<c;){let o=s[n++];for(o+=n;n<o;)this.sortBone(r[s[n++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let r=e[t];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let r=0,n=t.length;r<n;r++){let c=t[r];c.ax=c.x,c.ay=c.y,c.arotation=c.rotation,c.ascaleX=c.scaleX,c.ascaleY=c.scaleY,c.ashearX=c.shearX,c.ashearY=c.shearY}let s=this._updateCache;for(let r=0,n=s.length;r<n;r++)s[r].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let s=this.bones;for(let x=1,w=s.length;x<w;x++){let p=s[x];p.ax=p.x,p.ay=p.y,p.arotation=p.rotation,p.ascaleX=p.scaleX,p.ascaleY=p.scaleY,p.ashearX=p.shearX,p.ashearY=p.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let n=t.a,c=t.b,o=t.c,i=t.d;r.worldX=n*this.x+c*this.y+t.worldX,r.worldY=o*this.x+i*this.y+t.worldY;const l=(r.rotation+r.shearX)*F.degRad,a=(r.rotation+90+r.shearY)*F.degRad,h=Math.cos(l)*r.scaleX,u=Math.cos(a)*r.scaleY,d=Math.sin(l)*r.scaleX,f=Math.sin(a)*r.scaleY;r.a=(n*h+c*d)*this.scaleX,r.b=(n*u+c*f)*this.scaleX,r.c=(o*h+i*d)*this.scaleY,r.d=(o*u+i*f)*this.scaleY;let m=this._updateCache;for(let x=0,w=m.length;x<w;x++){let p=m[x];p!=r&&p.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;E.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.data.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.data.name==e)return n}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,r=t.length;s<r;s++){let n=t[s],c=n.data.attachmentName;if(c){let o=e.getAttachment(s,c);o&&n.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,n=s.length;r<n;r++){let c=s[r];if(c.data.name==e){let o=null;if(t&&(o=this.getAttachment(r,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);c.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new Pe,s=new Pe;return this.getBounds(t,s,void 0,e),{x:t.x,y:t.y,width:s.x,height:s.y}}getBounds(e,t,s=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let n=this.drawOrder,c=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let a=0,h=n.length;a<h;a++){let u=n[a];if(!u.bone.active)continue;let d=0,f=null,m=null,x=u.getAttachment();if(x instanceof V)d=8,f=E.setArraySize(s,d,0),x.computeWorldVertices(u,f,0,2),m=zt.quadTriangles;else if(x instanceof ye){let w=x;d=w.worldVerticesLength,f=E.setArraySize(s,d,0),w.computeWorldVertices(u,0,d,f,0,2),m=w.triangles}else if(x instanceof Ue&&r!=null){r.clipStart(u,x);continue}if(f&&m){r!=null&&r.isClipping()&&(r.clipTriangles(f,m,m.length),f=r.clippedVertices,d=r.clippedVertices.length);for(let w=0,p=f.length;w<p;w+=2){let g=f[w],b=f[w+1];c=Math.min(c,g),o=Math.min(o,b),i=Math.max(i,g),l=Math.max(l,b)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(c,o),t.set(i-c,l-o)}update(e){this.time+=e}physicsTranslate(e,t){const s=this.physicsConstraints;for(let r=0,n=s.length;r<n;r++)s[r].translate(e,t)}physicsRotate(e,t,s){const r=this.physicsConstraints;for(let n=0,c=r.length;n<c;n++)r[n].rotate(e,t,s)}},$e=zt;B($e,"quadTriangles",[0,1,2,2,3,0]),B($e,"yDown",!1);var Ts=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Ts||{}),Ms=class extends Xe{_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)}},Gt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let n=t[s];if(n.name==e)return n}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const n=t[s];if(n.name==e)return n}return null}},Ht=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},je=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new O(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let n=e.bones[r],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==n){c=!0;break}c||this.bones.push(n)}for(let r=0;r<e.constraints.length;r++){let n=e.constraints[r],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==n){c=!0;break}c||this.constraints.push(n)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let n=e.bones[r],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==n){c=!0;break}c||this.bones.push(n)}for(let r=0;r<e.constraints.length;r++){let n=e.constraints[r],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==n){c=!0;break}c||this.constraints.push(n)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof ye?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let r in s){let n=s[r];n&&e.push(new Ht(t,r,n))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let n=s[r];n&&t.push(new Ht(e,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let n=e.slots[r],c=n.getAttachment();if(c&&s<t.attachments.length){let o=t.attachments[s];for(let i in o){let l=o[i];if(c==l){let a=this.getAttachment(s,i);a&&n.setAttachment(a);break}}}s++}}},$t=class{index=0;name;boneData;color=new O(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Je.Normal;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Je=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Je||{}),jt=class extends Xe{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)}},ei=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Gt;s.name="";let r=new Ys(e),n=r.readInt32(),c=r.readInt32();s.hash=c==0&&n==0?null:c.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let i=0;i=r.readInt(!0);for(let a=0;a<i;a++){let h=r.readString();if(!h)throw new Error("String in string table must not be null.");r.strings.push(h)}i=r.readInt(!0);for(let a=0;a<i;a++){let h=r.readString();if(!h)throw new Error("Bone name must not be null.");let u=a==0?null:s.bones[r.readInt(!0)],d=new Dt(a,h,u);d.rotation=r.readFloat(),d.x=r.readFloat()*t,d.y=r.readFloat()*t,d.scaleX=r.readFloat(),d.scaleY=r.readFloat(),d.shearX=r.readFloat(),d.shearY=r.readFloat(),d.length=r.readFloat()*t,d.inherit=r.readByte(),d.skinRequired=r.readBoolean(),o&&(O.rgba8888ToColor(d.color,r.readInt32()),d.icon=r.readString()??void 0,d.visible=r.readBoolean()),s.bones.push(d)}i=r.readInt(!0);for(let a=0;a<i;a++){let h=r.readString();if(!h)throw new Error("Slot name must not be null.");let u=s.bones[r.readInt(!0)],d=new $t(a,h,u);O.rgba8888ToColor(d.color,r.readInt32());let f=r.readInt32();f!=-1&&O.rgb888ToColor(d.darkColor=new O,f),d.attachmentName=r.readStringRef(),d.blendMode=r.readInt(!0),o&&(d.visible=r.readBoolean()),s.slots.push(d)}i=r.readInt(!0);for(let a=0,h;a<i;a++){let u=r.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new Ut(u);d.order=r.readInt(!0),h=r.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let f=r.readByte();d.skinRequired=(f&1)!=0,d.bendDirection=f&2?1:-1,d.compress=(f&4)!=0,d.stretch=(f&8)!=0,d.uniform=(f&16)!=0,f&32&&(d.mix=f&64?r.readFloat():1),f&128&&(d.softness=r.readFloat()*t),s.ikConstraints.push(d)}i=r.readInt(!0);for(let a=0,h;a<i;a++){let u=r.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new jt(u);d.order=r.readInt(!0),h=r.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.bones[r.readInt(!0)];let f=r.readByte();d.skinRequired=(f&1)!=0,d.local=(f&2)!=0,d.relative=(f&4)!=0,f&8&&(d.offsetRotation=r.readFloat()),f&16&&(d.offsetX=r.readFloat()*t),f&32&&(d.offsetY=r.readFloat()*t),f&64&&(d.offsetScaleX=r.readFloat()),f&128&&(d.offsetScaleY=r.readFloat()),f=r.readByte(),f&1&&(d.offsetShearY=r.readFloat()),f&2&&(d.mixRotate=r.readFloat()),f&4&&(d.mixX=r.readFloat()),f&8&&(d.mixY=r.readFloat()),f&16&&(d.mixScaleX=r.readFloat()),f&32&&(d.mixScaleY=r.readFloat()),f&64&&(d.mixShearY=r.readFloat()),s.transformConstraints.push(d)}i=r.readInt(!0);for(let a=0,h;a<i;a++){let u=r.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new Wt(u);d.order=r.readInt(!0),d.skinRequired=r.readBoolean(),h=r.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[r.readInt(!0)]);d.target=s.slots[r.readInt(!0)];const f=r.readByte();d.positionMode=f&1,d.spacingMode=f>>1&3,d.rotateMode=f>>3&3,f&128&&(d.offsetRotation=r.readFloat()),d.position=r.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=r.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=r.readFloat(),d.mixX=r.readFloat(),d.mixY=r.readFloat(),s.pathConstraints.push(d)}i=r.readInt(!0);for(let a=0,h;a<i;a++){const u=r.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Ms(u);d.order=r.readInt(!0),d.bone=s.bones[r.readInt(!0)];let f=r.readByte();d.skinRequired=(f&1)!=0,f&2&&(d.x=r.readFloat()),f&4&&(d.y=r.readFloat()),f&8&&(d.rotate=r.readFloat()),f&16&&(d.scaleX=r.readFloat()),f&32&&(d.shearX=r.readFloat()),d.limit=(f&64?r.readFloat():5e3)*t,d.step=1/r.readUnsignedByte(),d.inertia=r.readFloat(),d.strength=r.readFloat(),d.damping=r.readFloat(),d.massInverse=f&128?r.readFloat():1,d.wind=r.readFloat(),d.gravity=r.readFloat(),f=r.readByte(),f&1&&(d.inertiaGlobal=!0),f&2&&(d.strengthGlobal=!0),f&4&&(d.dampingGlobal=!0),f&8&&(d.massGlobal=!0),f&16&&(d.windGlobal=!0),f&32&&(d.gravityGlobal=!0),f&64&&(d.mixGlobal=!0),d.mix=f&128?r.readFloat():1,s.physicsConstraints.push(d)}let l=this.readSkin(r,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let a=s.skins.length;for(E.setArraySize(s.skins,i=a+r.readInt(!0));a<i;a++){let h=this.readSkin(r,s,!1,o);if(!h)throw new Error("readSkin() should not have returned null.");s.skins[a]=h}}i=this.linkedMeshes.length;for(let a=0;a<i;a++){let h=this.linkedMeshes[a];const u=s.skins[h.skinIndex];if(!h.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(h.slotIndex,h.parent);if(!d)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?d:h.mesh,h.mesh.setParentMesh(d),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,i=r.readInt(!0);for(let a=0;a<i;a++){let h=r.readString();if(!h)throw new Error("Event data name must not be null");let u=new qt(h);u.intValue=r.readInt(!1),u.floatValue=r.readFloat(),u.stringValue=r.readString(),u.audioPath=r.readString(),u.audioPath&&(u.volume=r.readFloat(),u.balance=r.readFloat()),s.events.push(u)}i=r.readInt(!0);for(let a=0;a<i;a++){let h=r.readString();if(!h)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,h,s))}return s}readSkin(e,t,s,r){let n=null,c=0;if(s){if(c=e.readInt(!0),c==0)return null;n=new je("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");n=new je(o),r&&O.rgba8888ToColor(n.color,e.readInt32()),n.bones.length=e.readInt(!0);for(let i=0,l=n.bones.length;i<l;i++)n.bones[i]=t.bones[e.readInt(!0)];for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let i=0,l=e.readInt(!0);i<l;i++)n.constraints.push(t.physicsConstraints[e.readInt(!0)]);c=e.readInt(!0)}for(let o=0;o<c;o++){let i=e.readInt(!0);for(let l=0,a=e.readInt(!0);l<a;l++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let u=this.readAttachment(e,t,n,i,h,r);u&&n.setAttachment(i,h,u)}}return n}readAttachment(e,t,s,r,n,c){let o=this.scale,i=e.readByte();const l=i&8?e.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(i&7){case ge.Region:{let a=i&16?e.readStringRef():null;const h=i&32?e.readInt32():4294967295,u=i&64?this.readSequence(e):null;let d=i&128?e.readFloat():0,f=e.readFloat(),m=e.readFloat(),x=e.readFloat(),w=e.readFloat(),p=e.readFloat(),g=e.readFloat();a||(a=l);let b=this.attachmentLoader.newRegionAttachment(s,l,a,u);return b?(b.path=a,b.x=f*o,b.y=m*o,b.scaleX=x,b.scaleY=w,b.rotation=d,b.width=p*o,b.height=g*o,O.rgba8888ToColor(b.color,h),b.sequence=u,u==null&&b.updateRegion(),b):null}case ge.BoundingBox:{let a=this.readVertices(e,(i&16)!=0),h=c?e.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,l);return u?(u.worldVerticesLength=a.length,u.vertices=a.vertices,u.bones=a.bones,c&&O.rgba8888ToColor(u.color,h),u):null}case ge.Mesh:{let a=i&16?e.readStringRef():l;const h=i&32?e.readInt32():4294967295,u=i&64?this.readSequence(e):null,d=e.readInt(!0),f=this.readVertices(e,(i&128)!=0),m=this.readFloatArray(e,f.length,1),x=this.readShortArray(e,(f.length-d-2)*3);let w=[],p=0,g=0;c&&(w=this.readShortArray(e,e.readInt(!0)),p=e.readFloat(),g=e.readFloat()),a||(a=l);let b=this.attachmentLoader.newMeshAttachment(s,l,a,u);return b?(b.path=a,O.rgba8888ToColor(b.color,h),b.bones=f.bones,b.vertices=f.vertices,b.worldVerticesLength=f.length,b.triangles=x,b.regionUVs=m,u==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=u,c&&(b.edges=w,b.width=p*o,b.height=g*o),b):null}case ge.LinkedMesh:{const a=i&16?e.readStringRef():l;if(a==null)throw new Error("Path of linked mesh must not be null");const h=i&32?e.readInt32():4294967295,u=i&64?this.readSequence(e):null,d=(i&128)!=0,f=e.readInt(!0),m=e.readStringRef();let x=0,w=0;c&&(x=e.readFloat(),w=e.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,a,u);return p?(p.path=a,O.rgba8888ToColor(p.color,h),p.sequence=u,c&&(p.width=x*o,p.height=w*o),this.linkedMeshes.push(new ti(p,f,r,m,d)),p):null}case ge.Path:{const a=(i&16)!=0,h=(i&32)!=0,u=this.readVertices(e,(i&64)!=0),d=E.newArray(u.length/6,0);for(let x=0,w=d.length;x<w;x++)d[x]=e.readFloat()*o;const f=c?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=a,m.constantSpeed=h,m.worldVerticesLength=u.length,m.vertices=u.vertices,m.bones=u.bones,m.lengths=d,c&&O.rgba8888ToColor(m.color,f),m):null}case ge.Point:{const a=e.readFloat(),h=e.readFloat(),u=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,l);return f?(f.x=h*o,f.y=u*o,f.rotation=a,c&&O.rgba8888ToColor(f.color,d),f):null}case ge.Clipping:{const a=e.readInt(!0),h=this.readVertices(e,(i&16)!=0);let u=c?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[a],d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,c&&O.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(e){let t=new it(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,r=e.readInt(!0),n=new si;if(n.length=r<<1,!t)return n.vertices=this.readFloatArray(e,n.length,s),n;let c=new Array,o=new Array;for(let i=0;i<r;i++){let l=e.readInt(!0);o.push(l);for(let a=0;a<l;a++)o.push(e.readInt(!0)),c.push(e.readFloat()*s),c.push(e.readFloat()*s),c.push(e.readFloat())}return n.vertices=E.toFloatArray(c),n.bones=o,n}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let n=0;n<t;n++)r[n]=e.readFloat();else for(let n=0;n<t;n++)r[n]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,n=this.scale;for(let l=0,a=e.readInt(!0);l<a;l++){let h=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0),x=m-1;switch(f){case mi:{let w=new pe(m,h);for(let p=0;p<m;p++)w.setFrame(p,e.readFloat(),e.readStringRef());r.push(w);break}case gi:{let w=e.readInt(!0),p=new mt(m,w,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let A=0,k=0;p.setFrame(A,g,b,v,y,S),A!=x;A++){let M=e.readFloat(),T=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;switch(e.readByte()){case ce:p.setStepped(A);break;case de:z(e,p,k++,A,0,g,M,b,T,1),z(e,p,k++,A,1,g,M,v,R,1),z(e,p,k++,A,2,g,M,y,X,1),z(e,p,k++,A,3,g,M,S,I,1)}g=M,b=T,v=R,y=X,S=I}r.push(p);break}case xi:{let w=e.readInt(!0),p=new gt(m,w,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,A=0;p.setFrame(S,g,b,v,y),S!=x;S++){let k=e.readFloat(),M=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case ce:p.setStepped(S);break;case de:z(e,p,A++,S,0,g,k,b,M,1),z(e,p,A++,S,1,g,k,v,T,1),z(e,p,A++,S,2,g,k,y,R,1)}g=k,b=M,v=T,y=R}r.push(p);break}case bi:{let w=e.readInt(!0),p=new bt(m,w,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;for(let T=0,R=0;p.setFrame(T,g,b,v,y,S,A,k,M),T!=x;T++){let X=e.readFloat(),I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,H=e.readUnsignedByte()/255;switch(e.readByte()){case ce:p.setStepped(T);break;case de:z(e,p,R++,T,0,g,X,b,I,1),z(e,p,R++,T,1,g,X,v,Y,1),z(e,p,R++,T,2,g,X,y,P,1),z(e,p,R++,T,3,g,X,S,N,1),z(e,p,R++,T,4,g,X,A,q,1),z(e,p,R++,T,5,g,X,k,D,1),z(e,p,R++,T,6,g,X,M,H,1)}g=X,b=I,v=Y,y=P,S=N,A=q,k=D,M=H}r.push(p);break}case pi:{let w=e.readInt(!0),p=new pt(m,w,h),g=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let M=0,T=0;p.setFrame(M,g,b,v,y,S,A,k),M!=x;M++){let R=e.readFloat(),X=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,q=e.readUnsignedByte()/255;switch(e.readByte()){case ce:p.setStepped(M);break;case de:z(e,p,T++,M,0,g,R,b,X,1),z(e,p,T++,M,1,g,R,v,I,1),z(e,p,T++,M,2,g,R,y,Y,1),z(e,p,T++,M,3,g,R,S,P,1),z(e,p,T++,M,4,g,R,A,N,1),z(e,p,T++,M,5,g,R,k,q,1)}g=R,b=X,v=I,y=Y,S=P,A=N,k=q}r.push(p);break}case wi:{let w=new xt(m,e.readInt(!0),h),p=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,v=0;w.setFrame(b,p,g),b!=x;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case ce:w.setStepped(b);break;case de:z(e,w,v++,b,0,p,y,g,S,1)}p=y,g=S}r.push(w)}}}}for(let l=0,a=e.readInt(!0);l<a;l++){let h=e.readInt(!0);for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readByte(),m=e.readInt(!0);if(f==ui){let w=new ut(m,h);for(let p=0;p<m;p++)w.setFrame(p,e.readFloat(),e.readByte());r.push(w);continue}let x=e.readInt(!0);switch(f){case ii:r.push(Q(e,new Te(m,x,h),1));break;case ri:r.push(Jt(e,new rt(m,x,h),n));break;case ni:r.push(Q(e,new nt(m,x,h),n));break;case ai:r.push(Q(e,new at(m,x,h),n));break;case li:r.push(Jt(e,new lt(m,x,h),1));break;case oi:r.push(Q(e,new ot(m,x,h),1));break;case hi:r.push(Q(e,new ht(m,x,h),1));break;case ci:r.push(Jt(e,new ct(m,x,h),1));break;case di:r.push(Q(e,new dt(m,x,h),1));break;case fi:r.push(Q(e,new ft(m,x,h),1))}}}for(let l=0,a=e.readInt(!0);l<a;l++){let h=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new yt(u,e.readInt(!0),h),m=e.readByte(),x=e.readFloat(),w=m&1?m&2?e.readFloat():1:0,p=m&4?e.readFloat()*n:0;for(let g=0,b=0;f.setFrame(g,x,w,p,m&8?1:-1,(m&16)!=0,(m&32)!=0),g!=d;g++){m=e.readByte();const v=e.readFloat(),y=m&1?m&2?e.readFloat():1:0,S=m&4?e.readFloat()*n:0;m&64?f.setStepped(g):m&128&&(z(e,f,b++,g,0,x,v,w,y,1),z(e,f,b++,g,1,x,v,p,S,n)),x=v,w=y,p=S}r.push(f)}for(let l=0,a=e.readInt(!0);l<a;l++){let h=e.readInt(!0),u=e.readInt(!0),d=u-1,f=new vt(u,e.readInt(!0),h),m=e.readFloat(),x=e.readFloat(),w=e.readFloat(),p=e.readFloat(),g=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;f.setFrame(y,m,x,w,p,g,b,v),y!=d;y++){let A=e.readFloat(),k=e.readFloat(),M=e.readFloat(),T=e.readFloat(),R=e.readFloat(),X=e.readFloat(),I=e.readFloat();switch(e.readByte()){case ce:f.setStepped(y);break;case de:z(e,f,S++,y,0,m,A,x,k,1),z(e,f,S++,y,1,m,A,w,M,1),z(e,f,S++,y,2,m,A,p,T,1),z(e,f,S++,y,3,m,A,g,R,1),z(e,f,S++,y,4,m,A,b,X,1),z(e,f,S++,y,5,m,A,v,I,1)}m=A,x=k,w=M,p=T,g=R,b=X,v=I}r.push(f)}for(let l=0,a=e.readInt(!0);l<a;l++){let h=e.readInt(!0),u=s.pathConstraints[h];for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),x=e.readInt(!0),w=e.readInt(!0);switch(m){case Si:r.push(Q(e,new St(x,w,h),u.positionMode==0?n:1));break;case Ai:r.push(Q(e,new At(x,w,h),u.spacingMode==0||u.spacingMode==1?n:1));break;case Ci:let p=new Ct(x,w,h),g=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,A=0,k=p.getFrameCount()-1;p.setFrame(S,g,b,v,y),S!=k;S++){let M=e.readFloat(),T=e.readFloat(),R=e.readFloat(),X=e.readFloat();switch(e.readByte()){case ce:p.setStepped(S);break;case de:z(e,p,A++,S,0,g,M,b,T,1),z(e,p,A++,S,1,g,M,v,R,1),z(e,p,A++,S,2,g,M,y,X,1)}g=M,b=T,v=R,y=X}r.push(p)}}}for(let l=0,a=e.readInt(!0);l<a;l++){const h=e.readInt(!0)-1;for(let u=0,d=e.readInt(!0);u<d;u++){const f=e.readByte(),m=e.readInt(!0);if(f==Ri){const w=new De(m,h);for(let p=0;p<m;p++)w.setFrame(p,e.readFloat());r.push(w);continue}const x=e.readInt(!0);switch(f){case Ii:r.push(Q(e,new It(m,x,h),1));break;case ki:r.push(Q(e,new kt(m,x,h),1));break;case Ti:r.push(Q(e,new Tt(m,x,h),1));break;case Mi:r.push(Q(e,new Mt(m,x,h),1));break;case Yi:r.push(Q(e,new Yt(m,x,h),1));break;case Xi:r.push(Q(e,new Xt(m,x,h),1));break;case Fi:r.push(Q(e,new Ft(m,x,h),1))}}}for(let l=0,a=e.readInt(!0);l<a;l++){let h=s.skins[e.readInt(!0)];for(let u=0,d=e.readInt(!0);u<d;u++){let f=e.readInt(!0);for(let m=0,x=e.readInt(!0);m<x;m++){let w=e.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let p=h.getAttachment(f,w),g=e.readByte(),b=e.readInt(!0),v=b-1;switch(g){case yi:{let y=p,S=y.bones,A=y.vertices,k=S?A.length/3*2:A.length,M=e.readInt(!0),T=new wt(b,M,f,y),R=e.readFloat();for(let X=0,I=0;;X++){let Y,P=e.readInt(!0);if(P==0)Y=S?E.newFloatArray(k):A;else{Y=E.newFloatArray(k);let q=e.readInt(!0);if(P+=q,n==1)for(let D=q;D<P;D++)Y[D]=e.readFloat();else for(let D=q;D<P;D++)Y[D]=e.readFloat()*n;if(!S)for(let D=0,H=Y.length;D<H;D++)Y[D]+=A[D]}if(T.setFrame(X,R,Y),X==v)break;let N=e.readFloat();switch(e.readByte()){case ce:T.setStepped(X);break;case de:z(e,T,I++,X,0,R,N,0,1,1)}R=N}r.push(T);break}case vi:{let y=new Se(b,f,p);for(let S=0;S<b;S++){let A=e.readFloat(),k=e.readInt32();y.setFrame(S,A,ls[k&15],k>>4,e.readFloat())}r.push(y);break}}}}}let c=e.readInt(!0);if(c>0){let l=new we(c),a=s.slots.length;for(let h=0;h<c;h++){let u=e.readFloat(),d=e.readInt(!0),f=E.newArray(a,0);for(let p=a-1;p>=0;p--)f[p]=-1;let m=E.newArray(a-d,0),x=0,w=0;for(let p=0;p<d;p++){let g=e.readInt(!0);for(;x!=g;)m[w++]=x++;f[x+e.readInt(!0)]=x++}for(;x<a;)m[w++]=x++;for(let p=a-1;p>=0;p--)f[p]==-1&&(f[p]=m[--w]);l.setFrame(h,u,f)}r.push(l)}let o=e.readInt(!0);if(o>0){let l=new Me(o);for(let a=0;a<o;a++){let h=e.readFloat(),u=s.events[e.readInt(!0)],d=new _t(h,u);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(a,d)}r.push(l)}let i=0;for(let l=0,a=r.length;l<a;l++)i=Math.max(i,r[l].getDuration());return new Ve(t,r,i)}},Ys=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let r=0;r<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(n),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},ti=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,n){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}},si=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}},ge=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(ge||{});function Q(e,t,s){let r=e.readFloat(),n=e.readFloat()*s;for(let c=0,o=0,i=t.getFrameCount()-1;t.setFrame(c,r,n),c!=i;c++){let l=e.readFloat(),a=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(c);break;case de:z(e,t,o++,c,0,r,l,n,a,s)}r=l,n=a}return t}function Jt(e,t,s){let r=e.readFloat(),n=e.readFloat()*s,c=e.readFloat()*s;for(let o=0,i=0,l=t.getFrameCount()-1;t.setFrame(o,r,n,c),o!=l;o++){let a=e.readFloat(),h=e.readFloat()*s,u=e.readFloat()*s;switch(e.readByte()){case ce:t.setStepped(o);break;case de:z(e,t,i++,o,0,r,a,n,h,s),z(e,t,i++,o,1,r,a,c,u,s)}r=a,n=h,c=u}return t}function z(e,t,s,r,n,c,o,i,l,a){t.setBezier(s,r,n,c,i,e.readFloat(),e.readFloat()*a,e.readFloat(),e.readFloat()*a,o,l)}var ii=0,ri=1,ni=2,ai=3,li=4,oi=5,hi=6,ci=7,di=8,fi=9,ui=10,mi=0,gi=1,xi=2,bi=3,pi=4,wi=5,yi=0,vi=1,Si=0,Ai=1,Ci=2,Ii=0,ki=1,Ti=2,Mi=4,Yi=5,Xi=6,Fi=7,Ri=8,ce=1,de=2,Ei=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new ke(()=>E.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,n=this.polygonPool,c=e.slots,o=c.length;s.length=0,n.freeAll(r),r.length=0;for(let i=0;i<o;i++){let l=c[i];if(!l.bone.active)continue;let a=l.getAttachment();if(a instanceof qe){let h=a;s.push(h);let u=n.obtain();u.length!=h.worldVerticesLength&&(u=E.newFloatArray(h.worldVerticesLength)),r.push(u),h.computeWorldVertices(l,0,h.worldVerticesLength,u,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,n=this.polygons;for(let c=0,o=n.length;c<o;c++){let i=n[c],l=i;for(let a=0,h=i.length;a<h;a+=2){let u=l[a],d=l[a+1];e=Math.min(e,u),t=Math.min(t,d),s=Math.max(s,u),r=Math.max(r,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let n=this.minX,c=this.minY,o=this.maxX,i=this.maxY;if(e<=n&&s<=n||t<=c&&r<=c||e>=o&&s>=o||t>=i&&r>=i)return!1;let l=(r-t)/(s-e),a=l*(n-e)+t;if(a>c&&a<i||(a=l*(o-e)+t,a>c&&a<i))return!0;let h=(c-t)/l+e;return h>n&&h<o||(h=(i-t)/l+e,h>n&&h<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,n=s.length;r<n;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,n=e.length,c=n-2,o=!1;for(let i=0;i<n;i+=2){let l=r[i+1],a=r[c+1];if(l<s&&a>=s||a<s&&l>=s){let h=r[i];h+(s-l)/(a-l)*(r[c]-h)<t&&(o=!o)}c=i}return o}intersectsSegment(e,t,s,r){let n=this.polygons;for(let c=0,o=n.length;c<o;c++)if(this.intersectsSegmentPolygon(n[c],e,t,s,r))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,t,s,r,n){let c=e,o=e.length,i=t-r,l=s-n,a=t*n-s*r,h=c[o-2],u=c[o-1];for(let d=0;d<o;d+=2){let f=c[d],m=c[d+1],x=h*m-u*f,w=h-f,p=u-m,g=i*p-l*w,b=(a*w-i*x)/g;if((b>=h&&b<=f||b>=f&&b<=h)&&(b>=t&&b<=r||b>=r&&b<=t)){let v=(a*p-l*x)/g;if((v>=u&&v<=m||v>=m&&v<=u)&&(v>=s&&v<=n||v>=n&&v<=s))return!0}h=f,u=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},se=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new ke(()=>new Array);polygonIndicesPool=new ke(()=>new Array);triangulate(e){let t=e,s=e.length>>1,r=this.indicesArray;r.length=0;for(let o=0;o<s;o++)r[o]=o;let n=this.isConcaveArray;n.length=0;for(let o=0,i=s;o<i;++o)n[o]=se.isConcave(o,s,t,r);let c=this.triangles;for(c.length=0;s>3;){let o=s-1,i=0,l=1;for(;;){e:if(!n[i]){let u=r[o]<<1,d=r[i]<<1,f=r[l]<<1,m=t[u],x=t[u+1],w=t[d],p=t[d+1],g=t[f],b=t[f+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!n[v])continue;let y=r[v]<<1,S=t[y],A=t[y+1];if(se.positiveArea(g,b,m,x,S,A)&&se.positiveArea(m,x,w,p,S,A)&&se.positiveArea(w,p,g,b,S,A))break e}break}if(l==0){do{if(!n[i])break;i--}while(i>0);break}o=i,i=l,l=(l+1)%s}c.push(r[(s+i-1)%s]),c.push(r[i]),c.push(r[(i+1)%s]),r.splice(i,1),n.splice(i,1),s--;let a=(s+i-1)%s,h=i==s?0:i;n[a]=se.isConcave(a,s,t,r),n[h]=se.isConcave(h,s,t,r)}return s==3&&(c.push(r[2]),c.push(r[0]),c.push(r[1])),c}decompose(e,t){let s=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let o=this.polygonPool.obtain();o.length=0;let i=-1,l=0;for(let a=0,h=t.length;a<h;a+=3){let u=t[a]<<1,d=t[a+1]<<1,f=t[a+2]<<1,m=s[u],x=s[u+1],w=s[d],p=s[d+1],g=s[f],b=s[f+1],v=!1;if(i==u){let y=o.length-4,S=se.winding(o[y],o[y+1],o[y+2],o[y+3],g,b),A=se.winding(g,b,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(g),o.push(b),c.push(f),v=!0)}v||(o.length>0?(r.push(o),n.push(c)):(this.polygonPool.free(o),this.polygonIndicesPool.free(c)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(x),o.push(w),o.push(p),o.push(g),o.push(b),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(u),c.push(d),c.push(f),l=se.winding(m,x,w,p,g,b),i=u)}o.length>0&&(r.push(o),n.push(c));for(let a=0,h=r.length;a<h;a++){if(c=n[a],c.length==0)continue;let u=c[0],d=c[c.length-1];o=r[a];let f=o.length-4,m=o[f],x=o[f+1],w=o[f+2],p=o[f+3],g=o[0],b=o[1],v=o[2],y=o[3],S=se.winding(m,x,w,p,g,b);for(let A=0;A<h;A++){if(A==a)continue;let k=n[A];if(k.length!=3)continue;let M=k[0],T=k[1],R=k[2],X=r[A],I=X[X.length-2],Y=X[X.length-1];if(M!=u||T!=d)continue;let P=se.winding(m,x,w,p,I,Y),N=se.winding(I,Y,g,b,v,y);P==S&&N==S&&(X.length=0,k.length=0,o.push(I),o.push(Y),c.push(R),m=w,x=p,w=I,p=Y,A=0)}}for(let a=r.length-1;a>=0;a--)o=r[a],o.length==0&&(r.splice(a,1),this.polygonPool.free(o),c=n[a],n.splice(a,1),this.polygonIndicesPool.free(c));return r}static isConcave(e,t,s,r){let n=r[(t+e-1)%t]<<1,c=r[e]<<1,o=r[(e+1)%t]<<1;return!this.positiveArea(s[n],s[n+1],s[c],s[c+1],s[o],s[o+1])}static positiveArea(e,t,s,r,n,c){return e*(c-r)+s*(t-c)+n*(r-t)>=0}static winding(e,t,s,r,n,c){let o=s-e,i=r-t;return n*i-c*o+o*t-e*i>=0?1:-1}},Kt=class{triangulator=new se;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,r,0,2);let n=this.clippingPolygon;Kt.makeClockwise(n);let c=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let o=0,i=c.length;o<i;o++){let l=c[o];Kt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return c.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,r,n,c,o,i){let l,a,h,u,d,f;typeof t=="number"?(l=s,a=r,h=n,u=c,d=o,f=i):(l=t,a=s,h=r,u=n,d=c,f=o),h&&u&&d&&typeof f=="boolean"?this.clipTrianglesRender(e,l,a,h,u,d,f):this.clipTrianglesNoRender(e,l,a)}clipTrianglesNoRender(e,t,s){let r=this.clipOutput,n=this.clippedVertices,c=this.clippedTriangles,o=this.clippingPolygons,i=o.length,l=0;n.length=0,c.length=0;for(let a=0;a<s;a+=3){let h=t[a]<<1,u=e[h],d=e[h+1];h=t[a+1]<<1;let f=e[h],m=e[h+1];h=t[a+2]<<1;let x=e[h],w=e[h+1];for(let p=0;p<i;p++){let g=n.length;if(this.clip(u,d,f,m,x,w,o[p],r)){let b=r.length;if(b==0)continue;let v=b>>1,y=this.clipOutput,S=E.setArraySize(n,g+v*2);for(let k=0;k<b;k+=2,g+=2){let M=y[k],T=y[k+1];S[g]=M,S[g+1]=T}g=c.length;let A=E.setArraySize(c,g+3*(v-2));v--;for(let k=1;k<v;k++,g+=3)A[g]=l,A[g+1]=l+k,A[g+2]=l+k+1;l+=v+1}else{let b=E.setArraySize(n,g+6);b[g]=u,b[g+1]=d,b[g+2]=f,b[g+3]=m,b[g+4]=x,b[g+5]=w,g=c.length;let v=E.setArraySize(c,g+3);v[g]=l,v[g+1]=l+1,v[g+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,s,r,n,c,o){let i=this.clipOutput,l=this.clippedVertices,a=this.clippedTriangles,h=this.clippingPolygons,u=h.length,d=o?12:8,f=0;l.length=0,a.length=0;for(let m=0;m<s;m+=3){let x=t[m]<<1,w=e[x],p=e[x+1],g=r[x],b=r[x+1];x=t[m+1]<<1;let v=e[x],y=e[x+1],S=r[x],A=r[x+1];x=t[m+2]<<1;let k=e[x],M=e[x+1],T=r[x],R=r[x+1];for(let X=0;X<u;X++){let I=l.length;if(this.clip(w,p,v,y,k,M,h[X],i)){let Y=i.length;if(Y==0)continue;let P=y-M,N=k-v,q=w-k,D=M-p,H=1/(P*q+N*(p-M)),$=Y>>1,j=this.clipOutput,L=E.setArraySize(l,I+$*d);for(let W=0;W<Y;W+=2,I+=d){let ne=j[W],ie=j[W+1];L[I]=ne,L[I+1]=ie,L[I+2]=n.r,L[I+3]=n.g,L[I+4]=n.b,L[I+5]=n.a;let K=ne-k,Z=ie-M,ee=(P*K+N*Z)*H,xe=(D*K+q*Z)*H,Fe=1-ee-xe;L[I+6]=g*ee+S*xe+T*Fe,L[I+7]=b*ee+A*xe+R*Fe,o&&(L[I+8]=c.r,L[I+9]=c.g,L[I+10]=c.b,L[I+11]=c.a)}I=a.length;let U=E.setArraySize(a,I+3*($-2));$--;for(let W=1;W<$;W++,I+=3)U[I]=f,U[I+1]=f+W,U[I+2]=f+W+1;f+=$+1}else{let Y=E.setArraySize(l,I+3*d);Y[I]=w,Y[I+1]=p,Y[I+2]=n.r,Y[I+3]=n.g,Y[I+4]=n.b,Y[I+5]=n.a,o?(Y[I+6]=g,Y[I+7]=b,Y[I+8]=c.r,Y[I+9]=c.g,Y[I+10]=c.b,Y[I+11]=c.a,Y[I+12]=v,Y[I+13]=y,Y[I+14]=n.r,Y[I+15]=n.g,Y[I+16]=n.b,Y[I+17]=n.a,Y[I+18]=S,Y[I+19]=A,Y[I+20]=c.r,Y[I+21]=c.g,Y[I+22]=c.b,Y[I+23]=c.a,Y[I+24]=k,Y[I+25]=M,Y[I+26]=n.r,Y[I+27]=n.g,Y[I+28]=n.b,Y[I+29]=n.a,Y[I+30]=T,Y[I+31]=R,Y[I+32]=c.r,Y[I+33]=c.g,Y[I+34]=c.b,Y[I+35]=c.a):(Y[I+6]=g,Y[I+7]=b,Y[I+8]=v,Y[I+9]=y,Y[I+10]=n.r,Y[I+11]=n.g,Y[I+12]=n.b,Y[I+13]=n.a,Y[I+14]=S,Y[I+15]=A,Y[I+16]=k,Y[I+17]=M,Y[I+18]=n.r,Y[I+19]=n.g,Y[I+20]=n.b,Y[I+21]=n.a,Y[I+22]=T,Y[I+23]=R),I=a.length;let P=E.setArraySize(a,I+3);P[I]=f,P[I+1]=f+1,P[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,t,s,r){let n=this.clipOutput,c=this.clippedVertices,o=this.clippedUVs,i=this.clippedTriangles,l=this.clippingPolygons,a=l.length,h=0;c.length=0,o.length=0,i.length=0;for(let u=0;u<s;u+=3){let d=t[u]<<1,f=e[d],m=e[d+1],x=r[d],w=r[d+1];d=t[u+1]<<1;let p=e[d],g=e[d+1],b=r[d],v=r[d+1];d=t[u+2]<<1;let y=e[d],S=e[d+1],A=r[d],k=r[d+1];for(let M=0;M<a;M++){let T=c.length;if(this.clip(f,m,p,g,y,S,l[M],n)){let R=n.length;if(R==0)continue;let X=g-S,I=y-p,Y=f-y,P=S-m,N=1/(X*Y+I*(m-S)),q=R>>1,D=this.clipOutput,H=E.setArraySize(c,T+q*2),$=E.setArraySize(o,T+q*2);for(let L=0;L<R;L+=2,T+=2){let U=D[L],W=D[L+1];H[T]=U,H[T+1]=W;let ne=U-y,ie=W-S,K=(X*ne+I*ie)*N,Z=(P*ne+Y*ie)*N,ee=1-K-Z;$[T]=x*K+b*Z+A*ee,$[T+1]=w*K+v*Z+k*ee}T=i.length;let j=E.setArraySize(i,T+3*(q-2));q--;for(let L=1;L<q;L++,T+=3)j[T]=h,j[T+1]=h+L,j[T+2]=h+L+1;h+=q+1}else{let R=E.setArraySize(c,T+6);R[T]=f,R[T+1]=m,R[T+2]=p,R[T+3]=g,R[T+4]=y,R[T+5]=S;let X=E.setArraySize(o,T+3*2);X[T]=x,X[T+1]=w,X[T+2]=b,X[T+3]=v,X[T+4]=A,X[T+5]=k,T=i.length;let I=E.setArraySize(i,T+3);I[T]=h,I[T+1]=h+1,I[T+2]=h+2,h+=3;break}}}}clip(e,t,s,r,n,c,o,i){let l=i,a=!1,h;o.length%4>=2?(h=i,i=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(s),h.push(r),h.push(n),h.push(c),h.push(e),h.push(t),i.length=0;let u=o.length-4,d=o;for(let f=0;;f+=2){let m=d[f],x=d[f+1],w=m-d[f+2],p=x-d[f+3],g=i.length,b=h;for(let y=0,S=h.length-2;y<S;){let A=b[y],k=b[y+1];y+=2;let M=b[y],T=b[y+1],R=p*(m-M)>w*(x-T),X=p*(m-A)-w*(x-k);if(X>0){if(R){i.push(M),i.push(T);continue}let I=M-A,Y=T-k,P=X/(I*p-Y*w);if(P>=0&&P<=1)i.push(A+I*P),i.push(k+Y*P);else{i.push(M),i.push(T);continue}}else if(R){let I=M-A,Y=T-k,P=X/(I*p-Y*w);if(P>=0&&P<=1)i.push(A+I*P),i.push(k+Y*P),i.push(M),i.push(T);else{i.push(M),i.push(T);continue}}a=!0}if(g==i.length)return l.length=0,!0;if(i.push(i[0]),i.push(i[1]),f==u)break;let v=i;i=h,i.length=0,h=v}if(l!=i){l.length=0;for(let f=0,m=i.length-2;f<m;f++)l[f]=i[f]}else l.length=l.length-2;return a}static makeClockwise(e){let t=e,s=e.length,r=t[s-2]*t[1]-t[0]*t[s-1],n=0,c=0,o=0,i=0;for(let l=0,a=s-3;l<a;l+=2)n=t[l],c=t[l+1],o=t[l+2],i=t[l+3],r+=n*i-o*c;if(!(r<0))for(let l=0,a=s-2,h=s>>1;l<h;l+=2){let u=t[l],d=t[l+1],f=a-l;t[l]=t[f],t[l+1]=t[f+1],t[f]=u,t[f+1]=d}}},Pi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Gt,r=typeof e=="string"?JSON.parse(e):e,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=C(n,"referenceScale",100)*t,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let c=0;c<r.bones.length;c++){let o=r.bones[c],i=null,l=C(o,"parent",null);l&&(i=s.findBone(l));let a=new Dt(s.bones.length,o.name,i);a.length=C(o,"length",0)*t,a.x=C(o,"x",0)*t,a.y=C(o,"y",0)*t,a.rotation=C(o,"rotation",0),a.scaleX=C(o,"scaleX",1),a.scaleY=C(o,"scaleY",1),a.shearX=C(o,"shearX",0),a.shearY=C(o,"shearY",0),a.inherit=E.enumValue(Ye,C(o,"inherit","Normal")),a.skinRequired=C(o,"skin",!1);let h=C(o,"color",null);h&&a.color.setFromString(h),s.bones.push(a)}if(r.slots)for(let c=0;c<r.slots.length;c++){let o=r.slots[c],i=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${i}`);let a=new $t(s.slots.length,i,l),h=C(o,"color",null);h&&a.color.setFromString(h);let u=C(o,"dark",null);u&&(a.darkColor=O.fromString(u)),a.attachmentName=C(o,"attachment",null),a.blendMode=E.enumValue(Je,C(o,"blend","normal")),a.visible=C(o,"visible",!0),s.slots.push(a)}if(r.ik)for(let c=0;c<r.ik.length;c++){let o=r.ik[c],i=new Ut(o.name);i.order=C(o,"order",0),i.skinRequired=C(o,"skin",!1);for(let a=0;a<o.bones.length;a++){let h=s.findBone(o.bones[a]);if(!h)throw new Error(`Couldn't find bone ${o.bones[a]} for IK constraint ${o.name}.`);i.bones.push(h)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);i.target=l,i.mix=C(o,"mix",1),i.softness=C(o,"softness",0)*t,i.bendDirection=C(o,"bendPositive",!0)?1:-1,i.compress=C(o,"compress",!1),i.stretch=C(o,"stretch",!1),i.uniform=C(o,"uniform",!1),s.ikConstraints.push(i)}if(r.transform)for(let c=0;c<r.transform.length;c++){let o=r.transform[c],i=new jt(o.name);i.order=C(o,"order",0),i.skinRequired=C(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let u=o.bones[h],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${o.name}.`);i.bones.push(d)}let l=o.target,a=s.findBone(l);if(!a)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);i.target=a,i.local=C(o,"local",!1),i.relative=C(o,"relative",!1),i.offsetRotation=C(o,"rotation",0),i.offsetX=C(o,"x",0)*t,i.offsetY=C(o,"y",0)*t,i.offsetScaleX=C(o,"scaleX",0),i.offsetScaleY=C(o,"scaleY",0),i.offsetShearY=C(o,"shearY",0),i.mixRotate=C(o,"mixRotate",1),i.mixX=C(o,"mixX",1),i.mixY=C(o,"mixY",i.mixX),i.mixScaleX=C(o,"mixScaleX",1),i.mixScaleY=C(o,"mixScaleY",i.mixScaleX),i.mixShearY=C(o,"mixShearY",1),s.transformConstraints.push(i)}if(r.path)for(let c=0;c<r.path.length;c++){let o=r.path[c],i=new Wt(o.name);i.order=C(o,"order",0),i.skinRequired=C(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let u=o.bones[h],d=s.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${o.name}.`);i.bones.push(d)}let l=o.target,a=s.findSlot(l);if(!a)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);i.target=a,i.positionMode=E.enumValue(ze,C(o,"positionMode","Percent")),i.spacingMode=E.enumValue(Ge,C(o,"spacingMode","Length")),i.rotateMode=E.enumValue(He,C(o,"rotateMode","Tangent")),i.offsetRotation=C(o,"rotation",0),i.position=C(o,"position",0),i.positionMode==0&&(i.position*=t),i.spacing=C(o,"spacing",0),(i.spacingMode==0||i.spacingMode==1)&&(i.spacing*=t),i.mixRotate=C(o,"mixRotate",1),i.mixX=C(o,"mixX",1),i.mixY=C(o,"mixY",i.mixX),s.pathConstraints.push(i)}if(r.physics)for(let c=0;c<r.physics.length;c++){const o=r.physics[c],i=new Ms(o.name);i.order=C(o,"order",0),i.skinRequired=C(o,"skin",!1);const l=o.bone,a=s.findBone(l);if(a==null)throw new Error("Physics bone not found: "+l);i.bone=a,i.x=C(o,"x",0),i.y=C(o,"y",0),i.rotate=C(o,"rotate",0),i.scaleX=C(o,"scaleX",0),i.shearX=C(o,"shearX",0),i.limit=C(o,"limit",5e3)*t,i.step=1/C(o,"fps",60),i.inertia=C(o,"inertia",1),i.strength=C(o,"strength",100),i.damping=C(o,"damping",1),i.massInverse=1/C(o,"mass",1),i.wind=C(o,"wind",0),i.gravity=C(o,"gravity",0),i.mix=C(o,"mix",1),i.inertiaGlobal=C(o,"inertiaGlobal",!1),i.strengthGlobal=C(o,"strengthGlobal",!1),i.dampingGlobal=C(o,"dampingGlobal",!1),i.massGlobal=C(o,"massGlobal",!1),i.windGlobal=C(o,"windGlobal",!1),i.gravityGlobal=C(o,"gravityGlobal",!1),i.mixGlobal=C(o,"mixGlobal",!1),s.physicsConstraints.push(i)}if(r.skins)for(let c=0;c<r.skins.length;c++){let o=r.skins[c],i=new je(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let a=o.bones[l],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${o.name}.`);i.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){let a=o.ik[l],h=s.findIkConstraint(a);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${o.name}.`);i.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){let a=o.transform[l],h=s.findTransformConstraint(a);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${o.name}.`);i.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){let a=o.path[l],h=s.findPathConstraint(a);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${o.name}.`);i.constraints.push(h)}if(o.physics)for(let l=0;l<o.physics.length;l++){let a=o.physics[l],h=s.findPhysicsConstraint(a);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${o.name}.`);i.constraints.push(h)}for(let l in o.attachments){let a=s.findSlot(l);if(!a)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let h=o.attachments[l];for(let u in h){let d=this.readAttachment(h[u],i,a.index,u,s);d&&i.setAttachment(a.index,u,d)}}s.skins.push(i),i.name=="default"&&(s.defaultSkin=i)}for(let c=0,o=this.linkedMeshes.length;c<o;c++){let i=this.linkedMeshes[c],l=i.skin?s.findSkin(i.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${i.skin}`);let a=l.getAttachment(i.slotIndex,i.parent);if(!a)throw new Error(`Parent mesh not found: ${i.parent}`);i.mesh.timelineAttachment=i.inheritTimeline?a:i.mesh,i.mesh.setParentMesh(a),i.mesh.region!=null&&i.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let c in r.events){let o=r.events[c],i=new qt(c);i.intValue=C(o,"int",0),i.floatValue=C(o,"float",0),i.stringValue=C(o,"string",""),i.audioPath=C(o,"audio",null),i.audioPath&&(i.volume=C(o,"volume",1),i.balance=C(o,"balance",0)),s.events.push(i)}if(r.animations)for(let c in r.animations){let o=r.animations[c];this.readAnimation(o,c,s)}return s}readAttachment(e,t,s,r,n){let c=this.scale;switch(r=C(e,"name",r),C(e,"type","region")){case"region":{let o=C(e,"path",r),i=this.readSequence(C(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,r,o,i);if(!l)return null;l.path=o,l.x=C(e,"x",0)*c,l.y=C(e,"y",0)*c,l.scaleX=C(e,"scaleX",1),l.scaleY=C(e,"scaleY",1),l.rotation=C(e,"rotation",0),l.width=e.width*c,l.height=e.height*c,l.sequence=i;let a=C(e,"color",null);return a&&l.color.setFromString(a),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let i=C(e,"color",null);return i&&o.color.setFromString(i),o}case"mesh":case"linkedmesh":{let o=C(e,"path",r),i=this.readSequence(C(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,r,o,i);if(!l)return null;l.path=o;let a=C(e,"color",null);a&&l.color.setFromString(a),l.width=C(e,"width",0)*c,l.height=C(e,"height",0)*c,l.sequence=i;let h=C(e,"parent",null);if(h)return this.linkedMeshes.push(new Bi(l,C(e,"skin",null),s,h,C(e,"timelines",!0))),l;let u=e.uvs;return this.readVertices(e,l,u.length),l.triangles=e.triangles,l.regionUVs=u,l.region!=null&&l.updateRegion(),l.edges=C(e,"edges",null),l.hullLength=C(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=C(e,"closed",!1),o.constantSpeed=C(e,"constantSpeed",!0);let i=e.vertexCount;this.readVertices(e,o,i<<1);let l=E.newArray(i/3,0);for(let h=0;h<e.lengths.length;h++)l[h]=e.lengths[h]*c;o.lengths=l;let a=C(e,"color",null);return a&&o.color.setFromString(a),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=C(e,"x",0)*c,o.y=C(e,"y",0)*c,o.rotation=C(e,"rotation",0);let i=C(e,"color",null);return i&&o.color.setFromString(i),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let i=C(e,"end",null);i&&(o.endSlot=n.findSlot(i));let l=e.vertexCount;this.readVertices(e,o,l<<1);let a=C(e,"color",null);return a&&o.color.setFromString(a),o}}return null}readSequence(e){if(e==null)return null;let t=new it(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 r=this.scale;t.worldVerticesLength=s;let n=e.vertices;if(s==n.length){let i=E.toFloatArray(n);if(r!=1)for(let l=0,a=n.length;l<a;l++)i[l]*=r;t.vertices=i;return}let c=new Array,o=new Array;for(let i=0,l=n.length;i<l;){let a=n[i++];o.push(a);for(let h=i+a*4;i<h;i+=4)o.push(n[i]),c.push(n[i+1]*r),c.push(n[i+2]*r),c.push(n[i+3])}t.bones=o,t.vertices=E.toFloatArray(c)}readAnimation(e,t,s){let r=this.scale,n=new Array;if(e.slots)for(let o in e.slots){let i=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let a=l.index;for(let h in i){let u=i[h];if(!u)continue;let d=u.length;if(h=="attachment"){let f=new pe(d,a);for(let m=0;m<d;m++){let x=u[m];f.setFrame(m,C(x,"time",0),C(x,"name",null))}n.push(f)}else if(h=="rgba"){let f=new mt(d,d<<2,a),m=u[0],x=C(m,"time",0),w=O.fromString(m.color);for(let p=0,g=0;;p++){f.setFrame(p,x,w.r,w.g,w.b,w.a);let b=u[p+1];if(!b){f.shrink(g);break}let v=C(b,"time",0),y=O.fromString(b.color),S=m.curve;S&&(g=G(S,f,g,p,0,x,v,w.r,y.r,1),g=G(S,f,g,p,1,x,v,w.g,y.g,1),g=G(S,f,g,p,2,x,v,w.b,y.b,1),g=G(S,f,g,p,3,x,v,w.a,y.a,1)),x=v,w=y,m=b}n.push(f)}else if(h=="rgb"){let f=new gt(d,d*3,a),m=u[0],x=C(m,"time",0),w=O.fromString(m.color);for(let p=0,g=0;;p++){f.setFrame(p,x,w.r,w.g,w.b);let b=u[p+1];if(!b){f.shrink(g);break}let v=C(b,"time",0),y=O.fromString(b.color),S=m.curve;S&&(g=G(S,f,g,p,0,x,v,w.r,y.r,1),g=G(S,f,g,p,1,x,v,w.g,y.g,1),g=G(S,f,g,p,2,x,v,w.b,y.b,1)),x=v,w=y,m=b}n.push(f)}else if(h=="alpha")n.push(he(u,new xt(d,d,a),0,1));else if(h=="rgba2"){let f=new bt(d,d*7,a),m=u[0],x=C(m,"time",0),w=O.fromString(m.light),p=O.fromString(m.dark);for(let g=0,b=0;;g++){f.setFrame(g,x,w.r,w.g,w.b,w.a,p.r,p.g,p.b);let v=u[g+1];if(!v){f.shrink(b);break}let y=C(v,"time",0),S=O.fromString(v.light),A=O.fromString(v.dark),k=m.curve;k&&(b=G(k,f,b,g,0,x,y,w.r,S.r,1),b=G(k,f,b,g,1,x,y,w.g,S.g,1),b=G(k,f,b,g,2,x,y,w.b,S.b,1),b=G(k,f,b,g,3,x,y,w.a,S.a,1),b=G(k,f,b,g,4,x,y,p.r,A.r,1),b=G(k,f,b,g,5,x,y,p.g,A.g,1),b=G(k,f,b,g,6,x,y,p.b,A.b,1)),x=y,w=S,p=A,m=v}n.push(f)}else if(h=="rgb2"){let f=new pt(d,d*6,a),m=u[0],x=C(m,"time",0),w=O.fromString(m.light),p=O.fromString(m.dark);for(let g=0,b=0;;g++){f.setFrame(g,x,w.r,w.g,w.b,p.r,p.g,p.b);let v=u[g+1];if(!v){f.shrink(b);break}let y=C(v,"time",0),S=O.fromString(v.light),A=O.fromString(v.dark),k=m.curve;k&&(b=G(k,f,b,g,0,x,y,w.r,S.r,1),b=G(k,f,b,g,1,x,y,w.g,S.g,1),b=G(k,f,b,g,2,x,y,w.b,S.b,1),b=G(k,f,b,g,3,x,y,p.r,A.r,1),b=G(k,f,b,g,4,x,y,p.g,A.g,1),b=G(k,f,b,g,5,x,y,p.b,A.b,1)),x=y,w=S,p=A,m=v}n.push(f)}}}if(e.bones)for(let o in e.bones){let i=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let a=l.index;for(let h in i){let u=i[h],d=u.length;if(d!=0){if(h==="rotate")n.push(he(u,new Te(d,d,a),0,1));else if(h==="translate"){let f=new rt(d,d<<1,a);n.push(Qt(u,f,"x","y",0,r))}else if(h==="translatex"){let f=new nt(d,d,a);n.push(he(u,f,0,r))}else if(h==="translatey"){let f=new at(d,d,a);n.push(he(u,f,0,r))}else if(h==="scale"){let f=new lt(d,d<<1,a);n.push(Qt(u,f,"x","y",1,1))}else if(h==="scalex"){let f=new ot(d,d,a);n.push(he(u,f,1,1))}else if(h==="scaley"){let f=new ht(d,d,a);n.push(he(u,f,1,1))}else if(h==="shear"){let f=new ct(d,d<<1,a);n.push(Qt(u,f,"x","y",0,1))}else if(h==="shearx"){let f=new dt(d,d,a);n.push(he(u,f,0,1))}else if(h==="sheary"){let f=new ft(d,d,a);n.push(he(u,f,0,1))}else if(h==="inherit"){let f=new ut(d,l.index);for(let m=0;m<u.length;m++){let x=u[m];f.setFrame(m,C(x,"time",0),E.enumValue(Ye,C(x,"inherit","Normal")))}n.push(f)}}}}if(e.ik)for(let o in e.ik){let i=e.ik[o],l=i[0];if(!l)continue;let a=s.findIkConstraint(o);if(!a)throw new Error("IK Constraint not found: "+o);let h=s.ikConstraints.indexOf(a),u=new yt(i.length,i.length<<1,h),d=C(l,"time",0),f=C(l,"mix",1),m=C(l,"softness",0)*r;for(let x=0,w=0;;x++){u.setFrame(x,d,f,m,C(l,"bendPositive",!0)?1:-1,C(l,"compress",!1),C(l,"stretch",!1));let p=i[x+1];if(!p){u.shrink(w);break}let g=C(p,"time",0),b=C(p,"mix",1),v=C(p,"softness",0)*r,y=l.curve;y&&(w=G(y,u,w,x,0,d,g,f,b,1),w=G(y,u,w,x,1,d,g,m,v,r)),d=g,f=b,m=v,l=p}n.push(u)}if(e.transform)for(let o in e.transform){let i=e.transform[o],l=i[0];if(!l)continue;let a=s.findTransformConstraint(o);if(!a)throw new Error("Transform constraint not found: "+o);let h=s.transformConstraints.indexOf(a),u=new vt(i.length,i.length*6,h),d=C(l,"time",0),f=C(l,"mixRotate",1),m=C(l,"mixX",1),x=C(l,"mixY",m),w=C(l,"mixScaleX",1),p=C(l,"mixScaleY",w),g=C(l,"mixShearY",1);for(let b=0,v=0;;b++){u.setFrame(b,d,f,m,x,w,p,g);let y=i[b+1];if(!y){u.shrink(v);break}let S=C(y,"time",0),A=C(y,"mixRotate",1),k=C(y,"mixX",1),M=C(y,"mixY",k),T=C(y,"mixScaleX",1),R=C(y,"mixScaleY",T),X=C(y,"mixShearY",1),I=l.curve;I&&(v=G(I,u,v,b,0,d,S,f,A,1),v=G(I,u,v,b,1,d,S,m,k,1),v=G(I,u,v,b,2,d,S,x,M,1),v=G(I,u,v,b,3,d,S,w,T,1),v=G(I,u,v,b,4,d,S,p,R,1),v=G(I,u,v,b,5,d,S,g,X,1)),d=S,f=A,m=k,x=M,w=T,p=R,w=T,l=y}n.push(u)}if(e.path)for(let o in e.path){let i=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let a=s.pathConstraints.indexOf(l);for(let h in i){let u=i[h],d=u[0];if(!d)continue;let f=u.length;if(h==="position"){let m=new St(f,f,a);n.push(he(u,m,0,l.positionMode==0?r:1))}else if(h==="spacing"){let m=new At(f,f,a);n.push(he(u,m,0,l.spacingMode==0||l.spacingMode==1?r:1))}else if(h==="mix"){let m=new Ct(f,f*3,a),x=C(d,"time",0),w=C(d,"mixRotate",1),p=C(d,"mixX",1),g=C(d,"mixY",p);for(let b=0,v=0;;b++){m.setFrame(b,x,w,p,g);let y=u[b+1];if(!y){m.shrink(v);break}let S=C(y,"time",0),A=C(y,"mixRotate",1),k=C(y,"mixX",1),M=C(y,"mixY",k),T=d.curve;T&&(v=G(T,m,v,b,0,x,S,w,A,1),v=G(T,m,v,b,1,x,S,p,k,1),v=G(T,m,v,b,2,x,S,g,M,1)),x=S,w=A,p=k,g=M,d=y}n.push(m)}}}if(e.physics)for(let o in e.physics){let i=e.physics[o],l=-1;if(o.length>0){let a=s.findPhysicsConstraint(o);if(!a)throw new Error("Physics constraint not found: "+o);l=s.physicsConstraints.indexOf(a)}for(let a in i){let h=i[a],u=h[0];if(!u)continue;let d=h.length;if(a=="reset"){const m=new De(d,l);for(let x=0;u!=null;u=h[x+1],x++)m.setFrame(x,C(u,"time",0));n.push(m);continue}let f;if(a=="inertia")f=new It(d,d,l);else if(a=="strength")f=new kt(d,d,l);else if(a=="damping")f=new Tt(d,d,l);else if(a=="mass")f=new Mt(d,d,l);else if(a=="wind")f=new Yt(d,d,l);else if(a=="gravity")f=new Xt(d,d,l);else if(a=="mix")f=new Ft(d,d,l);else continue;n.push(he(h,f,0,1))}}if(e.attachments)for(let o in e.attachments){let i=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let a in i){let h=i[a],u=s.findSlot(a);if(!u)throw new Error("Slot not found: "+a);let d=u.index;for(let f in h){let m=h[f],x=l.getAttachment(d,f);for(let w in m){let p=m[w],g=p[0];if(g){if(w=="deform"){let b=x.bones,v=x.vertices,y=b?v.length/3*2:v.length,S=new wt(p.length,p.length,d,x),A=C(g,"time",0);for(let k=0,M=0;;k++){let T,R=C(g,"vertices",null);if(!R)T=b?E.newFloatArray(y):v;else{T=E.newFloatArray(y);let P=C(g,"offset",0);if(E.arrayCopy(R,0,T,P,R.length),r!=1)for(let N=P,q=N+R.length;N<q;N++)T[N]*=r;if(!b)for(let N=0;N<y;N++)T[N]+=v[N]}S.setFrame(k,A,T);let X=p[k+1];if(!X){S.shrink(M);break}let I=C(X,"time",0),Y=g.curve;Y&&(M=G(Y,S,M,k,0,A,I,0,1,1)),A=I,g=X}n.push(S)}else if(w=="sequence"){let b=new Se(p.length,d,x),v=0;for(let y=0;y<p.length;y++){let S=C(g,"delay",v),A=C(g,"time",0),k=as[C(g,"mode","hold")],M=C(g,"index",0);b.setFrame(y,A,k,M,S),v=S,g=p[y+1]}n.push(b)}}}}}}if(e.drawOrder){let o=new we(e.drawOrder.length),i=s.slots.length,l=0;for(let a=0;a<e.drawOrder.length;a++,l++){let h=e.drawOrder[a],u=null,d=C(h,"offsets",null);if(d){u=E.newArray(i,-1);let f=E.newArray(i-d.length,0),m=0,x=0;for(let w=0;w<d.length;w++){let p=d[w],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;m!=b;)f[x++]=m++;u[m+p.offset]=m++}for(;m<i;)f[x++]=m++;for(let w=i-1;w>=0;w--)u[w]==-1&&(u[w]=f[--x])}o.setFrame(l,C(h,"time",0),u)}n.push(o)}if(e.events){let o=new Me(e.events.length),i=0;for(let l=0;l<e.events.length;l++,i++){let a=e.events[l],h=s.findEvent(a.name);if(!h)throw new Error("Event not found: "+a.name);let u=new _t(E.toSinglePrecision(C(a,"time",0)),h);u.intValue=C(a,"int",h.intValue),u.floatValue=C(a,"float",h.floatValue),u.stringValue=C(a,"string",h.stringValue),u.data.audioPath&&(u.volume=C(a,"volume",1),u.balance=C(a,"balance",0)),o.setFrame(i,u)}n.push(o)}let c=0;for(let o=0,i=n.length;o<i;o++)c=Math.max(c,n[o].getDuration());s.animations.push(new Ve(t,n,c))}},Bi=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,n){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};function he(e,t,s,r){let n=e[0],c=C(n,"time",0),o=C(n,"value",s)*r,i=0;for(let l=0;;l++){t.setFrame(l,c,o);let a=e[l+1];if(!a)return t.shrink(i),t;let h=C(a,"time",0),u=C(a,"value",s)*r;n.curve&&(i=G(n.curve,t,i,l,0,c,h,o,u,r)),c=h,o=u,n=a}}function Qt(e,t,s,r,n,c){let o=e[0],i=C(o,"time",0),l=C(o,s,n)*c,a=C(o,r,n)*c,h=0;for(let u=0;;u++){t.setFrame(u,i,l,a);let d=e[u+1];if(!d)return t.shrink(h),t;let f=C(d,"time",0),m=C(d,s,n)*c,x=C(d,r,n)*c,w=o.curve;w&&(h=G(w,t,h,u,0,i,f,l,m,c),h=G(w,t,h,u,1,i,f,a,x,c)),i=f,l=m,a=x,o=d}}function G(e,t,s,r,n,c,o,i,l,a){if(e=="stepped")return t.setStepped(r),s;let h=n<<2,u=e[h],d=e[h+1]*a,f=e[h+2],m=e[h+3]*a;return t.setBezier(s,r,n,c,i,u,d,f,m,o,l),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 Xs=class extends Bt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Vi=class extends As{constructor(e="",t=new Ot){super(s=>new Xs(s),e,t)}},Li=E.newFloatArray(8),Ke=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=E.newFloatArray(8*1024);tempColor=new O;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let t=this.ctx,s=this.tempColor,r=e.color,n=e.drawOrder;this.debugRendering&&(t.strokeStyle="green");for(let c=0,o=n.length;c<o;c++){let i=n[c],l=i.bone;if(!l.active)continue;let a=i.getAttachment();if(!(a instanceof V))continue;a.computeWorldVertices(i,Li,0,2);let h=a.region,u=h.texture.getImage(),d=i.color,f=a.color;s.set(r.r*d.r*f.r,r.g*d.g*f.g,r.b*d.b*f.b,r.a*d.a*f.a),t.save(),t.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),t.translate(a.offset[0],a.offset[1]),t.rotate(a.rotation*Math.PI/180);let m=a.width/h.originalWidth;t.scale(m*a.scaleX,m*a.scaleY);let x=h.width,w=h.height;if(t.translate(x/2,w/2),a.region.degrees==90){let p=x;x=w,w=p,t.rotate(-Math.PI/2)}t.scale(1,-1),t.translate(-x/2,-w/2),t.globalAlpha=s.a,t.drawImage(u,u.width*h.u,u.height*h.v,x,w,0,0,x,w),this.debugRendering&&t.strokeRect(0,0,x,w),t.restore()}}drawTriangles(e){let t=this.ctx,s=this.tempColor,r=e.color,n=e.drawOrder,c=null,o=this.vertices,i=null;for(let a=0,h=n.length;a<h;a++){let u=n[a],d=u.getAttachment(),f,m;if(d instanceof V){let x=d;o=this.computeRegionVertices(u,x,!1),i=Ke.QUAD_TRIANGLES,f=x.region.texture.getImage()}else if(d instanceof ye){let x=d;o=this.computeMeshVertices(u,x,!1),i=x.triangles,f=x.region.texture.getImage()}else continue;if(f){u.data.blendMode!=c&&(c=u.data.blendMode);let x=u.color,w=d.color;s.set(r.r*x.r*w.r,r.g*x.g*w.g,r.b*x.b*w.b,r.a*x.a*w.a),t.globalAlpha=s.a;for(var l=0;l<i.length;l+=3){let p=i[l]*8,g=i[l+1]*8,b=i[l+2]*8,v=o[p],y=o[p+1],S=o[p+6],A=o[p+7],k=o[g],M=o[g+1],T=o[g+6],R=o[g+7],X=o[b],I=o[b+1],Y=o[b+6],P=o[b+7];this.drawTriangle(f,v,y,S,A,k,M,T,R,X,I,Y,P),this.debugRendering&&(t.strokeStyle="green",t.beginPath(),t.moveTo(v,y),t.lineTo(k,M),t.lineTo(X,I),t.lineTo(v,y),t.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,t,s,r,n,c,o,i,l,a,h,u,d){let f=this.ctx;const m=e.width-1,x=e.height-1;r*=m,n*=x,i*=m,l*=x,u*=m,d*=x,f.beginPath(),f.moveTo(t,s),f.lineTo(c,o),f.lineTo(a,h),f.closePath(),c-=t,o-=s,a-=t,h-=s,i-=r,l-=n,u-=r,d-=n;let w=i*d-u*l;if(w==0)return;w=1/w;const p=(d*c-l*a)*w,g=(d*o-l*h)*w,b=(i*a-u*c)*w,v=(i*h-u*o)*w,y=t-p*r-b*n,S=s-g*r-v*n;f.save(),f.transform(p,g,b,v,y,S),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,t,s){let r=e.bone.skeleton.color,n=e.color,c=t.color,o=r.a*n.a*c.a,i=s?o:1,l=this.tempColor;l.set(r.r*n.r*c.r*i,r.g*n.g*c.g*i,r.b*n.b*c.b*i,o),t.computeWorldVertices(e,this.vertices,0,Ke.VERTEX_SIZE);let a=this.vertices,h=t.uvs;return a[V.C1R]=l.r,a[V.C1G]=l.g,a[V.C1B]=l.b,a[V.C1A]=l.a,a[V.U1]=h[0],a[V.V1]=h[1],a[V.C2R]=l.r,a[V.C2G]=l.g,a[V.C2B]=l.b,a[V.C2A]=l.a,a[V.U2]=h[2],a[V.V2]=h[3],a[V.C3R]=l.r,a[V.C3G]=l.g,a[V.C3B]=l.b,a[V.C3A]=l.a,a[V.U3]=h[4],a[V.V3]=h[5],a[V.C4R]=l.r,a[V.C4G]=l.g,a[V.C4B]=l.b,a[V.C4A]=l.a,a[V.U4]=h[6],a[V.V4]=h[7],a}computeMeshVertices(e,t,s){let r=e.bone.skeleton.color,n=e.color,c=t.color,o=r.a*n.a*c.a,i=s?o:1,l=this.tempColor;l.set(r.r*n.r*c.r*i,r.g*n.g*c.g*i,r.b*n.b*c.b*i,o);let a=t.worldVerticesLength/2,h=this.vertices;h.length<t.worldVerticesLength&&(this.vertices=h=E.newFloatArray(t.worldVerticesLength)),t.computeWorldVertices(e,0,t.worldVerticesLength,h,0,Ke.VERTEX_SIZE);let u=t.uvs;for(let d=0,f=0,m=2;d<a;d++)h[m++]=l.r,h[m++]=l.g,h[m++]=l.b,h[m++]=l.a,h[m++]=u[f++],h[m++]=u[f++],m+=2;return h}},Zt=Ke;return B(Zt,"QUAD_TRIANGLES",[0,1,2,2,3,0]),B(Zt,"VERTEX_SIZE",8),qs(ss)})();
|
|
1
|
+
"use strict";var spine=(()=>{var Ue=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Ns=Object.getOwnPropertyNames,Os=Object.prototype.hasOwnProperty,qs=(e,t)=>{for(var s in t)Ue(e,s,{get:t[s],enumerable:!0})},Us=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ns(t))!Os.call(e,i)&&i!==s&&Ue(e,i,{get:()=>t[i],enumerable:!(r=Ds(t,i))||r.enumerable});return e},Ws=e=>Us(Ue({},"__esModule",{value:!0}),e),Kt={};qs(Kt,{AlphaTimeline:()=>it,Animation:()=>Me,AnimationState:()=>js,AnimationStateAdapter:()=>Js,AnimationStateData:()=>Ks,AssetManager:()=>Ni,AssetManagerBase:()=>ms,AtlasAttachmentLoader:()=>ei,Attachment:()=>ze,AttachmentTimeline:()=>me,BinaryInput:()=>As,BlendMode:()=>Ut,Bone:()=>Xt,BoneData:()=>Yt,BoundingBoxAttachment:()=>Ct,CURRENT:()=>hs,CanvasTexture:()=>Cs,ClippingAttachment:()=>It,Color:()=>D,ConstraintData:()=>Ce,CurveTimeline:()=>re,CurveTimeline1:()=>ie,CurveTimeline2:()=>Ye,DebugUtils:()=>Gs,DeformTimeline:()=>at,Downloader:()=>Ft,DrawOrderTimeline:()=>xe,Event:()=>Rt,EventData:()=>Et,EventQueue:()=>as,EventTimeline:()=>Xe,EventType:()=>ls,FIRST:()=>vt,FakeTexture:()=>Qs,HOLD_FIRST:()=>Re,HOLD_MIX:()=>os,HOLD_SUBSEQUENT:()=>At,IkConstraint:()=>gs,IkConstraintData:()=>Pt,IkConstraintTimeline:()=>lt,Inherit:()=>Pe,InheritTimeline:()=>et,IntSet:()=>zs,Interpolation:()=>Qt,MathUtils:()=>E,MeshAttachment:()=>Ae,MixBlend:()=>is,MixDirection:()=>rs,PathAttachment:()=>Se,PathConstraint:()=>xs,PathConstraintData:()=>Bt,PathConstraintMixTimeline:()=>dt,PathConstraintPositionTimeline:()=>ht,PathConstraintSpacingTimeline:()=>ct,Physics:()=>ys,PhysicsConstraintDampingTimeline:()=>mt,PhysicsConstraintGravityTimeline:()=>bt,PhysicsConstraintInertiaTimeline:()=>ft,PhysicsConstraintMassTimeline:()=>gt,PhysicsConstraintMixTimeline:()=>wt,PhysicsConstraintResetTimeline:()=>pt,PhysicsConstraintStrengthTimeline:()=>ut,PhysicsConstraintTimeline:()=>de,PhysicsConstraintWindTimeline:()=>xt,PointAttachment:()=>us,Pool:()=>ye,PositionMode:()=>Vt,Pow:()=>Zt,PowOut:()=>_s,RGB2Timeline:()=>nt,RGBA2Timeline:()=>rt,RGBATimeline:()=>tt,RGBTimeline:()=>st,RegionAttachment:()=>H,RotateMode:()=>Dt,RotateTimeline:()=>ve,SETUP:()=>St,SUBSEQUENT:()=>Fe,ScaleTimeline:()=>He,ScaleXTimeline:()=>je,ScaleYTimeline:()=>Je,SequenceTimeline:()=>yt,ShearTimeline:()=>Ke,ShearXTimeline:()=>Qe,ShearYTimeline:()=>Ze,Skeleton:()=>ps,SkeletonBinary:()=>si,SkeletonBounds:()=>Bi,SkeletonClipping:()=>Vi,SkeletonData:()=>Nt,SkeletonJson:()=>Li,SkeletonRenderer:()=>qi,Skin:()=>Be,SkinEntry:()=>Ot,Slot:()=>bs,SlotData:()=>qt,SpacingMode:()=>Lt,StringSet:()=>We,Texture:()=>Tt,TextureAtlas:()=>kt,TextureAtlasPage:()=>fs,TextureAtlasRegion:()=>Mt,TextureFilter:()=>Ee,TextureRegion:()=>ds,TextureWrap:()=>cs,TimeKeeper:()=>$s,Timeline:()=>j,TrackEntry:()=>ns,TransformConstraint:()=>ws,TransformConstraintData:()=>Wt,TransformConstraintTimeline:()=>ot,TranslateTimeline:()=>_e,TranslateXTimeline:()=>Ge,TranslateYTimeline:()=>$e,Triangulator:()=>Ss,Utils:()=>P,Vector2:()=>ke,VertexAttachment:()=>oe,WindowedMean:()=>Hs});var zs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},We=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;s<r;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},D=class ge{constructor(t=0,s=0,r=0,i=0){this.r=t,this.g=s,this.b=r,this.a=i}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,r,i){return this.r=t,this.g=s,this.b=r,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,r,i){return this.r+=t,this.g+=s,this.b+=r,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new ge){return s.setFromString(t)}},E=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,r){return t<s?s:t>r?r: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,r){let i=Math.random(),h=s-t;return i<=(r-t)/h?t+Math.sqrt(i*h*(r-t)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},Qt=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},Zt=class extends Qt{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}},_s=class extends Zt{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},P=class pe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,h){for(let o=s,n=i;o<s+h;o++,n++)r[n]=t[o]}static arrayFill(t,s,r,i){for(let h=s;h<r;h++)t[h]=i}static setArraySize(t,s,r=0){let i=t.length;if(i==s)return t;if(t.length=s,i<s)for(let h=i;h<s;h++)t[h]=r;return t}static ensureArrayCapacity(t,s,r=0){return t.length>=s?t:pe.setArraySize(t,s,r)}static newArray(t,s){let r=new Array(t);for(let i=0;i<t;i++)r[i]=s;return r}static newFloatArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static newShortArray(t){if(pe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let r=0;r<s.length;r++)s[r]=0;return s}}static toFloatArray(t){return pe.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return pe.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,r=!0){for(var i=0;i<t.length;i++)if(t[i]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Gs=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}},$s=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)}},Hs=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}},ze=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},oe=class Ys extends ze{static nextID=0;id=Ys.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,r,i,h,o){r=h+(r>>1)*o;let n=t.bone.skeleton,a=t.deform,l=this.vertices,c=this.bones;if(!c){a.length>0&&(l=a);let u=t.bone,x=u.worldX,w=u.worldY,p=u.a,g=u.b,b=u.c,y=u.d;for(let v=s,A=h;A<r;v+=2,A+=o){let S=l[v],I=l[v+1];i[A]=S*p+I*g+x,i[A+1]=S*b+I*y+w}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=n.bones;if(a.length==0)for(let u=h,x=f*3;u<r;u+=o){let w=0,p=0,g=c[d++];for(g+=d;d<g;d++,x+=3){let b=m[c[d]],y=l[x],v=l[x+1],A=l[x+2];w+=(y*b.a+v*b.b+b.worldX)*A,p+=(y*b.c+v*b.d+b.worldY)*A}i[u]=w,i[u+1]=p}else{let u=a;for(let x=h,w=f*3,p=f<<1;x<r;x+=o){let g=0,b=0,y=c[d++];for(y+=d;d<y;d++,w+=3,p+=2){let v=m[c[d]],A=l[w]+u[p],S=l[w+1]+u[p+1],I=l[w+2];g+=(A*v.a+S*v.b+v.worldX)*I,b+=(A*v.c+S*v.d+v.worldY)*I}i[x]=g,i[x+1]=b}}}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}},es=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 r=t.sequenceIndex;r==-1&&(r=this.setupIndex),r>=this.regions.length&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(t,s){let r=t,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return Ne._nextID++}},ts=(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))(ts||{}),ss=[0,1,2,3,4,5,6],Me=class{name;timelines=[];timelineIds=new We;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,r,i,h,o,n){if(!e)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l<c;l++)a[l].apply(e,t,s,i,h,o,n)}},is=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(is||{}),rs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(rs||{}),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 r=1;r<s;r++)if(e[r]>t)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let i=s;i<r;i+=s)if(e[i]>t)return i-s;return r-s}},re=class extends 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,r,i,h,o,n,a,l,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(r-h*2+n)*.03,u=(i-o*2+a)*.03,x=((h-n)*3-r+l)*.006,w=((o-a)*3-i+c)*.006,p=m*2+x,g=u*2+w,b=(h-r)*.3+m+x*.16666667,y=(o-i)*.3+u+w*.16666667,v=r+b,A=i+y;for(let S=f+18;f<S;f+=2)d[f]=v,d[f+1]=A,b+=p,y+=g,p+=x,g+=w,v+=b,A+=y}getBezierValue(e,t,s,r){let i=this.curves;if(i[r]>e){let a=this.frames[t],l=this.frames[t+s];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}let h=r+18;for(r+=2;r<h;r+=2)if(i[r]>=e){let a=i[r-2],l=i[r-1];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}t+=this.getFrameEntries();let o=i[h-2],n=i[h-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},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 i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=t[s],h=t[s+1];return h+(e-i)/(t[s+2]-i)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let h=this.getCurveValue(e);switch(s){case 0:return i+h*t;case 1:case 2:h+=i-r}return r+h*t}getAbsoluteValue(e,t,s,r,i){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}let h=this.getCurveValue(e);return s==0?i+(h-i)*t:r+(h-r)*t}getAbsoluteValue2(e,t,s,r,i,h){if(e<this.frames[0]){switch(s){case 0:return i;case 1:return r+(i-r)*t}return r}return s==0?i+(h-i)*t:r+(h-r)*t}getScaleValue(e,t,s,r,i,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return i+(h-i)*t}return i}let n=this.getCurveValue(e)*h;if(t==1)return s==3?i+n-h:n;if(r==1)switch(s){case 0:return h+(Math.abs(n)*E.signum(h)-h)*t;case 1:case 2:return i+(Math.abs(n)*E.signum(i)-i)*t}else{let a=0;switch(s){case 0:return a=Math.abs(h)*E.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(i)*E.signum(n),a+(n-a)*t}}return i+(n-h)*t}},Ye=class extends re{constructor(e,t,s,r){super(e,t,[s,r])}getFrameEntries(){return 3}setFrame(e,t,s,r){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r}},ve=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,i,h,n.rotation,n.data.rotation))}},_e=class extends Ye{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*i,n.y+=(n.data.y-n.y)*i}return}let l=0,c=0,d=j.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];l=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*u,c+=(a[d+3+2]-c)*u;break;case 1:l=a[d+1],c=a[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:n.x=n.data.x+l*i,n.y=n.data.y+c*i;break;case 1:case 2:n.x+=(n.data.x+l-n.x)*i,n.y+=(n.data.y+c-n.y)*i;break;case 3:n.x+=l*i,n.y+=c*i}}},Ge=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.x+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,i,h,n.x,n.data.x))}},$e=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.y+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,i,h,n.y,n.data.y))}},He=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,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*i,n.scaleY+=(n.data.scaleY-n.scaleY)*i}return}let l,c,d=j.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];l=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*u,c+=(a[d+3+2]-c)*u;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(l*=n.data.scaleX,c*=n.data.scaleY,i==1)h==3?(n.scaleX+=l-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=l,n.scaleY=c);else{let m=0,u=0;if(o==1)switch(h){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,n.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(l)*E.signum(m)-m)*i,n.scaleY=u+(Math.abs(c)*E.signum(u)-u)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}else switch(h){case 0:m=Math.abs(n.data.scaleX)*E.signum(l),u=Math.abs(n.data.scaleY)*E.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=u+(c-u)*i;break;case 1:case 2:m=Math.abs(n.scaleX)*E.signum(l),u=Math.abs(n.scaleY)*E.signum(c),n.scaleX=m+(l-m)*i,n.scaleY=u+(c-u)*i;break;case 3:n.scaleX+=(l-n.data.scaleX)*i,n.scaleY+=(c-n.data.scaleY)*i}}}},je=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,i,h,o,n.scaleX,n.data.scaleX))}},Je=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,i,h,o,n.scaleY,n.data.scaleY))}},Ke=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,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*i,n.shearY+=(n.data.shearY-n.shearY)*i}return}let l=0,c=0,d=j.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];l=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*u,c+=(a[d+3+2]-c)*u;break;case 1:l=a[d+1],c=a[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:n.shearX=n.data.shearX+l*i,n.shearY=n.data.shearY+c*i;break;case 1:case 2:n.shearX+=(n.data.shearX+l-n.shearX)*i,n.shearY+=(n.data.shearY+c-n.shearY)*i;break;case 3:n.shearX+=l*i,n.shearY+=c*i}}},Qe=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,i,h,n.shearX,n.data.shearX))}},Ze=class extends ie{boneIndex=0;constructor(e,t,s){super(e,t,N.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,r,i,h,o){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,i,h,n.shearY,n.data.shearY))}},et=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,r,i,h,o){let n=e.bones[this.boneIndex];if(!n.active)return;if(o==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[j.search(a,s,2)+1]}},tt=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,r,i,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let w=n.data.color;switch(h){case 0:l.setFromColor(w);return;case 1:l.add((w.r-l.r)*i,(w.g-l.g)*i,(w.b-l.b)*i,(w.a-l.a)*i)}return}let c=0,d=0,f=0,m=0,u=j.search(a,s,5),x=this.curves[u/5];switch(x){case 0:let w=a[u];c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];let p=(s-w)/(a[u+5]-w);c+=(a[u+5+1]-c)*p,d+=(a[u+5+2]-d)*p,f+=(a[u+5+3]-f)*p,m+=(a[u+5+4]-m)*p;break;case 1:c=a[u+1],d=a[u+2],f=a[u+3],m=a[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)}i==1?l.set(c,d,f,m):(h==0&&l.setFromColor(n.data.color),l.add((c-l.r)*i,(d-l.g)*i,(f-l.b)*i,(m-l.a)*i))}},st=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,r,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let x=n.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)*i,l.g+=(x.g-l.g)*i,l.b+=(x.b-l.b)*i}return}let c=0,d=0,f=0,m=j.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let x=a[m];c=a[m+1],d=a[m+2],f=a[m+3];let w=(s-x)/(a[m+4]-x);c+=(a[m+4+1]-c)*w,d+=(a[m+4+2]-d)*w,f+=(a[m+4+3]-f)*w;break;case 1:c=a[m+1],d=a[m+2],f=a[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(i==1)l.r=c,l.g=d,l.b=f;else{if(h==0){let x=n.data.color;l.r=x.r,l.g=x.g,l.b=x.b}l.r+=(c-l.r)*i,l.g+=(d-l.g)*i,l.b+=(f-l.b)*i}}},it=class extends ie{slotIndex=0;constructor(e,t,s){super(e,t,N.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*i}return}let l=this.getCurveValue(s);i==1?a.a=l:(h==0&&(a.a=n.data.color.a),a.a+=(l-a.a)*i)}},rt=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,r,i,h,o,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*i,(y.g-l.g)*i,(y.b-l.b)*i,(y.a-l.a)*i),c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let d=0,f=0,m=0,u=0,x=0,w=0,p=0,g=j.search(a,s,8),b=this.curves[g>>3];switch(b){case 0:let y=a[g];d=a[g+1],f=a[g+2],m=a[g+3],u=a[g+4],x=a[g+5],w=a[g+6],p=a[g+7];let v=(s-y)/(a[g+8]-y);d+=(a[g+8+1]-d)*v,f+=(a[g+8+2]-f)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,x+=(a[g+8+5]-x)*v,w+=(a[g+8+6]-w)*v,p+=(a[g+8+7]-p)*v;break;case 1:d=a[g+1],f=a[g+2],m=a[g+3],u=a[g+4],x=a[g+5],w=a[g+6],p=a[g+7];break;default:d=this.getBezierValue(s,g,1,b-2),f=this.getBezierValue(s,g,2,b+18-2),m=this.getBezierValue(s,g,3,b+18*2-2),u=this.getBezierValue(s,g,4,b+18*3-2),x=this.getBezierValue(s,g,5,b+18*4-2),w=this.getBezierValue(s,g,6,b+18*5-2),p=this.getBezierValue(s,g,7,b+18*6-2)}if(i==1)l.set(d,f,m,u),c.r=x,c.g=w,c.b=p;else{if(h==0){l.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*i,(f-l.g)*i,(m-l.b)*i,(u-l.a)*i),c.r+=(x-c.r)*i,c.g+=(w-c.g)*i,c.b+=(p-c.b)*i}}},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,r,i,h,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*i,l.g+=(y.g-l.g)*i,l.b+=(y.b-l.b)*i,c.r+=(v.r-c.r)*i,c.g+=(v.g-c.g)*i,c.b+=(v.b-c.b)*i}return}let d=0,f=0,m=0,u=0,x=0,w=0,p=0,g=j.search(a,s,7),b=this.curves[g/7];switch(b){case 0:let y=a[g];d=a[g+1],f=a[g+2],m=a[g+3],x=a[g+4],w=a[g+5],p=a[g+6];let v=(s-y)/(a[g+7]-y);d+=(a[g+7+1]-d)*v,f+=(a[g+7+2]-f)*v,m+=(a[g+7+3]-m)*v,x+=(a[g+7+4]-x)*v,w+=(a[g+7+5]-w)*v,p+=(a[g+7+6]-p)*v;break;case 1:d=a[g+1],f=a[g+2],m=a[g+3],x=a[g+4],w=a[g+5],p=a[g+6];break;default:d=this.getBezierValue(s,g,1,b-2),f=this.getBezierValue(s,g,2,b+18-2),m=this.getBezierValue(s,g,3,b+18*2-2),x=this.getBezierValue(s,g,4,b+18*3-2),w=this.getBezierValue(s,g,5,b+18*4-2),p=this.getBezierValue(s,g,6,b+18*5-2)}if(i==1)l.r=d,l.g=f,l.b=m,c.r=x,c.g=w,c.b=p;else{if(h==0){let y=n.data.color,v=n.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(d-l.r)*i,l.g+=(f-l.g)*i,l.b+=(m-l.b)*i,c.r+=(x-c.r)*i,c.g+=(w-c.g)*i,c.b+=(p-c.b)*i}}},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,r,i,h,o){let n=e.slots[this.slotIndex];if(n.bone.active){if(o==1){h==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[j.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},at=class extends re{slotIndex=0;attachment;vertices;constructor(e,t,s,r){super(e,t,[N.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,r,i,h,o,n,a,l,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(r-h*2+n)*.03,u=a*.03-o*.06,x=((h-n)*3-r+l)*.006,w=(o-a+.33333333)*.018,p=m*2+x,g=u*2+w,b=(h-r)*.3+m+x*.16666667,y=o*.3+u+w*.16666667,v=r+b,A=y;for(let S=f+18;f<S;f+=2)d[f]=v,d[f+1]=A,b+=p,y+=g,p+=x,g+=w,v+=b,A+=y}getCurvePercent(e,t){let s=this.curves,r=s[t];switch(r){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,s[r]>e){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let h=s[i-2],o=s[i-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof oe)||a.timelineAttachment!=this.attachment)return;let l=n.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(i==1){l.length=0;return}l.length=d;let g=a;if(g.bones){i=1-i;for(var m=0;m<d;m++)l[m]*=i}else{let b=g.vertices;for(var m=0;m<d;m++)l[m]+=(b[m]-l[m])*i}}return}if(l.length=d,s>=f[f.length-1]){let g=c[f.length-1];if(i==1)if(h==3){let b=a;if(b.bones)for(let y=0;y<d;y++)l[y]+=g[y];else{let y=b.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=a;if(y.bones)for(let v=0;v<d;v++)l[v]=g[v]*i;else{let v=y.vertices;for(let A=0;A<d;A++){let S=v[A];l[A]=S+(g[A]-S)*i}}break}case 1:case 2:for(let y=0;y<d;y++)l[y]+=(g[y]-l[y])*i;break;case 3:let b=a;if(b.bones)for(let y=0;y<d;y++)l[y]+=g[y]*i;else{let y=b.vertices;for(let v=0;v<d;v++)l[v]+=(g[v]-y[v])*i}}return}let u=j.search1(f,s),x=this.getCurvePercent(s,u),w=c[u],p=c[u+1];if(i==1)if(h==3){let g=a;if(g.bones)for(let b=0;b<d;b++){let y=w[b];l[b]+=y+(p[b]-y)*x}else{let b=g.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=v+(p[y]-v)*x-b[y]}}}else for(let g=0;g<d;g++){let b=w[g];l[g]=b+(p[g]-b)*x}else switch(h){case 0:{let b=a;if(b.bones)for(let y=0;y<d;y++){let v=w[y];l[y]=(v+(p[y]-v)*x)*i}else{let y=b.vertices;for(let v=0;v<d;v++){let A=w[v],S=y[v];l[v]=S+(A+(p[v]-A)*x-S)*i}}break}case 1:case 2:for(let b=0;b<d;b++){let y=w[b];l[b]+=(y+(p[b]-y)*x-l[b])*i}break;case 3:let g=a;if(g.bones)for(let b=0;b<d;b++){let y=w[b];l[b]+=(y+(p[b]-y)*x)*i}else{let b=g.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=(v+(p[y]-v)*x-b[y])*i}}}}},Xe=class Xs extends j{static propertyIds=[""+N.event];events;constructor(t){super(t,Xs.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,r,i,h,o,n){if(!i)return;let a=this.frames,l=this.frames.length;if(s>r)this.apply(t,s,Number.MAX_VALUE,i,h,o,n),s=-1;else if(s>=a[l-1])return;if(r<a[0])return;let c=0;if(s<a[0])c=0;else{c=j.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<l&&r>=a[c];c++)i.push(this.events[c])}},xe=class Fs extends j{static propertyIds=[""+N.drawOrder];drawOrders;constructor(t){super(t,Fs.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,r){this.frames[t]=s,this.drawOrders[t]=r}apply(t,s,r,i,h,o,n){if(n==1){o==0&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r<this.frames[0]){(o==0||o==1)&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=j.search1(this.frames,r),l=this.drawOrders[a];if(!l)P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,d=t.slots;for(let f=0,m=l.length;f<m;f++)c[f]=d[l[f]]}}},lt=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,r,i,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,r,i,h,o){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*i,n.softness+=(n.data.softness-n.softness)*i,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let l=0,c=0,d=j.search(a,s,6),f=this.curves[d/6];switch(f){case 0:let m=a[d];l=a[d+1],c=a[d+2];let u=(s-m)/(a[d+6]-m);l+=(a[d+6+1]-l)*u,c+=(a[d+6+2]-c)*u;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}h==0?(n.mix=n.data.mix+(l-n.data.mix)*i,n.softness=n.data.softness+(c-n.data.softness)*i,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(l-n.mix)*i,n.softness+=(c-n.softness)*i,o==0&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},ot=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,r,i,h,o,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=r,a[e+3]=i,a[e+4]=h,a[e+5]=o,a[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let p=n.data;switch(h){case 0:n.mixRotate=p.mixRotate,n.mixX=p.mixX,n.mixY=p.mixY,n.mixScaleX=p.mixScaleX,n.mixScaleY=p.mixScaleY,n.mixShearY=p.mixShearY;return;case 1:n.mixRotate+=(p.mixRotate-n.mixRotate)*i,n.mixX+=(p.mixX-n.mixX)*i,n.mixY+=(p.mixY-n.mixY)*i,n.mixScaleX+=(p.mixScaleX-n.mixScaleX)*i,n.mixScaleY+=(p.mixScaleY-n.mixScaleY)*i,n.mixShearY+=(p.mixShearY-n.mixShearY)*i}return}let l,c,d,f,m,u,x=j.search(a,s,7),w=this.curves[x/7];switch(w){case 0:let p=a[x];l=a[x+1],c=a[x+2],d=a[x+3],f=a[x+4],m=a[x+5],u=a[x+6];let g=(s-p)/(a[x+7]-p);l+=(a[x+7+1]-l)*g,c+=(a[x+7+2]-c)*g,d+=(a[x+7+3]-d)*g,f+=(a[x+7+4]-f)*g,m+=(a[x+7+5]-m)*g,u+=(a[x+7+6]-u)*g;break;case 1:l=a[x+1],c=a[x+2],d=a[x+3],f=a[x+4],m=a[x+5],u=a[x+6];break;default:l=this.getBezierValue(s,x,1,w-2),c=this.getBezierValue(s,x,2,w+18-2),d=this.getBezierValue(s,x,3,w+18*2-2),f=this.getBezierValue(s,x,4,w+18*3-2),m=this.getBezierValue(s,x,5,w+18*4-2),u=this.getBezierValue(s,x,6,w+18*5-2)}if(h==0){let p=n.data;n.mixRotate=p.mixRotate+(l-p.mixRotate)*i,n.mixX=p.mixX+(c-p.mixX)*i,n.mixY=p.mixY+(d-p.mixY)*i,n.mixScaleX=p.mixScaleX+(f-p.mixScaleX)*i,n.mixScaleY=p.mixScaleY+(m-p.mixScaleY)*i,n.mixShearY=p.mixShearY+(u-p.mixShearY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(d-n.mixY)*i,n.mixScaleX+=(f-n.mixScaleX)*i,n.mixScaleY+=(m-n.mixScaleY)*i,n.mixShearY+=(u-n.mixShearY)*i}},ht=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,i,h,n.position,n.data.position))}},ct=class extends ie{constraintIndex=0;constructor(e,t,s){super(e,t,N.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,i,h,n.spacing,n.data.spacing))}},dt=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,r,i){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=r,h[e+3]=i}apply(e,t,s,r,i,h,o){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*i,n.mixX+=(n.data.mixX-n.mixX)*i,n.mixY+=(n.data.mixY-n.mixY)*i}return}let l,c,d,f=j.search(a,s,4),m=this.curves[f>>2];switch(m){case 0:let u=a[f];l=a[f+1],c=a[f+2],d=a[f+3];let x=(s-u)/(a[f+4]-u);l+=(a[f+4+1]-l)*x,c+=(a[f+4+2]-c)*x,d+=(a[f+4+3]-d)*x;break;case 1:l=a[f+1],c=a[f+2],d=a[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=n.data;n.mixRotate=u.mixRotate+(l-u.mixRotate)*i,n.mixX=u.mixX+(c-u.mixX)*i,n.mixY=u.mixY+(d-u.mixY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(d-n.mixY)*i}},de=class extends ie{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,h,this.get(n),this.setup(n)))}},ft=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}},ut=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}},mt=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}},gt=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}},xt=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}},wt=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}},pt=class Rs extends j{static propertyIds=[N.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Rs.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,h,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const l=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],h,o,n),s=-1;else if(s>=l[l.length-1])return;if(!(r<l[0])&&(s<l[0]||r>=l[j.search1(l,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},yt=class fe extends j{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[N.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return fe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,r,i,h){let o=this.frames;t*=fe.ENTRIES,o[t]=s,o[t+fe.MODE]=r|i<<4,o[t+fe.DELAY]=h}apply(t,s,r,i,h,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let l=a.attachment,c=this.attachment;if(l!=c&&(!(l instanceof oe)||l.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(r<d[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let f=j.search(d,r,fe.ENTRIES),m=d[f],u=d[f+fe.MODE],x=d[f+fe.DELAY];if(!this.attachment.sequence)return;let w=u>>4,p=this.attachment.sequence.regions.length,g=ss[u&15];if(g!=0)switch(w+=(r-m)/x+1e-5|0,g){case 1:w=Math.min(p-1,w);break;case 2:w%=p;break;case 3:{let b=(p<<1)-2;w=b==0?0:w%b,w>=p&&(w=b-w);break}case 4:w=Math.max(p-1-w,0);break;case 5:w=p-1-w%p;break;case 6:{let b=(p<<1)-2;w=b==0?0:(w+p-1)%b,w>=p&&(w=b-w)}}a.sequenceIndex=w}},js=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 as(this);propertyIDs=new We;animationsChanged=!1;trackEntryPool=new ye(()=>new ns);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=t*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let r=t.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((r.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let f=0,m=r.length;f<m;f++){let u=r[f];if(!u||u.delay>0)continue;i=!0;let x=f==0?1:u.mixBlend,w=u.alpha;u.mixingFrom?w*=this.applyMixingFrom(u,t,x):u.trackTime>=u.trackEnd&&!u.next&&(w=0);let p=w>=u.alphaAttachmentThreshold,g=u.animationLast,b=u.getAnimationTime(),y=b,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let A=u.animation.timelines,S=A.length;if(f==0&&w==1||x==3){f==0&&(p=!0);for(let I=0;I<S;I++){P.webkit602BugfixHelper(w,x);var h=A[I];h instanceof me?this.applyAttachmentTimeline(h,t,y,x,p):h.apply(t,g,y,v,w,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],R=I[M]==Fe?x:0;!k&&F instanceof ve?this.applyRotateTimeline(F,t,y,w,R,u.timelinesRotation,M<<1,Y):F instanceof me?this.applyAttachmentTimeline(F,t,y,x,p):(P.webkit602BugfixHelper(w,x),F.apply(t,g,y,v,w,R,0))}}this.queueEvents(u,b),s.length=0,u.nextAnimationLast=b,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+St,n=t.slots,a=0,l=t.slots.length;a<l;a++){var c=n[a];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(),i}applyMixingFrom(t,s,r){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,s,r);let h=0;t.mixDuration==0?(h=1,r==1&&(r=0)):(h=t.mixTime/t.mixDuration,h>1&&(h=1),r!=1&&(r=i.mixBlend));let o=h<i.mixAttachmentThreshold,n=h<i.mixDrawOrderThreshold,a=i.animation.timelines,l=a.length,c=i.alpha*t.interruptAlpha,d=c*(1-h),f=i.animationLast,m=i.getAnimationTime(),u=m,x=null;if(i.reverse?u=i.animation.duration-u:h<i.eventThreshold&&(x=this.events),r==3)for(let w=0;w<l;w++)a[w].apply(s,f,u,x,d,r,1);else{let w=i.timelineMode,p=i.timelineHoldMix,g=i.shortestRotation,b=!g&&i.timelinesRotation.length!=l<<1;b&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let y=0;y<l;y++){let v=a[y],A=1,S,I=0;switch(w[y]){case Fe:if(!n&&v instanceof xe)continue;S=r,I=d;break;case vt:S=0,I=d;break;case At:S=r,I=c;break;case Re:S=0,I=c;break;default:S=0;let k=p[y];I=c*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=I,!g&&v instanceof ve?this.applyRotateTimeline(v,s,u,I,S,i.timelinesRotation,y<<1,b):v instanceof me?this.applyAttachmentTimeline(v,s,u,S,o&&I>=i.alphaAttachmentThreshold):(P.webkit602BugfixHelper(I,r),n&&v instanceof xe&&S==0&&(A=0),v.apply(s,f,u,x,I,S,A))}}return t.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(t,s,r,i,h){var o=s.slots[t.slotIndex];o.bone.active&&(r<t.frames[0]?(i==0||i==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,t.attachmentNames[j.search1(t.frames,r)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+St))}setAttachment(t,s,r,i){s.setAttachment(r?t.getAttachment(s.data.index,r):null),i&&(s.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(t,s,r,i,h,o,n,a){if(a&&(o[n]=0),i==1){t.apply(s,0,r,null,1,h,0);return}let l=s.bones[t.boneIndex];if(!l.active)return;let c=t.frames,d=0,f=0;if(r<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(r);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let x=0,w=0;a?(x=0,w=u):(x=o[n],w=o[n+1]);let p=x-x%360;m=u+p;let g=u>=0,b=x>=0;Math.abs(w)<=90&&E.signum(w)!=E.signum(u)&&(Math.abs(x-p)>180?(m+=360*E.signum(x),b=g):p!=0?m-=360*E.signum(x):b=g),b!=g&&(m+=360*E.signum(x)),o[n]=m}o[n+1]=u,l.rotation=d+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,h=i-r,o=t.trackLast%h,n=this.events,a=0,l=n.length;for(;a<l;a++){let d=n[a];if(d.time<o)break;d.time>i||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>=i&&t.animationLast<i;for(c&&this.queue.complete(t);a<l;a++){let d=n[a];d.time<r||this.queue.event(t,d)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,r){let i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,i,r)}setAnimationWith(t,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let o=this.trackEntry(t,s,r,h);return this.setCurrent(t,o,i),this.queue.drain(),o}addAnimation(t,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,r,i)}addAnimationWith(t,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(t,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,Oe.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,Oe.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r<i;r++){let h=this.tracks[r];h&&this.setEmptyAnimation(h.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(P.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,r,i){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,h.animation=s,h.loop=r,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=i?this.data.getMix(i.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let s=t.mixingTo,r=t.animation.timelines,i=t.animation.timelines.length,h=t.timelineMode;h.length=i;let o=t.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<i;a++)h[a]=n.addAll(r[a].getPropertyIds())?Re:At;return}e:for(let a=0;a<i;a++){let l=r[a],c=l.getPropertyIds();if(!n.addAll(c))h[a]=Fe;else if(!s||l instanceof me||l instanceof xe||l instanceof Xe||!s.animation.hasTimeline(c))h[a]=vt;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(t.mixDuration>0){h[a]=os,o[a]=d;continue e}break}h[a]=Re}}}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}},as=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let r=e[s],i=e[s+1];switch(r){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<t.length;o++){let n=t[o];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<t.length;o++){let n=t[o];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<t.length;o++){let n=t[o];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<t.length;o++){let n=t[o];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<t.length;o++){let n=t[o];n.complete&&n.complete(i)}break;case 5:let h=e[s+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<t.length;o++){let n=t[o];n.event&&n.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ls=(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))(ls||{}),Js=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Fe=0,vt=1,At=2,Re=3,os=4,St=1,hs=2,Ks=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);this.setMixWith(r,i,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},Ct=class Es extends oe{color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Es(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},It=class Ps extends oe{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ps(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Tt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ee=(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))(Ee||{}),cs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(cs||{}),ds=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Qs=class extends Tt{setFilters(e,t){}setWraps(e,t){}dispose(){}},kt=class{pages=new Array;regions=new Array;constructor(e){let t=new Zs(e),s=new Array(4),r={};r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.format=()=>{},r.filter=l=>{l.minFilter=P.enumValue(Ee,s[1]),l.magFilter=P.enumValue(Ee,s[2])},r.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},r.pma=l=>{l.pma=s[1]=="true"};var i={};i.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},i.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},i.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},i.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},i.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},i.index=l=>{l.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let o=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let l=new Mt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=i[s[0]];if(d)d(l);else{n||(n=[]),a||(a=[]),n.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));a.push(f)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),n&&n.length>0&&a&&a.length>0&&(l.names=n,l.values=a,n=null,a=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new fs(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Zs=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=t.indexOf(",",i);if(h==-1)return e[r]=t.substr(i).trim(),r;if(e[r]=t.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},fs=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}},Mt=class extends ds{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 Ht 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,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,n=0;if(this.region instanceof Mt){let a=this.region,l=a.page,c=l.width,d=l.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<r;f+=2)s[f]=i+t[f+1]*o,s[f+1]=h+(1-t[f])*n;return;case 180:i-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let f=0;f<r;f+=2)s[f]=i+(1-t[f])*o,s[f+1]=h+(1-t[f+1])*n;return;case 270:i-=a.offsetY/c,h-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<r;f+=2)s[f]=i+(1-t[f+1])*o,s[f+1]=h+t[f]*n;return}i-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-i,n=this.region.v2-h):(i=h=0,o=n=1);for(let a=0;a<r;a+=2)s[a]=i+t[a]*o,s[a+1]=h+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Ht(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=new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,r,i,h,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,r,i,h,o)}newLinkedMesh(){let t=new Ht(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 Bs extends oe{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new Bs(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}},us=class Vs 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*E.degRad,r=Math.cos(s),i=Math.sin(s),h=r*t.a+i*t.b,o=r*t.c+i*t.d;return E.atan2Deg(o,h)}copy(){let t=new Vs(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},H=class Ls extends ze{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 r=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*r,o=-this.height/2*this.scaleY+this.region.offsetY*i,n=h+this.region.width*r,a=o+this.region.height*i,l=this.rotation*E.degRad,c=Math.cos(l),d=Math.sin(l),f=this.x,m=this.y,u=h*c+f,x=h*d,w=o*c+m,p=o*d,g=n*c+f,b=n*d,y=a*c+m,v=a*d,A=this.offset;A[0]=u-p,A[1]=w+x,A[2]=u-v,A[3]=y+x,A[4]=g-v,A[5]=y+b,A[6]=g-p,A[7]=w+b,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,r,i){this.sequence!=null&&this.sequence.apply(t,this);let h=t.bone,o=this.offset,n=h.worldX,a=h.worldY,l=h.a,c=h.b,d=h.c,f=h.d,m=0,u=0;m=o[0],u=o[1],s[r]=m*l+u*c+n,s[r+1]=m*d+u*f+a,r+=i,m=o[2],u=o[3],s[r]=m*l+u*c+n,s[r+1]=m*d+u*f+a,r+=i,m=o[4],u=o[5],s[r]=m*l+u*c+n,s[r+1]=m*d+u*f+a,r+=i,m=o[6],u=o[7],s[r]=m*l+u*c+n,s[r+1]=m*d+u*f+a}copy(){let t=new Ls(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},ei=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let r=s.regions;for(let i=0,h=r.length;i<h;i++){let o=s.getPath(t,i),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");r[i]=n}}newRegionAttachment(e,t,s,r){let i=new H(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");i.region=h}return i}newMeshAttachment(e,t,s,r){let i=new Ae(t,s);if(r!=null)this.loadSequence(t,s,r);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");i.region=h}return i}newBoundingBoxAttachment(e,t){return new Ct(t)}newPathAttachment(e,t){return new Se(t)}newPointAttachment(e,t){return new us(t)}newClippingAttachment(e,t){return new It(t)}},Yt=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||{}),Xt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,r,i,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let n=this.parent;if(!n){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,x=(s+h)*E.degRad,w=(s+90+o)*E.degRad;this.a=Math.cos(x)*r*m,this.b=Math.cos(w)*i*m,this.c=Math.sin(x)*r*u,this.d=Math.sin(w)*i*u,this.worldX=e*m+f.x,this.worldY=t*u+f.y;return}let a=n.a,l=n.b,c=n.c,d=n.d;switch(this.worldX=a*e+l*t+n.worldX,this.worldY=c*e+d*t+n.worldY,this.inherit){case 0:{const f=(s+h)*E.degRad,m=(s+90+o)*E.degRad,u=Math.cos(f)*r,x=Math.cos(m)*i,w=Math.sin(f)*r,p=Math.sin(m)*i;this.a=a*u+l*w,this.b=a*x+l*p,this.c=c*u+d*w,this.d=c*x+d*p;return}case 1:{const f=(s+h)*E.degRad,m=(s+90+o)*E.degRad;this.a=Math.cos(f)*r,this.b=Math.cos(m)*i,this.c=Math.sin(f)*r,this.d=Math.sin(m)*i;break}case 2:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=f,c*=m;let u=a*a+c*c,x=0;u>1e-4?(u=Math.abs(a*d*m-l*f*c)/u,l=c*u,d=a*u,x=Math.atan2(c,a)*E.radDeg):(a=0,c=0,x=90-Math.atan2(d,l)*E.radDeg);const w=(s+h-x)*E.degRad,p=(s+o-x+90)*E.degRad,g=Math.cos(w)*r,b=Math.cos(p)*i,y=Math.sin(w)*r,v=Math.sin(p)*i;this.a=a*g-l*y,this.b=a*b-l*v,this.c=c*g+d*y,this.d=c*b+d*v;break}case 3:case 4:{s*=E.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(a*f+l*m)/this.skeleton.scaleX,x=(c*f+d*m)/this.skeleton.scaleY,w=Math.sqrt(u*u+x*x);w>1e-5&&(w=1/w),u*=w,x*=w,w=Math.sqrt(u*u+x*x),this.inherit==3&&a*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(x,u);const p=Math.cos(s)*w,g=Math.sin(s)*w;h*=E.degRad,o=(90+o)*E.degRad;const b=Math.cos(h)*r,y=Math.cos(o)*i,v=Math.sin(h)*r,A=Math.sin(o)*i;this.a=u*b+p*v,this.b=u*y+p*A,this.c=x*b+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)*E.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*E.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*o-d*n,this.ay=d*l-c*a;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*i-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*i-s*r),o=i*h,n=s*h;break}case 3:case 4:let w=E.cosDeg(this.rotation),p=E.sinDeg(this.rotation);t=(t*w+s*p)/this.skeleton.scaleX,r=(r*w+i*p)/this.skeleton.scaleY;let g=Math.sqrt(t*t+r*r);g>1e-5&&(g=1/g),t*=g,r*=g,g=Math.sqrt(t*t+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let b=E.PI/2+Math.atan2(r,t);s=Math.cos(b)*g,i=Math.sin(b)*g,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h}f=o*this.a-n*this.c,m=o*this.b-n*this.d,u=l*this.c-a*this.a,x=l*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let w=f*x-m*u;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*x,w)*E.radDeg,this.arotation=Math.atan2(u,f)*E.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,m)*E.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*E.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*E.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*E.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=E.sinDeg(e),s=E.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*E.radDeg}rotateWorld(e){e*=E.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,i=this.b;this.a=s*r-t*this.c,this.b=s*i-t*this.d,this.c=t*r+s*this.c,this.d=t*i+s*this.d}},Ce=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ms=class{pathPrefix="";textureLoader;downloader;assets={};assetsRefCount={};assetsLoaded={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Ft){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,this.assetsRefCount[t]=(this.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),r(h)},(h,o)=>{const n=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),r(h)},(h,o)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const r=this.assetsLoaded[e],i=r!==void 0;return i&&r.then(h=>this.success(t,e,h)).catch(h=>this.error(s,e,h)),i}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(t,e,a),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let i=e.lastIndexOf("/"),h=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((o,n)=>{this.downloader.downloadText(e,a=>{try{let l=new kt(a),c=l.pages.length,d=!1;for(let f of l.pages)this.loadTexture(r?r[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 atlas ${e} page image: ${m}`;this.error(s,e,x),n(x)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),n(c)}},(a,l)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${l}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},r){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((i,h)=>{this.downloader.downloadText(e,o=>{try{const n=new kt(o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),h(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(r,i)=>t(i),(r,i)=>s(i))})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
+
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],delete this.assetsRefCount[e],delete this.assetsLoaded[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={},this.assetsLoaded={},this.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){--this.assetsRefCount[e]===0&&this.remove(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Ft=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=t.charCodeAt(i);return r}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToString(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",r||e,!0);let h=()=>{this.finish(e,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||e,!0),i.responseType="arraybuffer";let h=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let i=t==200||t==0?[s]:[t,s];for(let h=i.length-1,o=r.length;h<o;h+=2)r[h].apply(null,i)}},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}},Et=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},gs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,r,i,h,o){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,l=n.b,c=n.c,d=n.d,f=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*E.signum(e.skeleton.scaleX),u=(s-e.worldY)*E.signum(e.skeleton.scaleY);break;case 2:let p=Math.abs(a*d-l*c)/Math.max(1e-4,a*a+c*c),g=a/e.skeleton.scaleX,b=c/e.skeleton.scaleY;l=-b*p*e.skeleton.scaleX,d=g*p*e.skeleton.scaleY,f+=Math.atan2(b,g)*E.radDeg;default:let y=t-n.worldX,v=s-n.worldY,A=a*d-l*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(y*d-v*l)/A-e.ax,u=(v*a-y*c)/A-e.ay)}f+=Math.atan2(u,m)*E.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=e.ascaleX,w=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const p=e.data.length*x;if(p>1e-4){const g=m*m+u*u;if(r&&g<p*p||i&&g>p*p){const b=(Math.sqrt(g)/p-1)*o+1;x*=b,h&&(w*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,x,w,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,h,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,u=f,x=t.ascaleX,w=0,p=0,g=0;d<0?(d=-d,w=180,g=-1):(w=0,g=1),f<0&&(f=-f,g=-g),x<0?(x=-x,p=180):p=0;let b=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*b+e.worldX,A=k*b+e.worldY):(y=t.ay,v=S*b+I*y+e.worldX,A=k*b+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 R=S*Y-I*k,T=v-F.worldX,X=A-F.worldY;R=Math.abs(R)<=1e-4?0:1/R;let B=(T*Y-X*I)*R-l,O=(X*S-T*k)*R-c,L=Math.sqrt(B*B+O*O),q=t.data.length*x,$,_;if(L<1e-4){this.apply1(e,s,r,!1,h,!1,a),t.updateWorldTransformWith(b,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}T=s-F.worldX,X=r-F.worldY;let J=(T*Y-X*I)*R-l,V=(X*S-T*k)*R-c,U=J*J+V*V;if(n!=0){n*=d*(x+1)*.5;let K=Math.sqrt(U),Z=K-L-q*d+n;if(Z>0){let ee=Math.min(1,Z/(n*2))-1;ee=(Z-n*(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*i):K>1?(K=1,_=0,h&&(S=(Math.sqrt(U)/(L+q)-1)*a+1,m*=S,o&&(u*=S))):_=Math.acos(K)*i,S=L+q*K,I=q*Math.sin(_),$=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 ae=-2*Z*L,be=Z-K;if(Y=ae*ae-4*be*k,Y>=0){let we=Math.sqrt(Y);ae<0&&(we=-we),we=-(ae+we)*.5;let Te=we/be,Ms=k/we,De=Math.abs(Te)<Math.abs(Ms)?Te:Ms;if(Te=U-De*De,Te>=0){X=Math.sqrt(Te)*i,$=ee-Math.atan2(X,De),_=Math.atan2(X/f,(De-L)/d);break e}}let Ie=E.PI,Ve=L-S,Gt=Ve*Ve,Is=0,Ts=0,Le=L+S,$t=Le*Le,ks=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<Gt&&(Ie=k,Gt=Y,Ve=T,Is=X),Y>$t&&(Ts=k,$t=Y,Le=T,ks=X)),U<=(Gt+$t)*.5?($=ee-Math.atan2(Is*i,Ve),_=Ie*i):($=ee-Math.atan2(ks*i,Le),_=Ts*i)}let G=Math.atan2(y,b)*g,te=e.arotation;$=($-G)*E.radDeg+w-te,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(l,c,te+$*a,m,u,0,0),te=t.arotation,_=((_+G)*E.radDeg-t.ashearX)*g+p-te,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(b,y,te+_*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Pt=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)}},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("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Vt=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Vt||{}),Lt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Lt||{}),Dt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Dt||{}),xs=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 i=0,h=t.bones.length;i<h;i++){let o=s.findBone(t.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(o)}let r=s.findSlot(t.target.name);if(!r)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=r,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof Se))return;let r=this.mixRotate,i=this.mixX,h=this.mixY;if(r==0&&i==0&&h==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,l=this.bones,c=l.length,d=n?c:c+1,f=P.setArraySize(this.spaces,d),m=a?this.lengths=P.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case 2:if(a)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)a&&(m[A]=0),f[++A]=u;else{let Y=k*I.a,M=k*I.c,F=Math.sqrt(Y*Y+M*M);a&&(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)a&&(m[A]=0),f[++A]=u;else{let Y=k*I.a,M=k*I.c,F=Math.sqrt(Y*Y+M*M);a&&(m[A]=F),f[++A]=(v?k+u:u)*F/k}}}let x=this.computeWorldPositions(s,d,n),w=x[0],p=x[1],g=o.offsetRotation,b=!1;if(g==0)b=o.rotateMode==1;else{b=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?E.degRad:-E.degRad}for(let y=0,v=3;y<c;y++,v+=3){let A=l[y];A.worldX+=(w-A.worldX)*i,A.worldY+=(p-A.worldY)*h;let S=x[v],I=x[v+1],k=S-w,Y=I-p;if(a){let M=m[y];if(M!=0){let F=(Math.sqrt(k*k+Y*Y)/M-1)*r+1;A.a*=F,A.c*=F}}if(w=S,p=I,r>0){let M=A.a,F=A.b,R=A.c,T=A.d,X=0,B=0,O=0;if(n?X=x[v-1]:f[y+1]==0?X=x[v+2]:X=Math.atan2(Y,k),X-=Math.atan2(R,M),b){B=Math.cos(X),O=Math.sin(X);let L=A.data.length;w+=(L*(B*M-O*R)-k)*r,p+=(L*(O*M+B*R)-Y)*r}else X+=g;X>E.PI?X-=E.PI2:X<-E.PI&&(X+=E.PI2),X*=r,B=Math.cos(X),O=Math.sin(X),A.a=B*M-O*R,A.b=B*F-O*T,A.c=O*M+B*R,A.d=O*F+B*T}A.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,h=this.position,o=this.spaces,n=P.setArraySize(this.positions,s*3+2),a=this.world,l=t.closed,c=t.worldVerticesLength,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 $;switch(this.data.spacingMode){case 2:$=q;break;case 3:$=q/s;break;default:$=1}a=P.setArraySize(this.world,8);for(let _=0,J=0,V=0;_<s;_++,J+=3){let U=o[_]*$;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(i,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,J);continue}else if(G>q){f!=ue.AFTER&&(f=ue.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-q,a,0,n,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(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,V*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,J,r||_>0&&U==0)}return n}l?(c+=2,a=P.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=P.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=P.setArraySize(this.curves,d),u=0,x=a[0],w=a[1],p=0,g=0,b=0,y=0,v=0,A=0,S=0,I=0,k=0,Y=0,M=0,F=0,R=0,T=0;for(let L=0,q=2;L<d;L++,q+=6)p=a[q],g=a[q+1],b=a[q+2],y=a[q+3],v=a[q+4],A=a[q+5],S=(x-p*2+b)*.1875,I=(w-g*2+y)*.1875,k=((p-b)*3-x+v)*.09375,Y=((g-y)*3-w+A)*.09375,M=S*2+k,F=I*2+Y,R=(p-x)*.75+S+k*.16666667,T=(g-w)*.75+I+Y*.16666667,u+=Math.sqrt(R*R+T*T),R+=M,T+=F,M+=k,F+=Y,u+=Math.sqrt(R*R+T*T),R+=M,T+=F,u+=Math.sqrt(R*R+T*T),R+=M+k,T+=F+Y,u+=Math.sqrt(R*R+T*T),m[L]=u,x=v,w=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,$=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),$=0;else if(V<0){this.addBeforePosition(V,a,0,n,q);continue}else if(V>u){this.addAfterPosition(V-u,a,c-4,n,q);continue}for(;;$++){let U=m[$];if(!(V>U)){if($==0)V/=U;else{let G=m[$-1];V=(V-G)/(U-G)}break}}if($!=f){f=$;let U=$*6;for(x=a[U],w=a[U+1],p=a[U+2],g=a[U+3],b=a[U+4],y=a[U+5],v=a[U+6],A=a[U+7],S=(x-p*2+b)*.03,I=(w-g*2+y)*.03,k=((p-b)*3-x+v)*.006,Y=((g-y)*3-w+A)*.006,M=S*2+k,F=I*2+Y,R=(p-x)*.3+S+k*.16666667,T=(g-w)*.3+I+Y*.16666667,O=Math.sqrt(R*R+T*T),B[0]=O,U=1;U<8;U++)R+=M,T+=F,M+=k,F+=Y,O+=Math.sqrt(R*R+T*T),B[U]=O;R+=M,T+=F,O+=Math.sqrt(R*R+T*T),B[8]=O,R+=M+k,T+=F+Y,O+=Math.sqrt(R*R+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,w,p,g,b,y,v,A,n,q,r||L>0&&J==0)}return n}addBeforePosition(t,s,r,i,h){let o=s[r],n=s[r+1],a=s[r+2]-o,l=s[r+3]-n,c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addAfterPosition(t,s,r,i,h){let o=s[r+2],n=s[r+3],a=o-s[r],l=n-s[r+1],c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addCurvePosition(t,s,r,i,h,o,n,a,l,c,d,f){if(t==0||isNaN(t)){c[d]=s,c[d+1]=r,c[d+2]=Math.atan2(h-r,i-s);return}let m=t*t,u=m*t,x=1-t,w=x*x,p=w*x,g=x*t,b=g*3,y=x*b,v=b*t,A=s*p+i*y+o*v+a*u,S=r*p+h*y+n*v+l*u;c[d]=A,c[d+1]=S,f&&(t<.001?c[d+2]=Math.atan2(h-r,i-s):c[d+2]=Math.atan2(S-(r*w+h*g*2+n*m),A-(s*w+i*g*2+o*m)))}},ti=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=a.time;const c=o.worldX,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,w=-1,p=this.data.limit*l,g=p*Math.abs(a.scaleY);if(p*=Math.abs(a.scaleX),s||r){if(s){const b=(this.ux-c)*m;this.xOffset+=b>p?p:b<-p?-p:b,this.ux=c}if(r){const b=(this.uy-d)*m;this.yOffset+=b>g?g:b<-g?-g:b,this.uy=d}if(f>=u){w=Math.pow(this.damping,60*u);const b=this.massInverse*u,y=this.strength,v=this.wind*x*a.scaleX,A=this.gravity*x*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*b,this.xOffset+=this.xVelocity*u,this.xVelocity*=w),r&&(this.yVelocity-=(A+this.yOffset*y)*b,this.yOffset+=this.yVelocity*u,this.yVelocity*=w),f-=u;while(f>=u)}s&&(o.worldX+=this.xOffset*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||h){let b=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),i){A=(this.data.rotate+this.data.shearX)*t;let k=Math.atan2(I+this.ty,S+this.tx)-b-this.rotateOffset*A;this.rotateOffset+=(k-Math.ceil(k*E.invPI2-.5)*E.PI2)*m,k=this.rotateOffset*A+b,y=Math.cos(k),v=Math.sin(k),h&&(k=n*o.getWorldScaleX(),k>0&&(this.scaleOffset+=(S*y+I*v)*m/k))}else{y=Math.cos(b),v=Math.sin(b);const k=n*o.getWorldScaleX();k>0&&(this.scaleOffset+=(S*y+I*v)*m/k)}if(f=this.remaining,f>=u){w==-1&&(w=Math.pow(this.damping,60*u));const k=this.massInverse*u,Y=this.strength,M=this.wind,F=ps.yDown?-this.gravity:this.gravity,R=n/x;for(;;)if(f-=u,h&&(this.scaleVelocity+=(M*y-F*v-this.scaleOffset*Y)*k,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=w),i){if(this.rotateVelocity-=((M*v+F*y)*R+this.rotateOffset*Y)*k,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=w,f<u)break;const T=this.rotateOffset*A+b;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),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i){let a=this.rotateOffset*t,l=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=a*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+=a*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 a*=this.data.rotate,l=Math.sin(a),c=Math.cos(a),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 a=1+this.scaleOffset*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*E.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*h-o,o*h+n*i-n)}},bs=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}},ws=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 r=0;r<e.bones.length;r++){let i=t.findBone(e.bones[r].name);if(!i)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(i)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,f=a*d-l*c>0?E.degRad:-E.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,x=this.bones;for(let w=0,p=x.length;w<p;w++){let g=x[w];if(e!=0){let b=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,a)-Math.atan2(v,b)+m;S>E.PI?S-=E.PI2:S<-E.PI&&(S+=E.PI2),S*=e;let I=Math.cos(S),k=Math.sin(S);g.a=I*b-k*v,g.b=I*y-k*A,g.c=k*b+I*v,g.d=k*y+I*A}if(o){let b=this.temp;n.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(b.x-g.worldX)*t,g.worldY+=(b.y-g.worldY)*s}if(r!=0){let b=Math.sqrt(g.a*g.a+g.c*g.c);b!=0&&(b=(b+(Math.sqrt(a*a+c*c)-b+this.data.offsetScaleX)*r)/b),g.a*=b,g.c*=b}if(i!=0){let b=Math.sqrt(g.b*g.b+g.d*g.d);b!=0&&(b=(b+(Math.sqrt(l*l+d*d)-b+this.data.offsetScaleY)*i)/b),g.b*=b,g.d*=b}if(h>0){let b=g.b,y=g.d,v=Math.atan2(y,b),A=Math.atan2(d,l)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));A>E.PI?A-=E.PI2:A<-E.PI&&(A+=E.PI2),A=v+(A+u)*h;let S=Math.sqrt(b*b+y*y);g.b=Math.cos(A)*S,g.d=Math.sin(A)*S}g.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,f=a*d-l*c>0?E.degRad:-E.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,x=this.bones;for(let w=0,p=x.length;w<p;w++){let g=x[w];if(e!=0){let b=g.a,y=g.b,v=g.c,A=g.d,S=Math.atan2(c,a)+m;S>E.PI?S-=E.PI2:S<-E.PI&&(S+=E.PI2),S*=e;let I=Math.cos(S),k=Math.sin(S);g.a=I*b-k*v,g.b=I*y-k*A,g.c=k*b+I*v,g.d=k*y+I*A}if(o){let b=this.temp;n.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),g.worldX+=b.x*t,g.worldY+=b.y*s}if(r!=0){let b=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*r+1;g.a*=b,g.c*=b}if(i!=0){let b=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*i+1;g.b*=b,g.d*=b}if(h>0){let b=Math.atan2(d,l)-Math.atan2(c,a);b>E.PI?b-=E.PI2:b<-E.PI&&(b+=E.PI2);let y=g.b,v=g.d;b=Math.atan2(v,y)+(b-E.PI/2+u)*h;let A=Math.sqrt(y*y+v*v);g.b=Math.cos(b)*A,g.d=Math.sin(b)*A}g.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],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;r!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*r)/u),i!=0&&x!=0&&(x=(x+(o.ascaleY-x+this.data.offsetScaleY)*i)/x);let w=c.ashearY;h!=0&&(w+=(o.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,w)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],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)*r+1),x=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*i+1),w=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,m,d,u,x,c.ashearX,w)}}},ps=class jt{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return jt.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=t.bones[s],i;if(!r.parent)i=new Xt(r,this,null);else{let h=this.bones[r.parent.index];i=new Xt(r,this,h),h.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let r=t.slots[s],i=this.bones[r.boneData.index],h=new bs(r,i);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let r=t.ikConstraints[s];this.ikConstraints.push(new gs(r,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let r=t.transformConstraints[s];this.transformConstraints.push(new ws(r,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let r=t.pathConstraints[s];this.pathConstraints.push(new xs(r,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let r=t.physicsConstraints[s];this.physicsConstraints.push(new ti(r,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 r=this.ikConstraints,i=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,n=r.length,a=i.length,l=h.length,c=this.physicsConstraints.length,d=n+a+l+c;e:for(let f=0;f<d;f++){for(let m=0;m<n;m++){let u=r[m];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let m=0;m<a;m++){let u=i[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 r=t.bones,i=r[0];if(this.sortBone(i),r.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let h=r[r.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(i.children),h.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,r=s.data.index,i=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(let a=0,l=this.data.skins.length;a<l;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,i);let h=s.getAttachment();h instanceof Se&&this.sortPathConstraintAttachmentWith(h,i);let o=t.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,r=s.length;if(t.data.local)for(let i=0;i<r;i++){let h=s[i];this.sortBone(h.parent),this.sortBone(h)}else for(let i=0;i<r;i++)this.sortBone(s[i]);this._updateCache.push(t);for(let i=0;i<r;i++)this.sortReset(s[i].children);for(let i=0;i<r;i++)s[i].sorted=!0}sortPathConstraintAttachment(t,s,r){let i=t.attachments[s];if(i)for(let h in i)this.sortPathConstraintAttachmentWith(i[h],r)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof Se))return;let r=t.bones;if(!r)this.sortBone(s);else{let i=this.bones;for(let h=0,o=r.length;h<o;){let n=r[h++];for(n+=h;h<n;)this.sortBone(i[r[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,r=t.length;s<r;s++){let i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let i=0,h=s.length;i<h;i++){let o=s[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let r=this._updateCache;for(let i=0,h=r.length;i<h;i++)r[i].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let r=this.bones;for(let w=1,p=r.length;w<p;w++){let g=r[w];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,n=s.c,a=s.d;i.worldX=h*this.x+o*this.y+s.worldX,i.worldY=n*this.x+a*this.y+s.worldY;const l=(i.rotation+i.shearX)*E.degRad,c=(i.rotation+90+i.shearY)*E.degRad,d=Math.cos(l)*i.scaleX,f=Math.cos(c)*i.scaleY,m=Math.sin(l)*i.scaleX,u=Math.sin(c)*i.scaleY;i.a=(h*d+o*m)*this.scaleX,i.b=(h*f+o*u)*this.scaleX,i.c=(n*d+a*m)*this.scaleY,i.d=(n*f+a*u)*this.scaleY;let x=this._updateCache;for(let w=0,p=x.length;w<p;w++){let g=x[w];g!=i&&g.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;P.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,r=t.length;s<r;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==t)return h}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r];if(h.data.name==t)return h}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let r=0,i=s.length;r<i;r++){let h=s[r],o=h.data.attachmentName;if(o){let n=t.getAttachment(r,o);n&&h.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let r=this.data.findSlot(t);if(!r)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(r.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let r=this.skin.getAttachment(t,s);if(r)return r}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let r=this.slots;for(let i=0,h=r.length;i<h;i++){let o=r[i];if(o.data.name==t){let n=null;if(s&&(n=this.getAttachment(i,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);o.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new ke,r=new ke;return this.getBounds(s,r,void 0,t),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(t,s,r=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let f=h[c];if(!f.bone.active)continue;let m=0,u=null,x=null,w=f.getAttachment();if(w instanceof H)m=8,u=P.setArraySize(r,m,0),w.computeWorldVertices(f,u,0,2),x=jt.quadTriangles;else if(w instanceof Ae){let p=w;m=p.worldVerticesLength,u=P.setArraySize(r,m,0),p.computeWorldVertices(f,0,m,u,0,2),x=p.triangles}else if(w instanceof It&&i!=null){i.clipStart(f,w);continue}if(u&&x){i!=null&&i.isClipping()&&(i.clipTriangles(u,x,x.length),u=i.clippedVertices,m=i.clippedVertices.length);for(let p=0,g=u.length;p<g;p+=2){let b=u[p],y=u[p+1];o=Math.min(o,b),n=Math.min(n,y),a=Math.max(a,b),l=Math.max(l,y)}}i?.clipEndWithSlot(f)}i?.clipEnd(),t.set(o,n),s.set(a-o,l-n)}update(t){this.time+=t}physicsTranslate(t,s){const r=this.physicsConstraints;for(let i=0,h=r.length;i<h;i++)r[i].translate(t,s)}physicsRotate(t,s,r){const i=this.physicsConstraints;for(let h=0,o=i.length;h<o;h++)i[h].rotate(t,s,r)}},ys=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ys||{}),vs=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)}},Nt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,r=t.length;s<r;s++){let i=t[s];if(i.name==e)return i}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,r=t.length;s<r;s++){const i=t[s];if(i.name==e)return i}return null}},Ot=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 r=this.attachments;e>=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let r=0;r<e.bones.length;r++){let i=e.bones[r],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){h=!0;break}h||this.bones.push(i)}for(let r=0;r<e.constraints.length;r++){let i=e.constraints[r],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){h=!0;break}h||this.constraints.push(i)}let t=e.getAttachments();for(let r=0;r<t.length;r++){var s=t[r];s.attachment&&(s.attachment instanceof 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 r in s){let i=s[r];i&&e.push(new Ot(t,r,i))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let r in s){let i=s[r];i&&t.push(new Ot(e,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let r=0;r<e.slots.length;r++){let i=e.slots[r],h=i.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let n in o){let a=o[n];if(h==a){let l=this.getAttachment(s,n);l&&i.setAttachment(l);break}}}s++}}},qt=class{index=0;name;boneData;color=new 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}},Ut=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Ut||{}),Wt=class extends 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)}},si=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Nt;s.name="";let r=new As(e),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("String in string table must not be null.");r.strings.push(c)}n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[r.readInt(!0)],f=new Yt(l,c,d);f.rotation=r.readFloat(),f.x=r.readFloat()*t,f.y=r.readFloat()*t,f.scaleX=r.readFloat(),f.scaleY=r.readFloat(),f.shearX=r.readFloat(),f.shearY=r.readFloat(),f.length=r.readFloat()*t,f.inherit=r.readByte(),f.skinRequired=r.readBoolean(),o&&(D.rgba8888ToColor(f.color,r.readInt32()),f.icon=r.readString()??void 0,f.visible=r.readBoolean()),s.bones.push(f)}n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[r.readInt(!0)],f=new qt(l,c,d);D.rgba8888ToColor(f.color,r.readInt32());let m=r.readInt32();m!=-1&&D.rgb888ToColor(f.darkColor=new D,m),f.attachmentName=r.readStringRef(),f.blendMode=r.readInt(!0),o&&(f.visible=r.readBoolean()),s.slots.push(f)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let d=r.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Pt(d);f.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[r.readInt(!0)]);f.target=s.bones[r.readInt(!0)];let m=r.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?r.readFloat():1),(m&128)!=0&&(f.softness=r.readFloat()*t),s.ikConstraints.push(f)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let d=r.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Wt(d);f.order=r.readInt(!0),c=r.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[r.readInt(!0)]);f.target=s.bones[r.readInt(!0)];let m=r.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=r.readFloat()),(m&16)!=0&&(f.offsetX=r.readFloat()*t),(m&32)!=0&&(f.offsetY=r.readFloat()*t),(m&64)!=0&&(f.offsetScaleX=r.readFloat()),(m&128)!=0&&(f.offsetScaleY=r.readFloat()),m=r.readByte(),(m&1)!=0&&(f.offsetShearY=r.readFloat()),(m&2)!=0&&(f.mixRotate=r.readFloat()),(m&4)!=0&&(f.mixX=r.readFloat()),(m&8)!=0&&(f.mixY=r.readFloat()),(m&16)!=0&&(f.mixScaleX=r.readFloat()),(m&32)!=0&&(f.mixScaleY=r.readFloat()),(m&64)!=0&&(f.mixShearY=r.readFloat()),s.transformConstraints.push(f)}n=r.readInt(!0);for(let l=0,c;l<n;l++){let d=r.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Bt(d);f.order=r.readInt(!0),f.skinRequired=r.readBoolean(),c=r.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[r.readInt(!0)]);f.target=s.slots[r.readInt(!0)];const m=r.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=r.readFloat()),f.position=r.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=r.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=r.readFloat(),f.mixX=r.readFloat(),f.mixY=r.readFloat(),s.pathConstraints.push(f)}n=r.readInt(!0);for(let l=0,c;l<n;l++){const d=r.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new vs(d);f.order=r.readInt(!0),f.bone=s.bones[r.readInt(!0)];let m=r.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=r.readFloat()),(m&4)!=0&&(f.y=r.readFloat()),(m&8)!=0&&(f.rotate=r.readFloat()),(m&16)!=0&&(f.scaleX=r.readFloat()),(m&32)!=0&&(f.shearX=r.readFloat()),f.limit=((m&64)!=0?r.readFloat():5e3)*t,f.step=1/r.readUnsignedByte(),f.inertia=r.readFloat(),f.strength=r.readFloat(),f.damping=r.readFloat(),f.massInverse=(m&128)!=0?r.readFloat():1,f.wind=r.readFloat(),f.gravity=r.readFloat(),m=r.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?r.readFloat():1,s.physicsConstraints.push(f)}let a=this.readSkin(r,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let l=s.skins.length;for(P.setArraySize(s.skins,n=l+r.readInt(!0));l<n;l++){let c=this.readSkin(r,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}n=this.linkedMeshes.length;for(let l=0;l<n;l++){let c=this.linkedMeshes[l];const 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,n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Event data name must not be null");let d=new Et(c);d.intValue=r.readInt(!1),d.floatValue=r.readFloat(),d.stringValue=r.readString(),d.audioPath=r.readString(),d.audioPath&&(d.volume=r.readFloat(),d.balance=r.readFloat()),s.events.push(d)}n=r.readInt(!0);for(let l=0;l<n;l++){let c=r.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,c,s))}return s}readSkin(e,t,s,r){let i=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;i=new Be("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");i=new Be(o),r&&D.rgba8888ToColor(i.color,e.readInt32()),i.bones.length=e.readInt(!0);for(let n=0,a=i.bones.length;n<a;n++)i.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)i.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let n=e.readInt(!0);for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,i,n,c,r);d&&i.setAttachment(n,c,d)}}return i}readAttachment(e,t,s,r,i,h){let o=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():i;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let l=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null;let f=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),x=e.readFloat(),w=e.readFloat(),p=e.readFloat(),g=e.readFloat();l||(l=a);let b=this.attachmentLoader.newRegionAttachment(s,a,l,d);return b?(b.path=l,b.x=m*o,b.y=u*o,b.scaleX=x,b.scaleY=w,b.rotation=f,b.width=p*o,b.height=g*o,D.rgba8888ToColor(b.color,c),b.sequence=d,d==null&&b.updateRegion(),b):null}case 1:{let l=this.readVertices(e,(n&16)!=0),c=h?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);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=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,f=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),x=this.readShortArray(e,(m.length-f-2)*3);let w=[],p=0,g=0;h&&(w=this.readShortArray(e,e.readInt(!0)),p=e.readFloat(),g=e.readFloat()),l||(l=a);let b=this.attachmentLoader.newMeshAttachment(s,a,l,d);return b?(b.path=l,D.rgba8888ToColor(b.color,c),b.bones=m.bones,b.vertices=m.vertices,b.worldVerticesLength=m.length,b.triangles=x,b.regionUVs=u,d==null&&b.updateRegion(),b.hullLength=f<<1,b.sequence=d,h&&(b.edges=w,b.width=p*o,b.height=g*o),b):null}case 3:{const l=(n&16)!=0?e.readStringRef():a;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,f=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let x=0,w=0;h&&(x=e.readFloat(),w=e.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,a,l,d);return p?(p.path=l,D.rgba8888ToColor(p.color,c),p.sequence=d,h&&(p.width=x*o,p.height=w*o),this.linkedMeshes.push(new ii(p,m,r,u,f)),p):null}case 4:{const l=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(e,(n&64)!=0),f=P.newArray(d.length/6,0);for(let x=0,w=f.length;x<w;x++)f[x]=e.readFloat()*o;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=l,u.constantSpeed=c,u.worldVerticesLength=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,a);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,(n&16)!=0);let d=h?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,a);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 es(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,r=e.readInt(!0),i=new ri;if(i.length=r<<1,!t)return i.vertices=this.readFloatArray(e,i.length,s),i;let h=new Array,o=new Array;for(let n=0;n<r;n++){let a=e.readInt(!0);o.push(a);for(let l=0;l<a;l++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return i.vertices=P.toFloatArray(h),i.bones=o,i}readFloatArray(e,t,s){let r=new Array(t);if(s==1)for(let i=0;i<t;i++)r[i]=e.readFloat();else for(let i=0;i<t;i++)r[i]=e.readFloat()*s;return r}readShortArray(e,t){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let r=new Array,i=this.scale;for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0),x=u-1;switch(m){case xi:{let w=new me(u,c);for(let p=0;p<u;p++)w.setFrame(p,e.readFloat(),e.readStringRef());r.push(w);break}case bi:{let w=e.readInt(!0),p=new tt(u,w,c),g=e.readFloat(),b=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,b,y,v,A),S!=x;S++){let k=e.readFloat(),Y=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case he:p.setStepped(S);break;case ce:W(e,p,I++,S,0,g,k,b,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,R,1)}g=k,b=Y,y=M,v=F,A=R}r.push(p);break}case wi:{let w=e.readInt(!0),p=new st(u,w,c),g=e.readFloat(),b=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,S=0;p.setFrame(A,g,b,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,b,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,b=k,y=Y,v=M}r.push(p);break}case pi:{let w=e.readInt(!0),p=new rt(u,w,c),g=e.readFloat(),b=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,b,y,v,A,S,I,k),Y!=x;Y++){let F=e.readFloat(),R=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,b,R,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,b=R,y=T,v=X,A=B,S=O,I=L,k=q}r.push(p);break}case yi:{let w=e.readInt(!0),p=new nt(u,w,c),g=e.readFloat(),b=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,b,y,v,A,S,I),k!=x;k++){let M=e.readFloat(),F=e.readUnsignedByte()/255,R=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,b,F,1),W(e,p,Y++,k,1,g,M,y,R,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,b=F,y=R,v=T,A=X,S=B,I=O}r.push(p);break}case vi:{let w=new it(u,e.readInt(!0),c),p=e.readFloat(),g=e.readUnsignedByte()/255;for(let b=0,y=0;w.setFrame(b,p,g),b!=x;b++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case he:w.setStepped(b);break;case ce:W(e,w,y++,b,0,p,v,g,A,1)}p=v,g=A}r.push(w)}}}}for(let a=0,l=e.readInt(!0);a<l;a++){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==gi){let w=new et(u,c);for(let p=0;p<u;p++)w.setFrame(p,e.readFloat(),e.readByte());r.push(w);continue}let x=e.readInt(!0);switch(m){case ni:r.push(Q(e,new ve(u,x,c),1));break;case ai:r.push(zt(e,new _e(u,x,c),i));break;case li:r.push(Q(e,new Ge(u,x,c),i));break;case oi:r.push(Q(e,new $e(u,x,c),i));break;case hi:r.push(zt(e,new He(u,x,c),1));break;case ci:r.push(Q(e,new je(u,x,c),1));break;case di:r.push(Q(e,new Je(u,x,c),1));break;case fi:r.push(zt(e,new Ke(u,x,c),1));break;case ui:r.push(Q(e,new Qe(u,x,c),1));break;case mi:r.push(Q(e,new Ze(u,x,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new lt(d,e.readInt(!0),c),u=e.readByte(),x=e.readFloat(),w=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,p=(u&4)!=0?e.readFloat()*i:0;for(let g=0,b=0;m.setFrame(g,x,w,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()*i:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(W(e,m,b++,g,0,x,y,w,v,1),W(e,m,b++,g,1,x,y,p,A,i)),x=y,w=v,p=A}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new ot(d,e.readInt(!0),c),u=e.readFloat(),x=e.readFloat(),w=e.readFloat(),p=e.readFloat(),g=e.readFloat(),b=e.readFloat(),y=e.readFloat();for(let v=0,A=0;m.setFrame(v,u,x,w,p,g,b,y),v!=f;v++){let S=e.readFloat(),I=e.readFloat(),k=e.readFloat(),Y=e.readFloat(),M=e.readFloat(),F=e.readFloat(),R=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,w,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,b,F,1),W(e,m,A++,v,5,u,S,y,R,1)}u=S,x=I,w=k,p=Y,g=M,b=F,y=R}r.push(m)}for(let a=0,l=e.readInt(!0);a<l;a++){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),w=e.readInt(!0);switch(u){case Ci:r.push(Q(e,new ht(x,w,c),d.positionMode==0?i:1));break;case Ii:r.push(Q(e,new ct(x,w,c),d.spacingMode==0||d.spacingMode==1?i:1));break;case Ti:let p=new dt(x,w,c),g=e.readFloat(),b=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,S=0,I=p.getFrameCount()-1;p.setFrame(A,g,b,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,b,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,b=Y,y=M,v=F}r.push(p)}}}for(let a=0,l=e.readInt(!0);a<l;a++){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==Pi){const w=new pt(u,c);for(let p=0;p<u;p++)w.setFrame(p,e.readFloat());r.push(w);continue}const x=e.readInt(!0);switch(m){case ki:r.push(Q(e,new ft(u,x,c),1));break;case Mi:r.push(Q(e,new ut(u,x,c),1));break;case Yi:r.push(Q(e,new mt(u,x,c),1));break;case Xi:r.push(Q(e,new gt(u,x,c),1));break;case Fi:r.push(Q(e,new xt(u,x,c),1));break;case Ri:r.push(Q(e,new bt(u,x,c),1));break;case Ei:r.push(Q(e,new wt(u,x,c),1))}}}for(let a=0,l=e.readInt(!0);a<l;a++){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 w=e.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let p=c.getAttachment(m,w),g=e.readByte(),b=e.readInt(!0),y=b-1;switch(g){case Ai:{let v=p,A=v.bones,S=v.vertices,I=A?S.length/3*2:S.length,k=e.readInt(!0),Y=new at(b,k,m,v),M=e.readFloat();for(let F=0,R=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,i==1)for(let L=O;L<X;L++)T[L]=e.readFloat();else for(let L=O;L<X;L++)T[L]=e.readFloat()*i;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,R++,F,0,M,B,0,1,1)}M=B}r.push(Y);break}case Si:{let v=new yt(b,m,p);for(let A=0;A<b;A++){let S=e.readFloat(),I=e.readInt32();v.setFrame(A,S,ss[I&15],I>>4,e.readFloat())}r.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let a=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,w=0;for(let p=0;p<f;p++){let g=e.readInt(!0);for(;x!=g;)u[w++]=x++;m[x+e.readInt(!0)]=x++}for(;x<l;)u[w++]=x++;for(let p=l-1;p>=0;p--)m[p]==-1&&(m[p]=u[--w]);a.setFrame(c,d,m)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=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()),a.setFrame(l,f)}r.push(a)}let n=0;for(let a=0,l=r.length;a<l;a++)n=Math.max(n,r[a].getDuration());return new Me(t,r,n)}},As=class{constructor(e,t=new Array,s=0,r=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let r=0;r<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(i),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},ii=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},ri=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function Q(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let h=0,o=0,n=t.getFrameCount()-1;t.setFrame(h,r,i),h!=n;h++){let a=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case he:t.setStepped(h);break;case ce:W(e,t,o++,h,0,r,a,i,l,s)}r=a,i=l}return t}function zt(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,h),o!=a;o++){let l=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case he:t.setStepped(o);break;case ce:W(e,t,n++,o,0,r,l,i,c,s),W(e,t,n++,o,1,r,l,h,d,s)}r=l,i=c,h=d}return t}function W(e,t,s,r,i,h,o,n,a,l){t.setBezier(s,r,i,h,n,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,a)}var ni=0,ai=1,li=2,oi=3,hi=4,ci=5,di=6,fi=7,ui=8,mi=9,gi=10,xi=0,bi=1,wi=2,pi=3,yi=4,vi=5,Ai=0,Si=1,Ci=0,Ii=1,Ti=2,ki=0,Mi=1,Yi=2,Xi=4,Fi=5,Ri=6,Ei=7,Pi=8,he=1,ce=2,Bi=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,r=this.polygons,i=this.polygonPool,h=e.slots,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n<o;n++){let a=h[n];if(!a.bone.active)continue;let l=a.getAttachment();if(l instanceof Ct){let c=l;s.push(c);let d=i.obtain();d.length!=c.worldVerticesLength&&(d=P.newFloatArray(c.worldVerticesLength)),r.push(d),c.computeWorldVertices(a,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,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let h=0,o=i.length;h<o;h++){let n=i[h],a=n;for(let l=0,c=n.length;l<c;l+=2){let d=a[l],f=a[l+1];e=Math.min(e,d),t=Math.min(t,f),s=Math.max(s,d),r=Math.max(r,f)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let i=this.minX,h=this.minY,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=h&&r<=h||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),l=a*(i-e)+t;if(l>h&&l<n||(l=a*(o-e)+t,l>h&&l<n))return!0;let c=(h-t)/a+e;return c>i&&c<o||(c=(n-t)/a+e,c>i&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],e,t))return this.boundingBoxes[r];return null}containsPointPolygon(e,t,s){let r=e,i=e.length,h=i-2,o=!1;for(let n=0;n<i;n+=2){let a=r[n+1],l=r[h+1];if(a<s&&l>=s||l<s&&a>=s){let c=r[n];c+(s-a)/(l-a)*(r[h]-c)<t&&(o=!o)}h=n}return o}intersectsSegment(e,t,s,r){let i=this.polygons;for(let h=0,o=i.length;h<o;h++)if(this.intersectsSegmentPolygon(i[h],e,t,s,r))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,r,i){let h=e,o=e.length,n=t-r,a=s-i,l=t*i-s*r,c=h[o-2],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,w=c-m,p=d-u,g=n*p-a*w,b=(l*w-n*x)/g;if((b>=c&&b<=m||b>=m&&b<=c)&&(b>=t&&b<=r||b>=r&&b<=t)){let y=(l*p-a*x)/g;if((y>=d&&y<=u||y>=u&&y<=d)&&(y>=s&&y<=i||y>=i&&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}},Ss=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,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n<r;n++)i[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=r;n<a;++n)h[n]=se.isConcave(n,r,s,i);let o=this.triangles;for(o.length=0;r>3;){let n=r-1,a=0,l=1;for(;;){e:if(!h[a]){let f=i[n]<<1,m=i[a]<<1,u=i[l]<<1,x=s[f],w=s[f+1],p=s[m],g=s[m+1],b=s[u],y=s[u+1];for(let v=(l+1)%r;v!=n;v=(v+1)%r){if(!h[v])continue;let A=i[v]<<1,S=s[A],I=s[A+1];if(se.positiveArea(b,y,x,w,S,I)&&se.positiveArea(x,w,p,g,S,I)&&se.positiveArea(p,g,b,y,S,I))break e}break}if(l==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=l,l=(l+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),h.splice(a,1),r--;let c=(r+a-1)%r,d=a==r?0:a;h[c]=se.isConcave(c,r,s,i),h[d]=se.isConcave(d,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(t,s){let r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,l=0;for(let c=0,d=s.length;c<d;c+=3){let f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,x=r[f],w=r[f+1],p=r[m],g=r[m+1],b=r[u],y=r[u+1],v=!1;if(a==f){let A=n.length-4,S=se.winding(n[A],n[A+1],n[A+2],n[A+3],b,y),I=se.winding(b,y,n[0],n[1],n[2],n[3]);S==l&&I==l&&(n.push(b),n.push(y),o.push(u),v=!0)}v||(n.length>0?(i.push(n),h.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(x),n.push(w),n.push(p),n.push(g),n.push(b),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(m),o.push(u),l=se.winding(x,w,p,g,b,y),a=f)}n.length>0&&(i.push(n),h.push(o));for(let c=0,d=i.length;c<d;c++){if(o=h[c],o.length==0)continue;let f=o[0],m=o[o.length-1];n=i[c];let u=n.length-4,x=n[u],w=n[u+1],p=n[u+2],g=n[u+3],b=n[0],y=n[1],v=n[2],A=n[3],S=se.winding(x,w,p,g,b,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],R=i[I],T=R[R.length-2],X=R[R.length-1];if(Y!=f||M!=m)continue;let B=se.winding(x,w,p,g,T,X),O=se.winding(T,X,b,y,v,A);B==S&&O==S&&(R.length=0,k.length=0,n.push(T),n.push(X),o.push(F),x=p,w=g,p=T,g=X,I=0)}}for(let c=i.length-1;c>=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let h=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,h,o){return t*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(t,s,r,i,h,o){let n=r-t,a=i-s;return h*a-o*n+n*s-t*a>=0?1:-1}},Vi=class Jt{triangulator=new Ss;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=P.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let h=this.clippingPolygon;Jt.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=o.length;n<a;n++){let l=o[n];Jt.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,s,r,i,h,o,n,a){let l,c,d,f,m,u;typeof s=="number"?(l=r,c=i,d=h,f=o,m=n,u=a):(l=s,c=r,d=i,f=h,m=o,u=n),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,l,c,d,f,m,u):this.clipTrianglesNoRender(t,l,c)}clipTrianglesNoRender(t,s,r){let i=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,l=0;h.length=0,o.length=0;for(let c=0;c<r;c+=3){let 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 w=t[d],p=t[d+1];for(let g=0;g<a;g++){let b=h.length;if(this.clip(f,m,u,x,w,p,n[g],i)){let y=i.length;if(y==0)continue;let v=y>>1,A=this.clipOutput,S=P.setArraySize(h,b+v*2);for(let k=0;k<y;k+=2,b+=2){let Y=A[k],M=A[k+1];S[b]=Y,S[b+1]=M}b=o.length;let I=P.setArraySize(o,b+3*(v-2));v--;for(let k=1;k<v;k++,b+=3)I[b]=l,I[b+1]=l+k,I[b+2]=l+k+1;l+=v+1}else{let y=P.setArraySize(h,b+6);y[b]=f,y[b+1]=m,y[b+2]=u,y[b+3]=x,y[b+4]=w,y[b+5]=p,b=o.length;let v=P.setArraySize(o,b+3);v[b]=l,v[b+1]=l+1,v[b+2]=l+2,l+=3;break}}}}clipTrianglesRender(t,s,r,i,h,o,n){let a=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=n?12:8,u=0;l.length=0,c.length=0;for(let x=0;x<r;x+=3){let w=s[x]<<1,p=t[w],g=t[w+1],b=i[w],y=i[w+1];w=s[x+1]<<1;let v=t[w],A=t[w+1],S=i[w],I=i[w+1];w=s[x+2]<<1;let k=t[w],Y=t[w+1],M=i[w],F=i[w+1];for(let R=0;R<f;R++){let T=l.length;if(this.clip(p,g,v,A,k,Y,d[R],a)){let X=a.length;if(X==0)continue;let B=A-Y,O=k-v,L=p-k,q=Y-g,$=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,ae=(B*Z+O*ee)*$,be=(q*Z+L*ee)*$,Ie=1-ae-be;V[T+6]=b*ae+S*be+M*Ie,V[T+7]=y*ae+I*be+F*Ie,n&&(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,n?(X[T+6]=b,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]=b,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,r,i){let h=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,l=this.clippingPolygons,c=l.length,d=0;o.length=0,n.length=0,a.length=0;for(let f=0;f<r;f+=3){let m=s[f]<<1,u=t[m],x=t[m+1],w=i[m],p=i[m+1];m=s[f+1]<<1;let g=t[m],b=t[m+1],y=i[m],v=i[m+1];m=s[f+2]<<1;let A=t[m],S=t[m+1],I=i[m],k=i[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(u,x,g,b,A,S,l[Y],h)){let F=h.length;if(F==0)continue;let R=b-S,T=A-g,X=u-A,B=S-x,O=1/(R*X+T*(x-S)),L=F>>1,q=this.clipOutput,$=P.setArraySize(o,M+L*2),_=P.setArraySize(n,M+L*2);for(let V=0;V<F;V+=2,M+=2){let U=q[V],G=q[V+1];$[M]=U,$[M+1]=G;let te=U-A,K=G-S,Z=(R*te+T*K)*O,ee=(B*te+X*K)*O,ae=1-Z-ee;_[M]=w*Z+y*ee+I*ae,_[M+1]=p*Z+v*ee+k*ae}M=a.length;let J=P.setArraySize(a,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]=b,F[M+4]=A,F[M+5]=S;let R=P.setArraySize(n,M+3*2);R[M]=w,R[M+1]=p,R[M+2]=y,R[M+3]=v,R[M+4]=I,R[M+5]=k,M=a.length;let T=P.setArraySize(a,M+3);T[M]=d,T[M+1]=d+1,T[M+2]=d+2,d+=3;break}}}}clip(t,s,r,i,h,o,n,a){let l=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(t),d.push(s),d.push(r),d.push(i),d.push(h),d.push(o),d.push(t),d.push(s),a.length=0;let f=n.length-4,m=n;for(let u=0;;u+=2){let x=m[u],w=m[u+1],p=x-m[u+2],g=w-m[u+3],b=a.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*(w-M),R=g*(x-I)-p*(w-k);if(R>0){if(F){a.push(Y),a.push(M);continue}let T=Y-I,X=M-k,B=R/(T*g-X*p);if(B>=0&&B<=1)a.push(I+T*B),a.push(k+X*B);else{a.push(Y),a.push(M);continue}}else if(F){let T=Y-I,X=M-k,B=R/(T*g-X*p);if(B>=0&&B<=1)a.push(I+T*B),a.push(k+X*B),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(b==a.length)return l.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==f)break;let v=a;a=d,a.length=0,d=v}if(l!=a){l.length=0;for(let u=0,x=a.length-2;u<x;u++)l[u]=a[u]}else l.length=l.length-2;return c}static makeClockwise(t){let s=t,r=t.length,i=s[r-2]*s[1]-s[0]*s[r-1],h=0,o=0,n=0,a=0;for(let l=0,c=r-3;l<c;l+=2)h=s[l],o=s[l+1],n=s[l+2],a=s[l+3],i+=h*a-n*o;if(!(i<0))for(let l=0,c=r-2,d=r>>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}}},Li=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Nt,r=typeof e=="string"?JSON.parse(e):e,i=r.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=C(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),r.bones)for(let h=0;h<r.bones.length;h++){let o=r.bones[h],n=null,a=C(o,"parent",null);a&&(n=s.findBone(a));let l=new Yt(s.bones.length,o.name,n);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(r.slots)for(let h=0;h<r.slots.length;h++){let o=r.slots[h],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let l=new qt(s.slots.length,n,a),c=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(Ut,C(o,"blend","normal")),l.visible=C(o,"visible",!0),s.slots.push(l)}if(r.ik)for(let h=0;h<r.ik.length;h++){let o=r.ik[h],n=new Pt(o.name);n.order=C(o,"order",0),n.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}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=C(o,"mix",1),n.softness=C(o,"softness",0)*t,n.bendDirection=C(o,"bendPositive",!0)?1:-1,n.compress=C(o,"compress",!1),n.stretch=C(o,"stretch",!1),n.uniform=C(o,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let h=0;h<r.transform.length;h++){let o=r.transform[h],n=new Wt(o.name);n.order=C(o,"order",0),n.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}.`);n.bones.push(f)}let a=o.target,l=s.findBone(a);if(!l)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=l,n.local=C(o,"local",!1),n.relative=C(o,"relative",!1),n.offsetRotation=C(o,"rotation",0),n.offsetX=C(o,"x",0)*t,n.offsetY=C(o,"y",0)*t,n.offsetScaleX=C(o,"scaleX",0),n.offsetScaleY=C(o,"scaleY",0),n.offsetShearY=C(o,"shearY",0),n.mixRotate=C(o,"mixRotate",1),n.mixX=C(o,"mixX",1),n.mixY=C(o,"mixY",n.mixX),n.mixScaleX=C(o,"mixScaleX",1),n.mixScaleY=C(o,"mixScaleY",n.mixScaleX),n.mixShearY=C(o,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let h=0;h<r.path.length;h++){let o=r.path[h],n=new Bt(o.name);n.order=C(o,"order",0),n.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}.`);n.bones.push(f)}let a=o.target,l=s.findSlot(a);if(!l)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=l,n.positionMode=P.enumValue(Vt,C(o,"positionMode","Percent")),n.spacingMode=P.enumValue(Lt,C(o,"spacingMode","Length")),n.rotateMode=P.enumValue(Dt,C(o,"rotateMode","Tangent")),n.offsetRotation=C(o,"rotation",0),n.position=C(o,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=C(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=C(o,"mixRotate",1),n.mixX=C(o,"mixX",1),n.mixY=C(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let h=0;h<r.physics.length;h++){const o=r.physics[h],n=new vs(o.name);n.order=C(o,"order",0),n.skinRequired=C(o,"skin",!1);const a=o.bone,l=s.findBone(a);if(l==null)throw new Error("Physics bone not found: "+a);n.bone=l,n.x=C(o,"x",0),n.y=C(o,"y",0),n.rotate=C(o,"rotate",0),n.scaleX=C(o,"scaleX",0),n.shearX=C(o,"shearX",0),n.limit=C(o,"limit",5e3)*t,n.step=1/C(o,"fps",60),n.inertia=C(o,"inertia",1),n.strength=C(o,"strength",100),n.damping=C(o,"damping",1),n.massInverse=1/C(o,"mass",1),n.wind=C(o,"wind",0),n.gravity=C(o,"gravity",0),n.mix=C(o,"mix",1),n.inertiaGlobal=C(o,"inertiaGlobal",!1),n.strengthGlobal=C(o,"strengthGlobal",!1),n.dampingGlobal=C(o,"dampingGlobal",!1),n.massGlobal=C(o,"massGlobal",!1),n.windGlobal=C(o,"windGlobal",!1),n.gravityGlobal=C(o,"gravityGlobal",!1),n.mixGlobal=C(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let h=0;h<r.skins.length;h++){let o=r.skins[h],n=new Be(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let l=o.bones[a],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let l=o.ik[a],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let l=o.transform[a],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let l=o.path[a],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let l=o.physics[a],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let l=s.findSlot(a);if(!l)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let d in c){let f=this.readAttachment(c[d],n,l.index,d,s);f&&n.setAttachment(l.index,d,f)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let l=a.getAttachment(n.slotIndex,n.parent);if(!l)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?l:n.mesh,n.mesh.setParentMesh(l),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let h in r.events){let o=r.events[h],n=new Et(h);n.intValue=C(o,"int",0),n.floatValue=C(o,"float",0),n.stringValue=C(o,"string",""),n.audioPath=C(o,"audio",null),n.audioPath&&(n.volume=C(o,"volume",1),n.balance=C(o,"balance",0)),s.events.push(n)}if(r.animations)for(let h in r.animations){let o=r.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,r,i){let h=this.scale;switch(r=C(e,"name",r),C(e,"type","region")){case"region":{let o=C(e,"path",r),n=this.readSequence(C(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,r,o,n);if(!a)return null;a.path=o,a.x=C(e,"x",0)*h,a.y=C(e,"y",0)*h,a.scaleX=C(e,"scaleX",1),a.scaleY=C(e,"scaleY",1),a.rotation=C(e,"rotation",0),a.width=e.width*h,a.height=e.height*h,a.sequence=n;let l=C(e,"color",null);return l&&a.color.setFromString(l),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,r);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let n=C(e,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=C(e,"path",r),n=this.readSequence(C(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,r,o,n);if(!a)return null;a.path=o;let l=C(e,"color",null);l&&a.color.setFromString(l),a.width=C(e,"width",0)*h,a.height=C(e,"height",0)*h,a.sequence=n;let c=C(e,"parent",null);if(c)return this.linkedMeshes.push(new Di(a,C(e,"skin",null),s,c,C(e,"timelines",!0))),a;let d=e.uvs;return this.readVertices(e,a,d.length),a.triangles=e.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=C(e,"edges",null),a.hullLength=C(e,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(t,r);if(!o)return null;o.closed=C(e,"closed",!1),o.constantSpeed=C(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,o,n<<1);let a=P.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*h;o.lengths=a;let l=C(e,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,r);if(!o)return null;o.x=C(e,"x",0)*h,o.y=C(e,"y",0)*h,o.rotation=C(e,"rotation",0);let n=C(e,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,r);if(!o)return null;let n=C(e,"end",null);n&&(o.endSlot=i.findSlot(n));let a=e.vertexCount;this.readVertices(e,o,a<<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 es(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 r=this.scale;t.worldVerticesLength=s;let i=e.vertices;if(s==i.length){let n=P.toFloatArray(i);if(r!=1)for(let a=0,l=i.length;a<l;a++)n[a]*=r;t.vertices=n;return}let h=new Array,o=new Array;for(let n=0,a=i.length;n<a;){let l=i[n++];o.push(l);for(let c=n+l*4;n<c;n+=4)o.push(i[n]),h.push(i[n+1]*r),h.push(i[n+2]*r),h.push(i[n+3])}t.bones=o,t.vertices=P.toFloatArray(h)}readAnimation(e,t,s){let r=this.scale,i=new Array;if(e.slots)for(let o in e.slots){let n=e.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let l=a.index;for(let c in n){let d=n[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))}i.push(m)}else if(c=="rgba"){let m=new tt(f,f<<2,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,x,w.r,w.g,w.b,w.a);let b=d[p+1];if(!b){m.shrink(g);break}let y=C(b,"time",0),v=D.fromString(b.color),A=u.curve;A&&(g=z(A,m,g,p,0,x,y,w.r,v.r,1),g=z(A,m,g,p,1,x,y,w.g,v.g,1),g=z(A,m,g,p,2,x,y,w.b,v.b,1),g=z(A,m,g,p,3,x,y,w.a,v.a,1)),x=y,w=v,u=b}i.push(m)}else if(c=="rgb"){let m=new st(f,f*3,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.color);for(let p=0,g=0;;p++){m.setFrame(p,x,w.r,w.g,w.b);let b=d[p+1];if(!b){m.shrink(g);break}let y=C(b,"time",0),v=D.fromString(b.color),A=u.curve;A&&(g=z(A,m,g,p,0,x,y,w.r,v.r,1),g=z(A,m,g,p,1,x,y,w.g,v.g,1),g=z(A,m,g,p,2,x,y,w.b,v.b,1)),x=y,w=v,u=b}i.push(m)}else if(c=="alpha")i.push(ne(d,new it(f,f,l),0,1));else if(c=="rgba2"){let m=new rt(f,f*7,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.light),p=D.fromString(u.dark);for(let g=0,b=0;;g++){m.setFrame(g,x,w.r,w.g,w.b,w.a,p.r,p.g,p.b);let y=d[g+1];if(!y){m.shrink(b);break}let v=C(y,"time",0),A=D.fromString(y.light),S=D.fromString(y.dark),I=u.curve;I&&(b=z(I,m,b,g,0,x,v,w.r,A.r,1),b=z(I,m,b,g,1,x,v,w.g,A.g,1),b=z(I,m,b,g,2,x,v,w.b,A.b,1),b=z(I,m,b,g,3,x,v,w.a,A.a,1),b=z(I,m,b,g,4,x,v,p.r,S.r,1),b=z(I,m,b,g,5,x,v,p.g,S.g,1),b=z(I,m,b,g,6,x,v,p.b,S.b,1)),x=v,w=A,p=S,u=y}i.push(m)}else if(c=="rgb2"){let m=new nt(f,f*6,l),u=d[0],x=C(u,"time",0),w=D.fromString(u.light),p=D.fromString(u.dark);for(let g=0,b=0;;g++){m.setFrame(g,x,w.r,w.g,w.b,p.r,p.g,p.b);let y=d[g+1];if(!y){m.shrink(b);break}let v=C(y,"time",0),A=D.fromString(y.light),S=D.fromString(y.dark),I=u.curve;I&&(b=z(I,m,b,g,0,x,v,w.r,A.r,1),b=z(I,m,b,g,1,x,v,w.g,A.g,1),b=z(I,m,b,g,2,x,v,w.b,A.b,1),b=z(I,m,b,g,3,x,v,p.r,S.r,1),b=z(I,m,b,g,4,x,v,p.g,S.g,1),b=z(I,m,b,g,5,x,v,p.b,S.b,1)),x=v,w=A,p=S,u=y}i.push(m)}}}if(e.bones)for(let o in e.bones){let n=e.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let l=a.index;for(let c in n){let d=n[c],f=d.length;if(f!=0){if(c==="rotate")i.push(ne(d,new ve(f,f,l),0,1));else if(c==="translate"){let m=new _e(f,f<<1,l);i.push(_t(d,m,"x","y",0,r))}else if(c==="translatex"){let m=new Ge(f,f,l);i.push(ne(d,m,0,r))}else if(c==="translatey"){let m=new $e(f,f,l);i.push(ne(d,m,0,r))}else if(c==="scale"){let m=new He(f,f<<1,l);i.push(_t(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new je(f,f,l);i.push(ne(d,m,1,1))}else if(c==="scaley"){let m=new Je(f,f,l);i.push(ne(d,m,1,1))}else if(c==="shear"){let m=new Ke(f,f<<1,l);i.push(_t(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Qe(f,f,l);i.push(ne(d,m,0,1))}else if(c==="sheary"){let m=new Ze(f,f,l);i.push(ne(d,m,0,1))}else if(c==="inherit"){let m=new et(f,a.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")))}i.push(m)}}}}if(e.ik)for(let o in e.ik){let n=e.ik[o],a=n[0];if(!a)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),d=new lt(n.length,n.length<<1,c),f=C(a,"time",0),m=C(a,"mix",1),u=C(a,"softness",0)*r;for(let x=0,w=0;;x++){d.setFrame(x,f,m,u,C(a,"bendPositive",!0)?1:-1,C(a,"compress",!1),C(a,"stretch",!1));let p=n[x+1];if(!p){d.shrink(w);break}let g=C(p,"time",0),b=C(p,"mix",1),y=C(p,"softness",0)*r,v=a.curve;v&&(w=z(v,d,w,x,0,f,g,m,b,1),w=z(v,d,w,x,1,f,g,u,y,r)),f=g,m=b,u=y,a=p}i.push(d)}if(e.transform)for(let o in e.transform){let n=e.transform[o],a=n[0];if(!a)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),d=new ot(n.length,n.length*6,c),f=C(a,"time",0),m=C(a,"mixRotate",1),u=C(a,"mixX",1),x=C(a,"mixY",u),w=C(a,"mixScaleX",1),p=C(a,"mixScaleY",w),g=C(a,"mixShearY",1);for(let b=0,y=0;;b++){d.setFrame(b,f,m,u,x,w,p,g);let v=n[b+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),R=a.curve;R&&(y=z(R,d,y,b,0,f,A,m,S,1),y=z(R,d,y,b,1,f,A,u,I,1),y=z(R,d,y,b,2,f,A,x,k,1),y=z(R,d,y,b,3,f,A,w,Y,1),y=z(R,d,y,b,4,f,A,p,M,1),y=z(R,d,y,b,5,f,A,g,F,1)),f=A,m=S,u=I,x=k,w=Y,p=M,w=Y,a=v}i.push(d)}if(e.path)for(let o in e.path){let n=e.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new ht(m,m,l);i.push(ne(d,u,0,a.positionMode==0?r:1))}else if(c==="spacing"){let u=new ct(m,m,l);i.push(ne(d,u,0,a.spacingMode==0||a.spacingMode==1?r:1))}else if(c==="mix"){let u=new dt(m,m*3,l),x=C(f,"time",0),w=C(f,"mixRotate",1),p=C(f,"mixX",1),g=C(f,"mixY",p);for(let b=0,y=0;;b++){u.setFrame(b,x,w,p,g);let v=d[b+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,b,0,x,A,w,S,1),y=z(Y,u,y,b,1,x,A,p,I,1),y=z(Y,u,y,b,2,x,A,g,k,1)),x=A,w=S,p=I,g=k,f=v}i.push(u)}}}if(e.physics)for(let o in e.physics){let n=e.physics[o],a=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(l)}for(let l in n){let c=n[l],d=c[0];if(!d)continue;let f=c.length;if(l=="reset"){const u=new pt(f,a);for(let x=0;d!=null;d=c[x+1],x++)u.setFrame(x,C(d,"time",0));i.push(u);continue}let m;if(l=="inertia")m=new ft(f,f,a);else if(l=="strength")m=new ut(f,f,a);else if(l=="damping")m=new mt(f,f,a);else if(l=="mass")m=new gt(f,f,a);else if(l=="wind")m=new xt(f,f,a);else if(l=="gravity")m=new bt(f,f,a);else if(l=="mix")m=new wt(f,f,a);else continue;i.push(ne(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let l in n){let c=n[l],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=a.getAttachment(f,m);for(let w in u){let p=u[w],g=p[0];if(g){if(w=="deform"){let b=x.bones,y=x.vertices,v=b?y.length/3*2:y.length,A=new at(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=b?P.newFloatArray(v):y;else{Y=P.newFloatArray(v);let X=C(g,"offset",0);if(P.arrayCopy(M,0,Y,X,M.length),r!=1)for(let B=X,O=B+M.length;B<O;B++)Y[B]*=r;if(!b)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 R=C(F,"time",0),T=g.curve;T&&(k=z(T,A,k,I,0,S,R,0,1,1)),S=R,g=F}i.push(A)}else if(w=="sequence"){let b=new yt(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=ts[C(g,"mode","hold")],k=C(g,"index",0);b.setFrame(v,S,I,k,A),y=A,g=p[v+1]}i.push(b)}}}}}}if(e.drawOrder){let o=new xe(e.drawOrder.length),n=s.slots.length,a=0;for(let l=0;l<e.drawOrder.length;l++,a++){let c=e.drawOrder[l],d=null,f=C(c,"offsets",null);if(f){d=P.newArray(n,-1);let m=P.newArray(n-f.length,0),u=0,x=0;for(let w=0;w<f.length;w++){let p=f[w],g=s.findSlot(p.slot);if(!g)throw new Error("Slot not found: "+g);let b=g.index;for(;u!=b;)m[x++]=u++;d[u+p.offset]=u++}for(;u<n;)m[x++]=u++;for(let w=n-1;w>=0;w--)d[w]==-1&&(d[w]=m[--x])}o.setFrame(a,C(c,"time",0),d)}i.push(o)}if(e.events){let o=new Xe(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let l=e.events[a],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let 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(n,d)}i.push(o)}let h=0;for(let o=0,n=i.length;o<n;o++)h=Math.max(h,i[o].getDuration());s.animations.push(new Me(t,i,h))}},Di=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}};function ne(e,t,s,r){let i=e[0],h=C(i,"time",0),o=C(i,"value",s)*r,n=0;for(let a=0;;a++){t.setFrame(a,h,o);let l=e[a+1];if(!l)return t.shrink(n),t;let c=C(l,"time",0),d=C(l,"value",s)*r;i.curve&&(n=z(i.curve,t,n,a,0,h,c,o,d,r)),h=c,o=d,i=l}}function _t(e,t,s,r,i,h){let o=e[0],n=C(o,"time",0),a=C(o,s,i)*h,l=C(o,r,i)*h,c=0;for(let d=0;;d++){t.setFrame(d,n,a,l);let f=e[d+1];if(!f)return t.shrink(c),t;let m=C(f,"time",0),u=C(f,s,i)*h,x=C(f,r,i)*h,w=o.curve;w&&(c=z(w,t,c,d,0,n,m,a,u,h),c=z(w,t,c,d,1,n,m,l,x,h)),n=m,a=u,l=x,o=f}}function z(e,t,s,r,i,h,o,n,a,l){if(e=="stepped")return t.setStepped(r),s;let c=i<<2,d=e[c],f=e[c+1]*l,m=e[c+2],u=e[c+3]*l;return t.setBezier(s,r,i,h,n,d,f,m,u,o,a),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 Cs=class extends Tt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Ni=class extends ms{constructor(e="",t=new Ft){super(s=>new Cs(s),e,t)}},Oi=P.newFloatArray(8),qi=class qe{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,r=this.tempColor,i=t.color,h=t.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,n=h.length;o<n;o++){let a=h[o],l=a.bone;if(!l.active)continue;let c=a.getAttachment();if(!(c instanceof H))continue;c.computeWorldVertices(a,Oi,0,2);let d=c.region,f=d.texture.getImage(),m=a.color,u=c.color;r.set(i.r*m.r*u.r,i.g*m.g*u.g,i.b*m.b*u.b,i.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 w=d.width,p=d.height;if(s.translate(w/2,p/2),c.region.degrees==90){let g=w;w=p,p=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-w/2,-p/2),s.globalAlpha=r.a,s.drawImage(f,f.width*d.u,f.height*d.v,w,p,0,0,w,p),this.debugRendering&&s.strokeRect(0,0,w,p),s.restore()}}drawTriangles(t){let s=this.ctx,r=this.tempColor,i=t.color,h=t.drawOrder,o=null,n=this.vertices,a=null;for(let c=0,d=h.length;c<d;c++){let f=h[c],m=f.getAttachment(),u,x;if(m instanceof H){let w=m;n=this.computeRegionVertices(f,w,!1),a=qe.QUAD_TRIANGLES,u=w.region.texture.getImage()}else if(m instanceof Ae){let w=m;n=this.computeMeshVertices(f,w,!1),a=w.triangles,u=w.region.texture.getImage()}else continue;if(u){f.data.blendMode!=o&&(o=f.data.blendMode);let w=f.color,p=m.color;r.set(i.r*w.r*p.r,i.g*w.g*p.g,i.b*w.b*p.b,i.a*w.a*p.a),s.globalAlpha=r.a;for(var l=0;l<a.length;l+=3){let g=a[l]*8,b=a[l+1]*8,y=a[l+2]*8,v=n[g],A=n[g+1],S=n[g+6],I=n[g+7],k=n[b],Y=n[b+1],M=n[b+6],F=n[b+7],R=n[y],T=n[y+1],X=n[y+6],B=n[y+7];this.drawTriangle(u,v,A,S,I,k,Y,M,F,R,T,X,B),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,A),s.lineTo(k,Y),s.lineTo(R,T),s.lineTo(v,A),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,s,r,i,h,o,n,a,l,c,d,f,m){let u=this.ctx;const x=t.width-1,w=t.height-1;i*=x,h*=w,a*=x,l*=w,f*=x,m*=w,u.beginPath(),u.moveTo(s,r),u.lineTo(o,n),u.lineTo(c,d),u.closePath(),o-=s,n-=r,c-=s,d-=r,a-=i,l-=h,f-=i,m-=h;let p=a*m-f*l;if(p==0)return;p=1/p;const g=(m*o-l*c)*p,b=(m*n-l*d)*p,y=(a*c-f*o)*p,v=(a*d-f*n)*p,A=s-g*i-y*h,S=r-b*i-v*h;u.save(),u.transform(g,b,y,v,A,S),u.clip(),u.drawImage(t,0,0),u.restore()}computeRegionVertices(t,s,r){let i=t.bone.skeleton.color,h=t.color,o=s.color,n=i.a*h.a*o.a,a=r?n:1,l=this.tempColor;l.set(i.r*h.r*o.r*a,i.g*h.g*o.g*a,i.b*h.b*o.b*a,n),s.computeWorldVertices(t,this.vertices,0,qe.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[H.C1R]=l.r,c[H.C1G]=l.g,c[H.C1B]=l.b,c[H.C1A]=l.a,c[H.U1]=d[0],c[H.V1]=d[1],c[H.C2R]=l.r,c[H.C2G]=l.g,c[H.C2B]=l.b,c[H.C2A]=l.a,c[H.U2]=d[2],c[H.V2]=d[3],c[H.C3R]=l.r,c[H.C3G]=l.g,c[H.C3B]=l.b,c[H.C3A]=l.a,c[H.U3]=d[4],c[H.V3]=d[5],c[H.C4R]=l.r,c[H.C4G]=l.g,c[H.C4B]=l.b,c[H.C4A]=l.a,c[H.U4]=d[6],c[H.V4]=d[7],c}computeMeshVertices(t,s,r){let i=t.bone.skeleton.color,h=t.color,o=s.color,n=i.a*h.a*o.a,a=r?n:1,l=this.tempColor;l.set(i.r*h.r*o.r*a,i.g*h.g*o.g*a,i.b*h.b*o.b*a,n);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,qe.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 Ws(Kt)})();
|