@esotericsoftware/spine-canvas 4.2.32 → 4.2.34

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 Re=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,Bs=Object.getOwnPropertyNames,Vs=Object.prototype.hasOwnProperty,Ls=(e,t,s)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ds=(e,t)=>{for(var s in t)Re(e,s,{get:t[s],enumerable:!0})},Os=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Bs(t))!Vs.call(e,a)&&a!==s&&Re(e,a,{get:()=>t[a],enumerable:!(i=Ps(t,a))||i.enumerable});return e},Ns=e=>Os(Re({},"__esModule",{value:!0}),e),B=(e,t,s)=>(Ls(e,typeof t!="symbol"?t+"":t,s),s),Gt={};Ds(Gt,{AlphaTimeline:()=>ft,Animation:()=>Ve,AnimationState:()=>cs,AnimationStateAdapter:()=>Gs,AnimationStateData:()=>Hs,AssetManager:()=>Pr,AssetManagerBase:()=>ys,AtlasAttachmentLoader:()=>Js,Attachment:()=>Ze,AttachmentTimeline:()=>we,BinaryInput:()=>Ts,BlendMode:()=>$e,Bone:()=>Xt,BoneData:()=>Mt,BoundingBoxAttachment:()=>_e,CURRENT:()=>ms,CanvasTexture:()=>Ys,ClippingAttachment:()=>It,Color:()=>O,ConstraintData:()=>Fe,CurveTimeline:()=>le,CurveTimeline1:()=>se,CurveTimeline2:()=>Le,DebugUtils:()=>Us,DeformTimeline:()=>gt,Downloader:()=>Ft,DrawOrderTimeline:()=>pe,Event:()=>Et,EventData:()=>Rt,EventQueue:()=>fs,EventTimeline:()=>Xe,EventType:()=>ee,FIRST:()=>St,FakeTexture:()=>$s,HOLD_FIRST:()=>Ne,HOLD_MIX:()=>us,HOLD_SUBSEQUENT:()=>At,IkConstraint:()=>vs,IkConstraintData:()=>Pt,IkConstraintTimeline:()=>xt,IntSet:()=>_s,Interpolation:()=>Ht,MathUtils:()=>X,MeshAttachment:()=>ye,MixBlend:()=>Qt,MixDirection:()=>Zt,PathAttachment:()=>Ae,PathConstraint:()=>Ce,PathConstraintData:()=>Bt,PathConstraintMixTimeline:()=>yt,PathConstraintPositionTimeline:()=>wt,PathConstraintSpacingTimeline:()=>pt,Physics:()=>ks,PhysicsConstraintDampingTimeline:()=>is,PhysicsConstraintGravityTimeline:()=>ls,PhysicsConstraintInertiaTimeline:()=>ss,PhysicsConstraintMassTimeline:()=>as,PhysicsConstraintMixTimeline:()=>os,PhysicsConstraintResetTimeline:()=>vt,PhysicsConstraintStrengthTimeline:()=>rs,PhysicsConstraintTimeline:()=>fe,PhysicsConstraintWindTimeline:()=>ns,PointAttachment:()=>Yt,Pool:()=>Ye,PositionMode:()=>We,Pow:()=>$t,PowOut:()=>qs,RGB2Timeline:()=>mt,RGBA2Timeline:()=>ut,RGBATimeline:()=>ct,RGBTimeline:()=>dt,RegionAttachment:()=>V,RotateMode:()=>Ge,RotateTimeline:()=>Me,SETUP:()=>Ct,SUBSEQUENT:()=>Oe,ScaleTimeline:()=>it,ScaleXTimeline:()=>at,ScaleYTimeline:()=>nt,SequenceTimeline:()=>Se,ShearTimeline:()=>lt,ShearXTimeline:()=>ot,ShearYTimeline:()=>ht,Skeleton:()=>Is,SkeletonBinary:()=>Zs,SkeletonBounds:()=>Fr,SkeletonClipping:()=>_t,SkeletonData:()=>Vt,SkeletonJson:()=>Er,SkeletonRenderer:()=>Ut,Skin:()=>He,SkinEntry:()=>Lt,Slot:()=>Ss,SlotData:()=>Dt,SpacingMode:()=>ze,StringSet:()=>Qe,Texture:()=>kt,TextureAtlas:()=>bs,TextureAtlasPage:()=>ws,TextureAtlasRegion:()=>Tt,TextureFilter:()=>qe,TextureRegion:()=>xs,TextureWrap:()=>gs,TimeKeeper:()=>Ws,Timeline:()=>J,TrackEntry:()=>ds,TransformConstraint:()=>As,TransformConstraintData:()=>Ot,TransformConstraintTimeline:()=>bt,TransformMode:()=>Ue,TranslateTimeline:()=>tt,TranslateXTimeline:()=>st,TranslateYTimeline:()=>rt,Triangulator:()=>te,Utils:()=>R,Vector2:()=>Pe,VertexAttachment:()=>ne,WindowedMean:()=>zs});var _s=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Qe=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}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 i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},X=ae;B(X,"PI",3.1415927),B(X,"PI2",ae.PI*2),B(X,"invPI2",1/ae.PI2),B(X,"radiansToDegrees",180/ae.PI),B(X,"radDeg",ae.radiansToDegrees),B(X,"degreesToRadians",ae.PI/180),B(X,"degRad",ae.degreesToRadians);var Ht=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},$t=class extends Ht{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}},qs=class extends $t{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,i,a){for(let h=t,o=i;h<t+a;h++,o++)s[o]=e[h]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:ve.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(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 i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=ve;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Us=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}},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}},Ws=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)}},zs=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}},jt=class extends Ze{id=jt.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,h){s=a+(s>>1)*h;let o=e.bone.skeleton,r=e.deform,l=this.vertices,n=this.bones;if(!n){r.length>0&&(l=r);let u=e.bone,m=u.worldX,g=u.worldY,p=u.a,w=u.b,x=u.c,b=u.d;for(let v=t,y=a;y<s;v+=2,y+=h){let S=l[v],A=l[v+1];i[y]=S*p+A*w+m,i[y+1]=S*x+A*b+g}return}let c=0,f=0;for(let u=0;u<t;u+=2){let m=n[c];c+=m+1,f+=m}let d=o.bones;if(r.length==0)for(let u=a,m=f*3;u<s;u+=h){let g=0,p=0,w=n[c++];for(w+=c;c<w;c++,m+=3){let x=d[n[c]],b=l[m],v=l[m+1],y=l[m+2];g+=(b*x.a+v*x.b+x.worldX)*y,p+=(b*x.c+v*x.d+x.worldY)*y}i[u]=g,i[u+1]=p}else{let u=r;for(let m=a,g=f*3,p=f<<1;m<s;m+=h){let w=0,x=0,b=n[c++];for(b+=c;c<b;c++,g+=3,p+=2){let v=d[n[c]],y=l[g]+u[p],S=l[g+1]+u[p+1],A=l[g+2];w+=(y*v.a+S*v.b+v.worldX)*A,x+=(y*v.c+S*v.d+v.worldY)*A}i[m]=w,i[m+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ne=jt;B(ne,"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 R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Be._nextID++}},et=Be;B(et,"_nextID",0);var Jt=(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))(Jt||{}),Kt=[0,1,2,3,4,5,6],Ve=class{name;timelines=[];timelineIds=new Qe;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,a,h,o,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let n=0,c=l.length;n<c;n++)l[n].apply(e,t,s,a,h,o,r)}},Qt=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Qt||{}),Zt=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Zt||{}),_={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,physicsConstraintInertia:19,physicsConstraintStrength:20,physicsConstraintDamping:21,physicsConstraintMass:22,physicsConstraintWind:23,physicsConstraintGravity:24,physicsConstraintMix:25,physicsConstraintReset:26,sequence:27},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},le=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,h,o,r,l,n,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-h*2+r)*.03,m=(a-o*2+l)*.03,g=((h-r)*3-i+n)*.006,p=((o-l)*3-a+c)*.006,w=u*2+g,x=m*2+p,b=(h-i)*.3+u+g*.16666667,v=(o-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let A=d+18;d<A;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=x,w+=g,x+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let l=this.frames[t],n=this.frames[t+s];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}let h=i+18;for(i+=2;i<h;i+=2)if(a[i]>=e){let l=a[i-2],n=a[i-1];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}t+=this.getFrameEntries();let o=a[h-2],r=a[h-1];return r+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-r)}},se=class extends le{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],h=t[s+1];return h+(e-a)/(t[s+2]-a)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return a+h*t;case 1:case 2:h+=a-i}return i+h*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let h=this.getCurveValue(e);return s==0?a+(h-a)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,a,h){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(h-a)*t:i+(h-i)*t}getScaleValue(e,t,s,i,a,h){const o=this.frames;if(e<o[0]){switch(s){case 0:return h;case 1:return a+(h-a)*t}return a}let r=this.getCurveValue(e)*h;if(t==1)return s==3?a+r-h:r;if(i==1)switch(s){case 0:return h+(Math.abs(r)*X.signum(h)-h)*t;case 1:case 2:return a+(Math.abs(r)*X.signum(a)-a)*t}else{let l=0;switch(s){case 0:return l=Math.abs(h)*X.signum(r),l+(r-l)*t;case 1:case 2:return l=Math.abs(a)*X.signum(r),l+(r-l)*t}}return a+(r-h)*t}},Le=class extends le{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Me=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,h,r.rotation,r.data.rotation))}},tt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,c=0,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,c+=(l[f+3+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:r.x=r.data.x+n*a,r.y=r.data.y+c*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+c-r.y)*a;break;case 3:r.x+=n*a,r.y+=c*a}}},st=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,h,r.x,r.data.x))}},rt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,h,r.y,r.data.y))}},it=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,c,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,c+=(l[f+3+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}if(n*=r.data.scaleX,c*=r.data.scaleY,a==1)h==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=n,r.scaleY=c);else{let u=0,m=0;if(o==1)switch(h){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*a;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(c-r.data.scaleY)*a}else switch(h){case 0:u=Math.abs(r.data.scaleX)*X.signum(n),m=Math.abs(r.data.scaleY)*X.signum(c),r.scaleX=u+(n-u)*a,r.scaleY=m+(c-m)*a;break;case 1:case 2:u=Math.abs(r.scaleX)*X.signum(n),m=Math.abs(r.scaleY)*X.signum(c),r.scaleX=u+(n-u)*a,r.scaleY=m+(c-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(c-r.data.scaleY)*a}}}},at=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,h,o,r.scaleX,r.data.scaleX))}},nt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,h,o,r.scaleX,r.data.scaleY))}},lt=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,c=0,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,c+=(l[f+3+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}switch(h){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+c*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+c-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=c*a}}},ot=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,h,r.shearX,r.data.shearX))}},ht=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,h,o){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,h,r.shearX,r.data.shearY))}},ct=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,a,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let p=r.data.color;switch(h){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let c=0,f=0,d=0,u=0,m=J.search(l,s,5),g=this.curves[m/5];switch(g){case 0:let p=l[m];c=l[m+1],f=l[m+2],d=l[m+3],u=l[m+4];let w=(s-p)/(l[m+5]-p);c+=(l[m+5+1]-c)*w,f+=(l[m+5+2]-f)*w,d+=(l[m+5+3]-d)*w,u+=(l[m+5+4]-u)*w;break;case 1:c=l[m+1],f=l[m+2],d=l[m+3],u=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),f=this.getBezierValue(s,m,2,g+18-2),d=this.getBezierValue(s,m,3,g+18*2-2),u=this.getBezierValue(s,m,4,g+18*3-2)}a==1?n.set(c,f,d,u):(h==0&&n.setFromColor(r.data.color),n.add((c-n.r)*a,(f-n.g)*a,(d-n.b)*a,(u-n.a)*a))}},dt=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let g=r.data.color;switch(h){case 0:n.r=g.r,n.g=g.g,n.b=g.b;return;case 1:n.r+=(g.r-n.r)*a,n.g+=(g.g-n.g)*a,n.b+=(g.b-n.b)*a}return}let c=0,f=0,d=0,u=J.search(l,s,4),m=this.curves[u>>2];switch(m){case 0:let g=l[u];c=l[u+1],f=l[u+2],d=l[u+3];let p=(s-g)/(l[u+4]-g);c+=(l[u+4+1]-c)*p,f+=(l[u+4+2]-f)*p,d+=(l[u+4+3]-d)*p;break;case 1:c=l[u+1],f=l[u+2],d=l[u+3];break;default:c=this.getBezierValue(s,u,1,m-2),f=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(a==1)n.r=c,n.g=f,n.b=d;else{if(h==0){let g=r.data.color;n.r=g.r,n.g=g.g,n.b=g.b}n.r+=(c-n.r)*a,n.g+=(f-n.g)*a,n.b+=(d-n.b)*a}}},ft=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,_.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(s<this.frames[0]){let c=r.data.color;switch(h){case 0:l.a=c.a;return;case 1:l.a+=(c.a-l.a)*a}return}let n=this.getCurveValue(s);a==1?l.a=n:(h==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*a)}},ut=class extends le{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,i,a,h,o,r,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,c=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:n.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),c.r+=(y.r-c.r)*a,c.g+=(y.g-c.g)*a,c.b+=(y.b-c.b)*a}return}let f=0,d=0,u=0,m=0,g=0,p=0,w=0,x=J.search(l,s,8),b=this.curves[x>>3];switch(b){case 0:let v=l[x];f=l[x+1],d=l[x+2],u=l[x+3],m=l[x+4],g=l[x+5],p=l[x+6],w=l[x+7];let y=(s-v)/(l[x+8]-v);f+=(l[x+8+1]-f)*y,d+=(l[x+8+2]-d)*y,u+=(l[x+8+3]-u)*y,m+=(l[x+8+4]-m)*y,g+=(l[x+8+5]-g)*y,p+=(l[x+8+6]-p)*y,w+=(l[x+8+7]-w)*y;break;case 1:f=l[x+1],d=l[x+2],u=l[x+3],m=l[x+4],g=l[x+5],p=l[x+6],w=l[x+7];break;default:f=this.getBezierValue(s,x,1,b-2),d=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+18*2-2),m=this.getBezierValue(s,x,4,b+18*3-2),g=this.getBezierValue(s,x,5,b+18*4-2),p=this.getBezierValue(s,x,6,b+18*5-2),w=this.getBezierValue(s,x,7,b+18*6-2)}if(a==1)n.set(f,d,u,m),c.r=g,c.g=p,c.b=w;else{if(h==0){n.setFromColor(r.data.color);let v=r.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}n.add((f-n.r)*a,(d-n.g)*a,(u-n.b)*a,(m-n.a)*a),c.r+=(g-c.r)*a,c.g+=(p-c.g)*a,c.b+=(w-c.b)*a}}},mt=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,h,o,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,c=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:n.r=v.r,n.g=v.g,n.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,c.r+=(y.r-c.r)*a,c.g+=(y.g-c.g)*a,c.b+=(y.b-c.b)*a}return}let f=0,d=0,u=0,m=0,g=0,p=0,w=0,x=J.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let v=l[x];f=l[x+1],d=l[x+2],u=l[x+3],g=l[x+4],p=l[x+5],w=l[x+6];let y=(s-v)/(l[x+7]-v);f+=(l[x+7+1]-f)*y,d+=(l[x+7+2]-d)*y,u+=(l[x+7+3]-u)*y,g+=(l[x+7+4]-g)*y,p+=(l[x+7+5]-p)*y,w+=(l[x+7+6]-w)*y;break;case 1:f=l[x+1],d=l[x+2],u=l[x+3],g=l[x+4],p=l[x+5],w=l[x+6];break;default:f=this.getBezierValue(s,x,1,b-2),d=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+18*2-2),g=this.getBezierValue(s,x,4,b+18*3-2),p=this.getBezierValue(s,x,5,b+18*4-2),w=this.getBezierValue(s,x,6,b+18*5-2)}if(a==1)n.r=f,n.g=d,n.b=u,c.r=g,c.g=p,c.b=w;else{if(h==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}n.r+=(f-n.r)*a,n.g+=(d-n.g)*a,n.b+=(u-n.b)*a,c.r+=(g-c.r)*a,c.g+=(p-c.g)*a,c.b+=(w-c.b)*a}}},we=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,i,a,h,o){let r=e.slots[this.slotIndex];if(r.bone.active){if(o==1){h==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},gt=class extends le{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,h,o,r,l,n,c){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-h*2+r)*.03,m=l*.03-o*.06,g=((h-r)*3-i+n)*.006,p=(o-l+.33333333)*.018,w=u*2+g,x=m*2+p,b=(h-i)*.3+u+g*.16666667,v=o*.3+m+p*.16666667,y=i+b,S=v;for(let A=d+18;d<A;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=x,w+=g,x+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],l=s[i-1];return l+(e-r)/(s[i]-r)*(s[i+1]-l)}let h=s[a-2],o=s[a-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof ne)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(s<d[0]){switch(h){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=f;let x=l;if(x.bones){a=1-a;for(var u=0;u<f;u++)n[u]*=a}else{let b=x.vertices;for(var u=0;u<f;u++)n[u]+=(b[u]-n[u])*a}}return}if(n.length=f,s>=d[d.length-1]){let x=c[d.length-1];if(a==1)if(h==3){let b=l;if(b.bones)for(let v=0;v<f;v++)n[v]+=x[v];else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=x[y]-v[y]}}else R.arrayCopy(x,0,n,0,f);else switch(h){case 0:{let v=l;if(v.bones)for(let y=0;y<f;y++)n[y]=x[y]*a;else{let y=v.vertices;for(let S=0;S<f;S++){let A=y[S];n[S]=A+(x[S]-A)*a}}break}case 1:case 2:for(let v=0;v<f;v++)n[v]+=(x[v]-n[v])*a;break;case 3:let b=l;if(b.bones)for(let v=0;v<f;v++)n[v]+=x[v]*a;else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=(x[y]-v[y])*a}}return}let m=J.search1(d,s),g=this.getCurvePercent(s,m),p=c[m],w=c[m+1];if(a==1)if(h==3){let x=l;if(x.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=v+(w[b]-v)*g}else{let b=x.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=y+(w[v]-y)*g-b[v]}}}else for(let x=0;x<f;x++){let b=p[x];n[x]=b+(w[x]-b)*g}else switch(h){case 0:{let b=l;if(b.bones)for(let v=0;v<f;v++){let y=p[v];n[v]=(y+(w[v]-y)*g)*a}else{let v=b.vertices;for(let y=0;y<f;y++){let S=p[y],A=v[y];n[y]=A+(S+(w[y]-S)*g-A)*a}}break}case 1:case 2:for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*g-n[b])*a}break;case 3:let x=l;if(x.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*g)*a}else{let b=x.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=(y+(w[v]-y)*g-b[v])*a}}}}},es=class extends J{events;constructor(e){super(e,es.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,h,o){if(!i)return;let r=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,h,o),t=-1;else if(t>=r[l-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let c=r[n];for(;n>0&&r[n-1]==c;)n--}for(;n<l&&s>=r[n];n++)i.push(this.events[n])}},Xe=es;B(Xe,"propertyIds",[""+_.event]);var ts=class extends J{drawOrders;constructor(e){super(e,ts.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,h,o){if(o==1){h==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(h==0||h==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),l=this.drawOrders[r];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,c=e.slots;for(let f=0,d=l.length;f<d;f++)n[f]=c[l[f]]}}},pe=ts;B(pe,"propertyIds",[""+_.drawOrder]);var xt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,h,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=h?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,a,h,o){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,c=0,f=J.search(l,s,6),d=this.curves[f/6];switch(d){case 0:let u=l[f];n=l[f+1],c=l[f+2];let m=(s-u)/(l[f+6]-u);n+=(l[f+6+1]-n)*m,c+=(l[f+6+2]-c)*m;break;case 1:n=l[f+1],c=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),c=this.getBezierValue(s,f,2,d+18-2)}h==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(c-r.data.softness)*a,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[f+3],r.compress=l[f+4]!=0,r.stretch=l[f+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(c-r.softness)*a,o==0&&(r.bendDirection=l[f+3],r.compress=l[f+4]!=0,r.stretch=l[f+5]!=0))}},bt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,h,o,r){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=a,l[e+4]=h,l[e+5]=o,l[e+6]=r}apply(e,t,s,i,a,h,o){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){let w=r.data;switch(h){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,c,f,d,u,m,g=J.search(l,s,7),p=this.curves[g/7];switch(p){case 0:let w=l[g];n=l[g+1],c=l[g+2],f=l[g+3],d=l[g+4],u=l[g+5],m=l[g+6];let x=(s-w)/(l[g+7]-w);n+=(l[g+7+1]-n)*x,c+=(l[g+7+2]-c)*x,f+=(l[g+7+3]-f)*x,d+=(l[g+7+4]-d)*x,u+=(l[g+7+5]-u)*x,m+=(l[g+7+6]-m)*x;break;case 1:n=l[g+1],c=l[g+2],f=l[g+3],d=l[g+4],u=l[g+5],m=l[g+6];break;default:n=this.getBezierValue(s,g,1,p-2),c=this.getBezierValue(s,g,2,p+18-2),f=this.getBezierValue(s,g,3,p+18*2-2),d=this.getBezierValue(s,g,4,p+18*3-2),u=this.getBezierValue(s,g,5,p+18*4-2),m=this.getBezierValue(s,g,6,p+18*5-2)}if(h==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(c-w.mixX)*a,r.mixY=w.mixY+(f-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(u-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(c-r.mixX)*a,r.mixY+=(f-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(u-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},wt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,h,r.position,r.data.position))}},pt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,h,r.spacing,r.data.spacing))}},yt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=a}apply(e,t,s,i,a,h,o){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(h){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,c,f,d=J.search(l,s,4),u=this.curves[d>>2];switch(u){case 0:let m=l[d];n=l[d+1],c=l[d+2],f=l[d+3];let g=(s-m)/(l[d+4]-m);n+=(l[d+4+1]-n)*g,c+=(l[d+4+2]-c)*g,f+=(l[d+4+3]-f)*g;break;case 1:n=l[d+1],c=l[d+2],f=l[d+3];break;default:n=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2),f=this.getBezierValue(s,d,3,u+18*2-2)}if(h==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(c-m.mixX)*a,r.mixY=m.mixY+(f-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(c-r.mixX)*a,r.mixY+=(f-r.mixY)*a}},fe=class extends se{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,h,o){let r;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,h,this.get(n),this.setup(n),l))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,h,this.get(r),this.setup(r)))}},ss=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}},rs=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}},is=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}},as=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}},ns=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}},ls=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}},os=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}},hs=class extends J{constraintIndex;constructor(e,t){super(e,hs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,h,o){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,h,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},vt=hs;B(vt,"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,i,a){let h=this.frames;e*=ue.ENTRIES,h[e]=t,h[e+ue.MODE]=s|i<<4,h[e+ue.DELAY]=a}apply(e,t,s,i,a,h,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof ne)||l.timelineAttachment!=n))return;let c=this.frames;if(s<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let f=J.search(c,s,ue.ENTRIES),d=c[f],u=c[f+ue.MODE],m=c[f+ue.DELAY];if(!this.attachment.sequence)return;let g=u>>4,p=this.attachment.sequence.regions.length,w=Kt[u&15];if(w!=0)switch(g+=(s-d)/m+1e-5|0,w){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let x=(p<<1)-2;g=x==0?0:g%x,g>=p&&(g=x-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let x=(p<<1)-2;g=x==0?0:(g+p-1)%x,g>=p&&(g=x-g)}}r.sequenceIndex=g}},Se=ue;B(Se,"ENTRIES",3),B(Se,"MODE",1),B(Se,"DELAY",2);var De=class{static emptyAnimation(){return De._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new fs(this);propertyIDs=new Qe;animationsChanged=!1;trackEntryPool=new Ye(()=>new ds);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let h=e*a.timeScale;if(a.delay>0){if(a.delay-=h,a.delay>0)continue;h=-a.delay,a.delay=0}let o=a.next;if(o){let r=a.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*o.timeScale,a.trackTime+=h,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let f=0,d=s.length;f<d;f++){let u=s[f];if(!u||u.delay>0)continue;i=!0;let m=f==0?1:u.mixBlend,g=u.alpha;u.mixingFrom?g*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(g=0);let p=g>=u.alphaAttachmentThreshold,w=u.animationLast,x=u.getAnimationTime(),b=x,v=t;u.reverse&&(b=u.animation.duration-b,v=null);let y=u.animation.timelines,S=y.length;if(f==0&&g==1||m==3){f==0&&(p=!0);for(let A=0;A<S;A++){R.webkit602BugfixHelper(g,m);var a=y[A];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,g,m,0)}}else{let A=u.timelineMode,k=u.shortestRotation,T=!k&&u.timelinesRotation.length!=S<<1;T&&(u.timelinesRotation.length=S<<1);for(let Y=0;Y<S;Y++){let E=y[Y],F=A[Y]==Oe?m:0;!k&&E instanceof Me?this.applyRotateTimeline(E,e,b,g,F,u.timelinesRotation,Y<<1,T):E instanceof we?this.applyAttachmentTimeline(E,e,b,m,p):(R.webkit602BugfixHelper(g,m),E.apply(e,w,b,v,g,F,0))}}this.queueEvents(u,x),t.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var h=this.unkeyedState+Ct,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==h){var c=n.data.attachmentName;n.setAttachment(c?e.getAttachment(n.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let h=a<i.mixAttachmentThreshold,o=a<i.mixDrawOrderThreshold,r=i.animation.timelines,l=r.length,n=i.alpha*e.interruptAlpha,c=n*(1-a),f=i.animationLast,d=i.getAnimationTime(),u=d,m=null;if(i.reverse?u=i.animation.duration-u:a<i.eventThreshold&&(m=this.events),s==3)for(let g=0;g<l;g++)r[g].apply(t,f,u,m,c,s,1);else{let g=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,x=!w&&i.timelinesRotation.length!=l<<1;x&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let b=0;b<l;b++){let v=r[b],y=1,S,A=0;switch(g[b]){case Oe:if(!o&&v instanceof pe)continue;S=s,A=c;break;case St:S=0,A=c;break;case At:S=s,A=n;break;case Ne:S=0,A=n;break;default:S=0;let k=p[b];A=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=A,!w&&v instanceof Me?this.applyRotateTimeline(v,t,u,A,S,i.timelinesRotation,b<<1,x):v instanceof we?this.applyAttachmentTimeline(v,t,u,S,h&&A>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(A,s),o&&v instanceof pe&&S==0&&(y=0),v.apply(t,f,u,m,A,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var h=t.slots[e.slotIndex];h.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,h,h.data.attachmentName,a):this.setAttachment(t,h,e.attachmentNames[J.search1(e.frames,s)],a),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Ct))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+ms)}applyRotateTimeline(e,t,s,i,a,h,o,r){if(r&&(h[o]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let n=e.frames,c=0,f=0;if(s<n[0])switch(a){case 0:l.rotation=l.data.rotation;default:return;case 1:c=l.rotation,f=l.data.rotation}else c=a==0?l.data.rotation:l.rotation,f=l.data.rotation+e.getCurveValue(s);let d=0,u=f-c;if(u-=Math.ceil(u/360-.5)*360,u==0)d=h[o];else{let m=0,g=0;r?(m=0,g=u):(m=h[o],g=h[o+1]);let p=m-m%360;d=u+p;let w=u>=0,x=m>=0;Math.abs(g)<=90&&X.signum(g)!=X.signum(u)&&(Math.abs(m-p)>180?(d+=360*X.signum(m),x=w):p!=0?d-=360*X.signum(m):x=w),x!=w&&(d+=360*X.signum(m)),h[o]=d}h[o+1]=u,l.rotation=c+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,h=e.trackLast%a,o=this.events,r=0,l=o.length;for(;r<l;r++){let c=o[r];if(c.time<h)break;c.time>i||this.queue.event(e,c)}let n=!1;for(e.loop?n=a==0||h>e.trackTime%a:n=t>=i&&e.animationLast<i,n&&this.queue.complete(e);r<l;r++){let c=o[r];c.time<s||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let h=this.trackEntry(e,t,s,a);return this.setCurrent(e,h,i),this.queue.drain(),h}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let h=this.trackEntry(e,t,s,a);return a?(a.next=h,h.previous=a,i<=0&&(i+=a.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=i,h}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,De.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,De.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-t),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let h=e.timelineHoldMix;h.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=o.addAll(s[r].getPropertyIds())?Ne:At;return}e:for(let r=0;r<i;r++){let l=s[r],n=l.getPropertyIds();if(!o.addAll(n))a[r]=Oe;else if(!t||l instanceof we||l instanceof pe||l instanceof Xe||!t.animation.hasTimeline(n))a[r]=St;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=us,h[r]=c;continue e}break}a[r]=Ne}}}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()}},cs=De;B(cs,"_emptyAnimation",new Ve("<empty>",[],0));var ds=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,this.previous!=null&&this.delay<=0&&(this.delay+=this.previous.getTrackComplete()-e),this.delay=this.delay}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}},fs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ee.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ee.interrupt),this.objects.push(e)}end(e){this.objects.push(ee.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ee.dispose),this.objects.push(e)}complete(e){this.objects.push(ee.complete),this.objects.push(e)}event(e,t){this.objects.push(ee.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case ee.start:a.listener&&a.listener.start&&a.listener.start(a);for(let o=0;o<t.length;o++){let r=t[o];r.start&&r.start(a)}break;case ee.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let o=0;o<t.length;o++){let r=t[o];r.interrupt&&r.interrupt(a)}break;case ee.end:a.listener&&a.listener.end&&a.listener.end(a);for(let o=0;o<t.length;o++){let r=t[o];r.end&&r.end(a)}case ee.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let o=0;o<t.length;o++){let r=t[o];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case ee.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let o=0;o<t.length;o++){let r=t[o];r.complete&&r.complete(a)}break;case ee.event:let h=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,h);for(let o=0;o<t.length;o++){let r=t[o];r.event&&r.event(a,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ee=(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))(ee||{}),Gs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Oe=0,St=1,At=2,Ne=3,us=4,Ct=1,ms=2,Hs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},_e=class extends ne{color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new _e(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},It=class extends ne{endSlot=null;color=new O(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new It(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},kt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},qe=(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))(qe||{}),gs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(gs||{}),xs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},$s=class extends kt{setFilters(e,t){}setWraps(e,t){}dispose(){}},bs=class{pages=new Array;regions=new Array;constructor(e){let t=new js(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(qe,s[1]),n.magFilter=R.enumValue(qe,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let c=s[1];c=="true"?n.degrees=90:c!="false"&&(n.degrees=parseInt(c))},a.index=n=>{n.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,r=null,l=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let n=new Tt(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let f=a[s[0]];if(f)f(n);else{r||(r=[]),l||(l=[]),r.push(s[0]);let d=[];for(let u=0;u<c;u++)d.push(parseInt(s[u+1]));l.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&l&&l.length>0&&(n.names=r,n.values=l,r=null,l=null),n.u=n.x/o.width,n.v=n.y/o.height,n.degrees==90?(n.u2=(n.x+n.height)/o.width,n.v2=(n.y+n.width)/o.height):(n.u2=(n.x+n.width)/o.width,n.v2=(n.y+n.height)/o.height),this.regions.push(n)}else{for(o=new ws(h.trim());t.readEntry(s,h=t.readLine())!=0;){let n=i[s[0]];n&&n(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},js=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let h=t.indexOf(",",a);if(h==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,h-a).trim(),a=h+1,i==4)return 4}}},ws=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(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}},Tt=class extends xs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends ne{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=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,h=0,o=0;if(this.region instanceof Tt){let r=this.region,l=r.page,n=l.width,c=l.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/n,o=r.originalWidth/c;for(let f=0;f<s;f+=2)t[f]=i+e[f+1]*h,t[f+1]=a+(1-e[f])*o;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/c,h=r.originalWidth/n,o=r.originalHeight/c;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f])*h,t[f+1]=a+(1-e[f+1])*o;return;case 270:i-=r.offsetY/n,a-=r.offsetX/c,h=r.originalHeight/n,o=r.originalWidth/c;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f+1])*h,t[f+1]=a+e[f]*o;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/n,o=r.originalHeight/c}else this.region?(h=this.region.u2-i,o=this.region.v2-a):(i=a=0,h=o=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*h,t[r+1]=a+e[r+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,h)}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 ne{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),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Yt=class extends ne{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*X.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,h=s*e.c+i*e.d;return X.atan2Deg(h,a)}copy(){let e=new Yt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ps=class extends Ze{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=R.newFloatArray(8);uvs=R.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,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*i,o=a+this.region.width*s,r=h+this.region.height*i,l=this.rotation*X.degRad,n=Math.cos(l),c=Math.sin(l),f=this.x,d=this.y,u=a*n+f,m=a*c,g=h*n+d,p=h*c,w=o*n+f,x=o*c,b=r*n+d,v=r*c,y=this.offset;y[0]=u-p,y[1]=g+m,y[2]=u-v,y[3]=b+m,y[4]=w-v,y[5]=b+x,y[6]=w-p,y[7]=g+x,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,h=this.offset,o=a.worldX,r=a.worldY,l=a.a,n=a.b,c=a.c,f=a.d,d=0,u=0;d=h[0],u=h[1],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r,s+=i,d=h[2],u=h[3],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r,s+=i,d=h[4],u=h[5],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r,s+=i,d=h[6],u=h[7],t[s]=d*l+u*n+o,t[s+1]=d*c+u*f+r}copy(){let e=new ps(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},V=ps;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 Js=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,h=i.length;a<h;a++){let o=s.getPath(t,a),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new V(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=h}return a}newMeshAttachment(e,t,s,i){let a=new ye(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=h}return a}newBoundingBoxAttachment(e,t){return new _e(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new Yt(t)}newClippingAttachment(e,t){return new It(t)}},Mt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;transformMode=Ue.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}},Ue=(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))(Ue||{}),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;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=h,this.ashearY=o;let r=this.parent;if(!r){let d=this.skeleton;const u=d.scaleX,m=d.scaleY,g=(s+h)*X.degRad,p=(s+90+o)*X.degRad;this.a=Math.cos(g)*i*u,this.b=Math.cos(p)*a*u,this.c=Math.sin(g)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*u+d.x,this.worldY=t*m+d.y;return}let l=r.a,n=r.b,c=r.c,f=r.d;switch(this.worldX=l*e+n*t+r.worldX,this.worldY=c*e+f*t+r.worldY,this.data.transformMode){case 0:{const d=(s+h)*X.degRad,u=(s+90+o)*X.degRad,m=Math.cos(d)*i,g=Math.cos(u)*a,p=Math.sin(d)*i,w=Math.sin(u)*a;this.a=l*m+n*p,this.b=l*g+n*w,this.c=c*m+f*p,this.d=c*g+f*w;return}case 1:{const d=(s+h)*X.degRad,u=(s+90+o)*X.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(u)*a,this.c=Math.sin(d)*i,this.d=Math.sin(u)*a;break}case 2:{let d=l*l+c*c,u=0;d>1e-4?(d=Math.abs(l*f-n*c)/d,l/=this.skeleton.scaleX,c/=this.skeleton.scaleY,n=c*d,f=l*d,u=Math.atan2(c,l)*X.radDeg):(l=0,c=0,u=90-Math.atan2(f,n)*X.radDeg);const m=(s+h-u)*X.degRad,g=(s+o-u+90)*X.degRad,p=Math.cos(m)*i,w=Math.cos(g)*a,x=Math.sin(m)*i,b=Math.sin(g)*a;this.a=l*p-n*x,this.b=l*w-n*b,this.c=c*p+f*x,this.d=c*w+f*b;break}case 3:case 4:{s*=X.degRad;const d=Math.cos(s),u=Math.sin(s);let m=(l*d+n*u)/this.skeleton.scaleX,g=(c*d+f*u)/this.skeleton.scaleY,p=Math.sqrt(m*m+g*g);p>1e-5&&(p=1/p),m*=p,g*=p,p=Math.sqrt(m*m+g*g),this.data.transformMode==3&&l*f-n*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(g,m);const w=Math.cos(s)*p,x=Math.sin(s)*p;h*=X.degRad,o=(90+o)*X.degRad;const b=Math.cos(h)*i,v=Math.cos(o)*a,y=Math.sin(h)*i,S=Math.sin(o)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=g*b+x*y,this.d=g*v+x*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}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)*X.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)*X.radDeg;return}let t=e.a,s=e.b,i=e.c,a=e.d,h=1/(t*a-s*i),o=a*h,r=s*h,l=i*h,n=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*o-f*r,this.ay=f*n-c*l;let d,u,m,g;if(this.data.transformMode==1)d=this.a,u=this.b,m=this.c,g=this.d;else{switch(this.data.transformMode){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i),y=t/this.skeleton.scaleX;s=-(i/this.skeleton.scaleY)*v*this.skeleton.scaleX,a=y*v*this.skeleton.scaleY,h=1/(t*a-s*i),o=a*h,r=s*h;break}case 3:case 4:let p=X.cosDeg(this.rotation),w=X.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let x=Math.sqrt(t*t+i*i);x>1e-5&&(x=1/x),t*=x,i*=x,x=Math.sqrt(t*t+i*i),this.data.transformMode==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let b=X.PI/2+Math.atan2(i,t);s=Math.cos(b)*x,a=Math.sin(b)*x,h=1/(t*a-s*i),o=a*h,r=s*h,l=i*h,n=t*h}d=o*this.a-r*this.c,u=o*this.b-r*this.d,m=n*this.c-l*this.a,g=n*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*g-u*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*u+m*g,p)*X.radDeg,this.arotation=Math.atan2(m,d)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,u)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*X.radDeg}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Fe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ys=class{pathPrefix="";textureLoader;downloader;assets={};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,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),h=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new bs(o),l=r.pages.length,n=!1;for(let c of r.pages)this.loadTexture(i?i[c.name]:h+c.name,(f,d)=>{n||(c.setTexture(d),--l==0&&this.success(t,e,r))},(f,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${f}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
- `+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}},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,i=new Uint8Array(s),a=0;a<s;a++)i[a]=t.charCodeAt(a);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let a=()=>{this.finish(e,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let a=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let a=t==200||t==0?[s]:[t,s];for(let h=a.length-1,o=i.length;h<o;h+=2)i[h].apply(null,a)}},Et=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Rt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},vs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,a,h,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,c=r.c,f=r.d,d=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=(t-e.worldX)*X.signum(e.skeleton.scaleX),m=(s-e.worldY)*X.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(l*f-n*c)/Math.max(1e-4,l*l+c*c),x=l/e.skeleton.scaleX,b=c/e.skeleton.scaleY;n=-b*w*e.skeleton.scaleX,f=x*w*e.skeleton.scaleY,d+=Math.atan2(b,x)*X.radDeg;default:let v=t-r.worldX,y=s-r.worldY,S=l*f-n*c;Math.abs(S)<=1e-4?(u=0,m=0):(u=(v*f-y*n)/S-e.ax,m=(y*l-v*c)/S-e.ay)}d+=Math.atan2(m,u)*X.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let g=e.ascaleX,p=e.ascaleY;if(i||a){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=s-e.worldY}const w=e.data.length*g;if(w>1e-4){const x=u*u+m*m;if(i&&x<w*w||a&&x>w*w){const b=(Math.sqrt(x)/w-1)*o+1;g*=b,h&&(p*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,g,p,e.ashearX,e.ashearY)}apply2(e,t,s,i,a,h,o,r,l){let n=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,u=f,m=d,g=t.ascaleX,p=0,w=0,x=0;f<0?(f=-f,p=180,x=-1):(p=0,x=1),d<0&&(d=-d,x=-x),g<0?(g=-g,w=180):w=0;let b=t.ax,v=0,y=0,S=0,A=e.a,k=e.b,T=e.c,Y=e.d,E=Math.abs(f-d)<=1e-4;!E||h?(v=0,y=A*b+e.worldX,S=T*b+e.worldY):(v=t.ay,y=A*b+k*v+e.worldX,S=T*b+Y*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");A=F.a,k=F.b,T=F.c,Y=F.d;let P=A*Y-k*T,I=y-F.worldX,M=S-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let L=(I*Y-M*k)*P-n,U=(M*A-I*T)*P-c,D=Math.sqrt(L*L+U*U),G=t.data.length*g,j,$;if(D<1e-4){this.apply1(e,s,i,!1,h,!1,l),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-F.worldX,M=i-F.worldY;let q=(I*Y-M*k)*P-n,N=(M*A-I*T)*P-c,H=q*q+N*N;if(r!=0){r*=f*(g+1)*.5;let K=Math.sqrt(H),re=K-D-G*f+r;if(re>0){let ie=Math.min(1,re/(r*2))-1;ie=(re-r*(1-ie*ie))/K,q-=ie*q,N-=ie*N,H=q*q+N*N}}e:if(E){G*=f;let K=(H-D*D-G*G)/(2*D*G);K<-1?(K=-1,$=Math.PI*a):K>1?(K=1,$=0,h&&(A=(Math.sqrt(H)/(D+G)-1)*l+1,u*=A,o&&(m*=A))):$=Math.acos(K)*a,A=D+G*K,k=G*Math.sin($),j=Math.atan2(N*A-q*k,q*A+N*k)}else{A=f*G,k=d*G;let K=A*A,re=k*k,ie=Math.atan2(N,q);T=re*D*D+K*H-K*re;let xe=-2*re*D,Ie=re-K;if(Y=xe*xe-4*Ie*T,Y>=0){let ke=Math.sqrt(Y);xe<0&&(ke=-ke),ke=-(xe+ke)*.5;let Es=ke/Ie,Rs=T/ke,Te=Math.abs(Es)<Math.abs(Rs)?Es:Rs;if(Te*Te<=H){M=Math.sqrt(H-Te*Te)*a,j=ie-Math.atan2(M,Te),$=Math.atan2(M/d,(Te-D)/f);break e}}let Ee=X.PI,Je=D-A,Wt=Je*Je,Ms=0,Xs=0,Ke=D+A,zt=Ke*Ke,Fs=0;T=-A*D/(K-re),T>=-1&&T<=1&&(T=Math.acos(T),I=A*Math.cos(T)+D,M=k*Math.sin(T),Y=I*I+M*M,Y<Wt&&(Ee=T,Wt=Y,Je=I,Ms=M),Y>zt&&(Xs=T,zt=Y,Ke=I,Fs=M)),H<=(Wt+zt)*.5?(j=ie-Math.atan2(Ms*a,Je),$=Ee*a):(j=ie-Math.atan2(Fs*a,Ke),$=Xs*a)}let Z=Math.atan2(v,b)*x,ce=e.arotation;j=(j-Z)*X.radDeg+p-ce,j>180?j-=360:j<-180&&(j+=360),e.updateWorldTransformWith(n,c,ce+j*l,u,m,0,0),ce=t.arotation,$=(($+Z)*X.radDeg-t.ashearX)*x+w-ce,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(b,v,ce+$*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Pt=class extends Fe{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},Bt=class extends Fe{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=We.Fixed;spacingMode=ze.Fixed;rotateMode=Ge.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},We=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(We||{}),ze=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ze||{}),Ge=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Ge||{}),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 i=0,a=e.bones.length;i<a;i++){let h=t.findBone(e.bones[i].name);if(!h)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(h)}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,i=this.mixX,a=this.mixY;if(s==0&&i==0&&a==0)return;let h=this.data,o=h.rotateMode==0,r=h.rotateMode==2,l=this.bones,n=l.length,c=o?n:n+1,f=R.setArraySize(this.spaces,c),d=r?this.lengths=R.setArraySize(this.lengths,n):[],u=this.spacing;switch(h.spacingMode){case 2:if(r)for(let y=0,S=c-1;y<S;y++){let A=l[y],k=A.data.length,T=k*A.a,Y=k*A.c;d[y]=Math.sqrt(T*T+Y*Y)}R.arrayFill(f,1,c,u);break;case 3:let b=0;for(let y=0,S=c-1;y<S;){let A=l[y],k=A.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*A.a,Y=k*A.c,E=Math.sqrt(T*T+Y*Y);r&&(d[y]=E),f[++y]=E,b+=E}}if(b>0){b=c/b*u;for(let y=1;y<c;y++)f[y]*=b}break;default:let v=h.spacingMode==0;for(let y=0,S=c-1;y<S;){let A=l[y],k=A.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*A.a,Y=k*A.c,E=Math.sqrt(T*T+Y*Y);r&&(d[y]=E),f[++y]=(v?k+u:u)*E/k}}}let m=this.computeWorldPositions(t,c,o),g=m[0],p=m[1],w=h.offsetRotation,x=!1;if(w==0)x=h.rotateMode==1;else{x=!1;let b=this.target.bone;w*=b.a*b.d-b.b*b.c>0?X.degRad:-X.degRad}for(let b=0,v=3;b<n;b++,v+=3){let y=l[b];y.worldX+=(g-y.worldX)*i,y.worldY+=(p-y.worldY)*a;let S=m[v],A=m[v+1],k=S-g,T=A-p;if(r){let Y=d[b];if(Y!=0){let E=(Math.sqrt(k*k+T*T)/Y-1)*s+1;y.a*=E,y.c*=E}}if(g=S,p=A,s>0){let Y=y.a,E=y.b,F=y.c,P=y.d,I=0,M=0,L=0;if(o?I=m[v-1]:f[b+1]==0?I=m[v+2]:I=Math.atan2(T,k),I-=Math.atan2(F,Y),x){M=Math.cos(I),L=Math.sin(I);let U=y.data.length;g+=(U*(M*Y-L*F)-k)*s,p+=(U*(L*Y+M*F)-T)*s}else I+=w;I>X.PI?I-=X.PI2:I<-X.PI&&(I+=X.PI2),I*=s,M=Math.cos(I),L=Math.sin(I),y.a=M*Y-L*F,y.b=M*E-L*P,y.c=L*Y+M*F,y.d=L*E+M*P}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,a=this.position,h=this.spaces,o=R.setArraySize(this.positions,t*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,c=n/6,f=me.NONE;if(!e.constantSpeed){let U=e.lengths;c-=l?1:2;let D=U[c];this.data.positionMode==1&&(a*=D);let G;switch(this.data.spacingMode){case 2:G=D;break;case 3:G=D/t;break;default:G=1}r=R.setArraySize(this.world,8);for(let j=0,$=0,q=0;j<t;j++,$+=3){let N=h[j]*G;a+=N;let H=a;if(l)H%=D,H<0&&(H+=D),q=0;else if(H<0){f!=me.BEFORE&&(f=me.BEFORE,e.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(H,r,0,o,$);continue}else if(H>D){f!=me.AFTER&&(f=me.AFTER,e.computeWorldVertices(i,n-6,4,r,0,2)),this.addAfterPosition(H-D,r,0,o,$);continue}for(;;q++){let Z=U[q];if(!(H>Z)){if(q==0)H/=Z;else{let ce=U[q-1];H=(H-ce)/(Z-ce)}break}}q!=f&&(f=q,l&&q==c?(e.computeWorldVertices(i,n-4,4,r,0,2),e.computeWorldVertices(i,0,4,r,4,2)):e.computeWorldVertices(i,q*6+2,8,r,0,2)),this.addCurvePosition(H,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],o,$,s||j>0&&N==0)}return o}l?(n+=2,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n-4,r,0,2),e.computeWorldVertices(i,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(c--,n-=4,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n,r,0,2));let d=R.setArraySize(this.curves,c),u=0,m=r[0],g=r[1],p=0,w=0,x=0,b=0,v=0,y=0,S=0,A=0,k=0,T=0,Y=0,E=0,F=0,P=0;for(let U=0,D=2;U<c;U++,D+=6)p=r[D],w=r[D+1],x=r[D+2],b=r[D+3],v=r[D+4],y=r[D+5],S=(m-p*2+x)*.1875,A=(g-w*2+b)*.1875,k=((p-x)*3-m+v)*.09375,T=((w-b)*3-g+y)*.09375,Y=S*2+k,E=A*2+T,F=(p-m)*.75+S+k*.16666667,P=(w-g)*.75+A+T*.16666667,u+=Math.sqrt(F*F+P*P),F+=Y,P+=E,Y+=k,E+=T,u+=Math.sqrt(F*F+P*P),F+=Y,P+=E,u+=Math.sqrt(F*F+P*P),F+=Y+k,P+=E+T,u+=Math.sqrt(F*F+P*P),d[U]=u,m=v,g=y;this.data.positionMode==1&&(a*=u);let I;switch(this.data.spacingMode){case 2:I=u;break;case 3:I=u/t;break;default:I=1}let M=this.segments,L=0;for(let U=0,D=0,G=0,j=0;U<t;U++,D+=3){let $=h[U]*I;a+=$;let q=a;if(l)q%=u,q<0&&(q+=u),G=0;else if(q<0){this.addBeforePosition(q,r,0,o,D);continue}else if(q>u){this.addAfterPosition(q-u,r,n-4,o,D);continue}for(;;G++){let N=d[G];if(!(q>N)){if(G==0)q/=N;else{let H=d[G-1];q=(q-H)/(N-H)}break}}if(G!=f){f=G;let N=G*6;for(m=r[N],g=r[N+1],p=r[N+2],w=r[N+3],x=r[N+4],b=r[N+5],v=r[N+6],y=r[N+7],S=(m-p*2+x)*.03,A=(g-w*2+b)*.03,k=((p-x)*3-m+v)*.006,T=((w-b)*3-g+y)*.006,Y=S*2+k,E=A*2+T,F=(p-m)*.3+S+k*.16666667,P=(w-g)*.3+A+T*.16666667,L=Math.sqrt(F*F+P*P),M[0]=L,N=1;N<8;N++)F+=Y,P+=E,Y+=k,E+=T,L+=Math.sqrt(F*F+P*P),M[N]=L;F+=Y,P+=E,L+=Math.sqrt(F*F+P*P),M[8]=L,F+=Y+k,P+=E+T,L+=Math.sqrt(F*F+P*P),M[9]=L,j=0}for(q*=L;;j++){let N=M[j];if(!(q>N)){if(j==0)q/=N;else{let H=M[j-1];q=j+(q-H)/(N-H)}break}}this.addCurvePosition(q*.1,m,g,p,w,x,b,v,y,o,D,s||U>0&&$==0)}return o}addBeforePosition(e,t,s,i,a){let h=t[s],o=t[s+1],r=t[s+2]-h,l=t[s+3]-o,n=Math.atan2(l,r);i[a]=h+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addAfterPosition(e,t,s,i,a){let h=t[s+2],o=t[s+3],r=h-t[s],l=o-t[s+1],n=Math.atan2(l,r);i[a]=h+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addCurvePosition(e,t,s,i,a,h,o,r,l,n,c,f){if(e==0||isNaN(e)){n[c]=t,n[c+1]=s,n[c+2]=Math.atan2(a-s,i-t);return}let d=e*e,u=d*e,m=1-e,g=m*m,p=g*m,w=m*e,x=w*3,b=m*x,v=x*e,y=t*p+i*b+h*v+r*u,S=s*p+a*b+o*v+l*u;n[c]=y,n[c+1]=S,f&&(e<.001?n[c+2]=Math.atan2(a-s,i-t):n[c+2]=Math.atan2(S-(s*g+a*w*2+o*d),y-(t*g+i*w*2+h*d)))}},Ce=me;B(Ce,"NONE",-1),B(Ce,"BEFORE",-2),B(Ce,"AFTER",-3),B(Ce,"epsilon",1e-5);var Ks=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,r=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:this.remaining+=Math.max(this.skeleton.time-this.lastTime,0),this.lastTime=this.skeleton.time;const l=o.worldX,n=o.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=n;else{let c=this.remaining,f=this.inertia,d=this.data.step;if(s||i){if(s&&(this.xOffset+=(this.ux-l)*f,this.ux=l),i&&(this.yOffset+=(this.uy-n)*f,this.uy=n),c>=d){const u=this.massInverse*d,m=this.strength,g=this.wind*100,p=this.gravity*-100,w=Math.pow(this.damping,60*d);do s&&(this.xVelocity+=(g-this.xOffset*m)*u,this.xOffset+=this.xVelocity*d,this.xVelocity*=w),i&&(this.yVelocity+=(p-this.yOffset*m)*u,this.yOffset+=this.yVelocity*d,this.yVelocity*=w),c-=d;while(c>=d)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a||h){let u=Math.atan2(o.c,o.a),m=0,g=0,p=0;if(a){p=(this.data.rotate+this.data.shearX)*t;let w=this.cx-o.worldX,x=this.cy-o.worldY,b=Math.atan2(x+this.ty,w+this.tx)-u-this.rotateOffset*p;this.rotateOffset+=(b-Math.ceil(b*X.invPI2-.5)*X.PI2)*f,b=this.rotateOffset*p+u,m=Math.cos(b),g=Math.sin(b),h&&(b=r*o.getWorldScaleX(),b>0&&(this.scaleOffset+=(w*m+x*g)*f/b))}else{m=Math.cos(u),g=Math.sin(u);const w=r*o.getWorldScaleX();w>0&&(this.scaleOffset+=((this.cx-o.worldX)*m+(this.cy-o.worldY)*g)*f/w)}if(c=this.remaining,c>=d){const w=this.massInverse*d,x=this.strength,b=this.wind,v=this.gravity,y=Math.pow(this.damping,60*d);for(;;)if(c-=d,h&&(this.scaleVelocity+=(b*m-v*g-this.scaleOffset*x)*w,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=y),a){if(this.rotateVelocity+=(-.01*r*(b*g+v*m)-this.rotateOffset*x)*w,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=y,c<d)break;const S=this.rotateOffset*p+u;m=Math.cos(S),g=Math.sin(S)}else if(c<d)break}}this.remaining=c}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a){let l=this.rotateOffset*t,n=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,n=Math.sin(d),c=Math.cos(d),f=o.b,o.b=c*f-n*o.d,o.d=n*f+c*o.d),d+=l*this.data.shearX,n=Math.sin(d),c=Math.cos(d),f=o.a,o.a=c*f-n*o.c,o.c=n*f+c*o.c}else l*=this.data.rotate,n=Math.sin(l),c=Math.cos(l),f=o.a,o.a=c*f-n*o.c,o.c=n*f+c*o.c,f=o.b,o.b=c*f-n*o.d,o.d=n*f+c*o.d}if(h){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=r*o.a,this.ty=r*o.c),o.updateAppliedTransform()}},Ss=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new 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 ne)||!(this.attachment instanceof ne)||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}},As=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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,c=r.c,f=r.d,d=l*f-n*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,g=this.bones;for(let p=0,w=g.length;p<w;p++){let x=g[p];if(e!=0){let b=x.a,v=x.b,y=x.c,S=x.d,A=Math.atan2(c,l)-Math.atan2(y,b)+u;A>X.PI?A-=X.PI2:A<-X.PI&&(A+=X.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);x.a=k*b-T*y,x.b=k*v-T*S,x.c=T*b+k*y,x.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(b.x-x.worldX)*t,x.worldY+=(b.y-x.worldY)*s}if(i!=0){let b=Math.sqrt(x.a*x.a+x.c*x.c);b!=0&&(b=(b+(Math.sqrt(l*l+c*c)-b+this.data.offsetScaleX)*i)/b),x.a*=b,x.c*=b}if(a!=0){let b=Math.sqrt(x.b*x.b+x.d*x.d);b!=0&&(b=(b+(Math.sqrt(n*n+f*f)-b+this.data.offsetScaleY)*a)/b),x.b*=b,x.d*=b}if(h>0){let b=x.b,v=x.d,y=Math.atan2(v,b),S=Math.atan2(f,n)-Math.atan2(c,l)-(y-Math.atan2(x.c,x.a));S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S=y+(S+m)*h;let A=Math.sqrt(b*b+v*v);x.b=Math.cos(S)*A,x.d=Math.sin(S)*A}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,c=r.c,f=r.d,d=l*f-n*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,g=this.bones;for(let p=0,w=g.length;p<w;p++){let x=g[p];if(e!=0){let b=x.a,v=x.b,y=x.c,S=x.d,A=Math.atan2(c,l)+u;A>X.PI?A-=X.PI2:A<-X.PI&&(A+=X.PI2),A*=e;let k=Math.cos(A),T=Math.sin(A);x.a=k*b-T*y,x.b=k*v-T*S,x.c=T*b+k*y,x.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),x.worldX+=b.x*t,x.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;x.a*=b,x.c*=b}if(a!=0){let b=(Math.sqrt(n*n+f*f)-1+this.data.offsetScaleY)*a+1;x.b*=b,x.d*=b}if(h>0){let b=Math.atan2(f,n)-Math.atan2(c,l);b>X.PI?b-=X.PI2:b<-X.PI&&(b+=X.PI2);let v=x.b,y=x.d;b=Math.atan2(y,v)+(b-X.PI/2+m)*h;let S=Math.sqrt(v*v+y*y);x.b=Math.cos(b)*S,x.d=Math.sin(b)*S}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let c=r[l],f=c.arotation;if(e!=0){let w=o.arotation-f+this.data.offsetRotation;w-=Math.ceil(w/360-.5)*360,f+=w*e}let d=c.ax,u=c.ay;d+=(o.ax-d+this.data.offsetX)*t,u+=(o.ay-u+this.data.offsetY)*s;let m=c.ascaleX,g=c.ascaleY;i!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*i)/m),a!=0&&g!=0&&(g=(g+(o.ascaleY-g+this.data.offsetScaleY)*a)/g);let p=c.ashearY;if(h!=0){let w=o.ashearY-p+this.data.offsetShearY;w-=Math.ceil(w/360-.5)*360,p+=w*h}c.updateWorldTransformWith(d,u,f,m,g,c.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,h=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let c=r[l],f=c.arotation+(o.arotation+this.data.offsetRotation)*e,d=c.ax+(o.ax+this.data.offsetX)*t,u=c.ay+(o.ay+this.data.offsetY)*s,m=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*a+1),p=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,u,f,m,g,c.ashearX,p)}}},Cs=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Cs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Xt(s,this,null);else{let a=this.bones[s.parent.index];i=new Xt(s,this,a),a.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],a=new Ss(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new vs(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new As(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 Ks(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 f=0,d=t.length;f<d;f++){let u=t[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,u=this.skin.bones.length;d<u;d++){let m=this.bones[f[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,a=this.pathConstraints,h=this.physicsConstraints,o=s.length,r=i.length,l=a.length,n=this.physicsConstraints.length,c=o+r+l+n;e:for(let f=0;f<c;f++){for(let d=0;d<o;d++){let u=s[d];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let d=0;d<r;d++){let u=i[d];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let d=0;d<l;d++){let u=a[d];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let d=0;d<n;d++){const u=h[d];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let a=s[s.length-1];this.sortBone(a),this._updateCache.push(e),this.sortReset(i.children),a.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let a=t.getAttachment();a instanceof Ae&&this.sortPathConstraintAttachmentWith(a,i);let h=e.bones,o=h.length;for(let r=0;r<o;r++)this.sortBone(h[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(h[r].children);for(let r=0;r<o;r++)h[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let a=t[i];this.sortBone(a.parent),this.sortBone(a)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let a in i)this.sortPathConstraintAttachmentWith(i[a],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ae))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let a=0,h=s.length;a<h;){let o=s[a++];for(o+=a;a<o;)this.sortBone(i[s[a++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(!e)throw new Error("physics is undefined");let t=this.bones;for(let i=0,a=t.length;i<a;i++){let h=t[i];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let s=this._updateCache;for(let i=0,a=s.length;i<a;i++)s[i].update(e)}updateWorldTransformWith(e,t){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=t.a,a=t.b,h=t.c,o=t.d;s.worldX=i*this.x+a*this.y+t.worldX,s.worldY=h*this.x+o*this.y+t.worldY;const r=(s.rotation+s.shearX)*X.degRad,l=(s.rotation+90+s.shearY)*X.degRad,n=Math.cos(r)*s.scaleX,c=Math.cos(l)*s.scaleY,f=Math.sin(r)*s.scaleX,d=Math.sin(l)*s.scaleY;s.a=(i*n+a*f)*this.scaleX,s.b=(i*c+a*d)*this.scaleX,s.c=(h*n+o*f)*this.scaleY,s.d=(h*c+o*d)*this.scaleY;let u=this._updateCache;for(let m=0,g=u.length;m<g;m++){let p=u[m];p!=s&&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;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s],h=a.data.attachmentName;if(h){let o=e.getAttachment(s,h);o&&a.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let h=s[i];if(h.data.name==e){let o=null;if(t&&(o=this.getAttachment(i,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);h.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(){let e=new Pe,t=new Pe;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,s=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let i=this.drawOrder,a=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l=0,n=i.length;l<n;l++){let c=i[l];if(!c.bone.active)continue;let f=0,d=null,u=c.getAttachment();if(u instanceof V)f=8,d=R.setArraySize(s,f,0),u.computeWorldVertices(c,d,0,2);else if(u instanceof ye){let m=u;f=m.worldVerticesLength,d=R.setArraySize(s,f,0),m.computeWorldVertices(c,0,f,d,0,2)}if(d)for(let m=0,g=d.length;m<g;m+=2){let p=d[m],w=d[m+1];a=Math.min(a,p),h=Math.min(h,w),o=Math.max(o,p),r=Math.max(r,w)}}e.set(a,h),t.set(o-a,r-h)}update(e){this.time+=e}},Is=Cs;B(Is,"yDown",!1);var ks=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ks||{}),Qs=class extends Fe{_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;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)}},Vt=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;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}},Lt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},He=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 i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){h=!0;break}h||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){h=!0;break}h||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){h=!0;break}h||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){h=!0;break}h||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof ye?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new Lt(t,i,a))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new Lt(e,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let a=e.slots[i],h=a.getAttachment();if(h&&s<t.attachments.length){let o=t.attachments[s];for(let r in o){let l=o[r];if(h==l){let n=this.getAttachment(s,r);n&&a.setAttachment(n);break}}}s++}}},Dt=class{index=0;name;boneData;color=new O(1,1,1,1);darkColor=null;attachmentName=null;blendMode=$e.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}},$e=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))($e||{}),Ot=class extends Fe{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)}},Zs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Vt;s.name="";let i=new Ts(e),a=i.readInt32(),h=i.readInt32();s.hash=h==0&&a==0?null:h.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let f=n==0?null:s.bones[i.readInt(!0)],d=new Mt(n,c,f);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.transformMode=i.readInt(!0),d.skinRequired=i.readBoolean(),o&&(O.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new Dt(n,c,f);O.rgba8888ToColor(d.color,i.readInt32());let u=i.readInt32();u!=-1&&O.rgb888ToColor(d.darkColor=new O,u),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Pt(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)],d.mix=i.readFloat(),d.softness=i.readFloat()*t;let u=i.readByte();d.skinRequired=(u&1)!=0,d.bendDirection=u&2?1:-1,d.compress=(u&4)!=0,d.stretch=(u&8)!=0,d.uniform=(u&16)!=0,s.ikConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Ot(f);d.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];const u=i.readByte();d.skinRequired=(u&1)!=0,d.local=(u&2)!=0,d.relative=(u&4)!=0,d.offsetRotation=i.readFloat(),d.offsetX=i.readFloat()*t,d.offsetY=i.readFloat()*t,d.offsetScaleX=i.readFloat(),d.offsetScaleY=i.readFloat(),d.offsetShearY=i.readFloat(),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),d.mixScaleX=i.readFloat(),d.mixScaleY=i.readFloat(),d.mixShearY=i.readFloat(),s.transformConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new Bt(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)],d.positionMode=i.readInt(!0),d.spacingMode=i.readInt(!0),d.rotateMode=i.readInt(!0),d.offsetRotation=i.readFloat(),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}r=i.readInt(!0);for(let n=0,c;n<r;n++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Qs(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let u=i.readByte();d.skinRequired=(u&1)!=0,u&2&&(d.x=i.readFloat()),u&4&&(d.y=i.readFloat()),u&8&&(d.rotate=i.readFloat()),u&16&&(d.scaleX=i.readFloat()),u&32&&(d.shearX=i.readFloat()),d.step=1/i.readByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=i.readFloat(),d.wind=i.readFloat(),d.gravity=i.readFloat(),d.mix=i.readFloat(),u=i.readByte(),u&1&&(d.inertiaGlobal=!0),u&2&&(d.strengthGlobal=!0),u&4&&(d.dampingGlobal=!0),u&8&&(d.massGlobal=!0),u&16&&(d.windGlobal=!0),u&32&&(d.gravityGlobal=!0),u&64&&(d.mixGlobal=!0),s.physicsConstraints.push(d)}let l=this.readSkin(i,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let n=s.skins.length;for(R.setArraySize(s.skins,r=n+i.readInt(!0));n<r;n++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[n]=c}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let c=this.linkedMeshes[n];const f=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let f=new Rt(c);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}r=i.readInt(!0);for(let n=0;n<r;n++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let a=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;a=new He("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");a=new He(o),i&&O.rgba8888ToColor(a.color,e.readInt32()),a.bones.length=e.readInt(!0);for(let r=0,l=a.bones.length;r<l;r++)a.bones[r]=t.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let o=0;o<h;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,a,r,c,i);f&&a.setAttachment(r,c,f)}}return a}readAttachment(e,t,s,i,a,h){let o=this.scale,r=e.readByte();const l=r&8?e.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(r&7){case ge.Region:{let n=r&16?e.readStringRef():null;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null;let d=e.readFloat(),u=e.readFloat(),m=e.readFloat(),g=e.readFloat(),p=e.readFloat(),w=e.readFloat(),x=e.readFloat();n||(n=l);let b=this.attachmentLoader.newRegionAttachment(s,l,n,f);return b?(b.path=n,b.x=u*o,b.y=m*o,b.scaleX=g,b.scaleY=p,b.rotation=d,b.width=w*o,b.height=x*o,O.rgba8888ToColor(b.color,c),b.sequence=f,f==null&&b.updateRegion(),b):null}case ge.BoundingBox:{let n=this.readVertices(e,(r&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,l);return f?(f.worldVerticesLength=n.length,f.vertices=n.vertices,f.bones=n.bones,h&&O.rgba8888ToColor(f.color,c),f):null}case ge.Mesh:{let n=r&16?e.readStringRef():l;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=e.readInt(!0),u=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,u.length,1),g=this.readShortArray(e,(u.length-d-2)*3);let p=[],w=0,x=0;h&&(p=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),x=e.readFloat()),n||(n=l);let b=this.attachmentLoader.newMeshAttachment(s,l,n,f);return b?(b.path=n,O.rgba8888ToColor(b.color,c),b.bones=u.bones,b.vertices=u.vertices,b.worldVerticesLength=u.length,b.triangles=g,b.regionUVs=m,f==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=f,h&&(b.edges=p,b.width=w*o,b.height=x*o),b):null}case ge.LinkedMesh:{const n=r&16?e.readStringRef():l;if(n==null)throw new Error("Path of linked mesh must not be null");const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=(r&128)!=0,u=e.readInt(!0),m=e.readStringRef();let g=0,p=0;h&&(g=e.readFloat(),p=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,l,n,f);return w?(w.path=n,O.rgba8888ToColor(w.color,c),w.sequence=f,h&&(w.width=g*o,w.height=p*o),this.linkedMeshes.push(new er(w,u,i,m,d)),w):null}case ge.Path:{const n=(r&16)!=0,c=(r&32)!=0,f=this.readVertices(e,(r&64)!=0),d=R.newArray(f.length/6,0);for(let g=0,p=d.length;g<p;g++)d[g]=e.readFloat()*o;const u=h?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=n,m.constantSpeed=c,m.worldVerticesLength=f.length,m.vertices=f.vertices,m.bones=f.bones,m.lengths=d,h&&O.rgba8888ToColor(m.color,u),m):null}case ge.Point:{const n=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,l);return u?(u.x=c*o,u.y=f*o,u.rotation=n,h&&O.rgba8888ToColor(u.color,d),u):null}case ge.Clipping:{const n=e.readInt(!0),c=this.readVertices(e,(r&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[n],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&O.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new et(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),a=new tr;if(a.length=i<<1,!t)return a.vertices=this.readFloatArray(e,a.length,s),a;let h=new Array,o=new Array;for(let r=0;r<i;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return a.vertices=R.toFloatArray(h),a.bones=o,a}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let a=0;a<t;a++)i[a]=e.readFloat();else for(let a=0;a<t;a++)i[a]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,a=this.scale;for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),g=m-1;switch(u){case fr:{let p=new we(m,c);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readStringRef());i.push(p);break}case ur:{let p=e.readInt(!0),w=new ct(m,p,c),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,x,b,v,y,S),A!=g;A++){let T=e.readFloat(),Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(A);break;case he:W(e,w,k++,A,0,x,T,b,Y,1),W(e,w,k++,A,1,x,T,v,E,1),W(e,w,k++,A,2,x,T,y,F,1),W(e,w,k++,A,3,x,T,S,P,1)}x=T,b=Y,v=E,y=F,S=P}i.push(w);break}case mr:{let p=e.readInt(!0),w=new dt(m,p,c),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,A=0;w.setFrame(S,x,b,v,y),S!=g;S++){let k=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(S);break;case he:W(e,w,A++,S,0,x,k,b,T,1),W(e,w,A++,S,1,x,k,v,Y,1),W(e,w,A++,S,2,x,k,y,E,1)}x=k,b=T,v=Y,y=E}i.push(w);break}case gr:{let p=e.readInt(!0),w=new ut(m,p,c),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let Y=0,E=0;w.setFrame(Y,x,b,v,y,S,A,k,T),Y!=g;Y++){let F=e.readFloat(),P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(Y);break;case he:W(e,w,E++,Y,0,x,F,b,P,1),W(e,w,E++,Y,1,x,F,v,I,1),W(e,w,E++,Y,2,x,F,y,M,1),W(e,w,E++,Y,3,x,F,S,L,1),W(e,w,E++,Y,4,x,F,A,U,1),W(e,w,E++,Y,5,x,F,k,D,1),W(e,w,E++,Y,6,x,F,T,G,1)}x=F,b=P,v=I,y=M,S=L,A=U,k=D,T=G}i.push(w);break}case xr:{let p=e.readInt(!0),w=new mt(m,p,c),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,x,b,v,y,S,A,k),T!=g;T++){let E=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(T);break;case he:W(e,w,Y++,T,0,x,E,b,F,1),W(e,w,Y++,T,1,x,E,v,P,1),W(e,w,Y++,T,2,x,E,y,I,1),W(e,w,Y++,T,3,x,E,S,M,1),W(e,w,Y++,T,4,x,E,A,L,1),W(e,w,Y++,T,5,x,E,k,U,1)}x=E,b=F,v=P,y=I,S=M,A=L,k=U}i.push(w);break}case br:{let p=new ft(m,e.readInt(!0),c),w=e.readFloat(),x=e.readUnsignedByte()/255;for(let b=0,v=0;p.setFrame(b,w,x),b!=g;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(b);break;case he:W(e,p,v++,b,0,w,y,x,S,1)}w=y,x=S}i.push(p)}}}}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),g=e.readInt(!0);switch(u){case sr:i.push(Q(e,new Me(m,g,c),1));break;case rr:i.push(Nt(e,new tt(m,g,c),a));break;case ir:i.push(Q(e,new st(m,g,c),a));break;case ar:i.push(Q(e,new rt(m,g,c),a));break;case nr:i.push(Nt(e,new it(m,g,c),1));break;case lr:i.push(Q(e,new at(m,g,c),1));break;case or:i.push(Q(e,new nt(m,g,c),1));break;case hr:i.push(Nt(e,new lt(m,g,c),1));break;case cr:i.push(Q(e,new ot(m,g,c),1));break;case dr:i.push(Q(e,new ht(m,g,c),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new xt(f,e.readInt(!0),c),m=e.readFloat(),g=e.readFloat(),p=e.readFloat()*a;for(let w=0,x=0;;w++){const b=e.readByte();if(u.setFrame(w,m,g,p,e.readByte(),(b&1)!=0,(b&2)!=0),w==d)break;let v=e.readFloat(),y=e.readFloat(),S=e.readFloat()*a;switch(e.readByte()){case oe:u.setStepped(w);break;case he:W(e,u,x++,w,0,m,v,g,y,1),W(e,u,x++,w,1,m,v,p,S,a)}m=v,g=y,p=S}i.push(u)}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new bt(f,e.readInt(!0),c),m=e.readFloat(),g=e.readFloat(),p=e.readFloat(),w=e.readFloat(),x=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;u.setFrame(y,m,g,p,w,x,b,v),y!=d;y++){let A=e.readFloat(),k=e.readFloat(),T=e.readFloat(),Y=e.readFloat(),E=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case oe:u.setStepped(y);break;case he:W(e,u,S++,y,0,m,A,g,k,1),W(e,u,S++,y,1,m,A,p,T,1),W(e,u,S++,y,2,m,A,w,Y,1),W(e,u,S++,y,3,m,A,x,E,1),W(e,u,S++,y,4,m,A,b,F,1),W(e,u,S++,y,5,m,A,v,P,1)}m=A,g=k,p=T,w=Y,x=E,b=F,v=P}i.push(u)}for(let l=0,n=e.readInt(!0);l<n;l++){let c=e.readInt(!0),f=s.pathConstraints[c];for(let d=0,u=e.readInt(!0);d<u;d++){const m=e.readByte(),g=e.readInt(!0),p=e.readInt(!0);switch(m){case yr:i.push(Q(e,new wt(g,p,c),f.positionMode==0?a:1));break;case vr:i.push(Q(e,new pt(g,p,c),f.spacingMode==0||f.spacingMode==1?a:1));break;case Sr:let w=new yt(g,p,c),x=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,A=0,k=w.getFrameCount()-1;w.setFrame(S,x,b,v,y),S!=k;S++){let T=e.readFloat(),Y=e.readFloat(),E=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:w.setStepped(S);break;case he:W(e,w,A++,S,0,x,T,b,Y,1),W(e,w,A++,S,1,x,T,v,E,1),W(e,w,A++,S,2,x,T,y,F,1)}x=T,b=Y,v=E,y=F}i.push(w)}}}for(let l=0,n=e.readInt(!0);l<n;l++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const u=e.readByte(),m=e.readInt(!0);if(u==Xr){const p=new vt(m,c);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat());i.push(p);continue}const g=e.readInt(!0);switch(u){case Ar:i.push(Q(e,new ss(m,g,c),1));break;case Cr:i.push(Q(e,new rs(m,g,c),1));break;case Ir:i.push(Q(e,new is(m,g,c),1));break;case kr:i.push(Q(e,new as(m,g,c),1));break;case Tr:i.push(Q(e,new ns(m,g,c),1));break;case Yr:i.push(Q(e,new ls(m,g,c),1));break;case Mr:i.push(Q(e,new os(m,g,c),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let c=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readInt(!0);for(let m=0,g=e.readInt(!0);m<g;m++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let w=c.getAttachment(u,p),x=e.readByte(),b=e.readInt(!0),v=b-1;switch(x){case wr:{let y=w,S=y.bones,A=y.vertices,k=S?A.length/3*2:A.length,T=e.readInt(!0),Y=new gt(b,T,u,y),E=e.readFloat();for(let F=0,P=0;;F++){let I,M=e.readInt(!0);if(M==0)I=S?R.newFloatArray(k):A;else{I=R.newFloatArray(k);let U=e.readInt(!0);if(M+=U,a==1)for(let D=U;D<M;D++)I[D]=e.readFloat();else for(let D=U;D<M;D++)I[D]=e.readFloat()*a;if(!S)for(let D=0,G=I.length;D<G;D++)I[D]+=A[D]}if(Y.setFrame(F,E,I),F==v)break;let L=e.readFloat();switch(e.readByte()){case oe:Y.setStepped(F);break;case he:W(e,Y,P++,F,0,E,L,0,1,1)}E=L}i.push(Y);break}case pr:{let y=new Se(b,u,w);for(let S=0;S<b;S++){let A=e.readFloat(),k=e.readInt32();y.setFrame(S,A,Kt[k&15],k>>4,e.readFloat())}i.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let l=new pe(h),n=s.slots.length;for(let c=0;c<h;c++){let f=e.readFloat(),d=e.readInt(!0),u=R.newArray(n,0);for(let w=n-1;w>=0;w--)u[w]=-1;let m=R.newArray(n-d,0),g=0,p=0;for(let w=0;w<d;w++){let x=e.readInt(!0);for(;g!=x;)m[p++]=g++;u[g+e.readInt(!0)]=g++}for(;g<n;)m[p++]=g++;for(let w=n-1;w>=0;w--)u[w]==-1&&(u[w]=m[--p]);l.setFrame(c,f,u)}i.push(l)}let o=e.readInt(!0);if(o>0){let l=new Xe(o);for(let n=0;n<o;n++){let c=e.readFloat(),f=s.events[e.readInt(!0)],d=new Et(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(n,d)}i.push(l)}let r=0;for(let l=0,n=i.length;l<n;l++)r=Math.max(r,i[l].getDuration());return new Ve(t,i,r)}},Ts=class{constructor(e,t=new Array,s=0,i=new DataView(e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let a=this.readUnsignedByte();switch(a>>4){case 12:case 13:t+=String.fromCharCode((a&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((a&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(a),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},er=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}},tr=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 i=e.readFloat(),a=e.readFloat()*s;for(let h=0,o=0,r=t.getFrameCount()-1;t.setFrame(h,i,a),h!=r;h++){let l=e.readFloat(),n=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(h);break;case he:W(e,t,o++,h,0,i,l,a,n,s)}i=l,a=n}return t}function Nt(e,t,s){let i=e.readFloat(),a=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,r=0,l=t.getFrameCount()-1;t.setFrame(o,i,a,h),o!=l;o++){let n=e.readFloat(),c=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(o);break;case he:W(e,t,r++,o,0,i,n,a,c,s),W(e,t,r++,o,1,i,n,h,f,s)}i=n,a=c,h=f}return t}function W(e,t,s,i,a,h,o,r,l,n){t.setBezier(s,i,a,h,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var sr=0,rr=1,ir=2,ar=3,nr=4,lr=5,or=6,hr=7,cr=8,dr=9,fr=0,ur=1,mr=2,gr=3,xr=4,br=5,wr=0,pr=1,yr=0,vr=1,Sr=2,Ar=0,Cr=1,Ir=2,kr=4,Tr=5,Yr=6,Mr=7,Xr=8,oe=1,he=2,Fr=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ye(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,h=e.slots,o=h.length;s.length=0,a.freeAll(i),i.length=0;for(let r=0;r<o;r++){let l=h[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof _e){let c=n;s.push(c);let f=a.obtain();f.length!=c.worldVerticesLength&&(f=R.newFloatArray(c.worldVerticesLength)),i.push(f),c.computeWorldVertices(l,0,c.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let h=0,o=a.length;h<o;h++){let r=a[h],l=r;for(let n=0,c=r.length;n<c;n+=2){let f=l[n],d=l[n+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let a=this.minX,h=this.minY,o=this.maxX,r=this.maxY;if(e<=a&&s<=a||t<=h&&i<=h||e>=o&&s>=o||t>=r&&i>=r)return!1;let l=(i-t)/(s-e),n=l*(a-e)+t;if(n>h&&n<r||(n=l*(o-e)+t,n>h&&n<r))return!0;let c=(h-t)/l+e;return c>a&&c<o||(c=(r-t)/l+e,c>a&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,a=e.length,h=a-2,o=!1;for(let r=0;r<a;r+=2){let l=i[r+1],n=i[h+1];if(l<s&&n>=s||n<s&&l>=s){let c=i[r];c+(s-l)/(n-l)*(i[h]-c)<t&&(o=!o)}h=r}return o}intersectsSegment(e,t,s,i){let a=this.polygons;for(let h=0,o=a.length;h<o;h++)if(this.intersectsSegmentPolygon(a[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,a){let h=e,o=e.length,r=t-i,l=s-a,n=t*a-s*i,c=h[o-2],f=h[o-1];for(let d=0;d<o;d+=2){let u=h[d],m=h[d+1],g=c*m-f*u,p=c-u,w=f-m,x=r*w-l*p,b=(n*p-r*g)/x;if((b>=c&&b<=u||b>=u&&b<=c)&&(b>=t&&b<=i||b>=i&&b<=t)){let v=(n*w-l*g)/x;if((v>=f&&v<=m||v>=m&&v<=f)&&(v>=s&&v<=a||v>=a&&v<=s))return!0}c=u,f=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}},te=class{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(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let o=0;o<s;o++)i[o]=o;let a=this.isConcaveArray;a.length=0;for(let o=0,r=s;o<r;++o)a[o]=te.isConcave(o,s,t,i);let h=this.triangles;for(h.length=0;s>3;){let o=s-1,r=0,l=1;for(;;){e:if(!a[r]){let f=i[o]<<1,d=i[r]<<1,u=i[l]<<1,m=t[f],g=t[f+1],p=t[d],w=t[d+1],x=t[u],b=t[u+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!a[v])continue;let y=i[v]<<1,S=t[y],A=t[y+1];if(te.positiveArea(x,b,m,g,S,A)&&te.positiveArea(m,g,p,w,S,A)&&te.positiveArea(p,w,x,b,S,A))break e}break}if(l==0){do{if(!a[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%s}h.push(i[(s+r-1)%s]),h.push(i[r]),h.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let n=(s+r-1)%s,c=r==s?0:r;a[n]=te.isConcave(n,s,t,i),a[c]=te.isConcave(c,s,t,i)}return s==3&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,c=t.length;n<c;n+=3){let f=t[n]<<1,d=t[n+1]<<1,u=t[n+2]<<1,m=s[f],g=s[f+1],p=s[d],w=s[d+1],x=s[u],b=s[u+1],v=!1;if(r==f){let y=o.length-4,S=te.winding(o[y],o[y+1],o[y+2],o[y+3],x,b),A=te.winding(x,b,o[0],o[1],o[2],o[3]);S==l&&A==l&&(o.push(x),o.push(b),h.push(u),v=!0)}v||(o.length>0?(i.push(o),a.push(h)):(this.polygonPool.free(o),this.polygonIndicesPool.free(h)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(g),o.push(p),o.push(w),o.push(x),o.push(b),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(f),h.push(d),h.push(u),l=te.winding(m,g,p,w,x,b),r=f)}o.length>0&&(i.push(o),a.push(h));for(let n=0,c=i.length;n<c;n++){if(h=a[n],h.length==0)continue;let f=h[0],d=h[h.length-1];o=i[n];let u=o.length-4,m=o[u],g=o[u+1],p=o[u+2],w=o[u+3],x=o[0],b=o[1],v=o[2],y=o[3],S=te.winding(m,g,p,w,x,b);for(let A=0;A<c;A++){if(A==n)continue;let k=a[A];if(k.length!=3)continue;let T=k[0],Y=k[1],E=k[2],F=i[A],P=F[F.length-2],I=F[F.length-1];if(T!=f||Y!=d)continue;let M=te.winding(m,g,p,w,P,I),L=te.winding(P,I,x,b,v,y);M==S&&L==S&&(F.length=0,k.length=0,o.push(P),o.push(I),h.push(E),m=p,g=w,p=P,w=I,A=0)}}for(let n=i.length-1;n>=0;n--)o=i[n],o.length==0&&(i.splice(n,1),this.polygonPool.free(o),h=a[n],a.splice(n,1),this.polygonIndicesPool.free(h));return i}static isConcave(e,t,s,i){let a=i[(t+e-1)%t]<<1,h=i[e]<<1,o=i[(e+1)%t]<<1;return!this.positiveArea(s[a],s[a+1],s[h],s[h+1],s[o],s[o+1])}static positiveArea(e,t,s,i,a,h){return e*(h-i)+s*(t-h)+a*(i-t)>=0}static winding(e,t,s,i,a,h){let o=s-e,r=i-t;return a*r-h*o+o*t-e*r>=0?1:-1}},_t=class{triangulator=new te;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let a=this.clippingPolygon;_t.makeClockwise(a);let h=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let o=0,r=h.length;o<r;o++){let l=h[o];_t.makeClockwise(l),l.push(l[0]),l.push(l[1])}return h.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,a,h,o,r){let l=this.clipOutput,n=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,u=r?12:8,m=0;n.length=0,c.length=0;e:for(let g=0;g<i;g+=3){let p=s[g]<<1,w=e[p],x=e[p+1],b=a[p],v=a[p+1];p=s[g+1]<<1;let y=e[p],S=e[p+1],A=a[p],k=a[p+1];p=s[g+2]<<1;let T=e[p],Y=e[p+1],E=a[p],F=a[p+1];for(let P=0;P<d;P++){let I=n.length;if(this.clip(w,x,y,S,T,Y,f[P],l)){let M=l.length;if(M==0)continue;let L=S-Y,U=T-y,D=w-T,G=Y-x,j=1/(L*D+U*(x-Y)),$=M>>1,q=this.clipOutput,N=R.setArraySize(n,I+$*u);for(let Z=0;Z<M;Z+=2){let ce=q[Z],K=q[Z+1];N[I]=ce,N[I+1]=K,N[I+2]=h.r,N[I+3]=h.g,N[I+4]=h.b,N[I+5]=h.a;let re=ce-T,ie=K-Y,xe=(L*re+U*ie)*j,Ie=(G*re+D*ie)*j,Ee=1-xe-Ie;N[I+6]=b*xe+A*Ie+E*Ee,N[I+7]=v*xe+k*Ie+F*Ee,r&&(N[I+8]=o.r,N[I+9]=o.g,N[I+10]=o.b,N[I+11]=o.a),I+=u}I=c.length;let H=R.setArraySize(c,I+3*($-2));$--;for(let Z=1;Z<$;Z++)H[I]=m,H[I+1]=m+Z,H[I+2]=m+Z+1,I+=3;m+=$+1}else{let M=R.setArraySize(n,I+3*u);M[I]=w,M[I+1]=x,M[I+2]=h.r,M[I+3]=h.g,M[I+4]=h.b,M[I+5]=h.a,r?(M[I+6]=b,M[I+7]=v,M[I+8]=o.r,M[I+9]=o.g,M[I+10]=o.b,M[I+11]=o.a,M[I+12]=y,M[I+13]=S,M[I+14]=h.r,M[I+15]=h.g,M[I+16]=h.b,M[I+17]=h.a,M[I+18]=A,M[I+19]=k,M[I+20]=o.r,M[I+21]=o.g,M[I+22]=o.b,M[I+23]=o.a,M[I+24]=T,M[I+25]=Y,M[I+26]=h.r,M[I+27]=h.g,M[I+28]=h.b,M[I+29]=h.a,M[I+30]=E,M[I+31]=F,M[I+32]=o.r,M[I+33]=o.g,M[I+34]=o.b,M[I+35]=o.a):(M[I+6]=b,M[I+7]=v,M[I+8]=y,M[I+9]=S,M[I+10]=h.r,M[I+11]=h.g,M[I+12]=h.b,M[I+13]=h.a,M[I+14]=A,M[I+15]=k,M[I+16]=T,M[I+17]=Y,M[I+18]=h.r,M[I+19]=h.g,M[I+20]=h.b,M[I+21]=h.a,M[I+22]=E,M[I+23]=F),I=c.length;let L=R.setArraySize(c,I+3);L[I]=m,L[I+1]=m+1,L[I+2]=m+2,m+=3;continue e}}}}clip(e,t,s,i,a,h,o,r){let l=r,n=!1,c;o.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(e),c.push(t),c.push(s),c.push(i),c.push(a),c.push(h),c.push(e),c.push(t),r.length=0;let f=o,d=o.length-4;for(let u=0;;u+=2){let m=f[u],g=f[u+1],p=f[u+2],w=f[u+3],x=m-p,b=g-w,v=c,y=c.length-2,S=r.length;for(let k=0;k<y;k+=2){let T=v[k],Y=v[k+1],E=v[k+2],F=v[k+3],P=x*(F-w)-b*(E-p)>0;if(x*(Y-w)-b*(T-p)>0){if(P){r.push(E),r.push(F);continue}let I=F-Y,M=E-T,L=I*(p-m)-M*(w-g);if(Math.abs(L)>1e-6){let U=(M*(g-Y)-I*(m-T))/L;r.push(m+(p-m)*U),r.push(g+(w-g)*U)}else r.push(m),r.push(g)}else if(P){let I=F-Y,M=E-T,L=I*(p-m)-M*(w-g);if(Math.abs(L)>1e-6){let U=(M*(g-Y)-I*(m-T))/L;r.push(m+(p-m)*U),r.push(g+(w-g)*U)}else r.push(m),r.push(g);r.push(E),r.push(F)}n=!0}if(S==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==d)break;let A=r;r=c,r.length=0,c=A}if(l!=r){l.length=0;for(let u=0,m=r.length-2;u<m;u++)l[u]=r[u]}else l.length=l.length-2;return n}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],a=0,h=0,o=0,r=0;for(let l=0,n=s-3;l<n;l+=2)a=t[l],h=t[l+1],o=t[l+2],r=t[l+3],i+=a*r-o*h;if(!(i<0))for(let l=0,n=s-2,c=s>>1;l<c;l+=2){let f=t[l],d=t[l+1],u=n-l;t[l]=t[u],t[l+1]=t[u+1],t[u]=f,t[u+1]=d}}},Er=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Vt,i=typeof e=="string"?JSON.parse(e):e,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.fps=a.fps,s.imagesPath=a.images),i.bones)for(let h=0;h<i.bones.length;h++){let o=i.bones[h],r=null,l=C(o,"parent",null);l&&(r=s.findBone(l));let n=new Mt(s.bones.length,o.name,r);n.length=C(o,"length",0)*t,n.x=C(o,"x",0)*t,n.y=C(o,"y",0)*t,n.rotation=C(o,"rotation",0),n.scaleX=C(o,"scaleX",1),n.scaleY=C(o,"scaleY",1),n.shearX=C(o,"shearX",0),n.shearY=C(o,"shearY",0),n.transformMode=R.enumValue(Ue,C(o,"transform","Normal")),n.skinRequired=C(o,"skin",!1);let c=C(o,"color",null);c&&n.color.setFromString(c),s.bones.push(n)}if(i.slots)for(let h=0;h<i.slots.length;h++){let o=i.slots[h],r=s.findBone(o.bone);if(!r)throw new Error(`Couldn't find bone ${o.bone} for slot ${o.name}`);let l=new Dt(s.slots.length,o.name,r),n=C(o,"color",null);n&&l.color.setFromString(n);let c=C(o,"dark",null);c&&(l.darkColor=O.fromString(c)),l.attachmentName=C(o,"attachment",null),l.blendMode=R.enumValue($e,C(o,"blend","normal")),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let o=i.ik[h],r=new Pt(o.name);r.order=C(o,"order",0),r.skinRequired=C(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let c=s.findBone(o.bones[n]);if(!c)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(c)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);r.target=l,r.mix=C(o,"mix",1),r.softness=C(o,"softness",0)*t,r.bendDirection=C(o,"bendPositive",!0)?1:-1,r.compress=C(o,"compress",!1),r.stretch=C(o,"stretch",!1),r.uniform=C(o,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let h=0;h<i.transform.length;h++){let o=i.transform[h],r=new Ot(o.name);r.order=C(o,"order",0),r.skinRequired=C(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=C(o,"local",!1),r.relative=C(o,"relative",!1),r.offsetRotation=C(o,"rotation",0),r.offsetX=C(o,"x",0)*t,r.offsetY=C(o,"y",0)*t,r.offsetScaleX=C(o,"scaleX",0),r.offsetScaleY=C(o,"scaleY",0),r.offsetShearY=C(o,"shearY",0),r.mixRotate=C(o,"mixRotate",1),r.mixX=C(o,"mixX",1),r.mixY=C(o,"mixY",r.mixX),r.mixScaleX=C(o,"mixScaleX",1),r.mixScaleY=C(o,"mixScaleY",r.mixScaleX),r.mixShearY=C(o,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let h=0;h<i.path.length;h++){let o=i.path[h],r=new Bt(o.name);r.order=C(o,"order",0),r.skinRequired=C(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let f=o.bones[c],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=R.enumValue(We,C(o,"positionMode","Percent")),r.spacingMode=R.enumValue(ze,C(o,"spacingMode","Length")),r.rotateMode=R.enumValue(Ge,C(o,"rotateMode","Tangent")),r.offsetRotation=C(o,"rotation",0),r.position=C(o,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=C(o,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=C(o,"mixRotate",1),r.mixX=C(o,"mixX",1),r.mixY=C(o,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.skins)for(let h=0;h<i.skins.length;h++){let o=i.skins[h],r=new He(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],c=s.findBone(n);if(!c)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(c)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],c=s.findIkConstraint(n);if(!c)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(c)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],c=s.findTransformConstraint(n);if(!c)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(c)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],c=s.findPathConstraint(n);if(!c)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(c)}for(let l in o.attachments){let n=s.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let c=o.attachments[l];for(let f in c){let d=this.readAttachment(c[f],r,n.index,f,s);d&&r.setAttachment(n.index,f,d)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let r=this.linkedMeshes[h],l=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${r.skin}`);let n=l.getAttachment(r.slotIndex,r.parent);if(!n)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let o=i.events[h],r=new Rt(h);r.intValue=C(o,"int",0),r.floatValue=C(o,"float",0),r.stringValue=C(o,"string",""),r.audioPath=C(o,"audio",null),r.audioPath&&(r.volume=C(o,"volume",1),r.balance=C(o,"balance",0)),s.events.push(r)}if(i.animations)for(let h in i.animations){let o=i.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(e,t,s,i,a){let h=this.scale;switch(i=C(e,"name",i),C(e,"type","region")){case"region":{let o=C(e,"path",i),r=this.readSequence(C(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,i,o,r);if(!l)return null;l.path=o,l.x=C(e,"x",0)*h,l.y=C(e,"y",0)*h,l.scaleX=C(e,"scaleX",1),l.scaleY=C(e,"scaleY",1),l.rotation=C(e,"rotation",0),l.width=e.width*h,l.height=e.height*h,l.sequence=r;let n=C(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=C(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=C(e,"path",i),r=this.readSequence(C(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,i,o,r);if(!l)return null;l.path=o;let n=C(e,"color",null);n&&l.color.setFromString(n),l.width=C(e,"width",0)*h,l.height=C(e,"height",0)*h,l.sequence=r;let c=C(e,"parent",null);if(c)return this.linkedMeshes.push(new Rr(l,C(e,"skin",null),s,c,C(e,"timelines",!0))),l;let f=e.uvs;return this.readVertices(e,l,f.length),l.triangles=e.triangles,l.regionUVs=f,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,i);if(!o)return null;o.closed=C(e,"closed",!1),o.constantSpeed=C(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=R.newArray(r/3,0);for(let c=0;c<e.lengths.length;c++)l[c]=e.lengths[c]*h;o.lengths=l;let n=C(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=C(e,"x",0)*h,o.y=C(e,"y",0)*h,o.rotation=C(e,"rotation",0);let r=C(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let r=C(e,"end",null);r&&(o.endSlot=a.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=C(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let t=new et(C(e,"count",0));return t.start=C(e,"start",1),t.digits=C(e,"digits",0),t.setupIndex=C(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let a=e.vertices;if(s==a.length){let r=R.toFloatArray(a);if(i!=1)for(let l=0,n=a.length;l<n;l++)r[l]*=i;t.vertices=r;return}let h=new Array,o=new Array;for(let r=0,l=a.length;r<l;){let n=a[r++];o.push(n);for(let c=r+n*4;r<c;r+=4)o.push(a[r]),h.push(a[r+1]*i),h.push(a[r+2]*i),h.push(a[r+3])}t.bones=o,t.vertices=R.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,a=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let c in r){let f=r[c];if(!f)continue;let d=f.length;if(c=="attachment"){let u=new we(d,n);for(let m=0;m<d;m++){let g=f[m];u.setFrame(m,C(g,"time",0),C(g,"name",null))}a.push(u)}else if(c=="rgba"){let u=new ct(d,d<<2,n),m=f[0],g=C(m,"time",0),p=O.fromString(m.color);for(let w=0,x=0;;w++){u.setFrame(w,g,p.r,p.g,p.b,p.a);let b=f[w+1];if(!b){u.shrink(x);break}let v=C(b,"time",0),y=O.fromString(b.color),S=m.curve;S&&(x=z(S,u,x,w,0,g,v,p.r,y.r,1),x=z(S,u,x,w,1,g,v,p.g,y.g,1),x=z(S,u,x,w,2,g,v,p.b,y.b,1),x=z(S,u,x,w,3,g,v,p.a,y.a,1)),g=v,p=y,m=b}a.push(u)}else if(c=="rgb"){let u=new dt(d,d*3,n),m=f[0],g=C(m,"time",0),p=O.fromString(m.color);for(let w=0,x=0;;w++){u.setFrame(w,g,p.r,p.g,p.b);let b=f[w+1];if(!b){u.shrink(x);break}let v=C(b,"time",0),y=O.fromString(b.color),S=m.curve;S&&(x=z(S,u,x,w,0,g,v,p.r,y.r,1),x=z(S,u,x,w,1,g,v,p.g,y.g,1),x=z(S,u,x,w,2,g,v,p.b,y.b,1)),g=v,p=y,m=b}a.push(u)}else if(c=="alpha")a.push(de(f,new ft(d,d,n),0,1));else if(c=="rgba2"){let u=new ut(d,d*7,n),m=f[0],g=C(m,"time",0),p=O.fromString(m.light),w=O.fromString(m.dark);for(let x=0,b=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,p.a,w.r,w.g,w.b);let v=f[x+1];if(!v){u.shrink(b);break}let y=C(v,"time",0),S=O.fromString(v.light),A=O.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,x,0,g,y,p.r,S.r,1),b=z(k,u,b,x,1,g,y,p.g,S.g,1),b=z(k,u,b,x,2,g,y,p.b,S.b,1),b=z(k,u,b,x,3,g,y,p.a,S.a,1),b=z(k,u,b,x,4,g,y,w.r,A.r,1),b=z(k,u,b,x,5,g,y,w.g,A.g,1),b=z(k,u,b,x,6,g,y,w.b,A.b,1)),g=y,p=S,w=A,m=v}a.push(u)}else if(c=="rgb2"){let u=new mt(d,d*6,n),m=f[0],g=C(m,"time",0),p=O.fromString(m.light),w=O.fromString(m.dark);for(let x=0,b=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,w.r,w.g,w.b);let v=f[x+1];if(!v){u.shrink(b);break}let y=C(v,"time",0),S=O.fromString(v.light),A=O.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,x,0,g,y,p.r,S.r,1),b=z(k,u,b,x,1,g,y,p.g,S.g,1),b=z(k,u,b,x,2,g,y,p.b,S.b,1),b=z(k,u,b,x,3,g,y,w.r,A.r,1),b=z(k,u,b,x,4,g,y,w.g,A.g,1),b=z(k,u,b,x,5,g,y,w.b,A.b,1)),g=y,p=S,w=A,m=v}a.push(u)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let c in r){let f=r[c],d=f.length;if(d!=0){if(c==="rotate")a.push(de(f,new Me(d,d,n),0,1));else if(c==="translate"){let u=new tt(d,d<<1,n);a.push(qt(f,u,"x","y",0,i))}else if(c==="translatex"){let u=new st(d,d,n);a.push(de(f,u,0,i))}else if(c==="translatey"){let u=new rt(d,d,n);a.push(de(f,u,0,i))}else if(c==="scale"){let u=new it(d,d<<1,n);a.push(qt(f,u,"x","y",1,1))}else if(c==="scalex"){let u=new at(d,d,n);a.push(de(f,u,1,1))}else if(c==="scaley"){let u=new nt(d,d,n);a.push(de(f,u,1,1))}else if(c==="shear"){let u=new lt(d,d<<1,n);a.push(qt(f,u,"x","y",0,1))}else if(c==="shearx"){let u=new ot(d,d,n);a.push(de(f,u,0,1))}else if(c==="sheary"){let u=new ht(d,d,n);a.push(de(f,u,0,1))}}}}if(e.ik)for(let o in e.ik){let r=e.ik[o],l=r[0];if(!l)continue;let n=s.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(n),f=new xt(r.length,r.length<<1,c),d=C(l,"time",0),u=C(l,"mix",1),m=C(l,"softness",0)*i;for(let g=0,p=0;;g++){f.setFrame(g,d,u,m,C(l,"bendPositive",!0)?1:-1,C(l,"compress",!1),C(l,"stretch",!1));let w=r[g+1];if(!w){f.shrink(p);break}let x=C(w,"time",0),b=C(w,"mix",1),v=C(w,"softness",0)*i,y=l.curve;y&&(p=z(y,f,p,g,0,d,x,u,b,1),p=z(y,f,p,g,1,d,x,m,v,i)),d=x,u=b,m=v,l=w}a.push(f)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=s.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(n),f=new bt(r.length,r.length*6,c),d=C(l,"time",0),u=C(l,"mixRotate",1),m=C(l,"mixX",1),g=C(l,"mixY",m),p=C(l,"mixScaleX",1),w=C(l,"mixScaleY",p),x=C(l,"mixShearY",1);for(let b=0,v=0;;b++){f.setFrame(b,d,u,m,g,p,w,x);let y=r[b+1];if(!y){f.shrink(v);break}let S=C(y,"time",0),A=C(y,"mixRotate",1),k=C(y,"mixX",1),T=C(y,"mixY",k),Y=C(y,"mixScaleX",1),E=C(y,"mixScaleY",Y),F=C(y,"mixShearY",1),P=l.curve;P&&(v=z(P,f,v,b,0,d,S,u,A,1),v=z(P,f,v,b,1,d,S,m,k,1),v=z(P,f,v,b,2,d,S,g,T,1),v=z(P,f,v,b,3,d,S,p,Y,1),v=z(P,f,v,b,4,d,S,w,E,1),v=z(P,f,v,b,5,d,S,x,F,1)),d=S,u=A,m=k,g=T,p=Y,w=E,p=Y,l=y}a.push(f)}if(e.path)for(let o in e.path){let r=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=s.pathConstraints.indexOf(l);for(let c in r){let f=r[c],d=f[0];if(!d)continue;let u=f.length;if(c==="position"){let m=new wt(u,u,n);a.push(de(f,m,0,l.positionMode==0?i:1))}else if(c==="spacing"){let m=new pt(u,u,n);a.push(de(f,m,0,l.spacingMode==0||l.spacingMode==1?i:1))}else if(c==="mix"){let m=new yt(u,u*3,n),g=C(d,"time",0),p=C(d,"mixRotate",1),w=C(d,"mixX",1),x=C(d,"mixY",w);for(let b=0,v=0;;b++){m.setFrame(b,g,p,w,x);let y=f[b+1];if(!y){m.shrink(v);break}let S=C(y,"time",0),A=C(y,"mixRotate",1),k=C(y,"mixX",1),T=C(y,"mixY",k),Y=d.curve;Y&&(v=z(Y,m,v,b,0,g,S,p,A,1),v=z(Y,m,v,b,1,g,S,w,k,1),v=z(Y,m,v,b,2,g,S,x,T,1)),g=S,p=A,w=k,x=T,d=y}a.push(m)}}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let c=r[n],f=s.findSlot(n);if(!f)throw new Error("Slot not found: "+n);let d=f.index;for(let u in c){let m=c[u],g=l.getAttachment(d,u);for(let p in m){let w=m[p],x=w[0];if(x){if(p=="deform"){let b=g.bones,v=g.vertices,y=b?v.length/3*2:v.length,S=new gt(w.length,w.length,d,g),A=C(x,"time",0);for(let k=0,T=0;;k++){let Y,E=C(x,"vertices",null);if(!E)Y=b?R.newFloatArray(y):v;else{Y=R.newFloatArray(y);let M=C(x,"offset",0);if(R.arrayCopy(E,0,Y,M,E.length),i!=1)for(let L=M,U=L+E.length;L<U;L++)Y[L]*=i;if(!b)for(let L=0;L<y;L++)Y[L]+=v[L]}S.setFrame(k,A,Y);let F=w[k+1];if(!F){S.shrink(T);break}let P=C(F,"time",0),I=x.curve;I&&(T=z(I,S,T,k,0,A,P,0,1,1)),A=P,x=F}a.push(S)}else if(p=="sequence"){let b=new Se(w.length,d,g),v=0;for(let y=0;y<w.length;y++){let S=C(x,"delay",v),A=C(x,"time",0),k=Jt[C(x,"mode","hold")],T=C(x,"index",0);b.setFrame(y,A,k,T,S),v=S,x=w[y+1]}a.push(b)}}}}}}if(e.drawOrder){let o=new pe(e.drawOrder.length),r=s.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let c=e.drawOrder[n],f=null,d=C(c,"offsets",null);if(d){f=R.newArray(r,-1);let u=R.newArray(r-d.length,0),m=0,g=0;for(let p=0;p<d.length;p++){let w=d[p],x=s.findSlot(w.slot);if(!x)throw new Error("Slot not found: "+x);let b=x.index;for(;m!=b;)u[g++]=m++;f[m+w.offset]=m++}for(;m<r;)u[g++]=m++;for(let p=r-1;p>=0;p--)f[p]==-1&&(f[p]=u[--g])}o.setFrame(l,C(c,"time",0),f)}a.push(o)}if(e.events){let o=new Xe(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],c=s.findEvent(n.name);if(!c)throw new Error("Event not found: "+n.name);let f=new Et(R.toSinglePrecision(C(n,"time",0)),c);f.intValue=C(n,"int",c.intValue),f.floatValue=C(n,"float",c.floatValue),f.stringValue=C(n,"string",c.stringValue),f.data.audioPath&&(f.volume=C(n,"volume",1),f.balance=C(n,"balance",0)),o.setFrame(r,f)}a.push(o)}let h=0;for(let o=0,r=a.length;o<r;o++)h=Math.max(h,a[o].getDuration());s.animations.push(new Ve(t,a,h))}},Rr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}};function de(e,t,s,i){let a=e[0],h=C(a,"time",0),o=C(a,"value",s)*i,r=0;for(let l=0;;l++){t.setFrame(l,h,o);let n=e[l+1];if(!n)return t.shrink(r),t;let c=C(n,"time",0),f=C(n,"value",s)*i;a.curve&&(r=z(a.curve,t,r,l,0,h,c,o,f,i)),h=c,o=f,a=n}}function qt(e,t,s,i,a,h){let o=e[0],r=C(o,"time",0),l=C(o,s,a)*h,n=C(o,i,a)*h,c=0;for(let f=0;;f++){t.setFrame(f,r,l,n);let d=e[f+1];if(!d)return t.shrink(c),t;let u=C(d,"time",0),m=C(d,s,a)*h,g=C(d,i,a)*h,p=o.curve;p&&(c=z(p,t,c,f,0,r,u,l,m,h),c=z(p,t,c,f,1,r,u,n,g,h)),r=u,l=m,n=g,o=d}}function z(e,t,s,i,a,h,o,r,l,n){if(e=="stepped")return t.setStepped(i),s;let c=a<<2,f=e[c],d=e[c+1]*n,u=e[c+2],m=e[c+3]*n;return t.setBezier(s,i,a,h,r,f,d,u,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 Ys=class extends kt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Pr=class extends ys{constructor(e="",t=new Ft){super(s=>new Ys(s),e,t)}},Br=R.newFloatArray(8),je=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=R.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,i=e.color,a=e.drawOrder;this.debugRendering&&(t.strokeStyle="green");for(let h=0,o=a.length;h<o;h++){let r=a[h],l=r.bone;if(!l.active)continue;let n=r.getAttachment();if(!(n instanceof V))continue;n.computeWorldVertices(r,Br,0,2);let c=n.region,f=c.texture.getImage(),d=r.color,u=n.color;s.set(i.r*d.r*u.r,i.g*d.g*u.g,i.b*d.b*u.b,i.a*d.a*u.a),t.save(),t.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),t.translate(n.offset[0],n.offset[1]),t.rotate(n.rotation*Math.PI/180);let m=n.width/c.originalWidth;t.scale(m*n.scaleX,m*n.scaleY);let g=c.width,p=c.height;if(t.translate(g/2,p/2),n.region.degrees==90){let w=g;g=p,p=w,t.rotate(-Math.PI/2)}t.scale(1,-1),t.translate(-g/2,-p/2),t.globalAlpha=s.a,t.drawImage(f,f.width*c.u,f.height*c.v,g,p,0,0,g,p),this.debugRendering&&t.strokeRect(0,0,g,p),t.restore()}}drawTriangles(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder,h=null,o=this.vertices,r=null;for(let n=0,c=a.length;n<c;n++){let f=a[n],d=f.getAttachment(),u,m;if(d instanceof V){let g=d;o=this.computeRegionVertices(f,g,!1),r=je.QUAD_TRIANGLES,u=g.region.texture.getImage()}else if(d instanceof ye){let g=d;o=this.computeMeshVertices(f,g,!1),r=g.triangles,u=g.region.texture.getImage()}else continue;if(u){f.data.blendMode!=h&&(h=f.data.blendMode);let g=f.color,p=d.color;s.set(i.r*g.r*p.r,i.g*g.g*p.g,i.b*g.b*p.b,i.a*g.a*p.a),t.globalAlpha=s.a;for(var l=0;l<r.length;l+=3){let w=r[l]*8,x=r[l+1]*8,b=r[l+2]*8,v=o[w],y=o[w+1],S=o[w+6],A=o[w+7],k=o[x],T=o[x+1],Y=o[x+6],E=o[x+7],F=o[b],P=o[b+1],I=o[b+6],M=o[b+7];this.drawTriangle(u,v,y,S,A,k,T,Y,E,F,P,I,M),this.debugRendering&&(t.strokeStyle="green",t.beginPath(),t.moveTo(v,y),t.lineTo(k,T),t.lineTo(F,P),t.lineTo(v,y),t.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,t,s,i,a,h,o,r,l,n,c,f,d){let u=this.ctx;i*=e.width,a*=e.height,r*=e.width,l*=e.height,f*=e.width,d*=e.height,u.beginPath(),u.moveTo(t,s),u.lineTo(h,o),u.lineTo(n,c),u.closePath(),h-=t,o-=s,n-=t,c-=s,r-=i,l-=a,f-=i,d-=a;var m=1/(r*d-f*l),g=(d*h-l*n)*m,p=(d*o-l*c)*m,w=(r*n-f*h)*m,x=(r*c-f*o)*m,b=t-g*i-w*a,v=s-p*i-x*a;u.save(),u.transform(g,p,w,x,b,v),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,h=t.color,o=i.a*a.a*h.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*h.r*r,i.g*a.g*h.g*r,i.b*a.b*h.b*r,o),t.computeWorldVertices(e,this.vertices,0,je.VERTEX_SIZE);let n=this.vertices,c=t.uvs;return n[V.C1R]=l.r,n[V.C1G]=l.g,n[V.C1B]=l.b,n[V.C1A]=l.a,n[V.U1]=c[0],n[V.V1]=c[1],n[V.C2R]=l.r,n[V.C2G]=l.g,n[V.C2B]=l.b,n[V.C2A]=l.a,n[V.U2]=c[2],n[V.V2]=c[3],n[V.C3R]=l.r,n[V.C3G]=l.g,n[V.C3B]=l.b,n[V.C3A]=l.a,n[V.U3]=c[4],n[V.V3]=c[5],n[V.C4R]=l.r,n[V.C4G]=l.g,n[V.C4B]=l.b,n[V.C4A]=l.a,n[V.U4]=c[6],n[V.V4]=c[7],n}computeMeshVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,h=t.color,o=i.a*a.a*h.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*h.r*r,i.g*a.g*h.g*r,i.b*a.b*h.b*r,o);let n=t.worldVerticesLength/2,c=this.vertices;c.length<t.worldVerticesLength&&(this.vertices=c=R.newFloatArray(t.worldVerticesLength)),t.computeWorldVertices(e,0,t.worldVerticesLength,c,0,je.VERTEX_SIZE);let f=t.uvs;for(let d=0,u=0,m=2;d<n;d++)c[m++]=l.r,c[m++]=l.g,c[m++]=l.b,c[m++]=l.a,c[m++]=f[u++],c[m++]=f[u++],m+=2;return c}},Ut=je;return B(Ut,"QUAD_TRIANGLES",[0,1,2,2,3,0]),B(Ut,"VERTEX_SIZE",8),Ns(Gt)})();
1
+ "use strict";var spine=(()=>{var Re=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Vs=Object.getOwnPropertyNames,Ls=Object.prototype.hasOwnProperty,Ds=(e,t,s)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ns=(e,t)=>{for(var s in t)Re(e,s,{get:t[s],enumerable:!0})},Os=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Vs(t))!Ls.call(e,a)&&a!==s&&Re(e,a,{get:()=>t[a],enumerable:!(i=Bs(t,a))||i.enumerable});return e},_s=e=>Os(Re({},"__esModule",{value:!0}),e),B=(e,t,s)=>(Ds(e,typeof t!="symbol"?t+"":t,s),s),Zt={};Ns(Zt,{AlphaTimeline:()=>ut,Animation:()=>Ve,AnimationState:()=>cs,AnimationStateAdapter:()=>Hs,AnimationStateData:()=>$s,AssetManager:()=>Pr,AssetManagerBase:()=>ys,AtlasAttachmentLoader:()=>Ks,Attachment:()=>et,AttachmentTimeline:()=>we,BinaryInput:()=>Ms,BlendMode:()=>je,Bone:()=>Lt,BoneData:()=>Vt,BoundingBoxAttachment:()=>qe,CURRENT:()=>ms,CanvasTexture:()=>Ys,ClippingAttachment:()=>Et,Color:()=>N,ConstraintData:()=>Fe,CurveTimeline:()=>le,CurveTimeline1:()=>se,CurveTimeline2:()=>Le,DebugUtils:()=>Ws,DeformTimeline:()=>xt,Downloader:()=>Dt,DrawOrderTimeline:()=>pe,Event:()=>Nt,EventData:()=>Ot,EventQueue:()=>fs,EventTimeline:()=>Xe,EventType:()=>ee,FIRST:()=>Yt,FakeTexture:()=>js,HOLD_FIRST:()=>_e,HOLD_MIX:()=>us,HOLD_SUBSEQUENT:()=>Xt,IkConstraint:()=>vs,IkConstraintData:()=>_t,IkConstraintTimeline:()=>bt,IntSet:()=>qs,Interpolation:()=>es,MathUtils:()=>X,MeshAttachment:()=>ye,MixBlend:()=>as,MixDirection:()=>ns,PathAttachment:()=>Ae,PathConstraint:()=>Ce,PathConstraintData:()=>qt,PathConstraintMixTimeline:()=>vt,PathConstraintPositionTimeline:()=>pt,PathConstraintSpacingTimeline:()=>yt,Physics:()=>ks,PhysicsConstraintDampingTimeline:()=>Ct,PhysicsConstraintGravityTimeline:()=>Tt,PhysicsConstraintInertiaTimeline:()=>St,PhysicsConstraintMassTimeline:()=>It,PhysicsConstraintMixTimeline:()=>Mt,PhysicsConstraintResetTimeline:()=>De,PhysicsConstraintStrengthTimeline:()=>At,PhysicsConstraintTimeline:()=>fe,PhysicsConstraintWindTimeline:()=>kt,PointAttachment:()=>Bt,Pool:()=>Me,PositionMode:()=>ze,Pow:()=>ts,PowOut:()=>Us,RGB2Timeline:()=>gt,RGBA2Timeline:()=>mt,RGBATimeline:()=>dt,RGBTimeline:()=>ft,RegionAttachment:()=>V,RotateMode:()=>He,RotateTimeline:()=>Ye,SETUP:()=>Ft,SUBSEQUENT:()=>Oe,ScaleTimeline:()=>at,ScaleXTimeline:()=>nt,ScaleYTimeline:()=>lt,SequenceTimeline:()=>Se,ShearTimeline:()=>ot,ShearXTimeline:()=>ht,ShearYTimeline:()=>ct,Skeleton:()=>Is,SkeletonBinary:()=>Zs,SkeletonBounds:()=>Fr,SkeletonClipping:()=>$t,SkeletonData:()=>Ut,SkeletonJson:()=>Er,SkeletonRenderer:()=>Jt,Skin:()=>$e,SkinEntry:()=>Wt,Slot:()=>Ss,SlotData:()=>zt,SpacingMode:()=>Ge,StringSet:()=>Ze,Texture:()=>Rt,TextureAtlas:()=>bs,TextureAtlasPage:()=>ws,TextureAtlasRegion:()=>Pt,TextureFilter:()=>Ue,TextureRegion:()=>xs,TextureWrap:()=>gs,TimeKeeper:()=>zs,Timeline:()=>J,TrackEntry:()=>ds,TransformConstraint:()=>As,TransformConstraintData:()=>Gt,TransformConstraintTimeline:()=>wt,TransformMode:()=>We,TranslateTimeline:()=>st,TranslateXTimeline:()=>rt,TranslateYTimeline:()=>it,Triangulator:()=>te,Utils:()=>R,Vector2:()=>Pe,VertexAttachment:()=>ne,WindowedMean:()=>Gs});var qs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ze=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},be=class{constructor(e=0,t=0,s=0,i=0){this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new be().setFromString(e)}},N=be;B(N,"WHITE",new be(1,1,1,1)),B(N,"RED",new be(1,0,0,1)),B(N,"GREEN",new be(0,1,0,1)),B(N,"BLUE",new be(0,0,1,1)),B(N,"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 i=Math.random(),a=t-e;return i<=(s-e)/a?e+Math.sqrt(i*a*(s-e)):t-Math.sqrt((1-i)*a*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},X=ae;B(X,"PI",3.1415927),B(X,"PI2",ae.PI*2),B(X,"invPI2",1/ae.PI2),B(X,"radiansToDegrees",180/ae.PI),B(X,"radDeg",ae.radiansToDegrees),B(X,"degreesToRadians",ae.PI/180),B(X,"degRad",ae.degreesToRadians);var es=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},ts=class extends es{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Us=class extends ts{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,i,a){for(let c=t,o=i;c<t+a;c++,o++)s[o]=e[c]}static arrayFill(e,t,s,i){for(let a=t;a<s;a++)e[a]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let a=i;a<t;a++)e[a]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:ve.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if(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 i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},R=ve;B(R,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ws=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)}}},Me=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}},zs=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)}},Gs=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}},et=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},ss=class extends et{id=ss.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,s,i,a,c){s=a+(s>>1)*c;let o=e.bone.skeleton,r=e.deform,l=this.vertices,n=this.bones;if(!n){r.length>0&&(l=r);let u=e.bone,m=u.worldX,g=u.worldY,p=u.a,w=u.b,x=u.c,b=u.d;for(let v=t,y=a;y<s;v+=2,y+=c){let S=l[v],C=l[v+1];i[y]=S*p+C*w+m,i[y+1]=S*x+C*b+g}return}let h=0,f=0;for(let u=0;u<t;u+=2){let m=n[h];h+=m+1,f+=m}let d=o.bones;if(r.length==0)for(let u=a,m=f*3;u<s;u+=c){let g=0,p=0,w=n[h++];for(w+=h;h<w;h++,m+=3){let x=d[n[h]],b=l[m],v=l[m+1],y=l[m+2];g+=(b*x.a+v*x.b+x.worldX)*y,p+=(b*x.c+v*x.d+x.worldY)*y}i[u]=g,i[u+1]=p}else{let u=r;for(let m=a,g=f*3,p=f<<1;m<s;m+=c){let w=0,x=0,b=n[h++];for(b+=h;h<b;h++,g+=3,p+=2){let v=d[n[h]],y=l[g]+u[p],S=l[g+1]+u[p+1],C=l[g+2];w+=(y*v.a+S*v.b+v.worldX)*C,x+=(y*v.c+S*v.d+v.worldY)*C}i[m]=w,i[m+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),R.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=R.newFloatArray(this.vertices.length),R.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ne=ss;B(ne,"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 R.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let a=this.digits-i.length;a>0;a--)s+="0";return s+=i,s}static nextID(){return Be._nextID++}},tt=Be;B(tt,"_nextID",0);var rs=(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))(rs||{}),is=[0,1,2,3,4,5,6],Ve=class{name;timelines=[];timelineIds=new Ze;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,a,c,o,r){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(e,t,s,a,c,o,r)}},as=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(as||{}),ns=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ns||{}),_={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,physicsConstraintInertia:19,physicsConstraintStrength:20,physicsConstraintDamping:21,physicsConstraintMass:22,physicsConstraintWind:23,physicsConstraintGravity:24,physicsConstraintMix:25,physicsConstraintReset:26,sequence:27},J=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=R.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let a=s;a<i;a+=s)if(e[a]>t)return a-s;return i-s}},le=class extends J{curves;constructor(e,t,s){super(e,s),this.curves=R.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=R.newFloatArray(t);R.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,a,c,o,r,l,n,h){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-c*2+r)*.03,m=(a-o*2+l)*.03,g=((c-r)*3-i+n)*.006,p=((o-l)*3-a+h)*.006,w=u*2+g,x=m*2+p,b=(c-i)*.3+u+g*.16666667,v=(o-a)*.3+m+p*.16666667,y=i+b,S=a+v;for(let C=d+18;d<C;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=x,w+=g,x+=p,y+=b,S+=v}getBezierValue(e,t,s,i){let a=this.curves;if(a[i]>e){let l=this.frames[t],n=this.frames[t+s];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}let c=i+18;for(i+=2;i<c;i+=2)if(a[i]>=e){let l=a[i-2],n=a[i-1];return n+(e-l)/(a[i]-l)*(a[i+1]-n)}t+=this.getFrameEntries();let o=a[c-2],r=a[c-1];return r+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-r)}},se=class extends le{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let a=2;a<=s;a+=2)if(t[a]>e){s=a-2;break}let i=this.curves[s>>1];switch(i){case 0:let a=t[s],c=t[s+1];return c+(e-a)/(t[s+2]-a)*(t[s+2+1]-c);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);switch(s){case 0:return a+c*t;case 1:case 2:c+=a-i}return i+c*t}getAbsoluteValue(e,t,s,i,a){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}let c=this.getCurveValue(e);return s==0?a+(c-a)*t:i+(c-i)*t}getAbsoluteValue2(e,t,s,i,a,c){if(e<this.frames[0]){switch(s){case 0:return a;case 1:return i+(a-i)*t}return i}return s==0?a+(c-a)*t:i+(c-i)*t}getScaleValue(e,t,s,i,a,c){const o=this.frames;if(e<o[0]){switch(s){case 0:return c;case 1:return a+(c-a)*t}return a}let r=this.getCurveValue(e)*c;if(t==1)return s==3?a+r-c:r;if(i==1)switch(s){case 0:return c+(Math.abs(r)*X.signum(c)-c)*t;case 1:case 2:return a+(Math.abs(r)*X.signum(a)-a)*t}else{let l=0;switch(s){case 0:return l=Math.abs(c)*X.signum(r),l+(r-l)*t;case 1:case 2:return l=Math.abs(a)*X.signum(r),l+(r-l)*t}}return a+(r-c)*t}},Le=class extends le{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Ye=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,a,c,r.rotation,r.data.rotation))}},st=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*a,r.y+=(r.data.y-r.y)*a}return}let n=0,h=0,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],h=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,h+=(l[f+3+2]-h)*m;break;case 1:n=l[f+1],h=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),h=this.getBezierValue(s,f,2,d+18-2)}switch(c){case 0:r.x=r.data.x+n*a,r.y=r.data.y+h*a;break;case 1:case 2:r.x+=(r.data.x+n-r.x)*a,r.y+=(r.data.y+h-r.y)*a;break;case 3:r.x+=n*a,r.y+=h*a}}},rt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,a,c,r.x,r.data.x))}},it=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,a,c,r.y,r.data.y))}},at=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*a,r.scaleY+=(r.data.scaleY-r.scaleY)*a}return}let n,h,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],h=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,h+=(l[f+3+2]-h)*m;break;case 1:n=l[f+1],h=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),h=this.getBezierValue(s,f,2,d+18-2)}if(n*=r.data.scaleX,h*=r.data.scaleY,a==1)c==3?(r.scaleX+=n-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=n,r.scaleY=h);else{let u=0,m=0;if(o==1)switch(c){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(h)*X.signum(m)-m)*a;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(n)*X.signum(u)-u)*a,r.scaleY=m+(Math.abs(h)*X.signum(m)-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}else switch(c){case 0:u=Math.abs(r.data.scaleX)*X.signum(n),m=Math.abs(r.data.scaleY)*X.signum(h),r.scaleX=u+(n-u)*a,r.scaleY=m+(h-m)*a;break;case 1:case 2:u=Math.abs(r.scaleX)*X.signum(n),m=Math.abs(r.scaleY)*X.signum(h),r.scaleX=u+(n-u)*a,r.scaleY=m+(h-m)*a;break;case 3:r.scaleX+=(n-r.data.scaleX)*a,r.scaleY+=(h-r.data.scaleY)*a}}}},nt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,a,c,o,r.scaleX,r.data.scaleX))}},lt=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,a,c,o,r.scaleX,r.data.scaleY))}},ot=class extends Le{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*a,r.shearY+=(r.data.shearY-r.shearY)*a}return}let n=0,h=0,f=J.search(l,s,3),d=this.curves[f/3];switch(d){case 0:let u=l[f];n=l[f+1],h=l[f+2];let m=(s-u)/(l[f+3]-u);n+=(l[f+3+1]-n)*m,h+=(l[f+3+2]-h)*m;break;case 1:n=l[f+1],h=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),h=this.getBezierValue(s,f,2,d+18-2)}switch(c){case 0:r.shearX=r.data.shearX+n*a,r.shearY=r.data.shearY+h*a;break;case 1:case 2:r.shearX+=(r.data.shearX+n-r.shearX)*a,r.shearY+=(r.data.shearY+h-r.shearY)*a;break;case 3:r.shearX+=n*a,r.shearY+=h*a}}},ht=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,a,c,r.shearX,r.data.shearX))}},ct=class extends se{boneIndex=0;constructor(e,t,s){super(e,t,_.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,a,c,o){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,a,c,r.shearX,r.data.shearY))}},dt=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,a,c){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let p=r.data.color;switch(c){case 0:n.setFromColor(p);return;case 1:n.add((p.r-n.r)*a,(p.g-n.g)*a,(p.b-n.b)*a,(p.a-n.a)*a)}return}let h=0,f=0,d=0,u=0,m=J.search(l,s,5),g=this.curves[m/5];switch(g){case 0:let p=l[m];h=l[m+1],f=l[m+2],d=l[m+3],u=l[m+4];let w=(s-p)/(l[m+5]-p);h+=(l[m+5+1]-h)*w,f+=(l[m+5+2]-f)*w,d+=(l[m+5+3]-d)*w,u+=(l[m+5+4]-u)*w;break;case 1:h=l[m+1],f=l[m+2],d=l[m+3],u=l[m+4];break;default:h=this.getBezierValue(s,m,1,g-2),f=this.getBezierValue(s,m,2,g+18-2),d=this.getBezierValue(s,m,3,g+18*2-2),u=this.getBezierValue(s,m,4,g+18*3-2)}a==1?n.set(h,f,d,u):(c==0&&n.setFromColor(r.data.color),n.add((h-n.r)*a,(f-n.g)*a,(d-n.b)*a,(u-n.a)*a))}},ft=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color;if(s<l[0]){let g=r.data.color;switch(c){case 0:n.r=g.r,n.g=g.g,n.b=g.b;return;case 1:n.r+=(g.r-n.r)*a,n.g+=(g.g-n.g)*a,n.b+=(g.b-n.b)*a}return}let h=0,f=0,d=0,u=J.search(l,s,4),m=this.curves[u>>2];switch(m){case 0:let g=l[u];h=l[u+1],f=l[u+2],d=l[u+3];let p=(s-g)/(l[u+4]-g);h+=(l[u+4+1]-h)*p,f+=(l[u+4+2]-f)*p,d+=(l[u+4+3]-d)*p;break;case 1:h=l[u+1],f=l[u+2],d=l[u+3];break;default:h=this.getBezierValue(s,u,1,m-2),f=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(a==1)n.r=h,n.g=f,n.b=d;else{if(c==0){let g=r.data.color;n.r=g.r,n.g=g.g,n.b=g.b}n.r+=(h-n.r)*a,n.g+=(f-n.g)*a,n.b+=(d-n.b)*a}}},ut=class extends se{slotIndex=0;constructor(e,t,s){super(e,t,_.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.color;if(s<this.frames[0]){let h=r.data.color;switch(c){case 0:l.a=h.a;return;case 1:l.a+=(h.a-l.a)*a}return}let n=this.getCurveValue(s);a==1?l.a=n:(c==0&&(l.a=r.data.color.a),l.a+=(n-l.a)*a)}},mt=class extends le{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,i,a,c,o,r,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r,this.frames[e+7]=l}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.setFromColor(v),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.add((v.r-n.r)*a,(v.g-n.g)*a,(v.b-n.b)*a,(v.a-n.a)*a),h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let f=0,d=0,u=0,m=0,g=0,p=0,w=0,x=J.search(l,s,8),b=this.curves[x>>3];switch(b){case 0:let v=l[x];f=l[x+1],d=l[x+2],u=l[x+3],m=l[x+4],g=l[x+5],p=l[x+6],w=l[x+7];let y=(s-v)/(l[x+8]-v);f+=(l[x+8+1]-f)*y,d+=(l[x+8+2]-d)*y,u+=(l[x+8+3]-u)*y,m+=(l[x+8+4]-m)*y,g+=(l[x+8+5]-g)*y,p+=(l[x+8+6]-p)*y,w+=(l[x+8+7]-w)*y;break;case 1:f=l[x+1],d=l[x+2],u=l[x+3],m=l[x+4],g=l[x+5],p=l[x+6],w=l[x+7];break;default:f=this.getBezierValue(s,x,1,b-2),d=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+18*2-2),m=this.getBezierValue(s,x,4,b+18*3-2),g=this.getBezierValue(s,x,5,b+18*4-2),p=this.getBezierValue(s,x,6,b+18*5-2),w=this.getBezierValue(s,x,7,b+18*6-2)}if(a==1)n.set(f,d,u,m),h.r=g,h.g=p,h.b=w;else{if(c==0){n.setFromColor(r.data.color);let v=r.data.darkColor;h.r=v.r,h.g=v.g,h.b=v.b}n.add((f-n.r)*a,(d-n.g)*a,(u-n.b)*a,(m-n.a)*a),h.r+=(g-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},gt=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c,this.frames[e+5]=o,this.frames[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=this.frames,n=r.color,h=r.darkColor;if(s<l[0]){let v=r.data.color,y=r.data.darkColor;switch(c){case 0:n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:n.r+=(v.r-n.r)*a,n.g+=(v.g-n.g)*a,n.b+=(v.b-n.b)*a,h.r+=(y.r-h.r)*a,h.g+=(y.g-h.g)*a,h.b+=(y.b-h.b)*a}return}let f=0,d=0,u=0,m=0,g=0,p=0,w=0,x=J.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let v=l[x];f=l[x+1],d=l[x+2],u=l[x+3],g=l[x+4],p=l[x+5],w=l[x+6];let y=(s-v)/(l[x+7]-v);f+=(l[x+7+1]-f)*y,d+=(l[x+7+2]-d)*y,u+=(l[x+7+3]-u)*y,g+=(l[x+7+4]-g)*y,p+=(l[x+7+5]-p)*y,w+=(l[x+7+6]-w)*y;break;case 1:f=l[x+1],d=l[x+2],u=l[x+3],g=l[x+4],p=l[x+5],w=l[x+6];break;default:f=this.getBezierValue(s,x,1,b-2),d=this.getBezierValue(s,x,2,b+18-2),u=this.getBezierValue(s,x,3,b+18*2-2),g=this.getBezierValue(s,x,4,b+18*3-2),p=this.getBezierValue(s,x,5,b+18*4-2),w=this.getBezierValue(s,x,6,b+18*5-2)}if(a==1)n.r=f,n.g=d,n.b=u,h.r=g,h.g=p,h.b=w;else{if(c==0){let v=r.data.color,y=r.data.darkColor;n.r=v.r,n.g=v.g,n.b=v.b,h.r=y.r,h.g=y.g,h.b=y.b}n.r+=(f-n.r)*a,n.g+=(d-n.g)*a,n.b+=(u-n.b)*a,h.r+=(g-h.r)*a,h.g+=(p-h.g)*a,h.b+=(w-h.b)*a}}},we=class extends J{slotIndex=0;attachmentNames;constructor(e,t){super(e,[_.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(r.bone.active){if(o==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(s<this.frames[0]){(c==0||c==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},xt=class extends le{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,a,c,o,r,l,n,h){let f=this.curves,d=this.getFrameCount()+e*18;s==0&&(f[t]=2+d);let u=(i-c*2+r)*.03,m=l*.03-o*.06,g=((c-r)*3-i+n)*.006,p=(o-l+.33333333)*.018,w=u*2+g,x=m*2+p,b=(c-i)*.3+u+g*.16666667,v=o*.3+m+p*.16666667,y=i+b,S=v;for(let C=d+18;d<C;d+=2)f[d]=y,f[d+1]=S,b+=w,v+=x,w+=g,x+=p,y+=b,S+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>e){let r=this.frames[t];return s[i+1]*(e-r)/(s[i]-r)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=e){let r=s[i-2],l=s[i-1];return l+(e-r)/(s[i]-r)*(s[i+1]-l)}let c=s[a-2],o=s[a-1];return o+(1-o)*(e-c)/(this.frames[t+this.getFrameEntries()]-c)}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.getAttachment();if(!l||!(l instanceof ne)||l.timelineAttachment!=this.attachment)return;let n=r.deform;n.length==0&&(c=0);let h=this.vertices,f=h[0].length,d=this.frames;if(s<d[0]){switch(c){case 0:n.length=0;return;case 1:if(a==1){n.length=0;return}n.length=f;let x=l;if(x.bones){a=1-a;for(var u=0;u<f;u++)n[u]*=a}else{let b=x.vertices;for(var u=0;u<f;u++)n[u]+=(b[u]-n[u])*a}}return}if(n.length=f,s>=d[d.length-1]){let x=h[d.length-1];if(a==1)if(c==3){let b=l;if(b.bones)for(let v=0;v<f;v++)n[v]+=x[v];else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=x[y]-v[y]}}else R.arrayCopy(x,0,n,0,f);else switch(c){case 0:{let v=l;if(v.bones)for(let y=0;y<f;y++)n[y]=x[y]*a;else{let y=v.vertices;for(let S=0;S<f;S++){let C=y[S];n[S]=C+(x[S]-C)*a}}break}case 1:case 2:for(let v=0;v<f;v++)n[v]+=(x[v]-n[v])*a;break;case 3:let b=l;if(b.bones)for(let v=0;v<f;v++)n[v]+=x[v]*a;else{let v=b.vertices;for(let y=0;y<f;y++)n[y]+=(x[y]-v[y])*a}}return}let m=J.search1(d,s),g=this.getCurvePercent(s,m),p=h[m],w=h[m+1];if(a==1)if(c==3){let x=l;if(x.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=v+(w[b]-v)*g}else{let b=x.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=y+(w[v]-y)*g-b[v]}}}else for(let x=0;x<f;x++){let b=p[x];n[x]=b+(w[x]-b)*g}else switch(c){case 0:{let b=l;if(b.bones)for(let v=0;v<f;v++){let y=p[v];n[v]=(y+(w[v]-y)*g)*a}else{let v=b.vertices;for(let y=0;y<f;y++){let S=p[y],C=v[y];n[y]=C+(S+(w[y]-S)*g-C)*a}}break}case 1:case 2:for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*g-n[b])*a}break;case 3:let x=l;if(x.bones)for(let b=0;b<f;b++){let v=p[b];n[b]+=(v+(w[b]-v)*g)*a}else{let b=x.vertices;for(let v=0;v<f;v++){let y=p[v];n[v]+=(y+(w[v]-y)*g-b[v])*a}}}}},ls=class extends J{events;constructor(e){super(e,ls.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,s,i,a,c,o){if(!i)return;let r=this.frames,l=this.frames.length;if(t>s)this.apply(e,t,Number.MAX_VALUE,i,a,c,o),t=-1;else if(t>=r[l-1])return;if(s<r[0])return;let n=0;if(t<r[0])n=0;else{n=J.search1(r,t)+1;let h=r[n];for(;n>0&&r[n-1]==h;)n--}for(;n<l&&s>=r[n];n++)i.push(this.events[n])}},Xe=ls;B(Xe,"propertyIds",[""+_.event]);var os=class extends J{drawOrders;constructor(e){super(e,os.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.drawOrders[e]=s}apply(e,t,s,i,a,c,o){if(o==1){c==0&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(c==0||c==1)&&R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=J.search1(this.frames,s),l=this.drawOrders[r];if(!l)R.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let n=e.drawOrder,h=e.slots;for(let f=0,d=l.length;f<d;f++)n[f]=h[l[f]]}}},pe=os;B(pe,"propertyIds",[""+_.drawOrder]);var bt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,a,c,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=a,this.frames[e+4]=c?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,a,c,o){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*a,r.softness+=(r.data.softness-r.softness)*a,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let n=0,h=0,f=J.search(l,s,6),d=this.curves[f/6];switch(d){case 0:let u=l[f];n=l[f+1],h=l[f+2];let m=(s-u)/(l[f+6]-u);n+=(l[f+6+1]-n)*m,h+=(l[f+6+2]-h)*m;break;case 1:n=l[f+1],h=l[f+2];break;default:n=this.getBezierValue(s,f,1,d-2),h=this.getBezierValue(s,f,2,d+18-2)}c==0?(r.mix=r.data.mix+(n-r.data.mix)*a,r.softness=r.data.softness+(h-r.data.softness)*a,o==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=l[f+3],r.compress=l[f+4]!=0,r.stretch=l[f+5]!=0)):(r.mix+=(n-r.mix)*a,r.softness+=(h-r.softness)*a,o==0&&(r.bendDirection=l[f+3],r.compress=l[f+4]!=0,r.stretch=l[f+5]!=0))}},wt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,a,c,o,r){let l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=a,l[e+4]=c,l[e+5]=o,l[e+6]=r}apply(e,t,s,i,a,c,o){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){let w=r.data;switch(c){case 0:r.mixRotate=w.mixRotate,r.mixX=w.mixX,r.mixY=w.mixY,r.mixScaleX=w.mixScaleX,r.mixScaleY=w.mixScaleY,r.mixShearY=w.mixShearY;return;case 1:r.mixRotate+=(w.mixRotate-r.mixRotate)*a,r.mixX+=(w.mixX-r.mixX)*a,r.mixY+=(w.mixY-r.mixY)*a,r.mixScaleX+=(w.mixScaleX-r.mixScaleX)*a,r.mixScaleY+=(w.mixScaleY-r.mixScaleY)*a,r.mixShearY+=(w.mixShearY-r.mixShearY)*a}return}let n,h,f,d,u,m,g=J.search(l,s,7),p=this.curves[g/7];switch(p){case 0:let w=l[g];n=l[g+1],h=l[g+2],f=l[g+3],d=l[g+4],u=l[g+5],m=l[g+6];let x=(s-w)/(l[g+7]-w);n+=(l[g+7+1]-n)*x,h+=(l[g+7+2]-h)*x,f+=(l[g+7+3]-f)*x,d+=(l[g+7+4]-d)*x,u+=(l[g+7+5]-u)*x,m+=(l[g+7+6]-m)*x;break;case 1:n=l[g+1],h=l[g+2],f=l[g+3],d=l[g+4],u=l[g+5],m=l[g+6];break;default:n=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),f=this.getBezierValue(s,g,3,p+18*2-2),d=this.getBezierValue(s,g,4,p+18*3-2),u=this.getBezierValue(s,g,5,p+18*4-2),m=this.getBezierValue(s,g,6,p+18*5-2)}if(c==0){let w=r.data;r.mixRotate=w.mixRotate+(n-w.mixRotate)*a,r.mixX=w.mixX+(h-w.mixX)*a,r.mixY=w.mixY+(f-w.mixY)*a,r.mixScaleX=w.mixScaleX+(d-w.mixScaleX)*a,r.mixScaleY=w.mixScaleY+(u-w.mixScaleY)*a,r.mixShearY=w.mixShearY+(m-w.mixShearY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(f-r.mixY)*a,r.mixScaleX+=(d-r.mixScaleX)*a,r.mixScaleY+=(u-r.mixScaleY)*a,r.mixShearY+=(m-r.mixShearY)*a}},pt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,a,c,r.position,r.data.position))}},yt=class extends se{constraintIndex=0;constructor(e,t,s){super(e,t,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,a,c,r.spacing,r.data.spacing))}},vt=class extends le{constraintIndex=0;constructor(e,t,s){super(e,t,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,a){let c=this.frames;e<<=2,c[e]=t,c[e+1]=s,c[e+2]=i,c[e+3]=a}apply(e,t,s,i,a,c,o){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let l=this.frames;if(s<l[0]){switch(c){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*a,r.mixX+=(r.data.mixX-r.mixX)*a,r.mixY+=(r.data.mixY-r.mixY)*a}return}let n,h,f,d=J.search(l,s,4),u=this.curves[d>>2];switch(u){case 0:let m=l[d];n=l[d+1],h=l[d+2],f=l[d+3];let g=(s-m)/(l[d+4]-m);n+=(l[d+4+1]-n)*g,h+=(l[d+4+2]-h)*g,f+=(l[d+4+3]-f)*g;break;case 1:n=l[d+1],h=l[d+2],f=l[d+3];break;default:n=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2),f=this.getBezierValue(s,d,3,u+18*2-2)}if(c==0){let m=r.data;r.mixRotate=m.mixRotate+(n-m.mixRotate)*a,r.mixX=m.mixX+(h-m.mixX)*a,r.mixY=m.mixY+(f-m.mixY)*a}else r.mixRotate+=(n-r.mixRotate)*a,r.mixX+=(h-r.mixX)*a,r.mixY+=(f-r.mixY)*a}},fe=class extends se{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex==-1){const l=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of e.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,a,c,this.get(n),this.setup(n),l))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,a,c,this.get(r),this.setup(r)))}},St=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}},At=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}},Ct=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}},It=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}},kt=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}},Tt=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}},Mt=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}},hs=class extends J{constraintIndex;constructor(e,t){super(e,hs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,s,i,a,c,o){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const l=this.frames;if(t>s)this.apply(e,t,Number.MAX_VALUE,[],a,c,o),t=-1;else if(t>=l[l.length-1])return;if(!(s<l[0])&&(t<l[0]||s>=l[J.search1(l,t)+1]))if(r!=null)r.reset();else for(const n of e.physicsConstraints)n.active&&n.reset()}},De=hs;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,i,a){let c=this.frames;e*=ue.ENTRIES,c[e]=t,c[e+ue.MODE]=s|i<<4,c[e+ue.DELAY]=a}apply(e,t,s,i,a,c,o){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let l=r.attachment,n=this.attachment;if(l!=n&&(!(l instanceof ne)||l.timelineAttachment!=n))return;let h=this.frames;if(s<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let f=J.search(h,s,ue.ENTRIES),d=h[f],u=h[f+ue.MODE],m=h[f+ue.DELAY];if(!this.attachment.sequence)return;let g=u>>4,p=this.attachment.sequence.regions.length,w=is[u&15];if(w!=0)switch(g+=(s-d)/m+1e-5|0,w){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let x=(p<<1)-2;g=x==0?0:g%x,g>=p&&(g=x-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let x=(p<<1)-2;g=x==0?0:(g+p-1)%x,g>=p&&(g=x-g)}}r.sequenceIndex=g}},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 fs(this);propertyIDs=new Ze;animationsChanged=!1;trackEntryPool=new Me(()=>new ds);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let c=e*a.timeScale;if(a.delay>0){if(a.delay-=c,a.delay>0)continue;c=-a.delay,a.delay=0}let o=a.next;if(o){let r=a.trackLast-o.delay;if(r>=0){for(o.delay=0,o.trackTime+=a.timeScale==0?0:(r/a.timeScale+e)*o.timeScale,a.trackTime+=c,this.setCurrent(s,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){t[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,e)){let r=a.mixingFrom;for(a.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}a.trackTime+=c}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let f=0,d=s.length;f<d;f++){let u=s[f];if(!u||u.delay>0)continue;i=!0;let m=f==0?1:u.mixBlend,g=u.alpha;u.mixingFrom?g*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(g=0);let p=g>=u.alphaAttachmentThreshold,w=u.animationLast,x=u.getAnimationTime(),b=x,v=t;u.reverse&&(b=u.animation.duration-b,v=null);let y=u.animation.timelines,S=y.length;if(f==0&&g==1||m==3){f==0&&(p=!0);for(let C=0;C<S;C++){R.webkit602BugfixHelper(g,m);var a=y[C];a instanceof we?this.applyAttachmentTimeline(a,e,b,m,p):a.apply(e,w,b,v,g,m,0)}}else{let C=u.timelineMode,k=u.shortestRotation,T=!k&&u.timelinesRotation.length!=S<<1;T&&(u.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let E=y[M],F=C[M]==Oe?m:0;!k&&E instanceof Ye?this.applyRotateTimeline(E,e,b,g,F,u.timelinesRotation,M<<1,T):E instanceof we?this.applyAttachmentTimeline(E,e,b,m,p):(R.webkit602BugfixHelper(g,m),E.apply(e,w,b,v,g,F,0))}}this.queueEvents(u,x),t.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var c=this.unkeyedState+Ft,o=e.slots,r=0,l=e.slots.length;r<l;r++){var n=o[r];if(n.attachmentState==c){var h=n.data.attachmentName;n.setAttachment(h?e.getAttachment(n.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let a=0;e.mixDuration==0?(a=1,s==1&&(s=0)):(a=e.mixTime/e.mixDuration,a>1&&(a=1),s!=1&&(s=i.mixBlend));let c=a<i.mixAttachmentThreshold,o=a<i.mixDrawOrderThreshold,r=i.animation.timelines,l=r.length,n=i.alpha*e.interruptAlpha,h=n*(1-a),f=i.animationLast,d=i.getAnimationTime(),u=d,m=null;if(i.reverse?u=i.animation.duration-u:a<i.eventThreshold&&(m=this.events),s==3)for(let g=0;g<l;g++)r[g].apply(t,f,u,m,h,s,1);else{let g=i.timelineMode,p=i.timelineHoldMix,w=i.shortestRotation,x=!w&&i.timelinesRotation.length!=l<<1;x&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let b=0;b<l;b++){let v=r[b],y=1,S,C=0;switch(g[b]){case Oe:if(!o&&v instanceof pe)continue;S=s,C=h;break;case Yt:S=0,C=h;break;case Xt:S=s,C=n;break;case _e:S=0,C=n;break;default:S=0;let k=p[b];C=n*Math.max(0,1-k.mixTime/k.mixDuration);break}i.totalAlpha+=C,!w&&v instanceof Ye?this.applyRotateTimeline(v,t,u,C,S,i.timelinesRotation,b<<1,x):v instanceof we?this.applyAttachmentTimeline(v,t,u,S,c&&C>=i.alphaAttachmentThreshold):(R.webkit602BugfixHelper(C,s),o&&v instanceof pe&&S==0&&(y=0),v.apply(t,f,u,m,C,S,y))}}return e.mixDuration>0&&this.queueEvents(i,d),this.events.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(e,t,s,i,a){var c=t.slots[e.slotIndex];c.bone.active&&(s<e.frames[0]?(i==0||i==1)&&this.setAttachment(t,c,c.data.attachmentName,a):this.setAttachment(t,c,e.attachmentNames[J.search1(e.frames,s)],a),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+Ft))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+ms)}applyRotateTimeline(e,t,s,i,a,c,o,r){if(r&&(c[o]=0),i==1){e.apply(t,0,s,null,1,a,0);return}let l=t.bones[e.boneIndex];if(!l.active)return;let n=e.frames,h=0,f=0;if(s<n[0])switch(a){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,f=l.data.rotation}else h=a==0?l.data.rotation:l.rotation,f=l.data.rotation+e.getCurveValue(s);let d=0,u=f-h;if(u-=Math.ceil(u/360-.5)*360,u==0)d=c[o];else{let m=0,g=0;r?(m=0,g=u):(m=c[o],g=c[o+1]);let p=m-m%360;d=u+p;let w=u>=0,x=m>=0;Math.abs(g)<=90&&X.signum(g)!=X.signum(u)&&(Math.abs(m-p)>180?(d+=360*X.signum(m),x=w):p!=0?d-=360*X.signum(m):x=w),x!=w&&(d+=360*X.signum(m)),c[o]=d}c[o+1]=u,l.rotation=h+d*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,a=i-s,c=e.trackLast%a,o=this.events,r=0,l=o.length;for(;r<l;r++){let h=o[r];if(h.time<c)break;h.time>i||this.queue.event(e,h)}let n=!1;for(e.loop?n=a==0||c>e.trackTime%a:n=t>=i&&e.animationLast<i,n&&this.queue.complete(e);r<l;r++){let h=o[r];h.time<s||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(e);a&&(a.nextTrackLast==-1?(this.tracks[e]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let c=this.trackEntry(e,t,s,a);return this.setCurrent(e,c,i),this.queue.drain(),c}addAnimation(e,t,s=!1,i=0){let a=this.data.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,a,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let a=this.expandToIndex(e);if(a)for(;a.next;)a=a.next;let c=this.trackEntry(e,t,s,a);return a?(a.next=c,c.previous=a,i<=0&&(i+=a.getTrackComplete()-c.mixDuration)):(this.setCurrent(e,c,!0),this.queue.drain()),c.delay=i,c}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,Ne.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,Ne.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-t),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let a=this.tracks[s];a&&this.setEmptyAnimation(a.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(R.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=e,a.animation=t,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=t.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,t):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=2,a}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=3)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,a=e.timelineMode;a.length=i;let c=e.timelineHoldMix;c.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<i;r++)a[r]=o.addAll(s[r].getPropertyIds())?_e:Xt;return}e:for(let r=0;r<i;r++){let l=s[r],n=l.getPropertyIds();if(!o.addAll(n))a[r]=Oe;else if(!t||l instanceof we||l instanceof pe||l instanceof Xe||!t.animation.hasTimeline(n))a[r]=Yt;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(n)){if(e.mixDuration>0){a[r]=us,c[r]=h;continue e}break}a[r]=_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()}},cs=Ne;B(cs,"_emptyAnimation",new Ve("<empty>",[],0));var ds=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,this.previous!=null&&this.delay<=0&&(this.delay+=this.previous.getTrackComplete()-e),this.delay=this.delay}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}},fs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ee.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ee.interrupt),this.objects.push(e)}end(e){this.objects.push(ee.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ee.dispose),this.objects.push(e)}complete(e){this.objects.push(ee.complete),this.objects.push(e)}event(e,t){this.objects.push(ee.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],a=e[s+1];switch(i){case ee.start:a.listener&&a.listener.start&&a.listener.start(a);for(let o=0;o<t.length;o++){let r=t[o];r.start&&r.start(a)}break;case ee.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let o=0;o<t.length;o++){let r=t[o];r.interrupt&&r.interrupt(a)}break;case ee.end:a.listener&&a.listener.end&&a.listener.end(a);for(let o=0;o<t.length;o++){let r=t[o];r.end&&r.end(a)}case ee.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let o=0;o<t.length;o++){let r=t[o];r.dispose&&r.dispose(a)}this.animState.trackEntryPool.free(a);break;case ee.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let o=0;o<t.length;o++){let r=t[o];r.complete&&r.complete(a)}break;case ee.event:let c=e[s+++2];a.listener&&a.listener.event&&a.listener.event(a,c);for(let o=0;o<t.length;o++){let r=t[o];r.event&&r.event(a,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ee=(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))(ee||{}),Hs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Oe=0,Yt=1,Xt=2,_e=3,us=4,Ft=1,ms=2,$s=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);this.setMixWith(i,a,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},qe=class extends ne{color=new N(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}},Et=class extends ne{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new Et(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Rt=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ue=(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))(Ue||{}),gs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(gs||{}),xs=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},js=class extends Rt{setFilters(e,t){}setWraps(e,t){}dispose(){}},bs=class{pages=new Array;regions=new Array;constructor(e){let t=new Js(e),s=new Array(4),i={};i.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},i.format=()=>{},i.filter=n=>{n.minFilter=R.enumValue(Ue,s[1]),n.magFilter=R.enumValue(Ue,s[2])},i.repeat=n=>{s[1].indexOf("x")!=-1&&(n.uWrap=10497),s[1].indexOf("y")!=-1&&(n.vWrap=10497)},i.pma=n=>{n.pma=s[1]=="true"};var a={};a.xy=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2])},a.size=n=>{n.width=parseInt(s[1]),n.height=parseInt(s[2])},a.bounds=n=>{n.x=parseInt(s[1]),n.y=parseInt(s[2]),n.width=parseInt(s[3]),n.height=parseInt(s[4])},a.offset=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2])},a.orig=n=>{n.originalWidth=parseInt(s[1]),n.originalHeight=parseInt(s[2])},a.offsets=n=>{n.offsetX=parseInt(s[1]),n.offsetY=parseInt(s[2]),n.originalWidth=parseInt(s[3]),n.originalHeight=parseInt(s[4])},a.rotate=n=>{let h=s[1];h=="true"?n.degrees=90:h!="false"&&(n.degrees=parseInt(h))},a.index=n=>{n.index=parseInt(s[1])};let c=t.readLine();for(;c&&c.trim().length==0;)c=t.readLine();for(;!(!c||c.trim().length==0||t.readEntry(s,c)==0);)c=t.readLine();let o=null,r=null,l=null;for(;c!==null;)if(c.trim().length==0)o=null,c=t.readLine();else if(o){let n=new Pt(o,c);for(;;){let h=t.readEntry(s,c=t.readLine());if(h==0)break;let f=a[s[0]];if(f)f(n);else{r||(r=[]),l||(l=[]),r.push(s[0]);let d=[];for(let u=0;u<h;u++)d.push(parseInt(s[u+1]));l.push(d)}}n.originalWidth==0&&n.originalHeight==0&&(n.originalWidth=n.width,n.originalHeight=n.height),r&&r.length>0&&l&&l.length>0&&(n.names=r,n.values=l,r=null,l=null),n.u=n.x/o.width,n.v=n.y/o.height,n.degrees==90?(n.u2=(n.x+n.height)/o.width,n.v2=(n.y+n.width)/o.height):(n.u2=(n.x+n.width)/o.width,n.v2=(n.y+n.height)/o.height),this.regions.push(n)}else{for(o=new ws(c.trim());t.readEntry(s,c=t.readLine())!=0;){let n=i[s[0]];n&&n(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Js=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,a=s+1;;i++){let c=t.indexOf(",",a);if(c==-1)return e[i]=t.substr(a).trim(),i;if(e[i]=t.substr(a,c-a).trim(),a=c+1,i==4)return 4}}},ws=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}},Pt=class extends xs{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},ye=class extends ne{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=R.newFloatArray(e.length));let t=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,c=0,o=0;if(this.region instanceof Pt){let r=this.region,l=r.page,n=l.width,h=l.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/n,a-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let f=0;f<s;f+=2)t[f]=i+e[f+1]*c,t[f+1]=a+(1-e[f])*o;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/n,a-=r.offsetY/h,c=r.originalWidth/n,o=r.originalHeight/h;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f])*c,t[f+1]=a+(1-e[f+1])*o;return;case 270:i-=r.offsetY/n,a-=r.offsetX/h,c=r.originalHeight/n,o=r.originalWidth/h;for(let f=0;f<s;f+=2)t[f]=i+(1-e[f+1])*c,t[f+1]=a+e[f]*o;return}i-=r.offsetX/n,a-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/n,o=r.originalHeight/h}else this.region?(c=this.region.u2-i,o=this.region.v2-a):(i=a=0,c=o=1);for(let r=0;r<s;r+=2)t[r]=i+e[r]*c,t[r+1]=a+e[r+1]*o}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),R.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),R.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),R.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),R.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,s,i,a,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,s,i,a,c)}newLinkedMesh(){let e=new ye(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ae=class extends ne{lengths=[];closed=!1;constantSpeed=!1;color=new N(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),R.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Bt=class extends ne{x=0;y=0;rotation=0;color=new N(.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*X.degRad,s=Math.cos(t),i=Math.sin(t),a=s*e.a+i*e.b,c=s*e.c+i*e.d;return X.atan2Deg(c,a)}copy(){let e=new Bt(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ps=class extends et{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=R.newFloatArray(8);uvs=R.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,c=-this.height/2*this.scaleY+this.region.offsetY*i,o=a+this.region.width*s,r=c+this.region.height*i,l=this.rotation*X.degRad,n=Math.cos(l),h=Math.sin(l),f=this.x,d=this.y,u=a*n+f,m=a*h,g=c*n+d,p=c*h,w=o*n+f,x=o*h,b=r*n+d,v=r*h,y=this.offset;y[0]=u-p,y[1]=g+m,y[2]=u-v,y[3]=b+m,y[4]=w-v,y[5]=b+x,y[6]=w-p,y[7]=g+x,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,i){this.sequence!=null&&this.sequence.apply(e,this);let a=e.bone,c=this.offset,o=a.worldX,r=a.worldY,l=a.a,n=a.b,h=a.c,f=a.d,d=0,u=0;d=c[0],u=c[1],t[s]=d*l+u*n+o,t[s+1]=d*h+u*f+r,s+=i,d=c[2],u=c[3],t[s]=d*l+u*n+o,t[s+1]=d*h+u*f+r,s+=i,d=c[4],u=c[5],t[s]=d*l+u*n+o,t[s+1]=d*h+u*f+r,s+=i,d=c[6],u=c[7],t[s]=d*l+u*n+o,t[s+1]=d*h+u*f+r}copy(){let e=new ps(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,R.arrayCopy(this.uvs,0,e.uvs,0,8),R.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},V=ps;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 Ks=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let a=0,c=i.length;a<c;a++){let o=s.getPath(t,a),r=this.atlas.findRegion(o);if(r==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");i[a]=r}}newRegionAttachment(e,t,s,i){let a=new V(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");a.region=c}return a}newMeshAttachment(e,t,s,i){let a=new ye(t,s);if(i!=null)this.loadSequence(t,s,i);else{let c=this.atlas.findRegion(s);if(!c)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");a.region=c}return a}newBoundingBoxAttachment(e,t){return new qe(t)}newPathAttachment(e,t){return new Ae(t)}newPointAttachment(e,t){return new Bt(t)}newClippingAttachment(e,t){return new Et(t)}},Vt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;transformMode=We.Normal;skinRequired=!1;color=new N;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},We=(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))(We||{}),Lt=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;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,a,c,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=c,this.ashearY=o;let r=this.parent;if(!r){let d=this.skeleton;const u=d.scaleX,m=d.scaleY,g=(s+c)*X.degRad,p=(s+90+o)*X.degRad;this.a=Math.cos(g)*i*u,this.b=Math.cos(p)*a*u,this.c=Math.sin(g)*i*m,this.d=Math.sin(p)*a*m,this.worldX=e*u+d.x,this.worldY=t*m+d.y;return}let l=r.a,n=r.b,h=r.c,f=r.d;switch(this.worldX=l*e+n*t+r.worldX,this.worldY=h*e+f*t+r.worldY,this.data.transformMode){case 0:{const d=(s+c)*X.degRad,u=(s+90+o)*X.degRad,m=Math.cos(d)*i,g=Math.cos(u)*a,p=Math.sin(d)*i,w=Math.sin(u)*a;this.a=l*m+n*p,this.b=l*g+n*w,this.c=h*m+f*p,this.d=h*g+f*w;return}case 1:{const d=(s+c)*X.degRad,u=(s+90+o)*X.degRad;this.a=Math.cos(d)*i,this.b=Math.cos(u)*a,this.c=Math.sin(d)*i,this.d=Math.sin(u)*a;break}case 2:{let d=l*l+h*h,u=0;d>1e-4?(d=Math.abs(l*f-n*h)/d,l/=this.skeleton.scaleX,h/=this.skeleton.scaleY,n=h*d,f=l*d,u=Math.atan2(h,l)*X.radDeg):(l=0,h=0,u=90-Math.atan2(f,n)*X.radDeg);const m=(s+c-u)*X.degRad,g=(s+o-u+90)*X.degRad,p=Math.cos(m)*i,w=Math.cos(g)*a,x=Math.sin(m)*i,b=Math.sin(g)*a;this.a=l*p-n*x,this.b=l*w-n*b,this.c=h*p+f*x,this.d=h*w+f*b;break}case 3:case 4:{s*=X.degRad;const d=Math.cos(s),u=Math.sin(s);let m=(l*d+n*u)/this.skeleton.scaleX,g=(h*d+f*u)/this.skeleton.scaleY,p=Math.sqrt(m*m+g*g);p>1e-5&&(p=1/p),m*=p,g*=p,p=Math.sqrt(m*m+g*g),this.data.transformMode==3&&l*f-n*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(g,m);const w=Math.cos(s)*p,x=Math.sin(s)*p;c*=X.degRad,o=(90+o)*X.degRad;const b=Math.cos(c)*i,v=Math.cos(o)*a,y=Math.sin(c)*i,S=Math.sin(o)*a;this.a=m*b+w*y,this.b=m*v+w*S,this.c=g*b+x*y,this.d=g*v+x*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}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)*X.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)*X.radDeg;return}let t=e.a,s=e.b,i=e.c,a=e.d,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c,h=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=h*o-f*r,this.ay=f*n-h*l;let d,u,m,g;if(this.data.transformMode==1)d=this.a,u=this.b,m=this.c,g=this.d;else{switch(this.data.transformMode){case 2:{let v=Math.abs(t*a-s*i)/(t*t+i*i),y=t/this.skeleton.scaleX;s=-(i/this.skeleton.scaleY)*v*this.skeleton.scaleX,a=y*v*this.skeleton.scaleY,c=1/(t*a-s*i),o=a*c,r=s*c;break}case 3:case 4:let p=X.cosDeg(this.rotation),w=X.sinDeg(this.rotation);t=(t*p+s*w)/this.skeleton.scaleX,i=(i*p+a*w)/this.skeleton.scaleY;let x=Math.sqrt(t*t+i*i);x>1e-5&&(x=1/x),t*=x,i*=x,x=Math.sqrt(t*t+i*i),this.data.transformMode==3&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let b=X.PI/2+Math.atan2(i,t);s=Math.cos(b)*x,a=Math.sin(b)*x,c=1/(t*a-s*i),o=a*c,r=s*c,l=i*c,n=t*c}d=o*this.a-r*this.c,u=o*this.b-r*this.d,m=n*this.c-l*this.a,g=n*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let p=d*g-u*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(d*u+m*g,p)*X.radDeg,this.arotation=Math.atan2(m,d)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,u)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*X.radDeg}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,a=this.b;this.a=s*i-t*this.c,this.b=s*a-t*this.d,this.c=t*i+s*this.c,this.d=t*a+s*this.d}},Fe=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ys=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Dt){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${a}`)})}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${a}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,a)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${a}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(t,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(t,e,this.textureLoader(c))},c.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let a=e.lastIndexOf("/"),c=a>=0?e.substring(0,a+1):"";e=this.start(e),this.downloader.downloadText(e,o=>{try{let r=new bs(o),l=r.pages.length,n=!1;for(let h of r.pages)this.loadTexture(i?i[h.name]:c+h.name,(f,d)=>{n||(h.setTexture(d),--l==0&&this.success(t,e,r))},(f,d)=>{n||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${f}`),n=!0})}catch(r){this.error(s,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(o,r)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${o}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
+ `+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}},Dt=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=t.charCodeAt(a);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let a=()=>{this.finish(e,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let a=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let a=t==200||t==0?[s]:[t,s];for(let c=a.length-1,o=i.length;c<o;c+=2)i[c].apply(null,a)}},Nt=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}},Ot=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},vs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,a,c,o){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let l=r.a,n=r.b,h=r.c,f=r.d,d=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=(t-e.worldX)*X.signum(e.skeleton.scaleX),m=(s-e.worldY)*X.signum(e.skeleton.scaleY);break;case 2:let w=Math.abs(l*f-n*h)/Math.max(1e-4,l*l+h*h),x=l/e.skeleton.scaleX,b=h/e.skeleton.scaleY;n=-b*w*e.skeleton.scaleX,f=x*w*e.skeleton.scaleY,d+=Math.atan2(b,x)*X.radDeg;default:let v=t-r.worldX,y=s-r.worldY,S=l*f-n*h;Math.abs(S)<=1e-4?(u=0,m=0):(u=(v*f-y*n)/S-e.ax,m=(y*l-v*h)/S-e.ay)}d+=Math.atan2(m,u)*X.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let g=e.ascaleX,p=e.ascaleY;if(i||a){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=s-e.worldY}const w=e.data.length*g;if(w>1e-4){const x=u*u+m*m;if(i&&x<w*w||a&&x>w*w){const b=(Math.sqrt(x)/w-1)*o+1;g*=b,c&&(p*=b)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,g,p,e.ashearX,e.ashearY)}apply2(e,t,s,i,a,c,o,r,l){let n=e.ax,h=e.ay,f=e.ascaleX,d=e.ascaleY,u=f,m=d,g=t.ascaleX,p=0,w=0,x=0;f<0?(f=-f,p=180,x=-1):(p=0,x=1),d<0&&(d=-d,x=-x),g<0?(g=-g,w=180):w=0;let b=t.ax,v=0,y=0,S=0,C=e.a,k=e.b,T=e.c,M=e.d,E=Math.abs(f-d)<=1e-4;!E||c?(v=0,y=C*b+e.worldX,S=T*b+e.worldY):(v=t.ay,y=C*b+k*v+e.worldX,S=T*b+M*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,k=F.b,T=F.c,M=F.d;let P=C*M-k*T,I=y-F.worldX,Y=S-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let L=(I*M-Y*k)*P-n,U=(Y*C-I*T)*P-h,D=Math.sqrt(L*L+U*U),G=t.data.length*g,j,$;if(D<1e-4){this.apply1(e,s,i,!1,c,!1,l),t.updateWorldTransformWith(b,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-F.worldX,Y=i-F.worldY;let q=(I*M-Y*k)*P-n,O=(Y*C-I*T)*P-h,H=q*q+O*O;if(r!=0){r*=f*(g+1)*.5;let K=Math.sqrt(H),re=K-D-G*f+r;if(re>0){let ie=Math.min(1,re/(r*2))-1;ie=(re-r*(1-ie*ie))/K,q-=ie*q,O-=ie*O,H=q*q+O*O}}e:if(E){G*=f;let K=(H-D*D-G*G)/(2*D*G);K<-1?(K=-1,$=Math.PI*a):K>1?(K=1,$=0,c&&(C=(Math.sqrt(H)/(D+G)-1)*l+1,u*=C,o&&(m*=C))):$=Math.acos(K)*a,C=D+G*K,k=G*Math.sin($),j=Math.atan2(O*C-q*k,q*C+O*k)}else{C=f*G,k=d*G;let K=C*C,re=k*k,ie=Math.atan2(O,q);T=re*D*D+K*H-K*re;let xe=-2*re*D,Ie=re-K;if(M=xe*xe-4*Ie*T,M>=0){let ke=Math.sqrt(M);xe<0&&(ke=-ke),ke=-(xe+ke)*.5;let Rs=ke/Ie,Ps=T/ke,Te=Math.abs(Rs)<Math.abs(Ps)?Rs:Ps;if(Te*Te<=H){Y=Math.sqrt(H-Te*Te)*a,j=ie-Math.atan2(Y,Te),$=Math.atan2(Y/d,(Te-D)/f);break e}}let Ee=X.PI,Ke=D-C,Kt=Ke*Ke,Xs=0,Fs=0,Qe=D+C,Qt=Qe*Qe,Es=0;T=-C*D/(K-re),T>=-1&&T<=1&&(T=Math.acos(T),I=C*Math.cos(T)+D,Y=k*Math.sin(T),M=I*I+Y*Y,M<Kt&&(Ee=T,Kt=M,Ke=I,Xs=Y),M>Qt&&(Fs=T,Qt=M,Qe=I,Es=Y)),H<=(Kt+Qt)*.5?(j=ie-Math.atan2(Xs*a,Ke),$=Ee*a):(j=ie-Math.atan2(Es*a,Qe),$=Fs*a)}let Z=Math.atan2(v,b)*x,de=e.arotation;j=(j-Z)*X.radDeg+p-de,j>180?j-=360:j<-180&&(j+=360),e.updateWorldTransformWith(n,h,de+j*l,u,m,0,0),de=t.arotation,$=(($+Z)*X.radDeg-t.ashearX)*x+w-de,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(b,v,de+$*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},_t=class extends Fe{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},qt=class extends Fe{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 i=0,a=e.bones.length;i<a;i++){let c=t.findBone(e.bones[i].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(c)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ae))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(s==0&&i==0&&a==0)return;let c=this.data,o=c.rotateMode==0,r=c.rotateMode==2,l=this.bones,n=l.length,h=o?n:n+1,f=R.setArraySize(this.spaces,h),d=r?this.lengths=R.setArraySize(this.lengths,n):[],u=this.spacing;switch(c.spacingMode){case 2:if(r)for(let y=0,S=h-1;y<S;y++){let C=l[y],k=C.data.length,T=k*C.a,M=k*C.c;d[y]=Math.sqrt(T*T+M*M)}R.arrayFill(f,1,h,u);break;case 3:let b=0;for(let y=0,S=h-1;y<S;){let C=l[y],k=C.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*C.a,M=k*C.c,E=Math.sqrt(T*T+M*M);r&&(d[y]=E),f[++y]=E,b+=E}}if(b>0){b=h/b*u;for(let y=1;y<h;y++)f[y]*=b}break;default:let v=c.spacingMode==0;for(let y=0,S=h-1;y<S;){let C=l[y],k=C.data.length;if(k<me.epsilon)r&&(d[y]=0),f[++y]=u;else{let T=k*C.a,M=k*C.c,E=Math.sqrt(T*T+M*M);r&&(d[y]=E),f[++y]=(v?k+u:u)*E/k}}}let m=this.computeWorldPositions(t,h,o),g=m[0],p=m[1],w=c.offsetRotation,x=!1;if(w==0)x=c.rotateMode==1;else{x=!1;let b=this.target.bone;w*=b.a*b.d-b.b*b.c>0?X.degRad:-X.degRad}for(let b=0,v=3;b<n;b++,v+=3){let y=l[b];y.worldX+=(g-y.worldX)*i,y.worldY+=(p-y.worldY)*a;let S=m[v],C=m[v+1],k=S-g,T=C-p;if(r){let M=d[b];if(M!=0){let E=(Math.sqrt(k*k+T*T)/M-1)*s+1;y.a*=E,y.c*=E}}if(g=S,p=C,s>0){let M=y.a,E=y.b,F=y.c,P=y.d,I=0,Y=0,L=0;if(o?I=m[v-1]:f[b+1]==0?I=m[v+2]:I=Math.atan2(T,k),I-=Math.atan2(F,M),x){Y=Math.cos(I),L=Math.sin(I);let U=y.data.length;g+=(U*(Y*M-L*F)-k)*s,p+=(U*(L*M+Y*F)-T)*s}else I+=w;I>X.PI?I-=X.PI2:I<-X.PI&&(I+=X.PI2),I*=s,Y=Math.cos(I),L=Math.sin(I),y.a=Y*M-L*F,y.b=Y*E-L*P,y.c=L*M+Y*F,y.d=L*E+Y*P}y.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,a=this.position,c=this.spaces,o=R.setArraySize(this.positions,t*3+2),r=this.world,l=e.closed,n=e.worldVerticesLength,h=n/6,f=me.NONE;if(!e.constantSpeed){let U=e.lengths;h-=l?1:2;let D=U[h];this.data.positionMode==1&&(a*=D);let G;switch(this.data.spacingMode){case 2:G=D;break;case 3:G=D/t;break;default:G=1}r=R.setArraySize(this.world,8);for(let j=0,$=0,q=0;j<t;j++,$+=3){let O=c[j]*G;a+=O;let H=a;if(l)H%=D,H<0&&(H+=D),q=0;else if(H<0){f!=me.BEFORE&&(f=me.BEFORE,e.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(H,r,0,o,$);continue}else if(H>D){f!=me.AFTER&&(f=me.AFTER,e.computeWorldVertices(i,n-6,4,r,0,2)),this.addAfterPosition(H-D,r,0,o,$);continue}for(;;q++){let Z=U[q];if(!(H>Z)){if(q==0)H/=Z;else{let de=U[q-1];H=(H-de)/(Z-de)}break}}q!=f&&(f=q,l&&q==h?(e.computeWorldVertices(i,n-4,4,r,0,2),e.computeWorldVertices(i,0,4,r,4,2)):e.computeWorldVertices(i,q*6+2,8,r,0,2)),this.addCurvePosition(H,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],o,$,s||j>0&&O==0)}return o}l?(n+=2,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n-4,r,0,2),e.computeWorldVertices(i,0,2,r,n-4,2),r[n-2]=r[0],r[n-1]=r[1]):(h--,n-=4,r=R.setArraySize(this.world,n),e.computeWorldVertices(i,2,n,r,0,2));let d=R.setArraySize(this.curves,h),u=0,m=r[0],g=r[1],p=0,w=0,x=0,b=0,v=0,y=0,S=0,C=0,k=0,T=0,M=0,E=0,F=0,P=0;for(let U=0,D=2;U<h;U++,D+=6)p=r[D],w=r[D+1],x=r[D+2],b=r[D+3],v=r[D+4],y=r[D+5],S=(m-p*2+x)*.1875,C=(g-w*2+b)*.1875,k=((p-x)*3-m+v)*.09375,T=((w-b)*3-g+y)*.09375,M=S*2+k,E=C*2+T,F=(p-m)*.75+S+k*.16666667,P=(w-g)*.75+C+T*.16666667,u+=Math.sqrt(F*F+P*P),F+=M,P+=E,M+=k,E+=T,u+=Math.sqrt(F*F+P*P),F+=M,P+=E,u+=Math.sqrt(F*F+P*P),F+=M+k,P+=E+T,u+=Math.sqrt(F*F+P*P),d[U]=u,m=v,g=y;this.data.positionMode==1&&(a*=u);let I;switch(this.data.spacingMode){case 2:I=u;break;case 3:I=u/t;break;default:I=1}let Y=this.segments,L=0;for(let U=0,D=0,G=0,j=0;U<t;U++,D+=3){let $=c[U]*I;a+=$;let q=a;if(l)q%=u,q<0&&(q+=u),G=0;else if(q<0){this.addBeforePosition(q,r,0,o,D);continue}else if(q>u){this.addAfterPosition(q-u,r,n-4,o,D);continue}for(;;G++){let O=d[G];if(!(q>O)){if(G==0)q/=O;else{let H=d[G-1];q=(q-H)/(O-H)}break}}if(G!=f){f=G;let O=G*6;for(m=r[O],g=r[O+1],p=r[O+2],w=r[O+3],x=r[O+4],b=r[O+5],v=r[O+6],y=r[O+7],S=(m-p*2+x)*.03,C=(g-w*2+b)*.03,k=((p-x)*3-m+v)*.006,T=((w-b)*3-g+y)*.006,M=S*2+k,E=C*2+T,F=(p-m)*.3+S+k*.16666667,P=(w-g)*.3+C+T*.16666667,L=Math.sqrt(F*F+P*P),Y[0]=L,O=1;O<8;O++)F+=M,P+=E,M+=k,E+=T,L+=Math.sqrt(F*F+P*P),Y[O]=L;F+=M,P+=E,L+=Math.sqrt(F*F+P*P),Y[8]=L,F+=M+k,P+=E+T,L+=Math.sqrt(F*F+P*P),Y[9]=L,j=0}for(q*=L;;j++){let O=Y[j];if(!(q>O)){if(j==0)q/=O;else{let H=Y[j-1];q=j+(q-H)/(O-H)}break}}this.addCurvePosition(q*.1,m,g,p,w,x,b,v,y,o,D,s||U>0&&$==0)}return o}addBeforePosition(e,t,s,i,a){let c=t[s],o=t[s+1],r=t[s+2]-c,l=t[s+3]-o,n=Math.atan2(l,r);i[a]=c+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addAfterPosition(e,t,s,i,a){let c=t[s+2],o=t[s+3],r=c-t[s],l=o-t[s+1],n=Math.atan2(l,r);i[a]=c+e*Math.cos(n),i[a+1]=o+e*Math.sin(n),i[a+2]=n}addCurvePosition(e,t,s,i,a,c,o,r,l,n,h,f){if(e==0||isNaN(e)){n[h]=t,n[h+1]=s,n[h+2]=Math.atan2(a-s,i-t);return}let d=e*e,u=d*e,m=1-e,g=m*m,p=g*m,w=m*e,x=w*3,b=m*x,v=x*e,y=t*p+i*b+c*v+r*u,S=s*p+a*b+o*v+l*u;n[h]=y,n[h+1]=S,f&&(e<.001?n[h+2]=Math.atan2(a-s,i-t):n[h+2]=Math.atan2(S-(s*g+a*w*2+o*d),y-(t*g+i*w*2+c*d)))}},Ce=me;B(Ce,"NONE",-1),B(Ce,"BEFORE",-2),B(Ce,"AFTER",-3),B(Ce,"epsilon",1e-5);var Qs=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,c=this.data.scaleX>0,o=this.bone,r=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:this.remaining+=Math.max(this.skeleton.time-this.lastTime,0),this.lastTime=this.skeleton.time;const l=o.worldX,n=o.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=n;else{let h=this.remaining,f=this.inertia,d=this.data.step;if(s||i){if(s&&(this.xOffset+=(this.ux-l)*f,this.ux=l),i&&(this.yOffset+=(this.uy-n)*f,this.uy=n),h>=d){const u=this.massInverse*d,m=this.strength,g=this.wind*100,p=this.gravity*-100,w=Math.pow(this.damping,60*d);do s&&(this.xVelocity+=(g-this.xOffset*m)*u,this.xOffset+=this.xVelocity*d,this.xVelocity*=w),i&&(this.yVelocity+=(p-this.yOffset*m)*u,this.yOffset+=this.yVelocity*d,this.yVelocity*=w),h-=d;while(h>=d)}s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a||c){let u=Math.atan2(o.c,o.a),m=0,g=0,p=0;if(a){p=(this.data.rotate+this.data.shearX)*t;let w=this.cx-o.worldX,x=this.cy-o.worldY,b=Math.atan2(x+this.ty,w+this.tx)-u-this.rotateOffset*p;this.rotateOffset+=(b-Math.ceil(b*X.invPI2-.5)*X.PI2)*f,b=this.rotateOffset*p+u,m=Math.cos(b),g=Math.sin(b),c&&(b=r*o.getWorldScaleX(),b>0&&(this.scaleOffset+=(w*m+x*g)*f/b))}else{m=Math.cos(u),g=Math.sin(u);const w=r*o.getWorldScaleX();w>0&&(this.scaleOffset+=((this.cx-o.worldX)*m+(this.cy-o.worldY)*g)*f/w)}if(h=this.remaining,h>=d){const w=this.massInverse*d,x=this.strength,b=this.wind,v=this.gravity,y=Math.pow(this.damping,60*d);for(;;)if(h-=d,c&&(this.scaleVelocity+=(b*m-v*g-this.scaleOffset*x)*w,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=y),a){if(this.rotateVelocity+=(-.01*r*(b*g+v*m)-this.rotateOffset*x)*w,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=y,h<d)break;const S=this.rotateOffset*p+u;m=Math.cos(S),g=Math.sin(S)}else if(h<d)break}}this.remaining=h}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*t*this.data.x),i&&(o.worldY+=this.yOffset*t*this.data.y)}if(a){let l=this.rotateOffset*t,n=0,h=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,n=Math.sin(d),h=Math.cos(d),f=o.b,o.b=h*f-n*o.d,o.d=n*f+h*o.d),d+=l*this.data.shearX,n=Math.sin(d),h=Math.cos(d),f=o.a,o.a=h*f-n*o.c,o.c=n*f+h*o.c}else l*=this.data.rotate,n=Math.sin(l),h=Math.cos(l),f=o.a,o.a=h*f-n*o.c,o.c=n*f+h*o.c,f=o.b,o.b=h*f-n*o.d,o.d=n*f+h*o.d}if(c){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=3&&(this.tx=r*o.a,this.ty=r*o.c),o.updateAppliedTransform()}},Ss=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new N,this.darkColor=e.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ne)||!(this.attachment instanceof ne)||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}},As=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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let a=t.findBone(e.bones[i].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(a)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,h=r.c,f=r.d,d=l*f-n*h>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,g=this.bones;for(let p=0,w=g.length;p<w;p++){let x=g[p];if(e!=0){let b=x.a,v=x.b,y=x.c,S=x.d,C=Math.atan2(h,l)-Math.atan2(y,b)+u;C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C*=e;let k=Math.cos(C),T=Math.sin(C);x.a=k*b-T*y,x.b=k*v-T*S,x.c=T*b+k*y,x.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(b.x-x.worldX)*t,x.worldY+=(b.y-x.worldY)*s}if(i!=0){let b=Math.sqrt(x.a*x.a+x.c*x.c);b!=0&&(b=(b+(Math.sqrt(l*l+h*h)-b+this.data.offsetScaleX)*i)/b),x.a*=b,x.c*=b}if(a!=0){let b=Math.sqrt(x.b*x.b+x.d*x.d);b!=0&&(b=(b+(Math.sqrt(n*n+f*f)-b+this.data.offsetScaleY)*a)/b),x.b*=b,x.d*=b}if(c>0){let b=x.b,v=x.d,y=Math.atan2(v,b),S=Math.atan2(f,n)-Math.atan2(h,l)-(y-Math.atan2(x.c,x.a));S>X.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S=y+(S+m)*c;let C=Math.sqrt(b*b+v*v);x.b=Math.cos(S)*C,x.d=Math.sin(S)*C}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=t!=0||s!=0,r=this.target,l=r.a,n=r.b,h=r.c,f=r.d,d=l*f-n*h>0?X.degRad:-X.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,g=this.bones;for(let p=0,w=g.length;p<w;p++){let x=g[p];if(e!=0){let b=x.a,v=x.b,y=x.c,S=x.d,C=Math.atan2(h,l)+u;C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C*=e;let k=Math.cos(C),T=Math.sin(C);x.a=k*b-T*y,x.b=k*v-T*S,x.c=T*b+k*y,x.d=T*v+k*S}if(o){let b=this.temp;r.localToWorld(b.set(this.data.offsetX,this.data.offsetY)),x.worldX+=b.x*t,x.worldY+=b.y*s}if(i!=0){let b=(Math.sqrt(l*l+h*h)-1+this.data.offsetScaleX)*i+1;x.a*=b,x.c*=b}if(a!=0){let b=(Math.sqrt(n*n+f*f)-1+this.data.offsetScaleY)*a+1;x.b*=b,x.d*=b}if(c>0){let b=Math.atan2(f,n)-Math.atan2(h,l);b>X.PI?b-=X.PI2:b<-X.PI&&(b+=X.PI2);let v=x.b,y=x.d;b=Math.atan2(y,v)+(b-X.PI/2+m)*c;let S=Math.sqrt(v*v+y*y);x.b=Math.cos(b)*S,x.d=Math.sin(b)*S}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],f=h.arotation;if(e!=0){let w=o.arotation-f+this.data.offsetRotation;w-=Math.ceil(w/360-.5)*360,f+=w*e}let d=h.ax,u=h.ay;d+=(o.ax-d+this.data.offsetX)*t,u+=(o.ay-u+this.data.offsetY)*s;let m=h.ascaleX,g=h.ascaleY;i!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*i)/m),a!=0&&g!=0&&(g=(g+(o.ascaleY-g+this.data.offsetScaleY)*a)/g);let p=h.ashearY;if(c!=0){let w=o.ashearY-p+this.data.offsetShearY;w-=Math.ceil(w/360-.5)*360,p+=w*c}h.updateWorldTransformWith(d,u,f,m,g,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,c=this.mixShearY,o=this.target,r=this.bones;for(let l=0,n=r.length;l<n;l++){let h=r[l],f=h.arotation+(o.arotation+this.data.offsetRotation)*e,d=h.ax+(o.ax+this.data.offsetX)*t,u=h.ay+(o.ay+this.data.offsetY)*s,m=h.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),g=h.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*a+1),p=h.ashearY+(o.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(d,u,f,m,g,h.ashearX,p)}}},Cs=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Cs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Lt(s,this,null);else{let a=this.bones[s.parent.index];i=new Lt(s,this,a),a.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],a=new Ss(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new vs(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new As(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 Qs(s,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,d=t.length;f<d;f++){let u=t[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,u=this.skin.bones.length;d<u;d++){let m=this.bones[f[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,a=this.pathConstraints,c=this.physicsConstraints,o=s.length,r=i.length,l=a.length,n=this.physicsConstraints.length,h=o+r+l+n;e:for(let f=0;f<h;f++){for(let d=0;d<o;d++){let u=s[d];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let d=0;d<r;d++){let u=i[d];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let d=0;d<l;d++){let u=a[d];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let d=0;d<n;d++){const u=c[d];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let a=s[s.length-1];this.sortBone(a),this._updateCache.push(e),this.sortReset(i.children),a.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,l=this.data.skins.length;r<l;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let a=t.getAttachment();a instanceof Ae&&this.sortPathConstraintAttachmentWith(a,i);let c=e.bones,o=c.length;for(let r=0;r<o;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<o;r++)this.sortReset(c[r].children);for(let r=0;r<o;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&R.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let a=t[i];this.sortBone(a.parent),this.sortBone(a)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let a in i)this.sortPathConstraintAttachmentWith(i[a],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ae))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let a=0,c=s.length;a<c;){let o=s[a++];for(o+=a;a<o;)this.sortBone(i[s[a++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&R.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(!e)throw new Error("physics is undefined");let t=this.bones;for(let i=0,a=t.length;i<a;i++){let c=t[i];c.ax=c.x,c.ay=c.y,c.arotation=c.rotation,c.ascaleX=c.scaleX,c.ascaleY=c.scaleY,c.ashearX=c.shearX,c.ashearY=c.shearY}let s=this._updateCache;for(let i=0,a=s.length;i<a;i++)s[i].update(e)}updateWorldTransformWith(e,t){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=t.a,a=t.b,c=t.c,o=t.d;s.worldX=i*this.x+a*this.y+t.worldX,s.worldY=c*this.x+o*this.y+t.worldY;const r=(s.rotation+s.shearX)*X.degRad,l=(s.rotation+90+s.shearY)*X.degRad,n=Math.cos(r)*s.scaleX,h=Math.cos(l)*s.scaleY,f=Math.sin(r)*s.scaleX,d=Math.sin(l)*s.scaleY;s.a=(i*n+a*f)*this.scaleX,s.b=(i*h+a*d)*this.scaleX,s.c=(c*n+o*f)*this.scaleY,s.d=(c*h+o*d)*this.scaleY;let u=this._updateCache;for(let m=0,g=u.length;m<g;m++){let p=u[m];p!=s&&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;R.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.data.name==e)return a}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s],c=a.data.attachmentName;if(c){let o=e.getAttachment(s,c);o&&a.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let c=s[i];if(c.data.name==e){let o=null;if(t&&(o=this.getAttachment(i,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);c.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(){let e=new Pe,t=new Pe;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,s=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let i=this.drawOrder,a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l=0,n=i.length;l<n;l++){let h=i[l];if(!h.bone.active)continue;let f=0,d=null,u=h.getAttachment();if(u instanceof V)f=8,d=R.setArraySize(s,f,0),u.computeWorldVertices(h,d,0,2);else if(u instanceof ye){let m=u;f=m.worldVerticesLength,d=R.setArraySize(s,f,0),m.computeWorldVertices(h,0,f,d,0,2)}if(d)for(let m=0,g=d.length;m<g;m+=2){let p=d[m],w=d[m+1];a=Math.min(a,p),c=Math.min(c,w),o=Math.max(o,p),r=Math.max(r,w)}}e.set(a,c),t.set(o-a,r-c)}update(e){this.time+=e}},Is=Cs;B(Is,"yDown",!1);var ks=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ks||{}),Ts=class extends Fe{_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;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)}},Ut=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;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let a=t[s];if(a.name==e)return a}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const a=t[s];if(a.name==e)return a}return null}},Wt=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},$e=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){c=!0;break}c||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){c=!0;break}c||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let a=e.bones[i],c=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==a){c=!0;break}c||this.bones.push(a)}for(let i=0;i<e.constraints.length;i++){let a=e.constraints[i],c=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==a){c=!0;break}c||this.constraints.push(a)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof ye?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new Wt(t,i,a))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new Wt(e,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let a=e.slots[i],c=a.getAttachment();if(c&&s<t.attachments.length){let o=t.attachments[s];for(let r in o){let l=o[r];if(c==l){let n=this.getAttachment(s,r);n&&a.setAttachment(n);break}}}s++}}},zt=class{index=0;name;boneData;color=new N(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||{}),Gt=class extends Fe{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)}},Zs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ut;s.name="";let i=new Ms(e),a=i.readInt32(),c=i.readInt32();s.hash=c==0&&a==0?null:c.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("String in string table must not be null.");i.strings.push(h)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Bone name must not be null.");let f=n==0?null:s.bones[i.readInt(!0)],d=new Vt(n,h,f);d.rotation=i.readFloat(),d.x=i.readFloat()*t,d.y=i.readFloat()*t,d.scaleX=i.readFloat(),d.scaleY=i.readFloat(),d.shearX=i.readFloat(),d.shearY=i.readFloat(),d.length=i.readFloat()*t,d.transformMode=i.readInt(!0),d.skinRequired=i.readBoolean(),o&&(N.rgba8888ToColor(d.color,i.readInt32()),d.icon=i.readString()??void 0,d.visible=i.readBoolean()),s.bones.push(d)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],d=new zt(n,h,f);N.rgba8888ToColor(d.color,i.readInt32());let u=i.readInt32();u!=-1&&N.rgb888ToColor(d.darkColor=new N,u),d.attachmentName=i.readStringRef(),d.blendMode=i.readInt(!0),o&&(d.visible=i.readBoolean()),s.slots.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new _t(f);d.order=i.readInt(!0),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)],d.mix=i.readFloat(),d.softness=i.readFloat()*t;let u=i.readByte();d.skinRequired=(u&1)!=0,d.bendDirection=u&2?1:-1,d.compress=(u&4)!=0,d.stretch=(u&8)!=0,d.uniform=(u&16)!=0,s.ikConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Gt(f);d.order=i.readInt(!0),h=i.readInt(!0);for(let m=0;m<h;m++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.bones[i.readInt(!0)];const u=i.readByte();d.skinRequired=(u&1)!=0,d.local=(u&2)!=0,d.relative=(u&4)!=0,d.offsetRotation=i.readFloat(),d.offsetX=i.readFloat()*t,d.offsetY=i.readFloat()*t,d.offsetScaleX=i.readFloat(),d.offsetScaleY=i.readFloat(),d.offsetShearY=i.readFloat(),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),d.mixScaleX=i.readFloat(),d.mixScaleY=i.readFloat(),d.mixShearY=i.readFloat(),s.transformConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new qt(f);d.order=i.readInt(!0),d.skinRequired=i.readBoolean(),h=i.readInt(!0);for(let u=0;u<h;u++)d.bones.push(s.bones[i.readInt(!0)]);d.target=s.slots[i.readInt(!0)],d.positionMode=i.readInt(!0),d.spacingMode=i.readInt(!0),d.rotateMode=i.readInt(!0),d.offsetRotation=i.readFloat(),d.position=i.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=i.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=i.readFloat(),d.mixX=i.readFloat(),d.mixY=i.readFloat(),s.pathConstraints.push(d)}r=i.readInt(!0);for(let n=0,h;n<r;n++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new Ts(f);d.order=i.readInt(!0),d.bone=s.bones[i.readInt(!0)];let u=i.readByte();d.skinRequired=(u&1)!=0,u&2&&(d.x=i.readFloat()),u&4&&(d.y=i.readFloat()),u&8&&(d.rotate=i.readFloat()),u&16&&(d.scaleX=i.readFloat()),u&32&&(d.shearX=i.readFloat()),d.step=1/i.readByte(),d.inertia=i.readFloat(),d.strength=i.readFloat(),d.damping=i.readFloat(),d.massInverse=i.readFloat(),d.wind=i.readFloat(),d.gravity=i.readFloat(),d.mix=i.readFloat(),u=i.readByte(),u&1&&(d.inertiaGlobal=!0),u&2&&(d.strengthGlobal=!0),u&4&&(d.dampingGlobal=!0),u&8&&(d.massGlobal=!0),u&16&&(d.windGlobal=!0),u&32&&(d.gravityGlobal=!0),u&64&&(d.mixGlobal=!0),s.physicsConstraints.push(d)}let l=this.readSkin(i,s,!0,o);l&&(s.defaultSkin=l,s.skins.push(l));{let n=s.skins.length;for(R.setArraySize(s.skins,r=n+i.readInt(!0));n<r;n++){let h=this.readSkin(i,s,!1,o);if(!h)throw new Error("readSkin() should not have returned null.");s.skins[n]=h}}r=this.linkedMeshes.length;for(let n=0;n<r;n++){let h=this.linkedMeshes[n];const f=s.skins[h.skinIndex];if(!h.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(h.slotIndex,h.parent);if(!d)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?d:h.mesh,h.mesh.setParentMesh(d),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Event data name must not be null");let f=new Ot(h);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}r=i.readInt(!0);for(let n=0;n<r;n++){let h=i.readString();if(!h)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,h,s))}return s}readSkin(e,t,s,i){let a=null,c=0;if(s){if(c=e.readInt(!0),c==0)return null;a=new $e("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");a=new $e(o),i&&N.rgba8888ToColor(a.color,e.readInt32()),a.bones.length=e.readInt(!0);for(let r=0,l=a.bones.length;r<l;r++)a.bones[r]=t.bones[e.readInt(!0)];for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,l=e.readInt(!0);r<l;r++)a.constraints.push(t.physicsConstraints[e.readInt(!0)]);c=e.readInt(!0)}for(let o=0;o<c;o++){let r=e.readInt(!0);for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,a,r,h,i);f&&a.setAttachment(r,h,f)}}return a}readAttachment(e,t,s,i,a,c){let o=this.scale,r=e.readByte();const l=r&8?e.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(r&7){case ge.Region:{let n=r&16?e.readStringRef():null;const h=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null;let d=e.readFloat(),u=e.readFloat(),m=e.readFloat(),g=e.readFloat(),p=e.readFloat(),w=e.readFloat(),x=e.readFloat();n||(n=l);let b=this.attachmentLoader.newRegionAttachment(s,l,n,f);return b?(b.path=n,b.x=u*o,b.y=m*o,b.scaleX=g,b.scaleY=p,b.rotation=d,b.width=w*o,b.height=x*o,N.rgba8888ToColor(b.color,h),b.sequence=f,f==null&&b.updateRegion(),b):null}case ge.BoundingBox:{let n=this.readVertices(e,(r&16)!=0),h=c?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,l);return f?(f.worldVerticesLength=n.length,f.vertices=n.vertices,f.bones=n.bones,c&&N.rgba8888ToColor(f.color,h),f):null}case ge.Mesh:{let n=r&16?e.readStringRef():l;const h=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=e.readInt(!0),u=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,u.length,1),g=this.readShortArray(e,(u.length-d-2)*3);let p=[],w=0,x=0;c&&(p=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),x=e.readFloat()),n||(n=l);let b=this.attachmentLoader.newMeshAttachment(s,l,n,f);return b?(b.path=n,N.rgba8888ToColor(b.color,h),b.bones=u.bones,b.vertices=u.vertices,b.worldVerticesLength=u.length,b.triangles=g,b.regionUVs=m,f==null&&b.updateRegion(),b.hullLength=d<<1,b.sequence=f,c&&(b.edges=p,b.width=w*o,b.height=x*o),b):null}case ge.LinkedMesh:{const n=r&16?e.readStringRef():l;if(n==null)throw new Error("Path of linked mesh must not be null");const h=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=(r&128)!=0,u=e.readInt(!0),m=e.readStringRef();let g=0,p=0;c&&(g=e.readFloat(),p=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,l,n,f);return w?(w.path=n,N.rgba8888ToColor(w.color,h),w.sequence=f,c&&(w.width=g*o,w.height=p*o),this.linkedMeshes.push(new er(w,u,i,m,d)),w):null}case ge.Path:{const n=(r&16)!=0,h=(r&32)!=0,f=this.readVertices(e,(r&64)!=0),d=R.newArray(f.length/6,0);for(let g=0,p=d.length;g<p;g++)d[g]=e.readFloat()*o;const u=c?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,l);return m?(m.closed=n,m.constantSpeed=h,m.worldVerticesLength=f.length,m.vertices=f.vertices,m.bones=f.bones,m.lengths=d,c&&N.rgba8888ToColor(m.color,u),m):null}case ge.Point:{const n=e.readFloat(),h=e.readFloat(),f=e.readFloat(),d=c?e.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,l);return u?(u.x=h*o,u.y=f*o,u.rotation=n,c&&N.rgba8888ToColor(u.color,d),u):null}case ge.Clipping:{const n=e.readInt(!0),h=this.readVertices(e,(r&16)!=0);let f=c?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[n],d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,c&&N.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new tt(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),a=new tr;if(a.length=i<<1,!t)return a.vertices=this.readFloatArray(e,a.length,s),a;let c=new Array,o=new Array;for(let r=0;r<i;r++){let l=e.readInt(!0);o.push(l);for(let n=0;n<l;n++)o.push(e.readInt(!0)),c.push(e.readFloat()*s),c.push(e.readFloat()*s),c.push(e.readFloat())}return a.vertices=R.toFloatArray(c),a.bones=o,a}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let a=0;a<t;a++)i[a]=e.readFloat();else for(let a=0;a<t;a++)i[a]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,a=this.scale;for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),g=m-1;switch(u){case fr:{let p=new we(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat(),e.readStringRef());i.push(p);break}case ur:{let p=e.readInt(!0),w=new dt(m,p,h),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let C=0,k=0;w.setFrame(C,x,b,v,y,S),C!=g;C++){let T=e.readFloat(),M=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(C);break;case he:W(e,w,k++,C,0,x,T,b,M,1),W(e,w,k++,C,1,x,T,v,E,1),W(e,w,k++,C,2,x,T,y,F,1),W(e,w,k++,C,3,x,T,S,P,1)}x=T,b=M,v=E,y=F,S=P}i.push(w);break}case mr:{let p=e.readInt(!0),w=new ft(m,p,h),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let S=0,C=0;w.setFrame(S,x,b,v,y),S!=g;S++){let k=e.readFloat(),T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(S);break;case he:W(e,w,C++,S,0,x,k,b,T,1),W(e,w,C++,S,1,x,k,v,M,1),W(e,w,C++,S,2,x,k,y,E,1)}x=k,b=T,v=M,y=E}i.push(w);break}case gr:{let p=e.readInt(!0),w=new mt(m,p,h),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let M=0,E=0;w.setFrame(M,x,b,v,y,S,C,k,T),M!=g;M++){let F=e.readFloat(),P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(M);break;case he:W(e,w,E++,M,0,x,F,b,P,1),W(e,w,E++,M,1,x,F,v,I,1),W(e,w,E++,M,2,x,F,y,Y,1),W(e,w,E++,M,3,x,F,S,L,1),W(e,w,E++,M,4,x,F,C,U,1),W(e,w,E++,M,5,x,F,k,D,1),W(e,w,E++,M,6,x,F,T,G,1)}x=F,b=P,v=I,y=Y,S=L,C=U,k=D,T=G}i.push(w);break}case xr:{let p=e.readInt(!0),w=new gt(m,p,h),x=e.readFloat(),b=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let T=0,M=0;w.setFrame(T,x,b,v,y,S,C,k),T!=g;T++){let E=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;switch(e.readByte()){case oe:w.setStepped(T);break;case he:W(e,w,M++,T,0,x,E,b,F,1),W(e,w,M++,T,1,x,E,v,P,1),W(e,w,M++,T,2,x,E,y,I,1),W(e,w,M++,T,3,x,E,S,Y,1),W(e,w,M++,T,4,x,E,C,L,1),W(e,w,M++,T,5,x,E,k,U,1)}x=E,b=F,v=P,y=I,S=Y,C=L,k=U}i.push(w);break}case br:{let p=new ut(m,e.readInt(!0),h),w=e.readFloat(),x=e.readUnsignedByte()/255;for(let b=0,v=0;p.setFrame(b,w,x),b!=g;b++){let y=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case oe:p.setStepped(b);break;case he:W(e,p,v++,b,0,w,y,x,S,1)}w=y,x=S}i.push(p)}}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readByte(),m=e.readInt(!0),g=e.readInt(!0);switch(u){case sr:i.push(Q(e,new Ye(m,g,h),1));break;case rr:i.push(Ht(e,new st(m,g,h),a));break;case ir:i.push(Q(e,new rt(m,g,h),a));break;case ar:i.push(Q(e,new it(m,g,h),a));break;case nr:i.push(Ht(e,new at(m,g,h),1));break;case lr:i.push(Q(e,new nt(m,g,h),1));break;case or:i.push(Q(e,new lt(m,g,h),1));break;case hr:i.push(Ht(e,new ot(m,g,h),1));break;case cr:i.push(Q(e,new ht(m,g,h),1));break;case dr:i.push(Q(e,new ct(m,g,h),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new bt(f,e.readInt(!0),h),m=e.readFloat(),g=e.readFloat(),p=e.readFloat()*a;for(let w=0,x=0;;w++){const b=e.readByte();if(u.setFrame(w,m,g,p,e.readByte(),(b&1)!=0,(b&2)!=0),w==d)break;let v=e.readFloat(),y=e.readFloat(),S=e.readFloat()*a;switch(e.readByte()){case oe:u.setStepped(w);break;case he:W(e,u,x++,w,0,m,v,g,y,1),W(e,u,x++,w,1,m,v,p,S,a)}m=v,g=y,p=S}i.push(u)}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new wt(f,e.readInt(!0),h),m=e.readFloat(),g=e.readFloat(),p=e.readFloat(),w=e.readFloat(),x=e.readFloat(),b=e.readFloat(),v=e.readFloat();for(let y=0,S=0;u.setFrame(y,m,g,p,w,x,b,v),y!=d;y++){let C=e.readFloat(),k=e.readFloat(),T=e.readFloat(),M=e.readFloat(),E=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case oe:u.setStepped(y);break;case he:W(e,u,S++,y,0,m,C,g,k,1),W(e,u,S++,y,1,m,C,p,T,1),W(e,u,S++,y,2,m,C,w,M,1),W(e,u,S++,y,3,m,C,x,E,1),W(e,u,S++,y,4,m,C,b,F,1),W(e,u,S++,y,5,m,C,v,P,1)}m=C,g=k,p=T,w=M,x=E,b=F,v=P}i.push(u)}for(let l=0,n=e.readInt(!0);l<n;l++){let h=e.readInt(!0),f=s.pathConstraints[h];for(let d=0,u=e.readInt(!0);d<u;d++){const m=e.readByte(),g=e.readInt(!0),p=e.readInt(!0);switch(m){case yr:i.push(Q(e,new pt(g,p,h),f.positionMode==0?a:1));break;case vr:i.push(Q(e,new yt(g,p,h),f.spacingMode==0||f.spacingMode==1?a:1));break;case Sr:let w=new vt(g,p,h),x=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let S=0,C=0,k=w.getFrameCount()-1;w.setFrame(S,x,b,v,y),S!=k;S++){let T=e.readFloat(),M=e.readFloat(),E=e.readFloat(),F=e.readFloat();switch(e.readByte()){case oe:w.setStepped(S);break;case he:W(e,w,C++,S,0,x,T,b,M,1),W(e,w,C++,S,1,x,T,v,E,1),W(e,w,C++,S,2,x,T,y,F,1)}x=T,b=M,v=E,y=F}i.push(w)}}}for(let l=0,n=e.readInt(!0);l<n;l++){const h=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const u=e.readByte(),m=e.readInt(!0);if(u==Xr){const p=new De(m,h);for(let w=0;w<m;w++)p.setFrame(w,e.readFloat());i.push(p);continue}const g=e.readInt(!0);switch(u){case Ar:i.push(Q(e,new St(m,g,h),1));break;case Cr:i.push(Q(e,new At(m,g,h),1));break;case Ir:i.push(Q(e,new Ct(m,g,h),1));break;case kr:i.push(Q(e,new It(m,g,h),1));break;case Tr:i.push(Q(e,new kt(m,g,h),1));break;case Mr:i.push(Q(e,new Tt(m,g,h),1));break;case Yr:i.push(Q(e,new Mt(m,g,h),1))}}}for(let l=0,n=e.readInt(!0);l<n;l++){let h=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let u=e.readInt(!0);for(let m=0,g=e.readInt(!0);m<g;m++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let w=h.getAttachment(u,p),x=e.readByte(),b=e.readInt(!0),v=b-1;switch(x){case wr:{let y=w,S=y.bones,C=y.vertices,k=S?C.length/3*2:C.length,T=e.readInt(!0),M=new xt(b,T,u,y),E=e.readFloat();for(let F=0,P=0;;F++){let I,Y=e.readInt(!0);if(Y==0)I=S?R.newFloatArray(k):C;else{I=R.newFloatArray(k);let U=e.readInt(!0);if(Y+=U,a==1)for(let D=U;D<Y;D++)I[D]=e.readFloat();else for(let D=U;D<Y;D++)I[D]=e.readFloat()*a;if(!S)for(let D=0,G=I.length;D<G;D++)I[D]+=C[D]}if(M.setFrame(F,E,I),F==v)break;let L=e.readFloat();switch(e.readByte()){case oe:M.setStepped(F);break;case he:W(e,M,P++,F,0,E,L,0,1,1)}E=L}i.push(M);break}case pr:{let y=new Se(b,u,w);for(let S=0;S<b;S++){let C=e.readFloat(),k=e.readInt32();y.setFrame(S,C,is[k&15],k>>4,e.readFloat())}i.push(y);break}}}}}let c=e.readInt(!0);if(c>0){let l=new pe(c),n=s.slots.length;for(let h=0;h<c;h++){let f=e.readFloat(),d=e.readInt(!0),u=R.newArray(n,0);for(let w=n-1;w>=0;w--)u[w]=-1;let m=R.newArray(n-d,0),g=0,p=0;for(let w=0;w<d;w++){let x=e.readInt(!0);for(;g!=x;)m[p++]=g++;u[g+e.readInt(!0)]=g++}for(;g<n;)m[p++]=g++;for(let w=n-1;w>=0;w--)u[w]==-1&&(u[w]=m[--p]);l.setFrame(h,f,u)}i.push(l)}let o=e.readInt(!0);if(o>0){let l=new Xe(o);for(let n=0;n<o;n++){let h=e.readFloat(),f=s.events[e.readInt(!0)],d=new Nt(h,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(n,d)}i.push(l)}let r=0;for(let l=0,n=i.length;l<n;l++)r=Math.max(r,i[l].getDuration());return new Ve(t,i,r)}},Ms=class{constructor(e,t=new Array,s=0,i=new DataView(e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let a=this.readUnsignedByte();switch(a>>4){case 12:case 13:t+=String.fromCharCode((a&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((a&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(a),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},er=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}},tr=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 i=e.readFloat(),a=e.readFloat()*s;for(let c=0,o=0,r=t.getFrameCount()-1;t.setFrame(c,i,a),c!=r;c++){let l=e.readFloat(),n=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(c);break;case he:W(e,t,o++,c,0,i,l,a,n,s)}i=l,a=n}return t}function Ht(e,t,s){let i=e.readFloat(),a=e.readFloat()*s,c=e.readFloat()*s;for(let o=0,r=0,l=t.getFrameCount()-1;t.setFrame(o,i,a,c),o!=l;o++){let n=e.readFloat(),h=e.readFloat()*s,f=e.readFloat()*s;switch(e.readByte()){case oe:t.setStepped(o);break;case he:W(e,t,r++,o,0,i,n,a,h,s),W(e,t,r++,o,1,i,n,c,f,s)}i=n,a=h,c=f}return t}function W(e,t,s,i,a,c,o,r,l,n){t.setBezier(s,i,a,c,r,e.readFloat(),e.readFloat()*n,e.readFloat(),e.readFloat()*n,o,l)}var sr=0,rr=1,ir=2,ar=3,nr=4,lr=5,or=6,hr=7,cr=8,dr=9,fr=0,ur=1,mr=2,gr=3,xr=4,br=5,wr=0,pr=1,yr=0,vr=1,Sr=2,Ar=0,Cr=1,Ir=2,kr=4,Tr=5,Mr=6,Yr=7,Xr=8,oe=1,he=2,Fr=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Me(()=>R.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,c=e.slots,o=c.length;s.length=0,a.freeAll(i),i.length=0;for(let r=0;r<o;r++){let l=c[r];if(!l.bone.active)continue;let n=l.getAttachment();if(n instanceof qe){let h=n;s.push(h);let f=a.obtain();f.length!=h.worldVerticesLength&&(f=R.newFloatArray(h.worldVerticesLength)),i.push(f),h.computeWorldVertices(l,0,h.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let c=0,o=a.length;c<o;c++){let r=a[c],l=r;for(let n=0,h=r.length;n<h;n+=2){let f=l[n],d=l[n+1];e=Math.min(e,f),t=Math.min(t,d),s=Math.max(s,f),i=Math.max(i,d)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let a=this.minX,c=this.minY,o=this.maxX,r=this.maxY;if(e<=a&&s<=a||t<=c&&i<=c||e>=o&&s>=o||t>=r&&i>=r)return!1;let l=(i-t)/(s-e),n=l*(a-e)+t;if(n>c&&n<r||(n=l*(o-e)+t,n>c&&n<r))return!0;let h=(c-t)/l+e;return h>a&&h<o||(h=(r-t)/l+e,h>a&&h<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,a=e.length,c=a-2,o=!1;for(let r=0;r<a;r+=2){let l=i[r+1],n=i[c+1];if(l<s&&n>=s||n<s&&l>=s){let h=i[r];h+(s-l)/(n-l)*(i[c]-h)<t&&(o=!o)}c=r}return o}intersectsSegment(e,t,s,i){let a=this.polygons;for(let c=0,o=a.length;c<o;c++)if(this.intersectsSegmentPolygon(a[c],e,t,s,i))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,t,s,i,a){let c=e,o=e.length,r=t-i,l=s-a,n=t*a-s*i,h=c[o-2],f=c[o-1];for(let d=0;d<o;d+=2){let u=c[d],m=c[d+1],g=h*m-f*u,p=h-u,w=f-m,x=r*w-l*p,b=(n*p-r*g)/x;if((b>=h&&b<=u||b>=u&&b<=h)&&(b>=t&&b<=i||b>=i&&b<=t)){let v=(n*w-l*g)/x;if((v>=f&&v<=m||v>=m&&v<=f)&&(v>=s&&v<=a||v>=a&&v<=s))return!0}h=u,f=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}},te=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Me(()=>new Array);polygonIndicesPool=new Me(()=>new Array);triangulate(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let o=0;o<s;o++)i[o]=o;let a=this.isConcaveArray;a.length=0;for(let o=0,r=s;o<r;++o)a[o]=te.isConcave(o,s,t,i);let c=this.triangles;for(c.length=0;s>3;){let o=s-1,r=0,l=1;for(;;){e:if(!a[r]){let f=i[o]<<1,d=i[r]<<1,u=i[l]<<1,m=t[f],g=t[f+1],p=t[d],w=t[d+1],x=t[u],b=t[u+1];for(let v=(l+1)%s;v!=o;v=(v+1)%s){if(!a[v])continue;let y=i[v]<<1,S=t[y],C=t[y+1];if(te.positiveArea(x,b,m,g,S,C)&&te.positiveArea(m,g,p,w,S,C)&&te.positiveArea(p,w,x,b,S,C))break e}break}if(l==0){do{if(!a[r])break;r--}while(r>0);break}o=r,r=l,l=(l+1)%s}c.push(i[(s+r-1)%s]),c.push(i[r]),c.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let n=(s+r-1)%s,h=r==s?0:r;a[n]=te.isConcave(n,s,t,i),a[h]=te.isConcave(h,s,t,i)}return s==3&&(c.push(i[2]),c.push(i[0]),c.push(i[1])),c}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let o=this.polygonPool.obtain();o.length=0;let r=-1,l=0;for(let n=0,h=t.length;n<h;n+=3){let f=t[n]<<1,d=t[n+1]<<1,u=t[n+2]<<1,m=s[f],g=s[f+1],p=s[d],w=s[d+1],x=s[u],b=s[u+1],v=!1;if(r==f){let y=o.length-4,S=te.winding(o[y],o[y+1],o[y+2],o[y+3],x,b),C=te.winding(x,b,o[0],o[1],o[2],o[3]);S==l&&C==l&&(o.push(x),o.push(b),c.push(u),v=!0)}v||(o.length>0?(i.push(o),a.push(c)):(this.polygonPool.free(o),this.polygonIndicesPool.free(c)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(g),o.push(p),o.push(w),o.push(x),o.push(b),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(f),c.push(d),c.push(u),l=te.winding(m,g,p,w,x,b),r=f)}o.length>0&&(i.push(o),a.push(c));for(let n=0,h=i.length;n<h;n++){if(c=a[n],c.length==0)continue;let f=c[0],d=c[c.length-1];o=i[n];let u=o.length-4,m=o[u],g=o[u+1],p=o[u+2],w=o[u+3],x=o[0],b=o[1],v=o[2],y=o[3],S=te.winding(m,g,p,w,x,b);for(let C=0;C<h;C++){if(C==n)continue;let k=a[C];if(k.length!=3)continue;let T=k[0],M=k[1],E=k[2],F=i[C],P=F[F.length-2],I=F[F.length-1];if(T!=f||M!=d)continue;let Y=te.winding(m,g,p,w,P,I),L=te.winding(P,I,x,b,v,y);Y==S&&L==S&&(F.length=0,k.length=0,o.push(P),o.push(I),c.push(E),m=p,g=w,p=P,w=I,C=0)}}for(let n=i.length-1;n>=0;n--)o=i[n],o.length==0&&(i.splice(n,1),this.polygonPool.free(o),c=a[n],a.splice(n,1),this.polygonIndicesPool.free(c));return i}static isConcave(e,t,s,i){let a=i[(t+e-1)%t]<<1,c=i[e]<<1,o=i[(e+1)%t]<<1;return!this.positiveArea(s[a],s[a+1],s[c],s[c+1],s[o],s[o+1])}static positiveArea(e,t,s,i,a,c){return e*(c-i)+s*(t-c)+a*(i-t)>=0}static winding(e,t,s,i,a,c){let o=s-e,r=i-t;return a*r-c*o+o*t-e*r>=0?1:-1}},$t=class{triangulator=new te;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=R.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let a=this.clippingPolygon;$t.makeClockwise(a);let c=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let o=0,r=c.length;o<r;o++){let l=c[o];$t.makeClockwise(l),l.push(l[0]),l.push(l[1])}return c.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,a,c,o,r){let l=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,f=this.clippingPolygons,d=f.length,u=r?12:8,m=0;n.length=0,h.length=0;e:for(let g=0;g<i;g+=3){let p=s[g]<<1,w=e[p],x=e[p+1],b=a[p],v=a[p+1];p=s[g+1]<<1;let y=e[p],S=e[p+1],C=a[p],k=a[p+1];p=s[g+2]<<1;let T=e[p],M=e[p+1],E=a[p],F=a[p+1];for(let P=0;P<d;P++){let I=n.length;if(this.clip(w,x,y,S,T,M,f[P],l)){let Y=l.length;if(Y==0)continue;let L=S-M,U=T-y,D=w-T,G=M-x,j=1/(L*D+U*(x-M)),$=Y>>1,q=this.clipOutput,O=R.setArraySize(n,I+$*u);for(let Z=0;Z<Y;Z+=2){let de=q[Z],K=q[Z+1];O[I]=de,O[I+1]=K,O[I+2]=c.r,O[I+3]=c.g,O[I+4]=c.b,O[I+5]=c.a;let re=de-T,ie=K-M,xe=(L*re+U*ie)*j,Ie=(G*re+D*ie)*j,Ee=1-xe-Ie;O[I+6]=b*xe+C*Ie+E*Ee,O[I+7]=v*xe+k*Ie+F*Ee,r&&(O[I+8]=o.r,O[I+9]=o.g,O[I+10]=o.b,O[I+11]=o.a),I+=u}I=h.length;let H=R.setArraySize(h,I+3*($-2));$--;for(let Z=1;Z<$;Z++)H[I]=m,H[I+1]=m+Z,H[I+2]=m+Z+1,I+=3;m+=$+1}else{let Y=R.setArraySize(n,I+3*u);Y[I]=w,Y[I+1]=x,Y[I+2]=c.r,Y[I+3]=c.g,Y[I+4]=c.b,Y[I+5]=c.a,r?(Y[I+6]=b,Y[I+7]=v,Y[I+8]=o.r,Y[I+9]=o.g,Y[I+10]=o.b,Y[I+11]=o.a,Y[I+12]=y,Y[I+13]=S,Y[I+14]=c.r,Y[I+15]=c.g,Y[I+16]=c.b,Y[I+17]=c.a,Y[I+18]=C,Y[I+19]=k,Y[I+20]=o.r,Y[I+21]=o.g,Y[I+22]=o.b,Y[I+23]=o.a,Y[I+24]=T,Y[I+25]=M,Y[I+26]=c.r,Y[I+27]=c.g,Y[I+28]=c.b,Y[I+29]=c.a,Y[I+30]=E,Y[I+31]=F,Y[I+32]=o.r,Y[I+33]=o.g,Y[I+34]=o.b,Y[I+35]=o.a):(Y[I+6]=b,Y[I+7]=v,Y[I+8]=y,Y[I+9]=S,Y[I+10]=c.r,Y[I+11]=c.g,Y[I+12]=c.b,Y[I+13]=c.a,Y[I+14]=C,Y[I+15]=k,Y[I+16]=T,Y[I+17]=M,Y[I+18]=c.r,Y[I+19]=c.g,Y[I+20]=c.b,Y[I+21]=c.a,Y[I+22]=E,Y[I+23]=F),I=h.length;let L=R.setArraySize(h,I+3);L[I]=m,L[I+1]=m+1,L[I+2]=m+2,m+=3;continue e}}}}clip(e,t,s,i,a,c,o,r){let l=r,n=!1,h;o.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(s),h.push(i),h.push(a),h.push(c),h.push(e),h.push(t),r.length=0;let f=o,d=o.length-4;for(let u=0;;u+=2){let m=f[u],g=f[u+1],p=f[u+2],w=f[u+3],x=m-p,b=g-w,v=h,y=h.length-2,S=r.length;for(let k=0;k<y;k+=2){let T=v[k],M=v[k+1],E=v[k+2],F=v[k+3],P=x*(F-w)-b*(E-p)>0;if(x*(M-w)-b*(T-p)>0){if(P){r.push(E),r.push(F);continue}let I=F-M,Y=E-T,L=I*(p-m)-Y*(w-g);if(Math.abs(L)>1e-6){let U=(Y*(g-M)-I*(m-T))/L;r.push(m+(p-m)*U),r.push(g+(w-g)*U)}else r.push(m),r.push(g)}else if(P){let I=F-M,Y=E-T,L=I*(p-m)-Y*(w-g);if(Math.abs(L)>1e-6){let U=(Y*(g-M)-I*(m-T))/L;r.push(m+(p-m)*U),r.push(g+(w-g)*U)}else r.push(m),r.push(g);r.push(E),r.push(F)}n=!0}if(S==r.length)return l.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==d)break;let C=r;r=h,r.length=0,h=C}if(l!=r){l.length=0;for(let u=0,m=r.length-2;u<m;u++)l[u]=r[u]}else l.length=l.length-2;return n}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],a=0,c=0,o=0,r=0;for(let l=0,n=s-3;l<n;l+=2)a=t[l],c=t[l+1],o=t[l+2],r=t[l+3],i+=a*r-o*c;if(!(i<0))for(let l=0,n=s-2,h=s>>1;l<h;l+=2){let f=t[l],d=t[l+1],u=n-l;t[l]=t[u],t[l+1]=t[u+1],t[u]=f,t[u+1]=d}}},Er=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ut,i=typeof e=="string"?JSON.parse(e):e,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.fps=a.fps,s.imagesPath=a.images),i.bones)for(let c=0;c<i.bones.length;c++){let o=i.bones[c],r=null,l=A(o,"parent",null);l&&(r=s.findBone(l));let n=new Vt(s.bones.length,o.name,r);n.length=A(o,"length",0)*t,n.x=A(o,"x",0)*t,n.y=A(o,"y",0)*t,n.rotation=A(o,"rotation",0),n.scaleX=A(o,"scaleX",1),n.scaleY=A(o,"scaleY",1),n.shearX=A(o,"shearX",0),n.shearY=A(o,"shearY",0),n.transformMode=R.enumValue(We,A(o,"transform","Normal")),n.skinRequired=A(o,"skin",!1);let h=A(o,"color",null);h&&n.color.setFromString(h),s.bones.push(n)}if(i.slots)for(let c=0;c<i.slots.length;c++){let o=i.slots[c],r=s.findBone(o.bone);if(!r)throw new Error(`Couldn't find bone ${o.bone} for slot ${o.name}`);let l=new zt(s.slots.length,o.name,r),n=A(o,"color",null);n&&l.color.setFromString(n);let h=A(o,"dark",null);h&&(l.darkColor=N.fromString(h)),l.attachmentName=A(o,"attachment",null),l.blendMode=R.enumValue(je,A(o,"blend","normal")),s.slots.push(l)}if(i.ik)for(let c=0;c<i.ik.length;c++){let o=i.ik[c],r=new _t(o.name);r.order=A(o,"order",0),r.skinRequired=A(o,"skin",!1);for(let n=0;n<o.bones.length;n++){let h=s.findBone(o.bones[n]);if(!h)throw new Error(`Couldn't find bone ${o.bones[n]} for IK constraint ${o.name}.`);r.bones.push(h)}let l=s.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);r.target=l,r.mix=A(o,"mix",1),r.softness=A(o,"softness",0)*t,r.bendDirection=A(o,"bendPositive",!0)?1:-1,r.compress=A(o,"compress",!1),r.stretch=A(o,"stretch",!1),r.uniform=A(o,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let c=0;c<i.transform.length;c++){let o=i.transform[c],r=new Gt(o.name);r.order=A(o,"order",0),r.skinRequired=A(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let f=o.bones[h],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findBone(l);if(!n)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);r.target=n,r.local=A(o,"local",!1),r.relative=A(o,"relative",!1),r.offsetRotation=A(o,"rotation",0),r.offsetX=A(o,"x",0)*t,r.offsetY=A(o,"y",0)*t,r.offsetScaleX=A(o,"scaleX",0),r.offsetScaleY=A(o,"scaleY",0),r.offsetShearY=A(o,"shearY",0),r.mixRotate=A(o,"mixRotate",1),r.mixX=A(o,"mixX",1),r.mixY=A(o,"mixY",r.mixX),r.mixScaleX=A(o,"mixScaleX",1),r.mixScaleY=A(o,"mixScaleY",r.mixScaleX),r.mixShearY=A(o,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let c=0;c<i.path.length;c++){let o=i.path[c],r=new qt(o.name);r.order=A(o,"order",0),r.skinRequired=A(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let f=o.bones[h],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${o.name}.`);r.bones.push(d)}let l=o.target,n=s.findSlot(l);if(!n)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);r.target=n,r.positionMode=R.enumValue(ze,A(o,"positionMode","Percent")),r.spacingMode=R.enumValue(Ge,A(o,"spacingMode","Length")),r.rotateMode=R.enumValue(He,A(o,"rotateMode","Tangent")),r.offsetRotation=A(o,"rotation",0),r.position=A(o,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=A(o,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=A(o,"mixRotate",1),r.mixX=A(o,"mixX",1),r.mixY=A(o,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let c=0;c<i.physics.length;c++){const o=i.physics[c],r=new Ts(o.name);r.order=A(o,"order",0),r.skinRequired=A(o,"skin",!1);const l=o.bone,n=s.findBone(l);if(n==null)throw new Error("Physics bone not found: "+l);r.bone=n,r.x=A(o,"x",0),r.y=A(o,"y",0),r.rotate=A(o,"rotate",0),r.scaleX=A(o,"scaleX",0),r.shearX=A(o,"shearX",0),r.step=1/A(o,"fps",60),r.inertia=A(o,"inertia",1),r.strength=A(o,"strength",100),r.damping=A(o,"damping",1),r.massInverse=1/A(o,"mass",1),r.wind=A(o,"wind",0),r.gravity=A(o,"gravity",0),r.mix=A(o,"mix",1),r.inertiaGlobal=A(o,"inertiaGlobal",!1),r.strengthGlobal=A(o,"strengthGlobal",!1),r.dampingGlobal=A(o,"dampingGlobal",!1),r.massGlobal=A(o,"massGlobal",!1),r.windGlobal=A(o,"windGlobal",!1),r.gravityGlobal=A(o,"gravityGlobal",!1),r.mixGlobal=A(o,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let c=0;c<i.skins.length;c++){let o=i.skins[c],r=new $e(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let n=o.bones[l],h=s.findBone(n);if(!h)throw new Error(`Couldn't find bone ${n} for skin ${o.name}.`);r.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){let n=o.ik[l],h=s.findIkConstraint(n);if(!h)throw new Error(`Couldn't find IK constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){let n=o.transform[l],h=s.findTransformConstraint(n);if(!h)throw new Error(`Couldn't find transform constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){let n=o.path[l],h=s.findPathConstraint(n);if(!h)throw new Error(`Couldn't find path constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}if(o.physics)for(let l=0;l<o.physics.length;l++){let n=o.physics[l],h=s.findPhysicsConstraint(n);if(!h)throw new Error(`Couldn't find physics constraint ${n} for skin ${o.name}.`);r.constraints.push(h)}for(let l in o.attachments){let n=s.findSlot(l);if(!n)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let h=o.attachments[l];for(let f in h){let d=this.readAttachment(h[f],r,n.index,f,s);d&&r.setAttachment(n.index,f,d)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let c=0,o=this.linkedMeshes.length;c<o;c++){let r=this.linkedMeshes[c],l=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${r.skin}`);let n=l.getAttachment(r.slotIndex,r.parent);if(!n)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?n:r.mesh,r.mesh.setParentMesh(n),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let c in i.events){let o=i.events[c],r=new Ot(c);r.intValue=A(o,"int",0),r.floatValue=A(o,"float",0),r.stringValue=A(o,"string",""),r.audioPath=A(o,"audio",null),r.audioPath&&(r.volume=A(o,"volume",1),r.balance=A(o,"balance",0)),s.events.push(r)}if(i.animations)for(let c in i.animations){let o=i.animations[c];this.readAnimation(o,c,s)}return s}readAttachment(e,t,s,i,a){let c=this.scale;switch(i=A(e,"name",i),A(e,"type","region")){case"region":{let o=A(e,"path",i),r=this.readSequence(A(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,i,o,r);if(!l)return null;l.path=o,l.x=A(e,"x",0)*c,l.y=A(e,"y",0)*c,l.scaleX=A(e,"scaleX",1),l.scaleY=A(e,"scaleY",1),l.rotation=A(e,"rotation",0),l.width=e.width*c,l.height=e.height*c,l.sequence=r;let n=A(e,"color",null);return n&&l.color.setFromString(n),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let r=A(e,"color",null);return r&&o.color.setFromString(r),o}case"mesh":case"linkedmesh":{let o=A(e,"path",i),r=this.readSequence(A(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,i,o,r);if(!l)return null;l.path=o;let n=A(e,"color",null);n&&l.color.setFromString(n),l.width=A(e,"width",0)*c,l.height=A(e,"height",0)*c,l.sequence=r;let h=A(e,"parent",null);if(h)return this.linkedMeshes.push(new Rr(l,A(e,"skin",null),s,h,A(e,"timelines",!0))),l;let f=e.uvs;return this.readVertices(e,l,f.length),l.triangles=e.triangles,l.regionUVs=f,l.region!=null&&l.updateRegion(),l.edges=A(e,"edges",null),l.hullLength=A(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,i);if(!o)return null;o.closed=A(e,"closed",!1),o.constantSpeed=A(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,o,r<<1);let l=R.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)l[h]=e.lengths[h]*c;o.lengths=l;let n=A(e,"color",null);return n&&o.color.setFromString(n),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,i);if(!o)return null;o.x=A(e,"x",0)*c,o.y=A(e,"y",0)*c,o.rotation=A(e,"rotation",0);let r=A(e,"color",null);return r&&o.color.setFromString(r),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,i);if(!o)return null;let r=A(e,"end",null);r&&(o.endSlot=a.findSlot(r));let l=e.vertexCount;this.readVertices(e,o,l<<1);let n=A(e,"color",null);return n&&o.color.setFromString(n),o}}return null}readSequence(e){if(e==null)return null;let t=new tt(A(e,"count",0));return t.start=A(e,"start",1),t.digits=A(e,"digits",0),t.setupIndex=A(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let a=e.vertices;if(s==a.length){let r=R.toFloatArray(a);if(i!=1)for(let l=0,n=a.length;l<n;l++)r[l]*=i;t.vertices=r;return}let c=new Array,o=new Array;for(let r=0,l=a.length;r<l;){let n=a[r++];o.push(n);for(let h=r+n*4;r<h;r+=4)o.push(a[r]),c.push(a[r+1]*i),c.push(a[r+2]*i),c.push(a[r+3])}t.bones=o,t.vertices=R.toFloatArray(c)}readAnimation(e,t,s){let i=this.scale,a=new Array;if(e.slots)for(let o in e.slots){let r=e.slots[o],l=s.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let n=l.index;for(let h in r){let f=r[h];if(!f)continue;let d=f.length;if(h=="attachment"){let u=new we(d,n);for(let m=0;m<d;m++){let g=f[m];u.setFrame(m,A(g,"time",0),A(g,"name",null))}a.push(u)}else if(h=="rgba"){let u=new dt(d,d<<2,n),m=f[0],g=A(m,"time",0),p=N.fromString(m.color);for(let w=0,x=0;;w++){u.setFrame(w,g,p.r,p.g,p.b,p.a);let b=f[w+1];if(!b){u.shrink(x);break}let v=A(b,"time",0),y=N.fromString(b.color),S=m.curve;S&&(x=z(S,u,x,w,0,g,v,p.r,y.r,1),x=z(S,u,x,w,1,g,v,p.g,y.g,1),x=z(S,u,x,w,2,g,v,p.b,y.b,1),x=z(S,u,x,w,3,g,v,p.a,y.a,1)),g=v,p=y,m=b}a.push(u)}else if(h=="rgb"){let u=new ft(d,d*3,n),m=f[0],g=A(m,"time",0),p=N.fromString(m.color);for(let w=0,x=0;;w++){u.setFrame(w,g,p.r,p.g,p.b);let b=f[w+1];if(!b){u.shrink(x);break}let v=A(b,"time",0),y=N.fromString(b.color),S=m.curve;S&&(x=z(S,u,x,w,0,g,v,p.r,y.r,1),x=z(S,u,x,w,1,g,v,p.g,y.g,1),x=z(S,u,x,w,2,g,v,p.b,y.b,1)),g=v,p=y,m=b}a.push(u)}else if(h=="alpha")a.push(ce(f,new ut(d,d,n),0,1));else if(h=="rgba2"){let u=new mt(d,d*7,n),m=f[0],g=A(m,"time",0),p=N.fromString(m.light),w=N.fromString(m.dark);for(let x=0,b=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,p.a,w.r,w.g,w.b);let v=f[x+1];if(!v){u.shrink(b);break}let y=A(v,"time",0),S=N.fromString(v.light),C=N.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,x,0,g,y,p.r,S.r,1),b=z(k,u,b,x,1,g,y,p.g,S.g,1),b=z(k,u,b,x,2,g,y,p.b,S.b,1),b=z(k,u,b,x,3,g,y,p.a,S.a,1),b=z(k,u,b,x,4,g,y,w.r,C.r,1),b=z(k,u,b,x,5,g,y,w.g,C.g,1),b=z(k,u,b,x,6,g,y,w.b,C.b,1)),g=y,p=S,w=C,m=v}a.push(u)}else if(h=="rgb2"){let u=new gt(d,d*6,n),m=f[0],g=A(m,"time",0),p=N.fromString(m.light),w=N.fromString(m.dark);for(let x=0,b=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,w.r,w.g,w.b);let v=f[x+1];if(!v){u.shrink(b);break}let y=A(v,"time",0),S=N.fromString(v.light),C=N.fromString(v.dark),k=m.curve;k&&(b=z(k,u,b,x,0,g,y,p.r,S.r,1),b=z(k,u,b,x,1,g,y,p.g,S.g,1),b=z(k,u,b,x,2,g,y,p.b,S.b,1),b=z(k,u,b,x,3,g,y,w.r,C.r,1),b=z(k,u,b,x,4,g,y,w.g,C.g,1),b=z(k,u,b,x,5,g,y,w.b,C.b,1)),g=y,p=S,w=C,m=v}a.push(u)}}}if(e.bones)for(let o in e.bones){let r=e.bones[o],l=s.findBone(o);if(!l)throw new Error("Bone not found: "+o);let n=l.index;for(let h in r){let f=r[h],d=f.length;if(d!=0){if(h==="rotate")a.push(ce(f,new Ye(d,d,n),0,1));else if(h==="translate"){let u=new st(d,d<<1,n);a.push(jt(f,u,"x","y",0,i))}else if(h==="translatex"){let u=new rt(d,d,n);a.push(ce(f,u,0,i))}else if(h==="translatey"){let u=new it(d,d,n);a.push(ce(f,u,0,i))}else if(h==="scale"){let u=new at(d,d<<1,n);a.push(jt(f,u,"x","y",1,1))}else if(h==="scalex"){let u=new nt(d,d,n);a.push(ce(f,u,1,1))}else if(h==="scaley"){let u=new lt(d,d,n);a.push(ce(f,u,1,1))}else if(h==="shear"){let u=new ot(d,d<<1,n);a.push(jt(f,u,"x","y",0,1))}else if(h==="shearx"){let u=new ht(d,d,n);a.push(ce(f,u,0,1))}else if(h==="sheary"){let u=new ct(d,d,n);a.push(ce(f,u,0,1))}}}}if(e.ik)for(let o in e.ik){let r=e.ik[o],l=r[0];if(!l)continue;let n=s.findIkConstraint(o);if(!n)throw new Error("IK Constraint not found: "+o);let h=s.ikConstraints.indexOf(n),f=new bt(r.length,r.length<<1,h),d=A(l,"time",0),u=A(l,"mix",1),m=A(l,"softness",0)*i;for(let g=0,p=0;;g++){f.setFrame(g,d,u,m,A(l,"bendPositive",!0)?1:-1,A(l,"compress",!1),A(l,"stretch",!1));let w=r[g+1];if(!w){f.shrink(p);break}let x=A(w,"time",0),b=A(w,"mix",1),v=A(w,"softness",0)*i,y=l.curve;y&&(p=z(y,f,p,g,0,d,x,u,b,1),p=z(y,f,p,g,1,d,x,m,v,i)),d=x,u=b,m=v,l=w}a.push(f)}if(e.transform)for(let o in e.transform){let r=e.transform[o],l=r[0];if(!l)continue;let n=s.findTransformConstraint(o);if(!n)throw new Error("Transform constraint not found: "+o);let h=s.transformConstraints.indexOf(n),f=new wt(r.length,r.length*6,h),d=A(l,"time",0),u=A(l,"mixRotate",1),m=A(l,"mixX",1),g=A(l,"mixY",m),p=A(l,"mixScaleX",1),w=A(l,"mixScaleY",p),x=A(l,"mixShearY",1);for(let b=0,v=0;;b++){f.setFrame(b,d,u,m,g,p,w,x);let y=r[b+1];if(!y){f.shrink(v);break}let S=A(y,"time",0),C=A(y,"mixRotate",1),k=A(y,"mixX",1),T=A(y,"mixY",k),M=A(y,"mixScaleX",1),E=A(y,"mixScaleY",M),F=A(y,"mixShearY",1),P=l.curve;P&&(v=z(P,f,v,b,0,d,S,u,C,1),v=z(P,f,v,b,1,d,S,m,k,1),v=z(P,f,v,b,2,d,S,g,T,1),v=z(P,f,v,b,3,d,S,p,M,1),v=z(P,f,v,b,4,d,S,w,E,1),v=z(P,f,v,b,5,d,S,x,F,1)),d=S,u=C,m=k,g=T,p=M,w=E,p=M,l=y}a.push(f)}if(e.path)for(let o in e.path){let r=e.path[o],l=s.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let n=s.pathConstraints.indexOf(l);for(let h in r){let f=r[h],d=f[0];if(!d)continue;let u=f.length;if(h==="position"){let m=new pt(u,u,n);a.push(ce(f,m,0,l.positionMode==0?i:1))}else if(h==="spacing"){let m=new yt(u,u,n);a.push(ce(f,m,0,l.spacingMode==0||l.spacingMode==1?i:1))}else if(h==="mix"){let m=new vt(u,u*3,n),g=A(d,"time",0),p=A(d,"mixRotate",1),w=A(d,"mixX",1),x=A(d,"mixY",w);for(let b=0,v=0;;b++){m.setFrame(b,g,p,w,x);let y=f[b+1];if(!y){m.shrink(v);break}let S=A(y,"time",0),C=A(y,"mixRotate",1),k=A(y,"mixX",1),T=A(y,"mixY",k),M=d.curve;M&&(v=z(M,m,v,b,0,g,S,p,C,1),v=z(M,m,v,b,1,g,S,w,k,1),v=z(M,m,v,b,2,g,S,x,T,1)),g=S,p=C,w=k,x=T,d=y}a.push(m)}}}if(e.physics)for(let o in e.physics){let r=e.physics[o],l=-1;if(o.length>0){let n=s.findPhysicsConstraint(o);if(!n)throw new Error("Physics constraint not found: "+o);l=s.physicsConstraints.indexOf(n)}for(let n in r){let h=r[n],f=h[0];if(!f)continue;let d=h.length;if(n=="reset"){const m=new De(h.size,l);for(let g=0;f!=null;f=h[g+1],g++)m.setFrame(g,A(f,"time",0));a.push(m);continue}let u;if(n=="inertia")u=new St(d,d,l);else if(n=="strength")u=new At(d,d,l);else if(n=="damping")u=new Ct(d,d,l);else if(n=="mass")u=new It(d,d,l);else if(n=="wind")u=new kt(d,d,l);else if(n=="gravity")u=new Tt(d,d,l);else if(n=="mix")u=new Mt(d,d,l);else continue;a.push(ce(h,u,0,1))}}if(e.attachments)for(let o in e.attachments){let r=e.attachments[o],l=s.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let n in r){let h=r[n],f=s.findSlot(n);if(!f)throw new Error("Slot not found: "+n);let d=f.index;for(let u in h){let m=h[u],g=l.getAttachment(d,u);for(let p in m){let w=m[p],x=w[0];if(x){if(p=="deform"){let b=g.bones,v=g.vertices,y=b?v.length/3*2:v.length,S=new xt(w.length,w.length,d,g),C=A(x,"time",0);for(let k=0,T=0;;k++){let M,E=A(x,"vertices",null);if(!E)M=b?R.newFloatArray(y):v;else{M=R.newFloatArray(y);let Y=A(x,"offset",0);if(R.arrayCopy(E,0,M,Y,E.length),i!=1)for(let L=Y,U=L+E.length;L<U;L++)M[L]*=i;if(!b)for(let L=0;L<y;L++)M[L]+=v[L]}S.setFrame(k,C,M);let F=w[k+1];if(!F){S.shrink(T);break}let P=A(F,"time",0),I=x.curve;I&&(T=z(I,S,T,k,0,C,P,0,1,1)),C=P,x=F}a.push(S)}else if(p=="sequence"){let b=new Se(w.length,d,g),v=0;for(let y=0;y<w.length;y++){let S=A(x,"delay",v),C=A(x,"time",0),k=rs[A(x,"mode","hold")],T=A(x,"index",0);b.setFrame(y,C,k,T,S),v=S,x=w[y+1]}a.push(b)}}}}}}if(e.drawOrder){let o=new pe(e.drawOrder.length),r=s.slots.length,l=0;for(let n=0;n<e.drawOrder.length;n++,l++){let h=e.drawOrder[n],f=null,d=A(h,"offsets",null);if(d){f=R.newArray(r,-1);let u=R.newArray(r-d.length,0),m=0,g=0;for(let p=0;p<d.length;p++){let w=d[p],x=s.findSlot(w.slot);if(!x)throw new Error("Slot not found: "+x);let b=x.index;for(;m!=b;)u[g++]=m++;f[m+w.offset]=m++}for(;m<r;)u[g++]=m++;for(let p=r-1;p>=0;p--)f[p]==-1&&(f[p]=u[--g])}o.setFrame(l,A(h,"time",0),f)}a.push(o)}if(e.events){let o=new Xe(e.events.length),r=0;for(let l=0;l<e.events.length;l++,r++){let n=e.events[l],h=s.findEvent(n.name);if(!h)throw new Error("Event not found: "+n.name);let f=new Nt(R.toSinglePrecision(A(n,"time",0)),h);f.intValue=A(n,"int",h.intValue),f.floatValue=A(n,"float",h.floatValue),f.stringValue=A(n,"string",h.stringValue),f.data.audioPath&&(f.volume=A(n,"volume",1),f.balance=A(n,"balance",0)),o.setFrame(r,f)}a.push(o)}let c=0;for(let o=0,r=a.length;o<r;o++)c=Math.max(c,a[o].getDuration());s.animations.push(new Ve(t,a,c))}},Rr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,a){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}};function ce(e,t,s,i){let a=e[0],c=A(a,"time",0),o=A(a,"value",s)*i,r=0;for(let l=0;;l++){t.setFrame(l,c,o);let n=e[l+1];if(!n)return t.shrink(r),t;let h=A(n,"time",0),f=A(n,"value",s)*i;a.curve&&(r=z(a.curve,t,r,l,0,c,h,o,f,i)),c=h,o=f,a=n}}function jt(e,t,s,i,a,c){let o=e[0],r=A(o,"time",0),l=A(o,s,a)*c,n=A(o,i,a)*c,h=0;for(let f=0;;f++){t.setFrame(f,r,l,n);let d=e[f+1];if(!d)return t.shrink(h),t;let u=A(d,"time",0),m=A(d,s,a)*c,g=A(d,i,a)*c,p=o.curve;p&&(h=z(p,t,h,f,0,r,u,l,m,c),h=z(p,t,h,f,1,r,u,n,g,c)),r=u,l=m,n=g,o=d}}function z(e,t,s,i,a,c,o,r,l,n){if(e=="stepped")return t.setStepped(i),s;let h=a<<2,f=e[h],d=e[h+1]*n,u=e[h+2],m=e[h+3]*n;return t.setBezier(s,i,a,c,r,f,d,u,m,o,l),s+1}function A(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 Ys=class extends Rt{constructor(e){super(e)}setFilters(e,t){}setWraps(e,t){}dispose(){}},Pr=class extends ys{constructor(e="",t=new Dt){super(s=>new Ys(s),e,t)}},Br=R.newFloatArray(8),Je=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=R.newFloatArray(8*1024);tempColor=new N;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder;this.debugRendering&&(t.strokeStyle="green");for(let c=0,o=a.length;c<o;c++){let r=a[c],l=r.bone;if(!l.active)continue;let n=r.getAttachment();if(!(n instanceof V))continue;n.computeWorldVertices(r,Br,0,2);let h=n.region,f=h.texture.getImage(),d=r.color,u=n.color;s.set(i.r*d.r*u.r,i.g*d.g*u.g,i.b*d.b*u.b,i.a*d.a*u.a),t.save(),t.transform(l.a,l.c,l.b,l.d,l.worldX,l.worldY),t.translate(n.offset[0],n.offset[1]),t.rotate(n.rotation*Math.PI/180);let m=n.width/h.originalWidth;t.scale(m*n.scaleX,m*n.scaleY);let g=h.width,p=h.height;if(t.translate(g/2,p/2),n.region.degrees==90){let w=g;g=p,p=w,t.rotate(-Math.PI/2)}t.scale(1,-1),t.translate(-g/2,-p/2),t.globalAlpha=s.a,t.drawImage(f,f.width*h.u,f.height*h.v,g,p,0,0,g,p),this.debugRendering&&t.strokeRect(0,0,g,p),t.restore()}}drawTriangles(e){let t=this.ctx,s=this.tempColor,i=e.color,a=e.drawOrder,c=null,o=this.vertices,r=null;for(let n=0,h=a.length;n<h;n++){let f=a[n],d=f.getAttachment(),u,m;if(d instanceof V){let g=d;o=this.computeRegionVertices(f,g,!1),r=Je.QUAD_TRIANGLES,u=g.region.texture.getImage()}else if(d instanceof ye){let g=d;o=this.computeMeshVertices(f,g,!1),r=g.triangles,u=g.region.texture.getImage()}else continue;if(u){f.data.blendMode!=c&&(c=f.data.blendMode);let g=f.color,p=d.color;s.set(i.r*g.r*p.r,i.g*g.g*p.g,i.b*g.b*p.b,i.a*g.a*p.a),t.globalAlpha=s.a;for(var l=0;l<r.length;l+=3){let w=r[l]*8,x=r[l+1]*8,b=r[l+2]*8,v=o[w],y=o[w+1],S=o[w+6],C=o[w+7],k=o[x],T=o[x+1],M=o[x+6],E=o[x+7],F=o[b],P=o[b+1],I=o[b+6],Y=o[b+7];this.drawTriangle(u,v,y,S,C,k,T,M,E,F,P,I,Y),this.debugRendering&&(t.strokeStyle="green",t.beginPath(),t.moveTo(v,y),t.lineTo(k,T),t.lineTo(F,P),t.lineTo(v,y),t.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,t,s,i,a,c,o,r,l,n,h,f,d){let u=this.ctx;i*=e.width,a*=e.height,r*=e.width,l*=e.height,f*=e.width,d*=e.height,u.beginPath(),u.moveTo(t,s),u.lineTo(c,o),u.lineTo(n,h),u.closePath(),c-=t,o-=s,n-=t,h-=s,r-=i,l-=a,f-=i,d-=a;var m=1/(r*d-f*l),g=(d*c-l*n)*m,p=(d*o-l*h)*m,w=(r*n-f*c)*m,x=(r*h-f*o)*m,b=t-g*i-w*a,v=s-p*i-x*a;u.save(),u.transform(g,p,w,x,b,v),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,c=t.color,o=i.a*a.a*c.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*c.r*r,i.g*a.g*c.g*r,i.b*a.b*c.b*r,o),t.computeWorldVertices(e,this.vertices,0,Je.VERTEX_SIZE);let n=this.vertices,h=t.uvs;return n[V.C1R]=l.r,n[V.C1G]=l.g,n[V.C1B]=l.b,n[V.C1A]=l.a,n[V.U1]=h[0],n[V.V1]=h[1],n[V.C2R]=l.r,n[V.C2G]=l.g,n[V.C2B]=l.b,n[V.C2A]=l.a,n[V.U2]=h[2],n[V.V2]=h[3],n[V.C3R]=l.r,n[V.C3G]=l.g,n[V.C3B]=l.b,n[V.C3A]=l.a,n[V.U3]=h[4],n[V.V3]=h[5],n[V.C4R]=l.r,n[V.C4G]=l.g,n[V.C4B]=l.b,n[V.C4A]=l.a,n[V.U4]=h[6],n[V.V4]=h[7],n}computeMeshVertices(e,t,s){let i=e.bone.skeleton.color,a=e.color,c=t.color,o=i.a*a.a*c.a,r=s?o:1,l=this.tempColor;l.set(i.r*a.r*c.r*r,i.g*a.g*c.g*r,i.b*a.b*c.b*r,o);let n=t.worldVerticesLength/2,h=this.vertices;h.length<t.worldVerticesLength&&(this.vertices=h=R.newFloatArray(t.worldVerticesLength)),t.computeWorldVertices(e,0,t.worldVerticesLength,h,0,Je.VERTEX_SIZE);let f=t.uvs;for(let d=0,u=0,m=2;d<n;d++)h[m++]=l.r,h[m++]=l.g,h[m++]=l.b,h[m++]=l.a,h[m++]=f[u++],h[m++]=f[u++],m+=2;return h}},Jt=Je;return B(Jt,"QUAD_TRIANGLES",[0,1,2,2,3,0]),B(Jt,"VERTEX_SIZE",8),_s(Zt)})();