73 lines
190 KiB
JavaScript
73 lines
190 KiB
JavaScript
"use strict";var spine=(()=>{var ft=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Si=Object.getOwnPropertyNames,Ti=Object.prototype.hasOwnProperty,Q=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),Ai=(t,e)=>{for(var s in e)ft(t,s,{get:e[s],enumerable:!0})},ki=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Si(e))!Ti.call(t,r)&&r!==s&&ft(t,r,{get:()=>e[r],enumerable:!(i=Ci(e,r))||i.enumerable});return t},Ii=t=>ki(ft({},"__esModule",{value:!0}),t),As={};if(Ai(As,{AABBRectangleBoundsProvider:()=>Sr,AlphaTimeline:()=>Mt,Animation:()=>ze,AnimationState:()=>Gt,AnimationStateAdapter:()=>Bi,AnimationStateData:()=>Vs,AssetCache:()=>qs,AssetManagerBase:()=>Li,AtlasAttachmentLoader:()=>Zt,Attachment:()=>gt,AttachmentTimeline:()=>ve,BinaryInput:()=>Js,BlendMode:()=>ds,Bone:()=>ts,BoneData:()=>es,BoundingBoxAttachment:()=>Kt,CURRENT:()=>Ds,ClippingAttachment:()=>Ce,Color:()=>V,ConstraintData:()=>Ne,CurveTimeline:()=>le,CurveTimeline1:()=>ae,CurveTimeline2:()=>Ge,DarkSlotMesh:()=>et,DarkTintBatchGeometry:()=>oi,DarkTintGeometry:()=>ti,DarkTintMaterial:()=>si,DarkTintMesh:()=>ii,DarkTintRenderer:()=>li,DebugUtils:()=>Pi,DeformTimeline:()=>Et,Downloader:()=>Ws,DrawOrderTimeline:()=>Ie,Event:()=>ss,EventData:()=>is,EventQueue:()=>Xs,EventTimeline:()=>$e,EventType:()=>Rs,FIRST:()=>$t,FakeTexture:()=>Xi,HOLD_FIRST:()=>je,HOLD_MIX:()=>Ls,HOLD_SUBSEQUENT:()=>Ht,IkConstraint:()=>zs,IkConstraintData:()=>rs,IkConstraintTimeline:()=>Ft,Inherit:()=>Qe,InheritTimeline:()=>At,IntSet:()=>Mi,Interpolation:()=>ks,MathUtils:()=>B,MeshAttachment:()=>Me,MixBlend:()=>Es,MixDirection:()=>Fs,PathAttachment:()=>Ye,PathConstraint:()=>Gs,PathConstraintData:()=>ns,PathConstraintMixTimeline:()=>Lt,PathConstraintPositionTimeline:()=>Xt,PathConstraintSpacingTimeline:()=>Rt,Physics:()=>js,PhysicsConstraintDampingTimeline:()=>Nt,PhysicsConstraintGravityTimeline:()=>Ut,PhysicsConstraintInertiaTimeline:()=>Dt,PhysicsConstraintMassTimeline:()=>_t,PhysicsConstraintMixTimeline:()=>qt,PhysicsConstraintResetTimeline:()=>Wt,PhysicsConstraintStrengthTimeline:()=>Vt,PhysicsConstraintTimeline:()=>pe,PhysicsConstraintWindTimeline:()=>Ot,PointAttachment:()=>Us,Pool:()=>ke,PositionMode:()=>as,Pow:()=>Is,PowOut:()=>Yi,RGB2Timeline:()=>Pt,RGBA2Timeline:()=>Yt,RGBATimeline:()=>kt,RGBTimeline:()=>It,RegionAttachment:()=>Ve,RotateMode:()=>ls,RotateTimeline:()=>De,SETUP:()=>jt,SUBSEQUENT:()=>He,ScaleTimeline:()=>bt,ScaleXTimeline:()=>yt,ScaleYTimeline:()=>vt,SequenceTimeline:()=>zt,SetupPoseBoundsProvider:()=>Tr,ShearTimeline:()=>Ct,ShearXTimeline:()=>St,ShearYTimeline:()=>Tt,Skeleton:()=>Pe,SkeletonBinary:()=>fs,SkeletonBounds:()=>Qs,SkeletonClipping:()=>Ze,SkeletonData:()=>_e,SkeletonJson:()=>gs,Skin:()=>Oe,SkinEntry:()=>hs,SkinsAndAnimationBoundsProvider:()=>Ar,Slot:()=>$s,SlotData:()=>cs,SlotMesh:()=>ei,SpacingMode:()=>os,Spine:()=>kr,SpineDebugRenderer:()=>Mr,SpineTexture:()=>Ue,StringSet:()=>mt,Texture:()=>Jt,TextureAtlas:()=>Je,TextureAtlasPage:()=>Os,TextureAtlasRegion:()=>Qt,TextureFilter:()=>Ke,TextureRegion:()=>_s,TextureWrap:()=>Ns,TimeKeeper:()=>Ei,Timeline:()=>H,TrackEntry:()=>Bs,TransformConstraint:()=>Hs,TransformConstraintData:()=>us,TransformConstraintTimeline:()=>Bt,TranslateTimeline:()=>xt,TranslateXTimeline:()=>pt,TranslateYTimeline:()=>wt,Triangulator:()=>Zs,Utils:()=>X,Vector2:()=>Le,VertexAttachment:()=>fe,WindowedMean:()=>Fi}),typeof window<"u"&&window.PIXI){let t=window.require;window.require=e=>{if(t)return t(e);if(e.startsWith("@pixi/"))return window.PIXI}}var Mi=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},mt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},V=class Se{constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}static WHITE=new Se(1,1,1,1);static RED=new Se(1,0,0,1);static GREEN=new Se(0,1,0,1);static BLUE=new Se(0,0,1,1);static MAGENTA=new Se(1,0,1,1);set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new Se){return s.setFromString(e)}},B=class ue{static PI=3.1415927;static PI2=ue.PI*2;static invPI2=1/ue.PI2;static radiansToDegrees=180/ue.PI;static radDeg=ue.radiansToDegrees;static degreesToRadians=ue.PI/180;static degRad=ue.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*ue.degRad)}static sinDeg(e){return Math.sin(e*ue.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ue.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ue.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),h=s-e;return r<=(i-e)/h?e+Math.sqrt(r*h*(i-e)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},ks=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Is=class extends ks{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Yi=class extends Is{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},X=class Re{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,h){for(let o=s,n=r;o<s+h;o++,n++)i[n]=e[o]}static arrayFill(e,s,i,r){for(let h=s;h<i;h++)e[h]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let h=r;h<s;h++)e[h]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:Re.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(Re.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(Re.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return Re.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Re.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Pi=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},ke=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Le=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Ei=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Fi=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},gt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},fe=class fi extends gt{static nextID=0;id=fi.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,h,o){i=h+(i>>1)*o;let n=e.bone.skeleton,a=e.deform,l=this.vertices,c=this.bones;if(!c){a.length>0&&(l=a);let f=e.bone,g=f.worldX,p=f.worldY,b=f.a,x=f.b,w=f.c,y=f.d;for(let v=s,C=h;C<i;v+=2,C+=o){let S=l[v],A=l[v+1];r[C]=S*b+A*x+g,r[C+1]=S*w+A*y+p}return}let d=0,u=0;for(let f=0;f<s;f+=2){let g=c[d];d+=g+1,u+=g}let m=n.bones;if(a.length==0)for(let f=h,g=u*3;f<i;f+=o){let p=0,b=0,x=c[d++];for(x+=d;d<x;d++,g+=3){let w=m[c[d]],y=l[g],v=l[g+1],C=l[g+2];p+=(y*w.a+v*w.b+w.worldX)*C,b+=(y*w.c+v*w.d+w.worldY)*C}r[f]=p,r[f+1]=b}else{let f=a;for(let g=h,p=u*3,b=u<<1;g<i;g+=o){let x=0,w=0,y=c[d++];for(y+=d;d<y;d++,p+=3,b+=2){let v=m[c[d]],C=l[p]+f[b],S=l[p+1]+f[b+1],A=l[p+2];x+=(C*v.a+S*v.b+v.worldX)*A,w+=(C*v.c+S*v.d+v.worldY)*A}r[g]=x,r[g+1]=w}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),X.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=X.newFloatArray(this.vertices.length),X.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Ms=class ct{static _nextID=0;id=ct.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new ct(this.regions.length);return X.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return ct._nextID++}},Ys=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(Ys||{}),Ps=[0,1,2,3,4,5,6],ze=class{name;timelines=[];timelineIds=new mt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,h,o,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l<c;l++)a[l].apply(t,e,s,r,h,o,n)}},Es=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(Es||{}),Fs=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(Fs||{}),N={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},H=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=X.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},le=class extends H{curves;constructor(t,e,s){super(t,s),this.curves=X.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=X.newFloatArray(e);X.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,h,o,n,a,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-h*2+n)*.03,f=(r-o*2+a)*.03,g=((h-n)*3-i+l)*.006,p=((o-a)*3-r+c)*.006,b=m*2+g,x=f*2+p,w=(h-i)*.3+m+g*.16666667,y=(o-r)*.3+f+p*.16666667,v=i+w,C=r+y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,w+=b,y+=x,b+=g,x+=p,v+=w,C+=y}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],l=this.frames[e+s];return l+(t-a)/(r[i]-a)*(r[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=t){let a=r[i-2],l=r[i-1];return l+(t-a)/(r[i]-a)*(r[i+1]-l)}e+=this.getFrameEntries();let o=r[h-2],n=r[h-1];return n+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-n)}},ae=class extends le{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],h=e[s+1];return h+(t-r)/(e[s+2]-r)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);switch(s){case 0:return r+h*e;case 1:case 2:h+=r-i}return i+h*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);return s==0?r+(h-r)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,r,h){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}return s==0?r+(h-r)*e:i+(h-i)*e}getScaleValue(t,e,s,i,r,h){const o=this.frames;if(t<o[0]){switch(s){case 0:return h;case 1:return r+(h-r)*e}return r}let n=this.getCurveValue(t)*h;if(e==1)return s==3?r+n-h:n;if(i==1)switch(s){case 0:return h+(Math.abs(n)*B.signum(h)-h)*e;case 1:case 2:return r+(Math.abs(n)*B.signum(r)-r)*e}else{let a=0;switch(s){case 0:return a=Math.abs(h)*B.signum(n),a+(n-a)*e;case 1:case 2:return a=Math.abs(r)*B.signum(n),a+(n-a)*e}}return r+(n-h)*e}},Ge=class extends le{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},De=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,h,n.rotation,n.data.rotation))}},xt=class extends Ge{boneIndex=0;constructor(t,e,s){super(t,e,N.x+"|"+s,N.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let l=0,c=0,d=H.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*f,c+=(a[d+3+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.x=n.data.x+l*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+l-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=l*r,n.y+=c*r}}},pt=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,h,n.x,n.data.x))}},wt=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,h,n.y,n.data.y))}},bt=class extends Ge{boneIndex=0;constructor(t,e,s){super(t,e,N.scaleX+"|"+s,N.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let l,c,d=H.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*f,c+=(a[d+3+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(l*=n.data.scaleX,c*=n.data.scaleY,r==1)h==3?(n.scaleX+=l-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=l,n.scaleY=c);else{let m=0,f=0;if(o==1)switch(h){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(l)*B.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*B.signum(f)-f)*r;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(l)*B.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*B.signum(f)-f)*r;break;case 3:n.scaleX+=(l-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(h){case 0:m=Math.abs(n.data.scaleX)*B.signum(l),f=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(l-m)*r,n.scaleY=f+(c-f)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*B.signum(l),f=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(l-m)*r,n.scaleY=f+(c-f)*r;break;case 3:n.scaleX+=(l-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},yt=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,h,o,n.scaleX,n.data.scaleX))}},vt=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,h,o,n.scaleY,n.data.scaleY))}},Ct=class extends Ge{boneIndex=0;constructor(t,e,s){super(t,e,N.shearX+"|"+s,N.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let l=0,c=0,d=H.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);l+=(a[d+3+1]-l)*f,c+=(a[d+3+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.shearX=n.data.shearX+l*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+l-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=l*r,n.shearY+=c*r}}},St=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,h,n.shearX,n.data.shearX))}},Tt=class extends ae{boneIndex=0;constructor(t,e,s){super(t,e,N.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,h,n.shearY,n.data.shearY))}},At=class extends H{boneIndex=0;constructor(t,e){super(t,[N.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,h,o){let n=t.bones[this.boneIndex];if(!n.active)return;if(o==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[H.search(a,s,2)+1]}},kt=class extends le{slotIndex=0;constructor(t,e,s){super(t,e,[N.rgb+"|"+s,N.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let p=n.data.color;switch(h){case 0:l.setFromColor(p);return;case 1:l.add((p.r-l.r)*r,(p.g-l.g)*r,(p.b-l.b)*r,(p.a-l.a)*r)}return}let c=0,d=0,u=0,m=0,f=H.search(a,s,5),g=this.curves[f/5];switch(g){case 0:let p=a[f];c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];let b=(s-p)/(a[f+5]-p);c+=(a[f+5+1]-c)*b,d+=(a[f+5+2]-d)*b,u+=(a[f+5+3]-u)*b,m+=(a[f+5+4]-m)*b;break;case 1:c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+18*2-2),m=this.getBezierValue(s,f,4,g+18*3-2)}r==1?l.set(c,d,u,m):(h==0&&l.setFromColor(n.data.color),l.add((c-l.r)*r,(d-l.g)*r,(u-l.b)*r,(m-l.a)*r))}},It=class extends le{slotIndex=0;constructor(t,e,s){super(t,e,[N.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color;if(s<a[0]){let g=n.data.color;switch(h){case 0:l.r=g.r,l.g=g.g,l.b=g.b;return;case 1:l.r+=(g.r-l.r)*r,l.g+=(g.g-l.g)*r,l.b+=(g.b-l.b)*r}return}let c=0,d=0,u=0,m=H.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let g=a[m];c=a[m+1],d=a[m+2],u=a[m+3];let p=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*p,d+=(a[m+4+2]-d)*p,u+=(a[m+4+3]-u)*p;break;case 1:c=a[m+1],d=a[m+2],u=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+18*2-2)}if(r==1)l.r=c,l.g=d,l.b=u;else{if(h==0){let g=n.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*r,l.g+=(d-l.g)*r,l.b+=(u-l.b)*r}}},Mt=class extends ae{slotIndex=0;constructor(t,e,s){super(t,e,N.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let l=this.getCurveValue(s);r==1?a.a=l:(h==0&&(a.a=n.data.color.a),a.a+=(l-a.a)*r)}},Yt=class extends le{slotIndex=0;constructor(t,e,s){super(t,e,[N.rgb+"|"+s,N.alpha+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,h,o,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*r,(y.g-l.g)*r,(y.b-l.b)*r,(y.a-l.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,p=0,b=0,x=H.search(a,s,8),w=this.curves[x>>3];switch(w){case 0:let y=a[x];d=a[x+1],u=a[x+2],m=a[x+3],f=a[x+4],g=a[x+5],p=a[x+6],b=a[x+7];let v=(s-y)/(a[x+8]-y);d+=(a[x+8+1]-d)*v,u+=(a[x+8+2]-u)*v,m+=(a[x+8+3]-m)*v,f+=(a[x+8+4]-f)*v,g+=(a[x+8+5]-g)*v,p+=(a[x+8+6]-p)*v,b+=(a[x+8+7]-b)*v;break;case 1:d=a[x+1],u=a[x+2],m=a[x+3],f=a[x+4],g=a[x+5],p=a[x+6],b=a[x+7];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+18*2-2),f=this.getBezierValue(s,x,4,w+18*3-2),g=this.getBezierValue(s,x,5,w+18*4-2),p=this.getBezierValue(s,x,6,w+18*5-2),b=this.getBezierValue(s,x,7,w+18*6-2)}if(r==1)l.set(d,u,m,f),c.r=g,c.g=p,c.b=b;else{if(h==0){l.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*r,(u-l.g)*r,(m-l.b)*r,(f-l.a)*r),c.r+=(g-c.r)*r,c.g+=(p-c.g)*r,c.b+=(b-c.b)*r}}},Pt=class extends le{slotIndex=0;constructor(t,e,s){super(t,e,[N.rgb+"|"+s,N.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,o,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=o,this.frames[t+6]=n}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*r,l.g+=(y.g-l.g)*r,l.b+=(y.b-l.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,p=0,b=0,x=H.search(a,s,7),w=this.curves[x/7];switch(w){case 0:let y=a[x];d=a[x+1],u=a[x+2],m=a[x+3],g=a[x+4],p=a[x+5],b=a[x+6];let v=(s-y)/(a[x+7]-y);d+=(a[x+7+1]-d)*v,u+=(a[x+7+2]-u)*v,m+=(a[x+7+3]-m)*v,g+=(a[x+7+4]-g)*v,p+=(a[x+7+5]-p)*v,b+=(a[x+7+6]-b)*v;break;case 1:d=a[x+1],u=a[x+2],m=a[x+3],g=a[x+4],p=a[x+5],b=a[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+18*2-2),g=this.getBezierValue(s,x,4,w+18*3-2),p=this.getBezierValue(s,x,5,w+18*4-2),b=this.getBezierValue(s,x,6,w+18*5-2)}if(r==1)l.r=d,l.g=u,l.b=m,c.r=g,c.g=p,c.b=b;else{if(h==0){let y=n.data.color,v=n.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(d-l.r)*r,l.g+=(u-l.g)*r,l.b+=(m-l.b)*r,c.r+=(g-c.r)*r,c.g+=(p-c.g)*r,c.b+=(b-c.b)*r}}},ve=class extends H{slotIndex=0;attachmentNames;constructor(t,e){super(t,[N.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(n.bone.active){if(o==1){h==0&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[H.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Et=class extends le{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[N.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,h,o,n,a,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-h*2+n)*.03,f=a*.03-o*.06,g=((h-n)*3-i+l)*.006,p=(o-a+.33333333)*.018,b=m*2+g,x=f*2+p,w=(h-i)*.3+m+g*.16666667,y=o*.3+f+p*.16666667,v=i+w,C=y;for(let S=u+18;u<S;u+=2)d[u]=v,d[u+1]=C,w+=b,y+=x,b+=g,x+=p,v+=w,C+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let h=s[r-2],o=s[r-1];return o+(1-o)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,r,h,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof fe)||a.timelineAttachment!=this.attachment)return;let l=n.deform;l.length==0&&(h=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case 0:l.length=0;return;case 1:if(r==1){l.length=0;return}l.length=d;let x=a;if(x.bones){r=1-r;for(var m=0;m<d;m++)l[m]*=r}else{let w=x.vertices;for(var m=0;m<d;m++)l[m]+=(w[m]-l[m])*r}}return}if(l.length=d,s>=u[u.length-1]){let x=c[u.length-1];if(r==1)if(h==3){let w=a;if(w.bones)for(let y=0;y<d;y++)l[y]+=x[y];else{let y=w.vertices;for(let v=0;v<d;v++)l[v]+=x[v]-y[v]}}else X.arrayCopy(x,0,l,0,d);else switch(h){case 0:{let y=a;if(y.bones)for(let v=0;v<d;v++)l[v]=x[v]*r;else{let v=y.vertices;for(let C=0;C<d;C++){let S=v[C];l[C]=S+(x[C]-S)*r}}break}case 1:case 2:for(let y=0;y<d;y++)l[y]+=(x[y]-l[y])*r;break;case 3:let w=a;if(w.bones)for(let y=0;y<d;y++)l[y]+=x[y]*r;else{let y=w.vertices;for(let v=0;v<d;v++)l[v]+=(x[v]-y[v])*r}}return}let f=H.search1(u,s),g=this.getCurvePercent(s,f),p=c[f],b=c[f+1];if(r==1)if(h==3){let x=a;if(x.bones)for(let w=0;w<d;w++){let y=p[w];l[w]+=y+(b[w]-y)*g}else{let w=x.vertices;for(let y=0;y<d;y++){let v=p[y];l[y]+=v+(b[y]-v)*g-w[y]}}}else for(let x=0;x<d;x++){let w=p[x];l[x]=w+(b[x]-w)*g}else switch(h){case 0:{let w=a;if(w.bones)for(let y=0;y<d;y++){let v=p[y];l[y]=(v+(b[y]-v)*g)*r}else{let y=w.vertices;for(let v=0;v<d;v++){let C=p[v],S=y[v];l[v]=S+(C+(b[v]-C)*g-S)*r}}break}case 1:case 2:for(let w=0;w<d;w++){let y=p[w];l[w]+=(y+(b[w]-y)*g-l[w])*r}break;case 3:let x=a;if(x.bones)for(let w=0;w<d;w++){let y=p[w];l[w]+=(y+(b[w]-y)*g)*r}else{let w=x.vertices;for(let y=0;y<d;y++){let v=p[y];l[y]+=(v+(b[y]-v)*g-w[y])*r}}}}},$e=class mi extends H{static propertyIds=[""+N.event];events;constructor(e){super(e,mi.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,h,o,n){if(!r)return;let a=this.frames,l=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,h,o,n),s=-1;else if(s>=a[l-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=H.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<l&&i>=a[c];c++)r.push(this.events[c])}},Ie=class gi extends H{static propertyIds=[""+N.drawOrder];drawOrders;constructor(e){super(e,gi.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,h,o,n){if(n==1){o==0&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(o==0||o==1)&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=H.search1(this.frames,i),l=this.drawOrders[a];if(!l)X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let u=0,m=l.length;u<m;u++)c[u]=d[l[u]]}}},Ft=class extends le{constraintIndex=0;constructor(t,e,s){super(t,e,[N.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,h,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,i,r,h,o){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let l=0,c=0,d=H.search(a,s,6),u=this.curves[d/6];switch(u){case 0:let m=a[d];l=a[d+1],c=a[d+2];let f=(s-m)/(a[d+6]-m);l+=(a[d+6+1]-l)*f,c+=(a[d+6+2]-c)*f;break;case 1:l=a[d+1],c=a[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==0?(n.mix=n.data.mix+(l-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(l-n.mix)*r,n.softness+=(c-n.softness)*r,o==0&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},Bt=class extends le{constraintIndex=0;constructor(t,e,s){super(t,e,[N.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,o,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=h,a[t+5]=o,a[t+6]=n}apply(t,e,s,i,r,h,o){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*r,n.mixX+=(b.mixX-n.mixX)*r,n.mixY+=(b.mixY-n.mixY)*r,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(b.mixShearY-n.mixShearY)*r}return}let l,c,d,u,m,f,g=H.search(a,s,7),p=this.curves[g/7];switch(p){case 0:let b=a[g];l=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];let x=(s-b)/(a[g+7]-b);l+=(a[g+7+1]-l)*x,c+=(a[g+7+2]-c)*x,d+=(a[g+7+3]-d)*x,u+=(a[g+7+4]-u)*x,m+=(a[g+7+5]-m)*x,f+=(a[g+7+6]-f)*x;break;case 1:l=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),c=this.getBezierValue(s,g,2,p+18-2),d=this.getBezierValue(s,g,3,p+18*2-2),u=this.getBezierValue(s,g,4,p+18*3-2),m=this.getBezierValue(s,g,5,p+18*4-2),f=this.getBezierValue(s,g,6,p+18*5-2)}if(h==0){let b=n.data;n.mixRotate=b.mixRotate+(l-b.mixRotate)*r,n.mixX=b.mixX+(c-b.mixX)*r,n.mixY=b.mixY+(d-b.mixY)*r,n.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*r,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*r,n.mixShearY=b.mixShearY+(f-b.mixShearY)*r}else n.mixRotate+=(l-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(u-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(f-n.mixShearY)*r}},Xt=class extends ae{constraintIndex=0;constructor(t,e,s){super(t,e,N.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,h,n.position,n.data.position))}},Rt=class extends ae{constraintIndex=0;constructor(t,e,s){super(t,e,N.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,h,n.spacing,n.data.spacing))}},Lt=class extends le{constraintIndex=0;constructor(t,e,s){super(t,e,[N.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=r}apply(t,e,s,i,r,h,o){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let l,c,d,u=H.search(a,s,4),m=this.curves[u>>2];switch(m){case 0:let f=a[u];l=a[u+1],c=a[u+2],d=a[u+3];let g=(s-f)/(a[u+4]-f);l+=(a[u+4+1]-l)*g,c+=(a[u+4+2]-c)*g,d+=(a[u+4+3]-d)*g;break;case 1:l=a[u+1],c=a[u+2],d=a[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(h==0){let f=n.data;n.mixRotate=f.mixRotate+(l-f.mixRotate)*r,n.mixX=f.mixX+(c-f.mixX)*r,n.mixY=f.mixY+(d-f.mixY)*r}else n.mixRotate+=(l-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},pe=class extends ae{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,r,h,this.get(l),this.setup(l),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,h,this.get(n),this.setup(n)))}},Dt=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Vt=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},Nt=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},_t=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},Ot=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},Ut=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},qt=class extends pe{constructor(t,e,s){super(t,e,s,N.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},Wt=class xi extends H{static propertyIds=[N.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,xi.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,h,o,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const l=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],h,o,n),s=-1;else if(s>=l[l.length-1])return;if(!(i<l[0])&&(s<l[0]||i>=l[H.search1(l,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},zt=class be extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[N.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return be.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,h){let o=this.frames;e*=be.ENTRIES,o[e]=s,o[e+be.MODE]=i|r<<4,o[e+be.DELAY]=h}apply(e,s,i,r,h,o,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let l=a.attachment,c=this.attachment;if(l!=c&&(!(l instanceof fe)||l.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==0||o==1)&&(a.sequenceIndex=-1);return}let u=H.search(d,i,be.ENTRIES),m=d[u],f=d[u+be.MODE],g=d[u+be.DELAY];if(!this.attachment.sequence)return;let p=f>>4,b=this.attachment.sequence.regions.length,x=Ps[f&15];if(x!=0)switch(p+=(i-m)/g+1e-5|0,x){case 1:p=Math.min(b-1,p);break;case 2:p%=b;break;case 3:{let w=(b<<1)-2;p=w==0?0:p%w,p>=b&&(p=w-p);break}case 4:p=Math.max(b-1-p,0);break;case 5:p=b-1-p%b;break;case 6:{let w=(b<<1)-2;p=w==0?0:(p+b-1)%w,p>=b&&(p=w-p)}}a.sequenceIndex=p}},Gt=class dt{static _emptyAnimation=new ze("<empty>",[],0);static emptyAnimation(){return dt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Xs(this);propertyIDs=new mt;animationsChanged=!1;trackEntryPool=new ke(()=>new Bs);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let o=e*h.timeScale;if(h.delay>0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+e)*n.timeScale,h.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let u=0,m=i.length;u<m;u++){let f=i[u];if(!f||f.delay>0)continue;r=!0;let g=u==0?1:f.mixBlend,p=f.alpha;f.mixingFrom?p*=this.applyMixingFrom(f,e,g):f.trackTime>=f.trackEnd&&!f.next&&(p=0);let b=p>=f.alphaAttachmentThreshold,x=f.animationLast,w=f.getAnimationTime(),y=w,v=s;f.reverse&&(y=f.animation.duration-y,v=null);let C=f.animation.timelines,S=C.length;if(u==0&&p==1||g==3){u==0&&(b=!0);for(let A=0;A<S;A++){X.webkit602BugfixHelper(p,g);var h=C[A];h instanceof ve?this.applyAttachmentTimeline(h,e,y,g,b):h.apply(e,x,y,v,p,g,0)}}else{let A=f.timelineMode,k=f.shortestRotation,Y=!k&&f.timelinesRotation.length!=S<<1;Y&&(f.timelinesRotation.length=S<<1);for(let M=0;M<S;M++){let E=C[M],F=A[M]==He?g:0;!k&&E instanceof De?this.applyRotateTimeline(E,e,y,p,F,f.timelinesRotation,M<<1,Y):E instanceof ve?this.applyAttachmentTimeline(E,e,y,g,b):(X.webkit602BugfixHelper(p,g),E.apply(e,x,y,v,p,F,0))}}this.queueEvents(f,w),s.length=0,f.nextAnimationLast=w,f.nextTrackLast=f.trackTime}for(var o=this.unkeyedState+jt,n=e.slots,a=0,l=e.slots.length;a<l;a++){var c=n[a];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;e.mixDuration==0?(h=1,i==1&&(i=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let o=h<r.mixAttachmentThreshold,n=h<r.mixDrawOrderThreshold,a=r.animation.timelines,l=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-h),u=r.animationLast,m=r.getAnimationTime(),f=m,g=null;if(r.reverse?f=r.animation.duration-f:h<r.eventThreshold&&(g=this.events),i==3)for(let p=0;p<l;p++)a[p].apply(s,u,f,g,d,i,1);else{let p=r.timelineMode,b=r.timelineHoldMix,x=r.shortestRotation,w=!x&&r.timelinesRotation.length!=l<<1;w&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let y=0;y<l;y++){let v=a[y],C=1,S,A=0;switch(p[y]){case He:if(!n&&v instanceof Ie)continue;S=i,A=d;break;case $t:S=0,A=d;break;case Ht:S=i,A=c;break;case je:S=0,A=c;break;default:S=0;let k=b[y];A=c*Math.max(0,1-k.mixTime/k.mixDuration);break}r.totalAlpha+=A,!x&&v instanceof De?this.applyRotateTimeline(v,s,f,A,S,r.timelinesRotation,y<<1,w):v instanceof ve?this.applyAttachmentTimeline(v,s,f,S,o&&A>=r.alphaAttachmentThreshold):(X.webkit602BugfixHelper(A,i),n&&v instanceof Ie&&S==0&&(C=0),v.apply(s,u,f,g,A,S,C))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(e,s,i,r,h){var o=s.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(r==0||r==1)&&this.setAttachment(s,o,o.data.attachmentName,h):this.setAttachment(s,o,e.attachmentNames[H.search1(e.frames,i)],h),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+jt))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Ds)}applyRotateTimeline(e,s,i,r,h,o,n,a){if(a&&(o[n]=0),r==1){e.apply(s,0,i,null,1,h,0);return}let l=s.bones[e.boneIndex];if(!l.active)return;let c=e.frames,d=0,u=0;if(i<c[0])switch(h){case 0:l.rotation=l.data.rotation;default:return;case 1:d=l.rotation,u=l.data.rotation}else d=h==0?l.data.rotation:l.rotation,u=l.data.rotation+e.getCurveValue(i);let m=0,f=u-d;if(f-=Math.ceil(f/360-.5)*360,f==0)m=o[n];else{let g=0,p=0;a?(g=0,p=f):(g=o[n],p=o[n+1]);let b=g-g%360;m=f+b;let x=f>=0,w=g>=0;Math.abs(p)<=90&&B.signum(p)!=B.signum(f)&&(Math.abs(g-b)>180?(m+=360*B.signum(g),w=x):b!=0?m-=360*B.signum(g):w=x),w!=x&&(m+=360*B.signum(g)),o[n]=m}o[n+1]=f,l.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,h=r-i,o=e.trackLast%h,n=this.events,a=0,l=n.length;for(;a<l;a++){let d=n[a];if(d.time<o)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(h==0)c=!0;else{const d=Math.floor(e.trackTime/h);c=d>0&&d>Math.floor(e.trackLast/h)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<l;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let o=this.trackEntry(e,s,i,h);return this.setCurrent(e,o,r),this.queue.drain(),o}addAnimation(e,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(e,s,i,h);return h?(h.next=o,o.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,dt.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,dt.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let h=this.tracks[i];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(X.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=i,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=r?this.data.getMix(r.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,h=e.timelineMode;h.length=r;let o=e.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)h[a]=n.addAll(i[a].getPropertyIds())?je:Ht;return}e:for(let a=0;a<r;a++){let l=i[a],c=l.getPropertyIds();if(!n.addAll(c))h[a]=He;else if(!s||l instanceof ve||l instanceof Ie||l instanceof $e||!s.animation.hasTimeline(c))h[a]=$t;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){h[a]=Ls,o[a]=d;continue e}break}h[a]=je}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Bs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Xs=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects;for(let e=0;e<t.length;e+=2){let s=t[e],i=t[e+1],r=this.animState.listeners.slice();switch(s){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let o=0;o<r.length;o++){let n=r[o];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let o=0;o<r.length;o++){let n=r[o];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let o=0;o<r.length;o++){let n=r[o];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let o=0;o<r.length;o++){let n=r[o];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let o=0;o<r.length;o++){let n=r[o];n.complete&&n.complete(i)}break;case 5:let h=t[e+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let o=0;o<r.length;o++){let n=r[o];n.event&&n.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Rs=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(Rs||{}),Bi=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},He=0,$t=1,Ht=2,je=3,Ls=4,jt=1,Ds=2,Vs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Kt=class pi extends fe{color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new pi(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Ce=class wi extends fe{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new wi(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Jt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Ke=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Ke||{}),Ns=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Ns||{}),_s=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Xi=class extends Jt{setFilters(t,e){}setWraps(t,e){}dispose(){}},Je=class{pages=new Array;regions=new Array;constructor(t){let e=new Ri(t),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=X.enumValue(Ke,s[1]),l.magFilter=X.enumValue(Ke,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},i.pma=l=>{l.pma=s[1]=="true"};var r={};r.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},r.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},r.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},r.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},r.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},r.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let o=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)o=null,h=e.readLine();else if(o){let l=new Qt(o,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(l);else{n||(n=[]),a||(a=[]),n.push(s[0]);let u=[];for(let m=0;m<c;m++)u.push(parseInt(s[m+1]));a.push(u)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),n&&n.length>0&&a&&a.length>0&&(l.names=n,l.values=a,n=null,a=null),l.u=l.x/o.width,l.v=l.y/o.height,l.degrees==90?(l.u2=(l.x+l.height)/o.width,l.v2=(l.y+l.width)/o.height):(l.u2=(l.x+l.width)/o.width,l.v2=(l.y+l.height)/o.height),this.regions.push(l)}else{for(o=new Os(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=i[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Ri=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=e.indexOf(",",r);if(h==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},Os=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Qt=class extends _s{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Me=class Cs extends fe{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=X.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,o=0,n=0;if(this.region instanceof Qt){let a=this.region,l=a.page,c=l.width,d=l.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+e[u+1]*o,s[u+1]=h+(1-e[u])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u])*o,s[u+1]=h+(1-e[u+1])*n;return;case 270:r-=a.offsetY/c,h-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u+1])*o,s[u+1]=h+e[u]*n;return}r-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-r,n=this.region.v2-h):(r=h=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*o,s[a+1]=h+e[a+1]*n}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 Cs(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),X.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?X.newFloatArray(this.uvs.length):new Array(this.uvs.length),X.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),X.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),X.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,h,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,h,o)}newLinkedMesh(){let e=new Cs(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}},Ye=class bi extends fe{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new bi(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),X.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Us=class yi extends fe{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*B.degRad,i=Math.cos(s),r=Math.sin(s),h=i*e.a+r*e.b,o=i*e.c+r*e.d;return B.atan2Deg(o,h)}copy(){let e=new yi(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Ve=class vi extends gt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=X.newFloatArray(8);uvs=X.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=h+this.region.width*i,a=o+this.region.height*r,l=this.rotation*B.degRad,c=Math.cos(l),d=Math.sin(l),u=this.x,m=this.y,f=h*c+u,g=h*d,p=o*c+m,b=o*d,x=n*c+u,w=n*d,y=a*c+m,v=a*d,C=this.offset;C[0]=f-b,C[1]=p+g,C[2]=f-v,C[3]=y+g,C[4]=x-v,C[5]=y+w,C[6]=x-b,C[7]=p+w,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,o=this.offset,n=h.worldX,a=h.worldY,l=h.a,c=h.b,d=h.c,u=h.d,m=0,f=0;m=o[0],f=o[1],s[i]=m*l+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[2],f=o[3],s[i]=m*l+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[4],f=o[5],s[i]=m*l+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=o[6],f=o[7],s[i]=m*l+f*c+n,s[i+1]=m*d+f*u+a}copy(){let e=new vi(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,X.arrayCopy(this.uvs,0,e.uvs,0,8),X.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Zt=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let o=s.getPath(e,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new Ve(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=h}return r}newMeshAttachment(t,e,s,i){let r=new Me(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=h}return r}newBoundingBoxAttachment(t,e){return new Kt(e)}newPathAttachment(t,e){return new Ye(e)}newPointAttachment(t,e){return new Us(e)}newClippingAttachment(t,e){return new Ce(e)}},es=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new V;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Qe=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Qe||{}),ts=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,r,h,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=o;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,g=(s+h)*B.degRad,p=(s+90+o)*B.degRad;this.a=Math.cos(g)*i*m,this.b=Math.cos(p)*r*m,this.c=Math.sin(g)*i*f,this.d=Math.sin(p)*r*f,this.worldX=t*m+u.x,this.worldY=e*f+u.y;return}let a=n.a,l=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+l*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case 0:{const u=(s+h)*B.degRad,m=(s+90+o)*B.degRad,f=Math.cos(u)*i,g=Math.cos(m)*r,p=Math.sin(u)*i,b=Math.sin(m)*r;this.a=a*f+l*p,this.b=a*g+l*b,this.c=c*f+d*p,this.d=c*g+d*b;return}case 1:{const u=(s+h)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(m)*r,this.c=Math.sin(u)*i,this.d=Math.sin(m)*r;break}case 2:{let u=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=u,c*=m;let f=a*a+c*c,g=0;f>1e-4?(f=Math.abs(a*d*m-l*u*c)/f,l=c*f,d=a*f,g=Math.atan2(c,a)*B.radDeg):(a=0,c=0,g=90-Math.atan2(d,l)*B.radDeg);const p=(s+h-g)*B.degRad,b=(s+o-g+90)*B.degRad,x=Math.cos(p)*i,w=Math.cos(b)*r,y=Math.sin(p)*i,v=Math.sin(b)*r;this.a=a*x-l*y,this.b=a*w-l*v,this.c=c*x+d*y,this.d=c*w+d*v;break}case 3:case 4:{s*=B.degRad;const u=Math.cos(s),m=Math.sin(s);let f=(a*u+l*m)/this.skeleton.scaleX,g=(c*u+d*m)/this.skeleton.scaleY,p=Math.sqrt(f*f+g*g);p>1e-5&&(p=1/p),f*=p,g*=p,p=Math.sqrt(f*f+g*g),this.inherit==3&&a*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p),s=Math.PI/2+Math.atan2(g,f);const b=Math.cos(s)*p,x=Math.sin(s)*p;h*=B.degRad,o=(90+o)*B.degRad;const w=Math.cos(h)*i,y=Math.cos(o)*r,v=Math.sin(h)*i,C=Math.sin(o)*r;this.a=f*w+b*v,this.b=f*y+b*C,this.c=g*w+x*v,this.d=g*y+x*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.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)*B.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,h=1/(e*r-s*i),o=r*h,n=s*h,a=i*h,l=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*o-d*n,this.ay=d*l-c*a;let u,m,f,g;if(this.inherit==1)u=this.a,m=this.b,f=this.c,g=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*r-s*i),o=r*h,n=s*h;break}case 3:case 4:let p=B.cosDeg(this.rotation),b=B.sinDeg(this.rotation);e=(e*p+s*b)/this.skeleton.scaleX,i=(i*p+r*b)/this.skeleton.scaleY;let x=Math.sqrt(e*e+i*i);x>1e-5&&(x=1/x),e*=x,i*=x,x=Math.sqrt(e*e+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let w=B.PI/2+Math.atan2(i,e);s=Math.cos(w)*x,r=Math.sin(w)*x,h=1/(e*r-s*i),o=r*h,n=s*h,a=i*h,l=e*h}u=o*this.a-n*this.c,m=o*this.b-n*this.d,f=l*this.c-a*this.a,g=l*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){let p=u*g-m*f;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(u*m+f*g,p)*B.radDeg,this.arotation=Math.atan2(f,u)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},Ne=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Li=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ws,i=new qs){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),i(h)},(h,o)=>{const n=`Couldn't load binary ${t}: status ${h}, ${o}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),i(h)},(h,o)=>{const n=`Couldn't load JSON ${t}: status ${h}, ${o}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(t,n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(t,n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),h=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,n)=>{this.downloader.downloadText(t,a=>{try{const l=this.createTextureAtlas(t,a);let c=l.pages.length,d=!1;if(c===0){this.success(e,t,l),o(l);return}for(let u of l.pages)this.loadTexture(i?i[u.name]:h+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(e,t,l),o(l)))},(m,f)=>{if(!d){const g=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,g),n(g)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),n(c)}},(a,l)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${l}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,h)=>{this.downloader.downloadText(t,o=>{try{const n=this.createTextureAtlas(t,o);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),h(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${t}: status ${o}, ${n}`;this.error(s,t,a),h(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Je){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new Je(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},qs=class ut{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=ut.AVAILABLE_CACHES.get(e);if(s)return s;const i=new ut;return ut.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},Ws=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let h=()=>{this.finish(t,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let h=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let h=r.length-1,o=i.length;h<o;h+=2)i[h].apply(null,r)}},ss=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},is=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},zs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,h,o){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,l=n.b,c=n.c,d=n.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*B.signum(t.skeleton.scaleX),f=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case 2:let b=Math.abs(a*d-l*c)/Math.max(1e-4,a*a+c*c),x=a/t.skeleton.scaleX,w=c/t.skeleton.scaleY;l=-w*b*t.skeleton.scaleX,d=x*b*t.skeleton.scaleY,u+=Math.atan2(w,x)*B.radDeg;default:let y=e-n.worldX,v=s-n.worldY,C=a*d-l*c;Math.abs(C)<=1e-4?(m=0,f=0):(m=(y*d-v*l)/C-t.ax,f=(v*a-y*c)/C-t.ay)}u+=Math.atan2(f,m)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,p=t.ascaleY;if(i||r){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const b=t.data.length*g;if(b>1e-4){const x=m*m+f*f;if(i&&x<b*b||r&&x>b*b){const w=(Math.sqrt(x)/b-1)*o+1;g*=w,h&&(p*=w)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*o,g,p,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,h,o,n,a){if(t.inherit!=0||e.inherit!=0)return;let l=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX,p=0,b=0,x=0;d<0?(d=-d,p=180,x=-1):(p=0,x=1),u<0&&(u=-u,x=-x),g<0?(g=-g,b=180):b=0;let w=e.ax,y=0,v=0,C=0,S=t.a,A=t.b,k=t.c,Y=t.d,M=Math.abs(d-u)<=1e-4;!M||h?(y=0,v=S*w+t.worldX,C=k*w+t.worldY):(y=e.ay,v=S*w+A*y+t.worldX,C=k*w+Y*y+t.worldY);let E=t.parent;if(!E)throw new Error("IK parent must itself have a parent.");S=E.a,A=E.b,k=E.c,Y=E.d;let F=S*Y-A*k,I=v-E.worldX,P=C-E.worldY;F=Math.abs(F)<=1e-4?0:1/F;let L=(I*Y-P*A)*F-l,_=(P*S-I*k)*F-c,D=Math.sqrt(L*L+_*_),O=e.data.length*g,$,z;if(D<1e-4){this.apply1(t,s,i,!1,h,!1,a),e.updateWorldTransformWith(w,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}I=s-E.worldX,P=i-E.worldY;let K=(I*Y-P*A)*F-l,R=(P*S-I*k)*F-c,U=K*K+R*R;if(n!=0){n*=d*(g+1)*.5;let J=Math.sqrt(U),te=J-D-O*d+n;if(te>0){let se=Math.min(1,te/(n*2))-1;se=(te-n*(1-se*se))/J,K-=se*K,R-=se*R,U=K*K+R*R}}e:if(M){O*=d;let J=(U-D*D-O*O)/(2*D*O);J<-1?(J=-1,z=Math.PI*r):J>1?(J=1,z=0,h&&(S=(Math.sqrt(U)/(D+O)-1)*a+1,m*=S,o&&(f*=S))):z=Math.acos(J)*r,S=D+O*J,A=O*Math.sin(z),$=Math.atan2(R*S-K*A,K*S+R*A)}else{S=d*O,A=u*O;let J=S*S,te=A*A,se=Math.atan2(R,K);k=te*D*D+J*U-J*te;let de=-2*te*D,Be=te-J;if(Y=de*de-4*Be*k,Y>=0){let Xe=Math.sqrt(Y);de<0&&(Xe=-Xe),Xe=-(de+Xe)*.5;let We=Xe/Be,ui=k/Xe,ht=Math.abs(We)<Math.abs(ui)?We:ui;if(We=U-ht*ht,We>=0){P=Math.sqrt(We)*r,$=se-Math.atan2(P,ht),z=Math.atan2(P/u,(ht-D)/d);break e}}let qe=B.PI,ot=D-S,ys=ot*ot,hi=0,ci=0,lt=D+S,vs=lt*lt,di=0;k=-S*D/(J-te),k>=-1&&k<=1&&(k=Math.acos(k),I=S*Math.cos(k)+D,P=A*Math.sin(k),Y=I*I+P*P,Y<ys&&(qe=k,ys=Y,ot=I,hi=P),Y>vs&&(ci=k,vs=Y,lt=I,di=P)),U<=(ys+vs)*.5?($=se-Math.atan2(hi*r,ot),z=qe*r):($=se-Math.atan2(di*r,lt),z=ci*r)}let G=Math.atan2(y,w)*x,ie=t.arotation;$=($-G)*B.radDeg+p-ie,$>180?$-=360:$<-180&&($+=360),t.updateWorldTransformWith(l,c,ie+$*a,m,f,0,0),ie=e.arotation,z=((z+G)*B.radDeg-e.ashearX)*x+b-ie,z>180?z-=360:z<-180&&(z+=360),e.updateWorldTransformWith(w,y,ie+z*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},rs=class extends Ne{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},ns=class extends Ne{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},as=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(as||{}),os=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(os||{}),ls=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(ls||{}),Gs=class ye{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,h=e.bones.length;r<h;r++){let o=s.findBone(e.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ye))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==0&&h==0)return;let o=this.data,n=o.rotateMode==0,a=o.rotateMode==2,l=this.bones,c=l.length,d=n?c:c+1,u=X.setArraySize(this.spaces,d),m=a?this.lengths=X.setArraySize(this.lengths,c):[],f=this.spacing;switch(o.spacingMode){case 2:if(a)for(let C=0,S=d-1;C<S;C++){let A=l[C],k=A.data.length,Y=k*A.a,M=k*A.c;m[C]=Math.sqrt(Y*Y+M*M)}X.arrayFill(u,1,d,f);break;case 3:let y=0;for(let C=0,S=d-1;C<S;){let A=l[C],k=A.data.length;if(k<ye.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=k*A.a,M=k*A.c,E=Math.sqrt(Y*Y+M*M);a&&(m[C]=E),u[++C]=E,y+=E}}if(y>0){y=d/y*f;for(let C=1;C<d;C++)u[C]*=y}break;default:let v=o.spacingMode==0;for(let C=0,S=d-1;C<S;){let A=l[C],k=A.data.length;if(k<ye.epsilon)a&&(m[C]=0),u[++C]=f;else{let Y=k*A.a,M=k*A.c,E=Math.sqrt(Y*Y+M*M);a&&(m[C]=E),u[++C]=(v?k+f:f)*E/k}}}let g=this.computeWorldPositions(s,d,n),p=g[0],b=g[1],x=o.offsetRotation,w=!1;if(x==0)w=o.rotateMode==1;else{w=!1;let y=this.target.bone;x*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=l[y];C.worldX+=(p-C.worldX)*r,C.worldY+=(b-C.worldY)*h;let S=g[v],A=g[v+1],k=S-p,Y=A-b;if(a){let M=m[y];if(M!=0){let E=(Math.sqrt(k*k+Y*Y)/M-1)*i+1;C.a*=E,C.c*=E}}if(p=S,b=A,i>0){let M=C.a,E=C.b,F=C.c,I=C.d,P=0,L=0,_=0;if(n?P=g[v-1]:u[y+1]==0?P=g[v+2]:P=Math.atan2(Y,k),P-=Math.atan2(F,M),w){L=Math.cos(P),_=Math.sin(P);let D=C.data.length;p+=(D*(L*M-_*F)-k)*i,b+=(D*(_*M+L*F)-Y)*i}else P+=x;P>B.PI?P-=B.PI2:P<-B.PI&&(P+=B.PI2),P*=i,L=Math.cos(P),_=Math.sin(P),C.a=L*M-_*F,C.b=L*E-_*I,C.c=_*M+L*F,C.d=_*E+L*I}C.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,h=this.position,o=this.spaces,n=X.setArraySize(this.positions,s*3+2),a=this.world,l=e.closed,c=e.worldVerticesLength,d=c/6,u=ye.NONE;if(!e.constantSpeed){let D=e.lengths;d-=l?1:2;let O=D[d];this.data.positionMode==1&&(h*=O);let $;switch(this.data.spacingMode){case 2:$=O;break;case 3:$=O/s;break;default:$=1}a=X.setArraySize(this.world,8);for(let z=0,K=0,R=0;z<s;z++,K+=3){let U=o[z]*$;h+=U;let G=h;if(l)G%=O,G<0&&(G+=O),R=0;else if(G<0){u!=ye.BEFORE&&(u=ye.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(G,a,0,n,K);continue}else if(G>O){u!=ye.AFTER&&(u=ye.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(G-O,a,0,n,K);continue}for(;;R++){let ie=D[R];if(!(G>ie)){if(R==0)G/=ie;else{let J=D[R-1];G=(G-J)/(ie-J)}break}}R!=u&&(u=R,l&&R==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,R*6+2,8,a,0,2)),this.addCurvePosition(G,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,K,i||z>0&&U==0)}return n}l?(c+=2,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=X.setArraySize(this.curves,d),f=0,g=a[0],p=a[1],b=0,x=0,w=0,y=0,v=0,C=0,S=0,A=0,k=0,Y=0,M=0,E=0,F=0,I=0;for(let D=0,O=2;D<d;D++,O+=6)b=a[O],x=a[O+1],w=a[O+2],y=a[O+3],v=a[O+4],C=a[O+5],S=(g-b*2+w)*.1875,A=(p-x*2+y)*.1875,k=((b-w)*3-g+v)*.09375,Y=((x-y)*3-p+C)*.09375,M=S*2+k,E=A*2+Y,F=(b-g)*.75+S+k*.16666667,I=(x-p)*.75+A+Y*.16666667,f+=Math.sqrt(F*F+I*I),F+=M,I+=E,M+=k,E+=Y,f+=Math.sqrt(F*F+I*I),F+=M,I+=E,f+=Math.sqrt(F*F+I*I),F+=M+k,I+=E+Y,f+=Math.sqrt(F*F+I*I),m[D]=f,g=v,p=C;this.data.positionMode==1&&(h*=f);let P;switch(this.data.spacingMode){case 2:P=f;break;case 3:P=f/s;break;default:P=1}let L=this.segments,_=0;for(let D=0,O=0,$=0,z=0;D<s;D++,O+=3){let K=o[D]*P;h+=K;let R=h;if(l)R%=f,R<0&&(R+=f),$=0;else if(R<0){this.addBeforePosition(R,a,0,n,O);continue}else if(R>f){this.addAfterPosition(R-f,a,c-4,n,O);continue}for(;;$++){let U=m[$];if(!(R>U)){if($==0)R/=U;else{let G=m[$-1];R=(R-G)/(U-G)}break}}if($!=u){u=$;let U=$*6;for(g=a[U],p=a[U+1],b=a[U+2],x=a[U+3],w=a[U+4],y=a[U+5],v=a[U+6],C=a[U+7],S=(g-b*2+w)*.03,A=(p-x*2+y)*.03,k=((b-w)*3-g+v)*.006,Y=((x-y)*3-p+C)*.006,M=S*2+k,E=A*2+Y,F=(b-g)*.3+S+k*.16666667,I=(x-p)*.3+A+Y*.16666667,_=Math.sqrt(F*F+I*I),L[0]=_,U=1;U<8;U++)F+=M,I+=E,M+=k,E+=Y,_+=Math.sqrt(F*F+I*I),L[U]=_;F+=M,I+=E,_+=Math.sqrt(F*F+I*I),L[8]=_,F+=M+k,I+=E+Y,_+=Math.sqrt(F*F+I*I),L[9]=_,z=0}for(R*=_;;z++){let U=L[z];if(!(R>U)){if(z==0)R/=U;else{let G=L[z-1];R=z+(R-G)/(U-G)}break}}this.addCurvePosition(R*.1,g,p,b,x,w,y,v,C,n,O,i||D>0&&K==0)}return n}addBeforePosition(e,s,i,r,h){let o=s[i],n=s[i+1],a=s[i+2]-o,l=s[i+3]-n,c=Math.atan2(l,a);r[h]=o+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addAfterPosition(e,s,i,r,h){let o=s[i+2],n=s[i+3],a=o-s[i],l=n-s[i+1],c=Math.atan2(l,a);r[h]=o+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addCurvePosition(e,s,i,r,h,o,n,a,l,c,d,u){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=e*e,f=m*e,g=1-e,p=g*g,b=p*g,x=g*e,w=x*3,y=g*w,v=w*e,C=s*b+r*y+o*v+a*f,S=i*b+h*y+n*v+l*f;c[d]=C,c[d+1]=S,u&&(e<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(S-(i*p+h*x*2+n*m),C-(s*p+r*x*2+o*m)))}},Di=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,p=-1,b=this.data.limit*l,x=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||i){if(s){const w=(this.ux-c)*m;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=c}if(i){const w=(this.uy-d)*m;this.yOffset+=w>x?x:w<-x?-x:w,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const w=this.massInverse*f,y=this.strength,v=this.wind*g*a.scaleX,C=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*w,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),i&&(this.yVelocity-=(C+this.yOffset*y)*w,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f;while(u>=f)}s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r||h){let w=Math.atan2(o.c,o.a),y=0,v=0,C=0,S=this.cx-o.worldX,A=this.cy-o.worldY;if(S>b?S=b:S<-b&&(S=-b),A>x?A=x:A<-x&&(A=-x),r){C=(this.data.rotate+this.data.shearX)*e;let k=Math.atan2(A+this.ty,S+this.tx)-w-this.rotateOffset*C;this.rotateOffset+=(k-Math.ceil(k*B.invPI2-.5)*B.PI2)*m,k=this.rotateOffset*C+w,y=Math.cos(k),v=Math.sin(k),h&&(k=n*o.getWorldScaleX(),k>0&&(this.scaleOffset+=(S*y+A*v)*m/k))}else{y=Math.cos(w),v=Math.sin(w);const k=n*o.getWorldScaleX();k>0&&(this.scaleOffset+=(S*y+A*v)*m/k)}if(u=this.remaining,u>=f){p==-1&&(p=Math.pow(this.damping,60*f));const k=this.massInverse*f,Y=this.strength,M=this.wind,E=Pe.yDown?-this.gravity:this.gravity,F=n/g;for(;;)if(u-=f,h&&(this.scaleVelocity+=(M*y-E*v-this.scaleOffset*Y)*k,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),r){if(this.rotateVelocity-=((M*v+E*y)*F+this.rotateOffset*Y)*k,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const I=this.rotateOffset*C+w;y=Math.cos(I),v=Math.sin(I)}else if(u<f)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,l=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=a*this.data.rotate,l=Math.sin(u),c=Math.cos(u),d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d),u+=a*this.data.shearX,l=Math.sin(u),c=Math.cos(u),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c}else a*=this.data.rotate,l=Math.sin(a),c=Math.cos(a),d=o.a,o.a=c*d-l*o.c,o.c=l*d+c*o.c,d=o.b,o.b=c*d-l*o.d,o.d=l*d+c*o.d}if(h){const a=1+this.scaleOffset*e*this.data.scaleX;o.a*=a,o.c*=a}t!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,r=Math.cos(i),h=Math.sin(i),o=this.cx-t,n=this.cy-e;this.translate(o*r-n*h-o,o*h+n*r-n)}},$s=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new V,this.darkColor=t.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof fe)||!(this.attachment instanceof fe)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Hs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Le;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,u=a*d-l*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;p<b;p++){let x=g[p];if(t!=0){let w=x.a,y=x.b,v=x.c,C=x.d,S=Math.atan2(c,a)-Math.atan2(v,w)+m;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=t;let A=Math.cos(S),k=Math.sin(S);x.a=A*w-k*v,x.b=A*y-k*C,x.c=k*w+A*v,x.d=k*y+A*C}if(o){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(w.x-x.worldX)*e,x.worldY+=(w.y-x.worldY)*s}if(i!=0){let w=Math.sqrt(x.a*x.a+x.c*x.c);w!=0&&(w=(w+(Math.sqrt(a*a+c*c)-w+this.data.offsetScaleX)*i)/w),x.a*=w,x.c*=w}if(r!=0){let w=Math.sqrt(x.b*x.b+x.d*x.d);w!=0&&(w=(w+(Math.sqrt(l*l+d*d)-w+this.data.offsetScaleY)*r)/w),x.b*=w,x.d*=w}if(h>0){let w=x.b,y=x.d,v=Math.atan2(y,w),C=Math.atan2(d,l)-Math.atan2(c,a)-(v-Math.atan2(x.c,x.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+f)*h;let S=Math.sqrt(w*w+y*y);x.b=Math.cos(C)*S,x.d=Math.sin(C)*S}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,u=a*d-l*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;p<b;p++){let x=g[p];if(t!=0){let w=x.a,y=x.b,v=x.c,C=x.d,S=Math.atan2(c,a)+m;S>B.PI?S-=B.PI2:S<-B.PI&&(S+=B.PI2),S*=t;let A=Math.cos(S),k=Math.sin(S);x.a=A*w-k*v,x.b=A*y-k*C,x.c=k*w+A*v,x.d=k*y+A*C}if(o){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=w.x*e,x.worldY+=w.y*s}if(i!=0){let w=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;x.a*=w,x.c*=w}if(r!=0){let w=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*r+1;x.b*=w,x.d*=w}if(h>0){let w=Math.atan2(d,l)-Math.atan2(c,a);w>B.PI?w-=B.PI2:w<-B.PI&&(w+=B.PI2);let y=x.b,v=x.d;w=Math.atan2(v,y)+(w-B.PI/2+f)*h;let C=Math.sqrt(y*y+v*v);x.b=Math.cos(w)*C,x.d=Math.sin(w)*C}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*t);let u=c.ax,m=c.ay;u+=(o.ax-u+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let f=c.ascaleX,g=c.ascaleY;i!=0&&f!=0&&(f=(f+(o.ascaleX-f+this.data.offsetScaleX)*i)/f),r!=0&&g!=0&&(g=(g+(o.ascaleY-g+this.data.offsetScaleY)*r)/g);let p=c.ashearY;h!=0&&(p+=(o.ashearY-p+this.data.offsetShearY)*h),c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;a<l;a++){let c=n[a],d=c.arotation+(o.arotation+this.data.offsetRotation)*t,u=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,f=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),p=c.ashearY+(o.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,p)}}},Pe=class Ss{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ss.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new ts(i,this,null);else{let h=this.bones[i.parent.index];r=new ts(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],h=new $s(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new zs(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new Hs(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new Gs(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new Di(i,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let u=0,m=s.length;u<m;u++){let f=s[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let g=this.bones[u[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,l=h.length,c=this.physicsConstraints.length,d=n+a+l+c;e:for(let u=0;u<d;u++){for(let m=0;m<n;m++){let f=i[m];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let m=0;m<a;m++){let f=r[m];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let m=0;m<l;m++){let f=h[m];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let m=0;m<c;m++){const f=o[m];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,m=s.length;u<m;u++)this.sortBone(s[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,l=this.data.skins.length;a<l;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let h=s.getAttachment();h instanceof Ye&&this.sortPathConstraintAttachmentWith(h,r);let o=e.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let h=s[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ye))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,o=i.length;h<o;){let n=i[h++];for(n+=h;h<n;)this.sortBone(r[i[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&X.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,h=s.length;r<h;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,h=i.length;r<h;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let p=1,b=i.length;p<b;p++){let x=i[p];x.ax=x.x,x.ay=x.y,x.arotation=x.rotation,x.ascaleX=x.scaleX,x.ascaleY=x.scaleY,x.ashearX=x.shearX,x.ashearY=x.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,o=s.b,n=s.c,a=s.d;r.worldX=h*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const l=(r.rotation+r.shearX)*B.degRad,c=(r.rotation+90+r.shearY)*B.degRad,d=Math.cos(l)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(l)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(h*d+o*m)*this.scaleX,r.b=(h*u+o*f)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*u+a*f)*this.scaleY;let g=this._updateCache;for(let p=0,b=g.length;p<b;p++){let x=g[p];x!=r&&x.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;X.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i],o=h.data.attachmentName;if(o){let n=e.getAttachment(i,o);n&&h.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,h=i.length;r<h;r++){let o=i[r];if(o.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Le,i=new Le;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let u=h[c];if(!u.bone.active)continue;let m=0,f=null,g=null,p=u.getAttachment();if(p instanceof Ve)m=8,f=X.setArraySize(i,m,0),p.computeWorldVertices(u,f,0,2),g=Ss.quadTriangles;else if(p instanceof Me){let b=p;m=b.worldVerticesLength,f=X.setArraySize(i,m,0),b.computeWorldVertices(u,0,m,f,0,2),g=b.triangles}else if(p instanceof Ce&&r!=null){r.clipStart(u,p);continue}if(f&&g){r!=null&&r.isClipping()&&(r.clipTriangles(f,g,g.length),f=r.clippedVertices,m=r.clippedVertices.length);for(let b=0,x=f.length;b<x;b+=2){let w=f[b],y=f[b+1];o=Math.min(o,w),n=Math.min(n,y),a=Math.max(a,w),l=Math.max(l,y)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(o,n),s.set(a-o,l-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let h=0,o=r.length;h<o;h++)r[h].rotate(e,s,i)}},js=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(js||{}),Ks=class extends Ne{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},_e=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},hs=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Oe=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],h=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof Me?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new hs(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new hs(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],h=r.getAttachment();if(h&&s<e.attachments.length){let o=e.attachments[s];for(let n in o){let a=o[n];if(h==a){let l=this.getAttachment(s,n);l&&r.setAttachment(l);break}}}s++}}},cs=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},ds=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(ds||{}),us=class extends Ne{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},fs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new _e;s.name="";let i=new Js(t),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let l=0;l<n;l++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let l=0;l<n;l++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[i.readInt(!0)],u=new es(l,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),o&&(V.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}n=i.readInt(!0);for(let l=0;l<n;l++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new cs(l,c,d);V.rgba8888ToColor(u.color,i.readInt32());let m=i.readInt32();m!=-1&&V.rgb888ToColor(u.darkColor=new V,m),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),o&&(u.visible=i.readBoolean()),s.slots.push(u)}n=i.readInt(!0);for(let l=0,c;l<n;l++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new rs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=(m&2)!=0?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,(m&32)!=0&&(u.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}n=i.readInt(!0);for(let l=0,c;l<n;l++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new us(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,(m&8)!=0&&(u.offsetRotation=i.readFloat()),(m&16)!=0&&(u.offsetX=i.readFloat()*e),(m&32)!=0&&(u.offsetY=i.readFloat()*e),(m&64)!=0&&(u.offsetScaleX=i.readFloat()),(m&128)!=0&&(u.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(u.offsetShearY=i.readFloat()),(m&2)!=0&&(u.mixRotate=i.readFloat()),(m&4)!=0&&(u.mixX=i.readFloat()),(m&8)!=0&&(u.mixY=i.readFloat()),(m&16)!=0&&(u.mixScaleX=i.readFloat()),(m&32)!=0&&(u.mixScaleY=i.readFloat()),(m&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}n=i.readInt(!0);for(let l=0,c;l<n;l++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new ns(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const m=i.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==0&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==0||u.spacingMode==1)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}n=i.readInt(!0);for(let l=0,c;l<n;l++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Ks(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,(m&2)!=0&&(u.x=i.readFloat()),(m&4)!=0&&(u.y=i.readFloat()),(m&8)!=0&&(u.rotate=i.readFloat()),(m&16)!=0&&(u.scaleX=i.readFloat()),(m&32)!=0&&(u.shearX=i.readFloat()),u.limit=((m&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(m&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(u.inertiaGlobal=!0),(m&2)!=0&&(u.strengthGlobal=!0),(m&4)!=0&&(u.dampingGlobal=!0),(m&8)!=0&&(u.massGlobal=!0),(m&16)!=0&&(u.windGlobal=!0),(m&32)!=0&&(u.gravityGlobal=!0),(m&64)!=0&&(u.mixGlobal=!0),u.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let l=s.skins.length;for(X.setArraySize(s.skins,n=l+i.readInt(!0));l<n;l++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}n=this.linkedMeshes.length;for(let l=0;l<n;l++){let c=this.linkedMeshes[l];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let l=0;l<n;l++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new is(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let l=0;l<n;l++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;r=new Oe("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");r=new Oe(o),i&&V.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let o=0;o<h;o++){let n=t.readInt(!0);for(let a=0,l=t.readInt(!0);a<l;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,h){let o=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let l=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let u=(n&128)!=0?t.readFloat():0,m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),b=t.readFloat(),x=t.readFloat();l||(l=a);let w=this.attachmentLoader.newRegionAttachment(s,a,l,d);return w?(w.path=l,w.x=m*o,w.y=f*o,w.scaleX=g,w.scaleY=p,w.rotation=u,w.width=b*o,w.height=x*o,V.rgba8888ToColor(w.color,c),w.sequence=d,d==null&&w.updateRegion(),w):null}case 1:{let l=this.readVertices(t,(n&16)!=0),c=h?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&V.rgba8888ToColor(d.color,c),d):null}case 2:{let l=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),f=this.readFloatArray(t,m.length,1),g=this.readShortArray(t,(m.length-u-2)*3);let p=[],b=0,x=0;h&&(p=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),x=t.readFloat()),l||(l=a);let w=this.attachmentLoader.newMeshAttachment(s,a,l,d);return w?(w.path=l,V.rgba8888ToColor(w.color,c),w.bones=m.bones,w.vertices=m.vertices,w.worldVerticesLength=m.length,w.triangles=g,w.regionUVs=f,d==null&&w.updateRegion(),w.hullLength=u<<1,w.sequence=d,h&&(w.edges=p,w.width=b*o,w.height=x*o),w):null}case 3:{const l=(n&16)!=0?t.readStringRef():a;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=(n&128)!=0,m=t.readInt(!0),f=t.readStringRef();let g=0,p=0;h&&(g=t.readFloat(),p=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,l,d);return b?(b.path=l,V.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*o,b.height=p*o),this.linkedMeshes.push(new Vi(b,m,i,f,u)),b):null}case 4:{const l=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),u=X.newArray(d.length/6,0);for(let g=0,p=u.length;g<p;g++)u[g]=t.readFloat()*o;const m=h?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=l,f.constantSpeed=c,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,h&&V.rgba8888ToColor(f.color,m),f):null}case 5:{const l=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=d*o,m.rotation=l,h&&V.rgba8888ToColor(m.color,u),m):null}case 6:{const l=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=h?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,a);return u?(u.endSlot=e.slots[l],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,h&&V.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new Ms(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Ni;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let h=new Array,o=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);o.push(a);for(let l=0;l<a;l++)o.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return r.vertices=X.toFloatArray(h),r.bones=o,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,l=t.readInt(!0);a<l;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0),g=f-1;switch(m){case Ji:{let p=new ve(f,c);for(let b=0;b<f;b++)p.setFrame(b,t.readFloat(),t.readStringRef());i.push(p);break}case Qi:{let p=t.readInt(!0),b=new kt(f,p,c),x=t.readFloat(),w=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let S=0,A=0;b.setFrame(S,x,w,y,v,C),S!=g;S++){let k=t.readFloat(),Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255;switch(t.readByte()){case me:b.setStepped(S);break;case ge:q(t,b,A++,S,0,x,k,w,Y,1),q(t,b,A++,S,1,x,k,y,M,1),q(t,b,A++,S,2,x,k,v,E,1),q(t,b,A++,S,3,x,k,C,F,1)}x=k,w=Y,y=M,v=E,C=F}i.push(b);break}case Zi:{let p=t.readInt(!0),b=new It(f,p,c),x=t.readFloat(),w=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let C=0,S=0;b.setFrame(C,x,w,y,v),C!=g;C++){let A=t.readFloat(),k=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case me:b.setStepped(C);break;case ge:q(t,b,S++,C,0,x,A,w,k,1),q(t,b,S++,C,1,x,A,y,Y,1),q(t,b,S++,C,2,x,A,v,M,1)}x=A,w=k,y=Y,v=M}i.push(b);break}case er:{let p=t.readInt(!0),b=new Yt(f,p,c),x=t.readFloat(),w=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let Y=0,M=0;b.setFrame(Y,x,w,y,v,C,S,A,k),Y!=g;Y++){let E=t.readFloat(),F=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case me:b.setStepped(Y);break;case ge:q(t,b,M++,Y,0,x,E,w,F,1),q(t,b,M++,Y,1,x,E,y,I,1),q(t,b,M++,Y,2,x,E,v,P,1),q(t,b,M++,Y,3,x,E,C,L,1),q(t,b,M++,Y,4,x,E,S,_,1),q(t,b,M++,Y,5,x,E,A,D,1),q(t,b,M++,Y,6,x,E,k,O,1)}x=E,w=F,y=I,v=P,C=L,S=_,A=D,k=O}i.push(b);break}case tr:{let p=t.readInt(!0),b=new Pt(f,p,c),x=t.readFloat(),w=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let k=0,Y=0;b.setFrame(k,x,w,y,v,C,S,A),k!=g;k++){let M=t.readFloat(),E=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255;switch(t.readByte()){case me:b.setStepped(k);break;case ge:q(t,b,Y++,k,0,x,M,w,E,1),q(t,b,Y++,k,1,x,M,y,F,1),q(t,b,Y++,k,2,x,M,v,I,1),q(t,b,Y++,k,3,x,M,C,P,1),q(t,b,Y++,k,4,x,M,S,L,1),q(t,b,Y++,k,5,x,M,A,_,1)}x=M,w=E,y=F,v=I,C=P,S=L,A=_}i.push(b);break}case sr:{let p=new Mt(f,t.readInt(!0),c),b=t.readFloat(),x=t.readUnsignedByte()/255;for(let w=0,y=0;p.setFrame(w,b,x),w!=g;w++){let v=t.readFloat(),C=t.readUnsignedByte()/255;switch(t.readByte()){case me:p.setStepped(w);break;case ge:q(t,p,y++,w,0,b,v,x,C,1)}b=v,x=C}i.push(p)}}}}for(let a=0,l=t.readInt(!0);a<l;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0);if(m==Ki){let p=new At(f,c);for(let b=0;b<f;b++)p.setFrame(b,t.readFloat(),t.readByte());i.push(p);continue}let g=t.readInt(!0);switch(m){case _i:i.push(ee(t,new De(f,g,c),1));break;case Oi:i.push(ms(t,new xt(f,g,c),r));break;case Ui:i.push(ee(t,new pt(f,g,c),r));break;case qi:i.push(ee(t,new wt(f,g,c),r));break;case Wi:i.push(ms(t,new bt(f,g,c),1));break;case zi:i.push(ee(t,new yt(f,g,c),1));break;case Gi:i.push(ee(t,new vt(f,g,c),1));break;case $i:i.push(ms(t,new Ct(f,g,c),1));break;case Hi:i.push(ee(t,new St(f,g,c),1));break;case ji:i.push(ee(t,new Tt(f,g,c),1))}}}for(let a=0,l=t.readInt(!0);a<l;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new Ft(d,t.readInt(!0),c),f=t.readByte(),g=t.readFloat(),p=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,b=(f&4)!=0?t.readFloat()*r:0;for(let x=0,w=0;m.setFrame(x,g,p,b,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),x!=u;x++){f=t.readByte();const y=t.readFloat(),v=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,C=(f&4)!=0?t.readFloat()*r:0;(f&64)!=0?m.setStepped(x):(f&128)!=0&&(q(t,m,w++,x,0,g,y,p,v,1),q(t,m,w++,x,1,g,y,b,C,r)),g=y,p=v,b=C}i.push(m)}for(let a=0,l=t.readInt(!0);a<l;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new Bt(d,t.readInt(!0),c),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),b=t.readFloat(),x=t.readFloat(),w=t.readFloat(),y=t.readFloat();for(let v=0,C=0;m.setFrame(v,f,g,p,b,x,w,y),v!=u;v++){let S=t.readFloat(),A=t.readFloat(),k=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),E=t.readFloat(),F=t.readFloat();switch(t.readByte()){case me:m.setStepped(v);break;case ge:q(t,m,C++,v,0,f,S,g,A,1),q(t,m,C++,v,1,f,S,p,k,1),q(t,m,C++,v,2,f,S,b,Y,1),q(t,m,C++,v,3,f,S,x,M,1),q(t,m,C++,v,4,f,S,w,E,1),q(t,m,C++,v,5,f,S,y,F,1)}f=S,g=A,p=k,b=Y,x=M,w=E,y=F}i.push(m)}for(let a=0,l=t.readInt(!0);a<l;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,m=t.readInt(!0);u<m;u++){const f=t.readByte(),g=t.readInt(!0),p=t.readInt(!0);switch(f){case nr:i.push(ee(t,new Xt(g,p,c),d.positionMode==0?r:1));break;case ar:i.push(ee(t,new Rt(g,p,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case or:let b=new Lt(g,p,c),x=t.readFloat(),w=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let C=0,S=0,A=b.getFrameCount()-1;b.setFrame(C,x,w,y,v),C!=A;C++){let k=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),E=t.readFloat();switch(t.readByte()){case me:b.setStepped(C);break;case ge:q(t,b,S++,C,0,x,k,w,Y,1),q(t,b,S++,C,1,x,k,y,M,1),q(t,b,S++,C,2,x,k,v,E,1)}x=k,w=Y,y=M,v=E}i.push(b)}}}for(let a=0,l=t.readInt(!0);a<l;a++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const m=t.readByte(),f=t.readInt(!0);if(m==gr){const p=new Wt(f,c);for(let b=0;b<f;b++)p.setFrame(b,t.readFloat());i.push(p);continue}const g=t.readInt(!0);switch(m){case lr:i.push(ee(t,new Dt(f,g,c),1));break;case hr:i.push(ee(t,new Vt(f,g,c),1));break;case cr:i.push(ee(t,new Nt(f,g,c),1));break;case dr:i.push(ee(t,new _t(f,g,c),1));break;case ur:i.push(ee(t,new Ot(f,g,c),1));break;case fr:i.push(ee(t,new Ut(f,g,c),1));break;case mr:i.push(ee(t,new qt(f,g,c),1))}}}for(let a=0,l=t.readInt(!0);a<l;a++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readInt(!0);for(let f=0,g=t.readInt(!0);f<g;f++){let p=t.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,p),x=t.readByte(),w=t.readInt(!0),y=w-1;switch(x){case ir:{let v=b,C=v.bones,S=v.vertices,A=C?S.length/3*2:S.length,k=t.readInt(!0),Y=new Et(w,k,m,v),M=t.readFloat();for(let E=0,F=0;;E++){let I,P=t.readInt(!0);if(P==0)I=C?X.newFloatArray(A):S;else{I=X.newFloatArray(A);let _=t.readInt(!0);if(P+=_,r==1)for(let D=_;D<P;D++)I[D]=t.readFloat();else for(let D=_;D<P;D++)I[D]=t.readFloat()*r;if(!C)for(let D=0,O=I.length;D<O;D++)I[D]+=S[D]}if(Y.setFrame(E,M,I),E==y)break;let L=t.readFloat();switch(t.readByte()){case me:Y.setStepped(E);break;case ge:q(t,Y,F++,E,0,M,L,0,1,1)}M=L}i.push(Y);break}case rr:{let v=new zt(w,m,b);for(let C=0;C<w;C++){let S=t.readFloat(),A=t.readInt32();v.setFrame(C,S,Ps[A&15],A>>4,t.readFloat())}i.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let a=new Ie(h),l=s.slots.length;for(let c=0;c<h;c++){let d=t.readFloat(),u=t.readInt(!0),m=X.newArray(l,0);for(let b=l-1;b>=0;b--)m[b]=-1;let f=X.newArray(l-u,0),g=0,p=0;for(let b=0;b<u;b++){let x=t.readInt(!0);for(;g!=x;)f[p++]=g++;m[g+t.readInt(!0)]=g++}for(;g<l;)f[p++]=g++;for(let b=l-1;b>=0;b--)m[b]==-1&&(m[b]=f[--p]);a.setFrame(c,d,m)}i.push(a)}let o=t.readInt(!0);if(o>0){let a=new $e(o);for(let l=0;l<o;l++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new ss(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(l,u)}i.push(a)}let n=0;for(let a=0,l=i.length;a<l;a++)n=Math.max(n,i[a].getDuration());return new ze(e,i,n)}},Js=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Vi=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Ni=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function ee(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let h=0,o=0,n=e.getFrameCount()-1;e.setFrame(h,i,r),h!=n;h++){let a=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case me:e.setStepped(h);break;case ge:q(t,e,o++,h,0,i,a,r,l,s)}i=a,r=l}return e}function ms(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,h=t.readFloat()*s;for(let o=0,n=0,a=e.getFrameCount()-1;e.setFrame(o,i,r,h),o!=a;o++){let l=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case me:e.setStepped(o);break;case ge:q(t,e,n++,o,0,i,l,r,c,s),q(t,e,n++,o,1,i,l,h,d,s)}i=l,r=c,h=d}return e}function q(t,e,s,i,r,h,o,n,a,l){e.setBezier(s,i,r,h,n,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,o,a)}var _i=0,Oi=1,Ui=2,qi=3,Wi=4,zi=5,Gi=6,$i=7,Hi=8,ji=9,Ki=10,Ji=0,Qi=1,Zi=2,er=3,tr=4,sr=5,ir=0,rr=1,nr=0,ar=1,or=2,lr=0,hr=1,cr=2,dr=4,ur=5,fr=6,mr=7,gr=8,me=1,ge=2,Qs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new ke(()=>X.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=t.slots,o=h.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=h[n];if(!a.bone.active)continue;let l=a.getAttachment();if(l instanceof Kt){let c=l;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=X.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let h=0,o=r.length;h<o;h++){let n=r[h],a=n;for(let l=0,c=n.length;l<c;l+=2){let d=a[l],u=a[l+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,h=this.minY,o=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=h&&i<=h||t>=o&&s>=o||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),l=a*(r-t)+e;if(l>h&&l<n||(l=a*(o-t)+e,l>h&&l<n))return!0;let c=(h-e)/a+t;return c>r&&c<o||(c=(n-e)/a+t,c>r&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,h=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],l=i[h+1];if(a<s&&l>=s||l<s&&a>=s){let c=i[n];c+(s-a)/(l-a)*(i[h]-c)<e&&(o=!o)}h=n}return o}intersectsSegment(t,e,s,i){let r=this.polygons;for(let h=0,o=r.length;h<o;h++)if(this.intersectsSegmentPolygon(r[h],t,e,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,i,r){let h=t,o=t.length,n=e-i,a=s-r,l=e*r-s*i,c=h[o-2],d=h[o-1];for(let u=0;u<o;u+=2){let m=h[u],f=h[u+1],g=c*f-d*m,p=c-m,b=d-f,x=n*b-a*p,w=(l*p-n*g)/x;if((w>=c&&w<=m||w>=m&&w<=c)&&(w>=e&&w<=i||w>=i&&w<=e)){let y=(l*b-a*g)/x;if((y>=d&&y<=f||y>=f&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Zs=class ne{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new ke(()=>new Array);polygonIndicesPool=new ke(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=i;n<a;++n)h[n]=ne.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,l=1;for(;;){e:if(!h[a]){let u=r[n]<<1,m=r[a]<<1,f=r[l]<<1,g=s[u],p=s[u+1],b=s[m],x=s[m+1],w=s[f],y=s[f+1];for(let v=(l+1)%i;v!=n;v=(v+1)%i){if(!h[v])continue;let C=r[v]<<1,S=s[C],A=s[C+1];if(ne.positiveArea(w,y,g,p,S,A)&&ne.positiveArea(g,p,b,x,S,A)&&ne.positiveArea(b,x,w,y,S,A))break e}break}if(l==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=l,l=(l+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),h.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;h[c]=ne.isConcave(c,i,s,r),h[d]=ne.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,l=0;for(let c=0,d=s.length;c<d;c+=3){let u=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,g=i[u],p=i[u+1],b=i[m],x=i[m+1],w=i[f],y=i[f+1],v=!1;if(a==u){let C=n.length-4,S=ne.winding(n[C],n[C+1],n[C+2],n[C+3],w,y),A=ne.winding(w,y,n[0],n[1],n[2],n[3]);S==l&&A==l&&(n.push(w),n.push(y),o.push(f),v=!0)}v||(n.length>0?(r.push(n),h.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(p),n.push(b),n.push(x),n.push(w),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(u),o.push(m),o.push(f),l=ne.winding(g,p,b,x,w,y),a=u)}n.length>0&&(r.push(n),h.push(o));for(let c=0,d=r.length;c<d;c++){if(o=h[c],o.length==0)continue;let u=o[0],m=o[o.length-1];n=r[c];let f=n.length-4,g=n[f],p=n[f+1],b=n[f+2],x=n[f+3],w=n[0],y=n[1],v=n[2],C=n[3],S=ne.winding(g,p,b,x,w,y);for(let A=0;A<d;A++){if(A==c)continue;let k=h[A];if(k.length!=3)continue;let Y=k[0],M=k[1],E=k[2],F=r[A],I=F[F.length-2],P=F[F.length-1];if(Y!=u||M!=m)continue;let L=ne.winding(g,p,b,x,I,P),_=ne.winding(I,P,w,y,v,C);L==S&&_==S&&(F.length=0,k.length=0,n.push(I),n.push(P),o.push(E),g=b,p=x,b=I,x=P,A=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(e,s,i,r){let h=r[(s+e-1)%s]<<1,o=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(e,s,i,r,h,o){return e*(o-r)+i*(s-o)+h*(r-s)>=0}static winding(e,s,i,r,h,o){let n=i-e,a=r-s;return h*a-o*n+n*s-e*a>=0?1:-1}},Ze=class Ts{triangulator=new Zs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=X.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let h=this.clippingPolygon;Ts.makeClockwise(h);let o=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=o.length;n<a;n++){let l=o[n];Ts.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,h,o,n,a){let l,c,d,u,m,f;typeof s=="number"?(l=i,c=r,d=h,u=o,m=n,f=a):(l=s,c=i,d=r,u=h,m=o,f=n),d&&u&&m&&typeof f=="boolean"?this.clipTrianglesRender(e,l,c,d,u,m,f):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,h=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,l=0;h.length=0,o.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,u=e[d],m=e[d+1];d=s[c+1]<<1;let f=e[d],g=e[d+1];d=s[c+2]<<1;let p=e[d],b=e[d+1];for(let x=0;x<a;x++){let w=h.length;if(this.clip(u,m,f,g,p,b,n[x],r)){let y=r.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,S=X.setArraySize(h,w+v*2);for(let k=0;k<y;k+=2,w+=2){let Y=C[k],M=C[k+1];S[w]=Y,S[w+1]=M}w=o.length;let A=X.setArraySize(o,w+3*(v-2));v--;for(let k=1;k<v;k++,w+=3)A[w]=l,A[w+1]=l+k,A[w+2]=l+k+1;l+=v+1}else{let y=X.setArraySize(h,w+6);y[w]=u,y[w+1]=m,y[w+2]=f,y[w+3]=g,y[w+4]=p,y[w+5]=b,w=o.length;let v=X.setArraySize(o,w+3);v[w]=l,v[w+1]=l+1,v[w+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,s,i,r,h,o,n){let a=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=n?12:8,f=0;l.length=0,c.length=0;for(let g=0;g<i;g+=3){let p=s[g]<<1,b=e[p],x=e[p+1],w=r[p],y=r[p+1];p=s[g+1]<<1;let v=e[p],C=e[p+1],S=r[p],A=r[p+1];p=s[g+2]<<1;let k=e[p],Y=e[p+1],M=r[p],E=r[p+1];for(let F=0;F<u;F++){let I=l.length;if(this.clip(b,x,v,C,k,Y,d[F],a)){let P=a.length;if(P==0)continue;let L=C-Y,_=k-v,D=b-k,O=Y-x,$=1/(L*D+_*(x-Y)),z=P>>1,K=this.clipOutput,R=X.setArraySize(l,I+z*m);for(let G=0;G<P;G+=2,I+=m){let ie=K[G],J=K[G+1];R[I]=ie,R[I+1]=J,R[I+2]=h.r,R[I+3]=h.g,R[I+4]=h.b,R[I+5]=h.a;let te=ie-k,se=J-Y,de=(L*te+_*se)*$,Be=(O*te+D*se)*$,qe=1-de-Be;R[I+6]=w*de+S*Be+M*qe,R[I+7]=y*de+A*Be+E*qe,n&&(R[I+8]=o.r,R[I+9]=o.g,R[I+10]=o.b,R[I+11]=o.a)}I=c.length;let U=X.setArraySize(c,I+3*(z-2));z--;for(let G=1;G<z;G++,I+=3)U[I]=f,U[I+1]=f+G,U[I+2]=f+G+1;f+=z+1}else{let P=X.setArraySize(l,I+3*m);P[I]=b,P[I+1]=x,P[I+2]=h.r,P[I+3]=h.g,P[I+4]=h.b,P[I+5]=h.a,n?(P[I+6]=w,P[I+7]=y,P[I+8]=o.r,P[I+9]=o.g,P[I+10]=o.b,P[I+11]=o.a,P[I+12]=v,P[I+13]=C,P[I+14]=h.r,P[I+15]=h.g,P[I+16]=h.b,P[I+17]=h.a,P[I+18]=S,P[I+19]=A,P[I+20]=o.r,P[I+21]=o.g,P[I+22]=o.b,P[I+23]=o.a,P[I+24]=k,P[I+25]=Y,P[I+26]=h.r,P[I+27]=h.g,P[I+28]=h.b,P[I+29]=h.a,P[I+30]=M,P[I+31]=E,P[I+32]=o.r,P[I+33]=o.g,P[I+34]=o.b,P[I+35]=o.a):(P[I+6]=w,P[I+7]=y,P[I+8]=v,P[I+9]=C,P[I+10]=h.r,P[I+11]=h.g,P[I+12]=h.b,P[I+13]=h.a,P[I+14]=S,P[I+15]=A,P[I+16]=k,P[I+17]=Y,P[I+18]=h.r,P[I+19]=h.g,P[I+20]=h.b,P[I+21]=h.a,P[I+22]=M,P[I+23]=E),I=c.length;let L=X.setArraySize(c,I+3);L[I]=f,L[I+1]=f+1,L[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let h=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,l=this.clippingPolygons,c=l.length,d=0;o.length=0,n.length=0,a.length=0;for(let u=0;u<i;u+=3){let m=s[u]<<1,f=e[m],g=e[m+1],p=r[m],b=r[m+1];m=s[u+1]<<1;let x=e[m],w=e[m+1],y=r[m],v=r[m+1];m=s[u+2]<<1;let C=e[m],S=e[m+1],A=r[m],k=r[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(f,g,x,w,C,S,l[Y],h)){let E=h.length;if(E==0)continue;let F=w-S,I=C-x,P=f-C,L=S-g,_=1/(F*P+I*(g-S)),D=E>>1,O=this.clipOutput,$=X.setArraySize(o,M+D*2),z=X.setArraySize(n,M+D*2);for(let R=0;R<E;R+=2,M+=2){let U=O[R],G=O[R+1];$[M]=U,$[M+1]=G;let ie=U-C,J=G-S,te=(F*ie+I*J)*_,se=(L*ie+P*J)*_,de=1-te-se;z[M]=p*te+y*se+A*de,z[M+1]=b*te+v*se+k*de}M=a.length;let K=X.setArraySize(a,M+3*(D-2));D--;for(let R=1;R<D;R++,M+=3)K[M]=d,K[M+1]=d+R,K[M+2]=d+R+1;d+=D+1}else{let E=X.setArraySize(o,M+6);E[M]=f,E[M+1]=g,E[M+2]=x,E[M+3]=w,E[M+4]=C,E[M+5]=S;let F=X.setArraySize(n,M+3*2);F[M]=p,F[M+1]=b,F[M+2]=y,F[M+3]=v,F[M+4]=A,F[M+5]=k,M=a.length;let I=X.setArraySize(a,M+3);I[M]=d,I[M+1]=d+1,I[M+2]=d+2,d+=3;break}}}}clip(e,s,i,r,h,o,n,a){let l=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(h),d.push(o),d.push(e),d.push(s),a.length=0;let u=n.length-4,m=n;for(let f=0;;f+=2){let g=m[f],p=m[f+1],b=g-m[f+2],x=p-m[f+3],w=a.length,y=d;for(let C=0,S=d.length-2;C<S;){let A=y[C],k=y[C+1];C+=2;let Y=y[C],M=y[C+1],E=x*(g-Y)>b*(p-M),F=x*(g-A)-b*(p-k);if(F>0){if(E){a.push(Y),a.push(M);continue}let I=Y-A,P=M-k,L=F/(I*x-P*b);if(L>=0&&L<=1)a.push(A+I*L),a.push(k+P*L);else{a.push(Y),a.push(M);continue}}else if(E){let I=Y-A,P=M-k,L=F/(I*x-P*b);if(L>=0&&L<=1)a.push(A+I*L),a.push(k+P*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(w==a.length)return l.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==u)break;let v=a;a=d,a.length=0,d=v}if(l!=a){l.length=0;for(let f=0,g=a.length-2;f<g;f++)l[f]=a[f]}else l.length=l.length-2;return c}static makeClockwise(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,o=0,n=0,a=0;for(let l=0,c=i-3;l<c;l+=2)h=s[l],o=s[l+1],n=s[l+2],a=s[l+3],r+=h*a-n*o;if(!(r<0))for(let l=0,c=i-2,d=i>>1;l<d;l+=2){let u=s[l],m=s[l+1],f=c-l;s[l]=s[f],s[l+1]=s[f+1],s[f]=u,s[f+1]=m}}},gs=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new _e,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=T(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let o=i.bones[h],n=null,a=T(o,"parent",null);a&&(n=s.findBone(a));let l=new es(s.bones.length,o.name,n);l.length=T(o,"length",0)*e,l.x=T(o,"x",0)*e,l.y=T(o,"y",0)*e,l.rotation=T(o,"rotation",0),l.scaleX=T(o,"scaleX",1),l.scaleY=T(o,"scaleY",1),l.shearX=T(o,"shearX",0),l.shearY=T(o,"shearY",0),l.inherit=X.enumValue(Qe,T(o,"inherit","Normal")),l.skinRequired=T(o,"skin",!1);let c=T(o,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(i.slots)for(let h=0;h<i.slots.length;h++){let o=i.slots[h],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let l=new cs(s.slots.length,n,a),c=T(o,"color",null);c&&l.color.setFromString(c);let d=T(o,"dark",null);d&&(l.darkColor=V.fromString(d)),l.attachmentName=T(o,"attachment",null),l.blendMode=X.enumValue(ds,T(o,"blend","normal")),l.visible=T(o,"visible",!0),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let o=i.ik[h],n=new rs(o.name);n.order=T(o,"order",0),n.skinRequired=T(o,"skin",!1);for(let l=0;l<o.bones.length;l++){let c=s.findBone(o.bones[l]);if(!c)throw new Error(`Couldn't find bone ${o.bones[l]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=T(o,"mix",1),n.softness=T(o,"softness",0)*e,n.bendDirection=T(o,"bendPositive",!0)?1:-1,n.compress=T(o,"compress",!1),n.stretch=T(o,"stretch",!1),n.uniform=T(o,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let h=0;h<i.transform.length;h++){let o=i.transform[h],n=new us(o.name);n.order=T(o,"order",0),n.skinRequired=T(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);n.bones.push(u)}let a=o.target,l=s.findBone(a);if(!l)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=l,n.local=T(o,"local",!1),n.relative=T(o,"relative",!1),n.offsetRotation=T(o,"rotation",0),n.offsetX=T(o,"x",0)*e,n.offsetY=T(o,"y",0)*e,n.offsetScaleX=T(o,"scaleX",0),n.offsetScaleY=T(o,"scaleY",0),n.offsetShearY=T(o,"shearY",0),n.mixRotate=T(o,"mixRotate",1),n.mixX=T(o,"mixX",1),n.mixY=T(o,"mixY",n.mixX),n.mixScaleX=T(o,"mixScaleX",1),n.mixScaleY=T(o,"mixScaleY",n.mixScaleX),n.mixShearY=T(o,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let h=0;h<i.path.length;h++){let o=i.path[h],n=new ns(o.name);n.order=T(o,"order",0),n.skinRequired=T(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);n.bones.push(u)}let a=o.target,l=s.findSlot(a);if(!l)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=l,n.positionMode=X.enumValue(as,T(o,"positionMode","Percent")),n.spacingMode=X.enumValue(os,T(o,"spacingMode","Length")),n.rotateMode=X.enumValue(ls,T(o,"rotateMode","Tangent")),n.offsetRotation=T(o,"rotation",0),n.position=T(o,"position",0),n.positionMode==0&&(n.position*=e),n.spacing=T(o,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=e),n.mixRotate=T(o,"mixRotate",1),n.mixX=T(o,"mixX",1),n.mixY=T(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let h=0;h<i.physics.length;h++){const o=i.physics[h],n=new Ks(o.name);n.order=T(o,"order",0),n.skinRequired=T(o,"skin",!1);const a=o.bone,l=s.findBone(a);if(l==null)throw new Error("Physics bone not found: "+a);n.bone=l,n.x=T(o,"x",0),n.y=T(o,"y",0),n.rotate=T(o,"rotate",0),n.scaleX=T(o,"scaleX",0),n.shearX=T(o,"shearX",0),n.limit=T(o,"limit",5e3)*e,n.step=1/T(o,"fps",60),n.inertia=T(o,"inertia",1),n.strength=T(o,"strength",100),n.damping=T(o,"damping",1),n.massInverse=1/T(o,"mass",1),n.wind=T(o,"wind",0),n.gravity=T(o,"gravity",0),n.mix=T(o,"mix",1),n.inertiaGlobal=T(o,"inertiaGlobal",!1),n.strengthGlobal=T(o,"strengthGlobal",!1),n.dampingGlobal=T(o,"dampingGlobal",!1),n.massGlobal=T(o,"massGlobal",!1),n.windGlobal=T(o,"windGlobal",!1),n.gravityGlobal=T(o,"gravityGlobal",!1),n.mixGlobal=T(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let h=0;h<i.skins.length;h++){let o=i.skins[h],n=new Oe(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let l=o.bones[a],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let l=o.ik[a],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let l=o.transform[a],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let l=o.path[a],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let l=o.physics[a],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let l=s.findSlot(a);if(!l)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let d in c){let u=this.readAttachment(c[d],n,l.index,d,s);u&&n.setAttachment(l.index,d,u)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,o=this.linkedMeshes.length;h<o;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let l=a.getAttachment(n.slotIndex,n.parent);if(!l)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?l:n.mesh,n.mesh.setParentMesh(l),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let o=i.events[h],n=new is(h);n.intValue=T(o,"int",0),n.floatValue=T(o,"float",0),n.stringValue=T(o,"string",""),n.audioPath=T(o,"audio",null),n.audioPath&&(n.volume=T(o,"volume",1),n.balance=T(o,"balance",0)),s.events.push(n)}if(i.animations)for(let h in i.animations){let o=i.animations[h];this.readAnimation(o,h,s)}return s}readAttachment(t,e,s,i,r){let h=this.scale;switch(i=T(t,"name",i),T(t,"type","region")){case"region":{let o=T(t,"path",i),n=this.readSequence(T(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,o,n);if(!a)return null;a.path=o,a.x=T(t,"x",0)*h,a.y=T(t,"y",0)*h,a.scaleX=T(t,"scaleX",1),a.scaleY=T(t,"scaleY",1),a.rotation=T(t,"rotation",0),a.width=t.width*h,a.height=t.height*h,a.sequence=n;let l=T(t,"color",null);return l&&a.color.setFromString(l),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let n=T(t,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=T(t,"path",i),n=this.readSequence(T(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,o,n);if(!a)return null;a.path=o;let l=T(t,"color",null);l&&a.color.setFromString(l),a.width=T(t,"width",0)*h,a.height=T(t,"height",0)*h,a.sequence=n;let c=T(t,"parent",null);if(c)return this.linkedMeshes.push(new xr(a,T(t,"skin",null),s,c,T(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=T(t,"edges",null),a.hullLength=T(t,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(e,i);if(!o)return null;o.closed=T(t,"closed",!1),o.constantSpeed=T(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,o,n<<1);let a=X.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*h;o.lengths=a;let l=T(t,"color",null);return l&&o.color.setFromString(l),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,i);if(!o)return null;o.x=T(t,"x",0)*h,o.y=T(t,"y",0)*h,o.rotation=T(t,"rotation",0);let n=T(t,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,i);if(!o)return null;let n=T(t,"end",null);n&&(o.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,o,a<<1);let l=T(t,"color",null);return l&&o.color.setFromString(l),o}}return null}readSequence(t){if(t==null)return null;let e=new Ms(T(t,"count",0));return e.start=T(t,"start",1),e.digits=T(t,"digits",0),e.setupIndex=T(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=X.toFloatArray(r);if(i!=1)for(let a=0,l=r.length;a<l;a++)n[a]*=i;e.vertices=n;return}let h=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let l=r[n++];o.push(l);for(let c=n+l*4;n<c;n+=4)o.push(r[n]),h.push(r[n+1]*i),h.push(r[n+2]*i),h.push(r[n+3])}e.bones=o,e.vertices=X.toFloatArray(h)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let o in t.slots){let n=t.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let l=a.index;for(let c in n){let d=n[c];if(!d)continue;let u=d.length;if(c=="attachment"){let m=new ve(u,l);for(let f=0;f<u;f++){let g=d[f];m.setFrame(f,T(g,"time",0),T(g,"name",null))}r.push(m)}else if(c=="rgba"){let m=new kt(u,u<<2,l),f=d[0],g=T(f,"time",0),p=V.fromString(f.color);for(let b=0,x=0;;b++){m.setFrame(b,g,p.r,p.g,p.b,p.a);let w=d[b+1];if(!w){m.shrink(x);break}let y=T(w,"time",0),v=V.fromString(w.color),C=f.curve;C&&(x=W(C,m,x,b,0,g,y,p.r,v.r,1),x=W(C,m,x,b,1,g,y,p.g,v.g,1),x=W(C,m,x,b,2,g,y,p.b,v.b,1),x=W(C,m,x,b,3,g,y,p.a,v.a,1)),g=y,p=v,f=w}r.push(m)}else if(c=="rgb"){let m=new It(u,u*3,l),f=d[0],g=T(f,"time",0),p=V.fromString(f.color);for(let b=0,x=0;;b++){m.setFrame(b,g,p.r,p.g,p.b);let w=d[b+1];if(!w){m.shrink(x);break}let y=T(w,"time",0),v=V.fromString(w.color),C=f.curve;C&&(x=W(C,m,x,b,0,g,y,p.r,v.r,1),x=W(C,m,x,b,1,g,y,p.g,v.g,1),x=W(C,m,x,b,2,g,y,p.b,v.b,1)),g=y,p=v,f=w}r.push(m)}else if(c=="alpha")r.push(he(d,new Mt(u,u,l),0,1));else if(c=="rgba2"){let m=new Yt(u,u*7,l),f=d[0],g=T(f,"time",0),p=V.fromString(f.light),b=V.fromString(f.dark);for(let x=0,w=0;;x++){m.setFrame(x,g,p.r,p.g,p.b,p.a,b.r,b.g,b.b);let y=d[x+1];if(!y){m.shrink(w);break}let v=T(y,"time",0),C=V.fromString(y.light),S=V.fromString(y.dark),A=f.curve;A&&(w=W(A,m,w,x,0,g,v,p.r,C.r,1),w=W(A,m,w,x,1,g,v,p.g,C.g,1),w=W(A,m,w,x,2,g,v,p.b,C.b,1),w=W(A,m,w,x,3,g,v,p.a,C.a,1),w=W(A,m,w,x,4,g,v,b.r,S.r,1),w=W(A,m,w,x,5,g,v,b.g,S.g,1),w=W(A,m,w,x,6,g,v,b.b,S.b,1)),g=v,p=C,b=S,f=y}r.push(m)}else if(c=="rgb2"){let m=new Pt(u,u*6,l),f=d[0],g=T(f,"time",0),p=V.fromString(f.light),b=V.fromString(f.dark);for(let x=0,w=0;;x++){m.setFrame(x,g,p.r,p.g,p.b,b.r,b.g,b.b);let y=d[x+1];if(!y){m.shrink(w);break}let v=T(y,"time",0),C=V.fromString(y.light),S=V.fromString(y.dark),A=f.curve;A&&(w=W(A,m,w,x,0,g,v,p.r,C.r,1),w=W(A,m,w,x,1,g,v,p.g,C.g,1),w=W(A,m,w,x,2,g,v,p.b,C.b,1),w=W(A,m,w,x,3,g,v,b.r,S.r,1),w=W(A,m,w,x,4,g,v,b.g,S.g,1),w=W(A,m,w,x,5,g,v,b.b,S.b,1)),g=v,p=C,b=S,f=y}r.push(m)}}}if(t.bones)for(let o in t.bones){let n=t.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let l=a.index;for(let c in n){let d=n[c],u=d.length;if(u!=0){if(c==="rotate")r.push(he(d,new De(u,u,l),0,1));else if(c==="translate"){let m=new xt(u,u<<1,l);r.push(xs(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new pt(u,u,l);r.push(he(d,m,0,i))}else if(c==="translatey"){let m=new wt(u,u,l);r.push(he(d,m,0,i))}else if(c==="scale"){let m=new bt(u,u<<1,l);r.push(xs(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new yt(u,u,l);r.push(he(d,m,1,1))}else if(c==="scaley"){let m=new vt(u,u,l);r.push(he(d,m,1,1))}else if(c==="shear"){let m=new Ct(u,u<<1,l);r.push(xs(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new St(u,u,l);r.push(he(d,m,0,1))}else if(c==="sheary"){let m=new Tt(u,u,l);r.push(he(d,m,0,1))}else if(c==="inherit"){let m=new At(u,a.index);for(let f=0;f<d.length;f++){let g=d[f];m.setFrame(f,T(g,"time",0),X.enumValue(Qe,T(g,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let o in t.ik){let n=t.ik[o],a=n[0];if(!a)continue;let l=s.findIkConstraint(o);if(!l)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(l),d=new Ft(n.length,n.length<<1,c),u=T(a,"time",0),m=T(a,"mix",1),f=T(a,"softness",0)*i;for(let g=0,p=0;;g++){d.setFrame(g,u,m,f,T(a,"bendPositive",!0)?1:-1,T(a,"compress",!1),T(a,"stretch",!1));let b=n[g+1];if(!b){d.shrink(p);break}let x=T(b,"time",0),w=T(b,"mix",1),y=T(b,"softness",0)*i,v=a.curve;v&&(p=W(v,d,p,g,0,u,x,m,w,1),p=W(v,d,p,g,1,u,x,f,y,i)),u=x,m=w,f=y,a=b}r.push(d)}if(t.transform)for(let o in t.transform){let n=t.transform[o],a=n[0];if(!a)continue;let l=s.findTransformConstraint(o);if(!l)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(l),d=new Bt(n.length,n.length*6,c),u=T(a,"time",0),m=T(a,"mixRotate",1),f=T(a,"mixX",1),g=T(a,"mixY",f),p=T(a,"mixScaleX",1),b=T(a,"mixScaleY",p),x=T(a,"mixShearY",1);for(let w=0,y=0;;w++){d.setFrame(w,u,m,f,g,p,b,x);let v=n[w+1];if(!v){d.shrink(y);break}let C=T(v,"time",0),S=T(v,"mixRotate",1),A=T(v,"mixX",1),k=T(v,"mixY",A),Y=T(v,"mixScaleX",1),M=T(v,"mixScaleY",Y),E=T(v,"mixShearY",1),F=a.curve;F&&(y=W(F,d,y,w,0,u,C,m,S,1),y=W(F,d,y,w,1,u,C,f,A,1),y=W(F,d,y,w,2,u,C,g,k,1),y=W(F,d,y,w,3,u,C,p,Y,1),y=W(F,d,y,w,4,u,C,b,M,1),y=W(F,d,y,w,5,u,C,x,E,1)),u=C,m=S,f=A,g=k,p=Y,b=M,p=Y,a=v}r.push(d)}if(t.path)for(let o in t.path){let n=t.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let l=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],u=d[0];if(!u)continue;let m=d.length;if(c==="position"){let f=new Xt(m,m,l);r.push(he(d,f,0,a.positionMode==0?i:1))}else if(c==="spacing"){let f=new Rt(m,m,l);r.push(he(d,f,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let f=new Lt(m,m*3,l),g=T(u,"time",0),p=T(u,"mixRotate",1),b=T(u,"mixX",1),x=T(u,"mixY",b);for(let w=0,y=0;;w++){f.setFrame(w,g,p,b,x);let v=d[w+1];if(!v){f.shrink(y);break}let C=T(v,"time",0),S=T(v,"mixRotate",1),A=T(v,"mixX",1),k=T(v,"mixY",A),Y=u.curve;Y&&(y=W(Y,f,y,w,0,g,C,p,S,1),y=W(Y,f,y,w,1,g,C,b,A,1),y=W(Y,f,y,w,2,g,C,x,k,1)),g=C,p=S,b=A,x=k,u=v}r.push(f)}}}if(t.physics)for(let o in t.physics){let n=t.physics[o],a=-1;if(o.length>0){let l=s.findPhysicsConstraint(o);if(!l)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(l)}for(let l in n){let c=n[l],d=c[0];if(!d)continue;let u=c.length;if(l=="reset"){const f=new Wt(u,a);for(let g=0;d!=null;d=c[g+1],g++)f.setFrame(g,T(d,"time",0));r.push(f);continue}let m;if(l=="inertia")m=new Dt(u,u,a);else if(l=="strength")m=new Vt(u,u,a);else if(l=="damping")m=new Nt(u,u,a);else if(l=="mass")m=new _t(u,u,a);else if(l=="wind")m=new Ot(u,u,a);else if(l=="gravity")m=new Ut(u,u,a);else if(l=="mix")m=new qt(u,u,a);else continue;r.push(he(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let n=t.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let l in n){let c=n[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let u=d.index;for(let m in c){let f=c[m],g=a.getAttachment(u,m);for(let p in f){let b=f[p],x=b[0];if(x){if(p=="deform"){let w=g.bones,y=g.vertices,v=w?y.length/3*2:y.length,C=new Et(b.length,b.length,u,g),S=T(x,"time",0);for(let A=0,k=0;;A++){let Y,M=T(x,"vertices",null);if(!M)Y=w?X.newFloatArray(v):y;else{Y=X.newFloatArray(v);let P=T(x,"offset",0);if(X.arrayCopy(M,0,Y,P,M.length),i!=1)for(let L=P,_=L+M.length;L<_;L++)Y[L]*=i;if(!w)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(A,S,Y);let E=b[A+1];if(!E){C.shrink(k);break}let F=T(E,"time",0),I=x.curve;I&&(k=W(I,C,k,A,0,S,F,0,1,1)),S=F,x=E}r.push(C)}else if(p=="sequence"){let w=new zt(b.length,u,g),y=0;for(let v=0;v<b.length;v++){let C=T(x,"delay",y),S=T(x,"time",0),A=Ys[T(x,"mode","hold")],k=T(x,"index",0);w.setFrame(v,S,A,k,C),y=C,x=b[v+1]}r.push(w)}}}}}}if(t.drawOrder){let o=new Ie(t.drawOrder.length),n=s.slots.length,a=0;for(let l=0;l<t.drawOrder.length;l++,a++){let c=t.drawOrder[l],d=null,u=T(c,"offsets",null);if(u){d=X.newArray(n,-1);let m=X.newArray(n-u.length,0),f=0,g=0;for(let p=0;p<u.length;p++){let b=u[p],x=s.findSlot(b.slot);if(!x)throw new Error("Slot not found: "+x);let w=x.index;for(;f!=w;)m[g++]=f++;d[f+b.offset]=f++}for(;f<n;)m[g++]=f++;for(let p=n-1;p>=0;p--)d[p]==-1&&(d[p]=m[--g])}o.setFrame(a,T(c,"time",0),d)}r.push(o)}if(t.events){let o=new $e(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let l=t.events[a],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new ss(X.toSinglePrecision(T(l,"time",0)),c);d.intValue=T(l,"int",c.intValue),d.floatValue=T(l,"float",c.floatValue),d.stringValue=T(l,"string",c.stringValue),d.data.audioPath&&(d.volume=T(l,"volume",1),d.balance=T(l,"balance",0)),o.setFrame(n,d)}r.push(o)}let h=0;for(let o=0,n=r.length;o<n;o++)h=Math.max(h,r[o].getDuration());s.animations.push(new ze(e,r,h))}},xr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function he(t,e,s,i){let r=t[0],h=T(r,"time",0),o=T(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,h,o);let l=t[a+1];if(!l)return e.shrink(n),e;let c=T(l,"time",0),d=T(l,"value",s)*i;r.curve&&(n=W(r.curve,e,n,a,0,h,c,o,d,i)),h=c,o=d,r=l}}function xs(t,e,s,i,r,h){let o=t[0],n=T(o,"time",0),a=T(o,s,r)*h,l=T(o,i,r)*h,c=0;for(let d=0;;d++){e.setFrame(d,n,a,l);let u=t[d+1];if(!u)return e.shrink(c),e;let m=T(u,"time",0),f=T(u,s,r)*h,g=T(u,i,r)*h,p=o.curve;p&&(c=W(p,e,c,d,0,n,m,a,f,h),c=W(p,e,c,d,1,n,m,l,g,h)),n=m,a=f,l=g,o=u}}function W(t,e,s,i,r,h,o,n,a,l){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],u=t[c+1]*l,m=t[c+2],f=t[c+3]*l;return e.setBezier(s,i,r,h,n,d,u,m,f,o,a),s+1}function T(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var oe=Q("@pixi/core"),Ue=class Te extends Jt{static textureMap=new Map;static from(e){return Te.textureMap.has(e)?Te.textureMap.get(e):new Te(e)}texture;constructor(e){super(e.resource.source),this.texture=oe.Texture.from(e)}setFilters(e,s){this.texture.baseTexture.scaleMode=Te.toPixiTextureFilter(e),this.texture.baseTexture.mipmap=Te.toPixiMipMap(e)}setWraps(e,s){this.texture.baseTexture.wrapMode=Te.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiTextureFilter(e){switch(e){case 9728:case 9986:case 9984:return oe.SCALE_MODES.NEAREST;case 9729:case 9987:case 9985:return oe.SCALE_MODES.LINEAR;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiMipMap(e){switch(e){case 9728:case 9729:return oe.MIPMAP_MODES.OFF;case 9986:case 9984:case 9987:case 9985:return oe.MIPMAP_MODES.ON;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureWrap(e){switch(e){case 33071:return oe.WRAP_MODES.CLAMP;case 33648:return oe.WRAP_MODES.MIRRORED_REPEAT;case 10497:return oe.WRAP_MODES.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(e)}`)}}static toPixiBlending(e){switch(e){case 0:return oe.BLEND_MODES.NORMAL;case 1:return oe.BLEND_MODES.ADD;case 2:return oe.BLEND_MODES.MULTIPLY;case 3:return oe.BLEND_MODES.SCREEN;default:throw new Error(`Unknown blendMode: ${String(e)}`)}}},ps=Q("@pixi/mesh"),pr=Q("@pixi/core"),ei=class Ae extends ps.Mesh{name="";static auxColor=[0,0,0,0];warnedTwoTint=!1;constructor(){const e=new ps.MeshGeometry;e.getBuffer("aVertexPosition").static=!1,e.getBuffer("aTextureCoord").static=!1;const s=new ps.MeshMaterial(pr.Texture.EMPTY);super(e,s)}updateFromSpineData(e,s,i,r,h,o,n,a){this.texture=e.texture;const l=h/(a?12:8)*2,c=this.geometry.getBuffer("aTextureCoord");c.data?.length!==l&&(c.data=new Float32Array(l));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==l&&(d.data=new Float32Array(l));let u=0,m=c.data,f=d.data;for(let p=0;p<h;p+=a?12:8){let b=p;f[u]=r[b++],f[u+1]=r[b++],b+=4,m[u]=r[b++],m[u+1]=r[b++],u+=2}a&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),Ae.auxColor[0]=r[2],Ae.auxColor[1]=r[3],Ae.auxColor[2]=r[4],Ae.auxColor[3]=r[5],this.tint=Ae.auxColor,this.alpha=Ae.auxColor[3],this.blendMode=Ue.toPixiBlending(s);const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const p=g.data;for(let b=0;b<n;b++)p[b]=o[b]}this.name=i,c.update(),d.update(),g.update()}},wr=Q("@pixi/mesh"),Ee=Q("@pixi/core"),ti=class extends Ee.Geometry{constructor(t=!1){super();const e=new Ee.Buffer(void 0),s=new Ee.Buffer(void 0,!0),i=new Ee.Buffer(void 0,!0,!0);this.addAttribute("aVertexPosition",e,2,!1,Ee.TYPES.FLOAT),this.addAttribute("aTextureCoord",s,2,!1,Ee.TYPES.FLOAT),this.addIndex(i)}},xe=Q("@pixi/core"),br=`
|
|
attribute vec2 aVertexPosition;
|
|
attribute vec2 aTextureCoord;
|
|
|
|
uniform mat3 projectionMatrix;
|
|
uniform mat3 translationMatrix;
|
|
uniform mat3 uTextureMatrix;
|
|
|
|
varying vec2 vTextureCoord;
|
|
|
|
void main(void)
|
|
{
|
|
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
}
|
|
`,yr=`
|
|
varying vec2 vTextureCoord;
|
|
uniform vec4 uColor;
|
|
uniform vec4 uDarkColor;
|
|
|
|
uniform sampler2D uSampler;
|
|
|
|
void main(void)
|
|
{
|
|
vec4 texColor = texture2D(uSampler, vTextureCoord);
|
|
gl_FragColor.a = texColor.a * uColor.a;
|
|
gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb;
|
|
}
|
|
`,si=class extends xe.Shader{uvMatrix;batchable;pluginName;_tintRGB;_darkTintRGB;_colorDirty;_alpha;_tintColor;_darkTintColor;constructor(t){const e={uSampler:t??xe.Texture.EMPTY,alpha:1,uTextureMatrix:xe.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},s={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(xe.Program.from(br,yr),e),this._colorDirty=!1,this.uvMatrix=new xe.TextureMatrix(e.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new xe.Color(s.tint),this._darkTintColor=new xe.Color(s.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=s.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(t){t!==this.darkTint&&(this._darkTintColor.setValue(t),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,xe.Color.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),xe.Color.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}},ii=class extends wr.Mesh{_darkTintRGB=0;constructor(t){super(new ti,new si(t),void 0,void 0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(t){this.shader.darkTint=t}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(t){const e=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._darkTintRGB=s._darkTintRGB,this._texture=s.texture;const i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)}},et=class Z extends ii{name="";static auxColor=[0,0,0,0];constructor(){super()}updateFromSpineData(e,s,i,r,h,o,n,a){this.texture=e.texture;const l=h/(a?12:8)*2,c=this.geometry.getBuffer("aTextureCoord");c.data?.length!==l&&(c.data=new Float32Array(l));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==l&&(d.data=new Float32Array(l));let u=0,m=c.data,f=d.data;for(let p=0;p<h;p+=a?12:8){let b=p;f[u]=r[b++],f[u+1]=r[b++],b+=4,m[u]=r[b++],m[u+1]=r[b++],u+=2}a?(Z.auxColor[0]=r[8],Z.auxColor[1]=r[9],Z.auxColor[2]=r[10],Z.auxColor[3]=r[11],this.darkTint=Z.auxColor,Z.auxColor[0]=r[2],Z.auxColor[1]=r[3],Z.auxColor[2]=r[4],Z.auxColor[3]=r[5],this.tint=Z.auxColor):(Z.auxColor[0]=r[2],Z.auxColor[1]=r[3],Z.auxColor[2]=r[4],Z.auxColor[3]=r[5],this.tint=Z.auxColor),this.blendMode=Ue.toPixiBlending(s),this.alpha=Z.auxColor[3];const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const p=g.data;for(let b=0;b<n;b++)p[b]=o[b]}this.name=i,c.update(),d.update(),g.update()}},tt=Q("@pixi/assets"),vr=Q("@pixi/core"),ri=Q("@pixi/core"),ni=Q("@pixi/display"),Cr=Q("@pixi/graphics"),Rr=Q("@pixi/events"),Sr=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Tr=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new Pe(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(2);const s=e.getBoundsRect(this.clipping?new Ze:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Ar=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Gt(t.state.data),s=new Pe(t.skeleton.data),i=this.clipping?new Ze:void 0,r=s.data;if(this.skins.length>0){let o=new Oe("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const h=this.animation!=null?r.findAnimation(this.animation):null;if(h==null){s.updateWorldTransform(2);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,h,!1);const c=Math.max(h.duration/this.timeStep,1);for(let u=0;u<c;u++){const m=u>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(i);o=Math.min(o,f.x),n=Math.min(n,f.y),a=Math.max(a,f.x+f.width),l=Math.max(l,f.y+f.height)}const d={x:o,y:n,width:a-o,height:l-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},kr=class j extends ni.Container{skeleton;state;darkTint=!1;hasNeverUpdated=!0;_debug=void 0;get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}slotMeshFactory=()=>new ei;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};_autoUpdate=!1;_ticker=ri.Ticker.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!e&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=e}get ticker(){return this._ticker}set ticker(e){e=e??ri.Ticker.shared,this._ticker!==e&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),e.add(this.internalUpdate,this)),this._ticker=e)}meshesCache=new Map;static vectorAux=new Le;static clipper=new Ze;static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;static DARK_VERTEX_SIZE=12;lightColor=new V;darkColor=new V;_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(e){this._boundsProvider=e,e?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}_boundsPoint=new vr.Point;_boundsSpineID=-1;_boundsSpineDirty=!0;constructor(e,s){if(e instanceof _e)e={...s,skeletonData:e};else if(s)throw new Error("You cannot use options and oldOptions together.");super();const i=e instanceof _e?e:e.skeletonData;this.skeleton=new Pe(i);const r=new Vs(i);this.state=new Gt(r),e?.darkTint!==void 0||s?.slotMeshFactory===void 0?(this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(h=>!!h.data.darkColor):e?.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new et)):this.initializeMeshFactory(s?.slotMeshFactory),e?.ticker&&(this._ticker=e.ticker),this.autoUpdate=e?.autoUpdate??!0,this.boundsProvider=e.boundsProvider}initializeMeshFactory(e){if(e){this.slotMeshFactory=e;const s=this.slotMeshFactory();s instanceof et&&(this.darkTint=!0),s.destroy()}else for(let s=0;s<this.skeleton.slots.length;s++)if(this.skeleton.slots[s].data.darkColor){this.slotMeshFactory=()=>new et,this.darkTint=!0;break}}update(e){this.internalUpdate(0,e)}internalUpdate(e,s){this.hasNeverUpdated=!1;const i=s??this._ticker.deltaMS/1e3;this.state.update(i),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(i),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}updateTransform(){this.renderMeshes(),this.sortChildren(),this.debug?.renderDebug(this),super.updateTransform()}destroy(e){this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,s]of this.meshesCache)s?.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(let s in this.clippingSlotToPixiMasks)this.clippingSlotToPixiMasks[s].mask?.destroy(),delete this.clippingSlotToPixiMasks[s];super.destroy(e)}resetMeshes(){for(const[,e]of this.meshesCache)e.zIndex=-1,e.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(e){return this.meshesCache.has(e)}getMeshForSlot(e){if(this.hasMeshForSlot(e)){let s=this.meshesCache.get(e);return s.visible=!0,s}else{let s=this.slotMeshFactory();return this.addChild(s),this.meshesCache.set(e,s),s}}slotsObject=new Map;getSlotFromRef(e){let s;if(typeof e=="number"?s=this.skeleton.slots[e]:typeof e=="string"?s=this.skeleton.findSlot(e):s=e,!s)throw new Error(`No slot found with the given slot reference: ${e}`);return s}addSlotObject(e,s,i){let r=this.getSlotFromRef(e);const h=this.slotsObject.get(r)?.container;if(!(h&&h===s)){for(const[o,{container:n}]of this.slotsObject)if(o!==r&&n===s){this.removeSlotObject(o,s);break}h&&this.removeChild(h),this.slotsObject.set(r,{container:s,followAttachmentTimeline:i?.followAttachmentTimeline||!1,followSlotColor:i?.followSlotColor||!1}),this.addChild(s)}}getSlotObject(e){const s=this.slotsObject.get(this.getSlotFromRef(e));return s?s.container:void 0}removeSlotObject(e,s){let i=this.getSlotFromRef(e),r=this.slotsObject.get(i)?.container;r&&(s&&s!==r||(this.removeChild(r),this.slotsObject.delete(i)))}removeSlotObjects(){for(const[,e]of this.slotsObject)e.container.removeFromParent();this.slotsObject.clear()}verticesCache=X.newFloatArray(1024);clippingSlotToPixiMasks={};updateSlotObject(e,s,i){const{container:r,followAttachmentTimeline:h}=e,o=h?!!s.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(s)&&o,r.visible){let n=s.bone;const a=r.localTransform;a.a=n.a,a.b=n.c,a.c=-n.b,a.d=-n.d,a.tx=n.worldX,a.ty=n.worldY,r.transform.setFromMatrix(a),r.zIndex=i,r.alpha=this.skeleton.color.a*s.color.a,e.followSlotColor&&this.setSlotObjectTint(r,255*this.skeleton.color.r*s.color.r<<16|255*this.skeleton.color.g*s.color.g<<8|255*this.skeleton.color.b*s.color.b)}}setSlotObjectTint(e,s){const i=e;"tint"in i&&(i.tint=s);for(const r of i.children??[])this.setSlotObjectTint(r,s)}currentClippingSlot;updateAndSetPixiMask(e,s){const i=e.attachment;if(i&&i instanceof Ce){const o=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot;const h=this.slotsObject.get(e);if(r&&h){let o=r.mask;if(o||(o=ai.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const l=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,l,c,0,2),o.clear().lineStyle(0).beginFill(0).drawPolygon(c).endFill()}h.container.mask=o}else h?.container.mask&&(h.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof Ce)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),ai.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){this.resetMeshes();let e=null,s=null;const i=this.skeleton.drawOrder;for(let r=0,h=i.length,o=0;r<h;r++){const n=i[r];let a=this.slotsObject.get(n),l=r+o;a&&(this.updateSlotObject(a,n,l+1),o++),this.updateAndSetPixiMask(n,r===i.length-1);const c=n.darkColor!=null,d=j.clipper.isClipping()?2:c?j.DARK_VERTEX_SIZE:j.VERTEX_SIZE;if(!n.bone.active){j.clipper.clipEndWithSlot(n);continue}const u=n.getAttachment();let m,f,g=0;if(u instanceof Ve){const p=u;m=p.color,g=d*4,p.computeWorldVertices(n,this.verticesCache,0,d),e=j.QUAD_TRIANGLES,s=p.uvs,f=p.region?.texture}else if(u instanceof Me){const p=u;m=p.color,g=(p.worldVerticesLength>>1)*d,g>this.verticesCache.length&&(this.verticesCache=X.newFloatArray(g)),p.computeWorldVertices(n,0,p.worldVerticesLength,this.verticesCache,0,d),e=p.triangles,s=p.uvs,f=p.region?.texture}else if(u instanceof Ce){j.clipper.clipStart(n,u);continue}else{this.hasMeshForSlot(n)&&(this.getMeshForSlot(n).visible=!1),j.clipper.clipEndWithSlot(n);continue}if(f!=null){const b=n.bone.skeleton.color,x=n.color,w=b.a*x.a*m.a;this.lightColor.set(b.r*x.r*m.r,b.g*x.g*m.g,b.b*x.b*m.b,w),n.darkColor!=null?this.darkColor.set(n.darkColor.r,n.darkColor.g,n.darkColor.b,1):this.darkColor.set(0,0,0,1);let y,v,C,S;if(j.clipper.isClipping())j.clipper.clipTriangles(this.verticesCache,e,e.length,s,this.lightColor,this.darkColor,c),y=j.clipper.clippedVertices,v=y.length,C=j.clipper.clippedTriangles,S=C.length;else{const k=this.verticesCache;for(let Y=2,M=0,E=g;Y<E;Y+=d,M+=2){let F=Y;k[F++]=this.lightColor.r,k[F++]=this.lightColor.g,k[F++]=this.lightColor.b,k[F++]=this.lightColor.a,k[F++]=s[M],k[F++]=s[M+1],c&&(k[F++]=this.darkColor.r,k[F++]=this.darkColor.g,k[F++]=this.darkColor.b,k[F++]=this.darkColor.a)}y=this.verticesCache,v=g,C=e,S=e.length}if(v==0||S==0){j.clipper.clipEndWithSlot(n);continue}const A=this.getMeshForSlot(n);A.renderable=!0,A.zIndex=l,A.updateFromSpineData(f,n.data.blendMode,n.data.name,y,v,C,S,c)}j.clipper.clipEndWithSlot(n)}j.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const e=this.transform;if(this._boundsSpineID===e._worldID)return;this.updateBounds();const s=this._localBounds,i=this._boundsPoint;i.set(s.minX,s.minY),e.worldTransform.apply(i,i),this._bounds.minX=i.x,this._bounds.minY=i.y,i.set(s.maxX,s.maxY),e.worldTransform.apply(i,i),this._bounds.maxX=i.x,this._bounds.maxY=i.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new ni.Bounds);const e=this._boundsProvider.calculateBounds(this),s=this._localBounds;s.clear(),s.minX=e.x,s.minY=e.y,s.maxX=e.x+e.width,s.maxY=e.y+e.height,this.hitArea=this._localBounds.getRectangle()}setBonePosition(e,s){const i=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cannot set bone position, bone ${String(i)} not found`);if(j.vectorAux.set(s.x,s.y),e.parent){const r=e.parent.worldToLocal(j.vectorAux);e.x=r.x,e.y=r.y}else e.x=j.vectorAux.x,e.y=j.vectorAux.y}getBonePosition(e,s){const i=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(s||(s={x:0,y:0}),s.x=e.worldX,s.y=e.worldY,s):(console.error(`Cannot get bone position! Bone ${String(i)} not found`),s)}skeletonToPixiWorldCoordinates(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,s){this.pixiWorldCoordinatesToSkeleton(e),s.parent?s.parent.worldToLocal(e):s.worldToLocal(e)}static skeletonCache=Object.create(null);static from(e,s,i){if(typeof e=="string")return j.oldFrom(e,s,i);const{skeleton:r,atlas:h,scale:o=1,darkTint:n,autoUpdate:a,boundsProvider:l,ticker:c}=e,d=`${r}-${h}-${o}`;let u=j.skeletonCache[d];if(!u){const m=tt.Assets.get(r),f=tt.Assets.get(h),g=new Zt(f);let p=m instanceof Uint8Array?new fs(g):new gs(g);p.scale=o,u=p.readSkeletonData(m),j.skeletonCache[d]=u}return new j({skeletonData:u,darkTint:n,autoUpdate:a,boundsProvider:l,ticker:c})}static oldFrom(e,s,i){const r=`${e}-${s}-${i?.scale??1}`;let h=j.skeletonCache[r];if(h)return new j(h,i);const o=tt.Assets.get(e),n=tt.Assets.get(s),a=new Zt(n);let l=o instanceof Uint8Array?new fs(a):new gs(a);return l.scale=i?.scale??1,h=l.readSkeletonData(o),j.skeletonCache[r]=h,new this(h,i)}get tint(){return this.skeleton.color.toRgb888()}set tint(e){V.rgb888ToColor(this.skeleton.color,e)}},ai=new ke(()=>new Cr.Graphics);Pe.yDown=!0;var ws=Q("@pixi/display"),ce=Q("@pixi/graphics"),Ir=Q("@pixi/text"),Mr=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}const e={parentDebugContainer:new ws.Container,bones:new ws.Container,skeletonXY:new ce.Graphics,regionAttachmentsShape:new ce.Graphics,meshTrianglesLine:new ce.Graphics,meshHullLine:new ce.Graphics,clippingPolygon:new ce.Graphics,boundingBoxesRect:new ce.Graphics,boundingBoxesCircle:new ce.Graphics,boundingBoxesPolygon:new ce.Graphics,pathsCurve:new ce.Graphics,pathsLine:new ce.Graphics,eventText:new ws.Container,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(t.scale.x||t.scale.y||1),h=new Ir.Text(i.data.name,{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"});h.scale.x=Math.sign(t.scale.x),h.anchor.set(.5),e.eventText.addChild(h),setTimeout(()=>{h.destroyed||h.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let r=e.bones.children.length;r>0;r--)e.bones.children[r-1].destroy({children:!0,texture:!0,baseTexture:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const r of e.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(t,e,s,i){const r=t.skeleton,h=r.x,o=r.y,n=r.bones;e.skeletonXY.lineStyle(s,this.skeletonXYColor,1);for(let l=0,c=n.length;l<c;l++){const d=n[l],u=d.data.length,m=h+d.worldX,f=o+d.worldY,g=h+u*d.a+d.worldX,p=o+u*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const b=Math.abs(m-g),x=Math.abs(f-p),w=Math.pow(b,2),y=x,v=Math.pow(x,2),C=Math.sqrt(w+v),S=Math.pow(C,2),A=Math.PI/180,k=Math.acos((S+v-w)/(2*y*C))||0;if(C===0)continue;const Y=new ce.Graphics;e.bones.addChild(Y);const M=C/50/i;Y.beginFill(this.bonesColor,1),Y.drawPolygon(0,0,0-M,C-M*3,0,C-M,0+M,C-M*3),Y.endFill(),Y.x=m,Y.y=f,Y.pivot.y=C;let E=0;m<g&&f<p?E=-k+180*A:m>g&&f<p?E=180*A+k:m>g&&f>p?E=-k:m<g&&f>p?E=k:f===p&&m<g?E=90*A:f===p&&m>g?E=-90*A:m===g&&f<p?E=180*A:m===g&&f>p&&(E=0),Y.rotation=E,Y.lineStyle(s+M/2.4,this.bonesColor,1),Y.beginFill(0,.6),Y.drawCircle(0,C,M*1.2),Y.endFill()}const a=s*3;e.skeletonXY.moveTo(h-a,o-a),e.skeletonXY.lineTo(h+a,o+a),e.skeletonXY.moveTo(h+a,o-a),e.skeletonXY.lineTo(h-a,o+a)}drawRegionAttachmentsFunc(t,e,s){const r=t.skeleton.slots;e.regionAttachmentsShape.lineStyle(s,this.regionAttachmentsColor,1);for(let h=0,o=r.length;h<o;h++){const n=r[h],a=n.getAttachment();if(a==null||!(a instanceof Ve))continue;const l=a,c=new Float32Array(8);l.computeWorldVertices(n,c,0,2),e.regionAttachmentsShape.drawPolygon(Array.from(c.slice(0,8)))}}drawMeshHullAndMeshTriangles(t,e,s){const r=t.skeleton.slots;e.meshHullLine.lineStyle(s,this.meshHullColor,1),e.meshTrianglesLine.lineStyle(s,this.meshTrianglesColor,1);for(let h=0,o=r.length;h<o;h++){const n=r[h];if(!n.bone.active)continue;const a=n.getAttachment();if(a==null||!(a instanceof Me))continue;const l=a,c=new Float32Array(l.worldVerticesLength),d=l.triangles;let u=l.hullLength;if(l.computeWorldVertices(n,0,l.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,f=d.length;m<f;m+=3){const g=d[m]*2,p=d[m+1]*2,b=d[m+2]*2;e.meshTrianglesLine.moveTo(c[g],c[g+1]),e.meshTrianglesLine.lineTo(c[p],c[p+1]),e.meshTrianglesLine.lineTo(c[b],c[b+1])}if(this.drawMeshHull&&u>0){u=(u>>1)*2;let m=c[u-2],f=c[u-1];for(let g=0,p=u;g<p;g+=2){const b=c[g],x=c[g+1];e.meshHullLine.moveTo(b,x),e.meshHullLine.lineTo(m,f),m=b,f=x}}}}drawClippingFunc(t,e,s){const r=t.skeleton.slots;e.clippingPolygon.lineStyle(s,this.clippingPolygonColor,1);for(let h=0,o=r.length;h<o;h++){const n=r[h];if(!n.bone.active)continue;const a=n.getAttachment();if(a==null||!(a instanceof Ce))continue;const l=a,c=l.worldVerticesLength,d=new Float32Array(c);l.computeWorldVertices(n,0,c,d,0,2),e.clippingPolygon.drawPolygon(Array.from(d))}}drawBoundingBoxesFunc(t,e,s){e.boundingBoxesRect.lineStyle(s,this.boundingBoxesRectColor,5);const i=new Qs;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.drawRect(i.minX,i.minY,i.getWidth(),i.getHeight());const r=i.polygons,h=(o,n,a)=>{if(e.boundingBoxesPolygon.lineStyle(s,this.boundingBoxesPolygonColor,1),e.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),a<3)throw new Error("Polygon must contain at least 3 vertices");const l=[],c=s*2;for(let d=0,u=o.length;d<u;d+=2){const m=o[d],f=o[d+1];e.boundingBoxesCircle.lineStyle(0),e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(m,f,c),e.boundingBoxesCircle.endFill(),l.push(m,f)}e.boundingBoxesPolygon.drawPolygon(l),e.boundingBoxesPolygon.endFill()};for(let o=0,n=r.length;o<n;o++){const a=r[o];h(a,0,a.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;e.pathsCurve.lineStyle(s,this.pathsCurveColor,1),e.pathsLine.lineStyle(s,this.pathsLineColor,1);for(let h=0,o=r.length;h<o;h++){const n=r[h];if(!n.bone.active)continue;const a=n.getAttachment();if(a==null||!(a instanceof Ye))continue;const l=a;let c=l.worldVerticesLength;const d=new Float32Array(c);l.computeWorldVertices(n,0,c,d,0,2);let u=d[2],m=d[3],f=0,g=0;if(l.closed){const p=d[0],b=d[1],x=d[c-2],w=d[c-1];f=d[c-4],g=d[c-3],e.pathsCurve.moveTo(u,m),e.pathsCurve.bezierCurveTo(p,b,x,w,f,g),e.pathsLine.moveTo(u,m),e.pathsLine.lineTo(p,b),e.pathsLine.moveTo(f,g),e.pathsLine.lineTo(x,w)}c-=4;for(let p=4;p<c;p+=6){const b=d[p],x=d[p+1],w=d[p+2],y=d[p+3];f=d[p+4],g=d[p+5],e.pathsCurve.moveTo(u,m),e.pathsCurve.bezierCurveTo(b,x,w,y,f,g),e.pathsLine.moveTo(u,m),e.pathsLine.lineTo(b,x),e.pathsLine.moveTo(f,g),e.pathsLine.lineTo(w,y),u=f,m=g}}}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({baseTexture:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},bs=Q("@pixi/assets"),st=Q("@pixi/assets"),re=Q("@pixi/core"),it="spineTextureAtlasLoader",Yr={extension:re.ExtensionType.Asset,resolver:{test:t=>(0,st.checkExtension)(t,".atlas"),parse:t=>{const e=t.split(".");return{resolution:parseFloat(re.settings.RETINA_PREFIX?.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:it,extension:{type:re.ExtensionType.LoadParser,priority:st.LoaderParserPriority.Normal,name:it},test(t){return(0,st.checkExtension)(t,".atlas")},async load(t){const e=await re.settings.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[${it}] Failed to fetch ${t}: ${e.status} ${e.statusText}`);return await e.text()},testParse(t,e){const s=(0,st.checkExtension)(e.src,".atlas"),i=typeof t=="string",r=e.loadParser===it;return Promise.resolve((s||r)&&i)},unload(t){t.dispose()},async parse(t,e,s){const i=e.data||{};let r=re.utils.path.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const h=new Je(t);if(i.images instanceof re.BaseTexture||typeof i.images=="string"){const a=i.images;i.images={},i.images[h.pages[0].name]=a}const o=[];let n=!0;for(const a of s.parsers)if(a.name=="loadTextures"){n=a.config?.preferCreateImageBitmap;break}bs.Assets.setPreferences({preferCreateImageBitmap:!1});for(const a of h.pages){const l=a.name,c=i?.images?i.images[l]:void 0;if(c instanceof re.BaseTexture)a.setTexture(Ue.from(c));else{const d=c??re.utils.path.normalize([...r.split(re.utils.path.sep),l].join(re.utils.path.sep)),u={src:(0,bs.copySearchParams)(d,e.src),data:{...i.imageMetadata,alphaMode:a.pma?re.ALPHA_MODES.PMA:re.ALPHA_MODES.UNPACK}},m=s.load(u).then(f=>{a.setTexture(Ue.from(f.baseTexture))});o.push(m)}}return await Promise.all(o),bs.Assets.setPreferences({preferCreateImageBitmap:n}),h}}};re.extensions.add(Yr);var rt=Q("@pixi/assets"),nt=Q("@pixi/core"),at="spineSkeletonLoader";function Pr(t){return t.hasOwnProperty("bones")}function Er(t){return t instanceof Uint8Array}var Fr={extension:nt.ExtensionType.Asset,loader:{name:at,extension:{type:nt.ExtensionType.LoadParser,priority:rt.LoaderParserPriority.Normal,name:at},test(t){return(0,rt.checkExtension)(t,".skel")},async load(t){const e=await nt.settings.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[${at}] Failed to fetch ${t}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(t,e){const s=(0,rt.checkExtension)(e.src,".json")&&Pr(t),i=(0,rt.checkExtension)(e.src,".skel")&&Er(t),r=e.loadParser===at;return Promise.resolve(s||i||r)}}};nt.extensions.add(Fr);var we=Q("@pixi/core"),oi=class extends we.Geometry{_buffer;_indexBuffer;constructor(t=!1){super(),this._buffer=new we.Buffer(void 0,t,!1),this._indexBuffer=new we.Buffer(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,we.TYPES.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,we.TYPES.FLOAT).addAttribute("aColor",this._buffer,4,!0,we.TYPES.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,we.TYPES.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,we.TYPES.FLOAT).addIndex(this._indexBuffer)}},Fe=Q("@pixi/core"),Br=`
|
|
precision highp float;
|
|
attribute vec2 aVertexPosition;
|
|
attribute vec2 aTextureCoord;
|
|
attribute vec4 aColor;
|
|
attribute vec4 aDarkColor;
|
|
attribute float aTextureId;
|
|
|
|
uniform mat3 projectionMatrix;
|
|
uniform mat3 translationMatrix;
|
|
uniform vec4 tint;
|
|
|
|
varying vec2 vTextureCoord;
|
|
varying vec4 vColor;
|
|
varying vec4 vDarkColor;
|
|
varying float vTextureId;
|
|
|
|
void main(void){
|
|
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vTextureCoord = aTextureCoord;
|
|
vTextureId = aTextureId;
|
|
vColor = aColor * tint;
|
|
vDarkColor = aDarkColor * tint;
|
|
|
|
}
|
|
`,Xr=`
|
|
varying vec2 vTextureCoord;
|
|
varying vec4 vColor;
|
|
varying vec4 vDarkColor;
|
|
varying float vTextureId;
|
|
uniform sampler2D uSamplers[%count%];
|
|
|
|
void main(void){
|
|
vec4 color;
|
|
%forloop%
|
|
|
|
|
|
gl_FragColor.a = color.a * vColor.a;
|
|
gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb;
|
|
}
|
|
`,li=class extends Fe.BatchRenderer{static extension={name:"darkTintBatch",type:Fe.ExtensionType.RendererPlugin};constructor(t){super(t),this.shaderGenerator=new Fe.BatchShaderGenerator(Br,Xr),this.geometryClass=oi,this.vertexSize=7}packInterleavedGeometry(t,e,s,i,r){const{uint32View:h,float32View:o}=e,n=i/this.vertexSize,a=t.uvs,l=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,u=Math.min(t.worldAlpha,1),m=Fe.Color.shared.setValue(t._tintRGB).toPremultiplied(u,!0),f=Fe.Color.shared.setValue(t._darkTintRGB).premultiply(u,!0).toPremultiplied(1,!1);for(let g=0;g<c.length;g+=2)o[i++]=c[g],o[i++]=c[g+1],o[i++]=a[g],o[i++]=a[g+1],h[i++]=m,h[i++]=f,o[i++]=d;for(let g=0;g<l.length;g++)s[r++]=n+l[g]}};return Fe.extensions.add(li),Ii(As)})();
|