"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;s1&&(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 ei?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?e:Re.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;ethis.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.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e>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=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;e0&&(e%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l(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;ie)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;re)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;ut){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=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>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>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(st){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let r=i+18;for(i+=2;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[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;yi)this.apply(e,s,Number.MAX_VALUE,r,h,o,n),s=-1;else if(s>=a[l-1])return;if(i0&&a[c-1]==d;)c--}for(;c=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>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[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>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("",[],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;i0){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;u0)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;A1&&(h=1),i!=1&&(i=r.mixBlend));let o=h=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=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(;ar||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=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;i0){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=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[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;m0&&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.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= 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{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;h180?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&&xb*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)=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,Yvs&&(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;r0){y=d/y*f;for(let C=1;C0?B.degRad:-B.degRad}for(let y=0,v=3;y0){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;zO){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;Df){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,u0){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;i0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;pB.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;pB.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;as.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(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.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i= 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>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>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=0;b--)m[b]=-1;let f=X.newArray(l-u,0),g=0,p=0;for(let b=0;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>>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>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=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&&lh&&lr&&cr&&ct.minX&&this.minYt.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i=s||l=s){let c=i[n];c+(s-a)/(l-a)*(i[h]-c)=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;n3;){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;c0?(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=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>1,C=this.clipOutput,S=X.setArraySize(h,w+v*2);for(let k=0;k>1,K=this.clipOutput,R=X.setArraySize(l,I+z*m);for(let G=0;G>1,O=this.clipOutput,$=X.setArraySize(o,M+D*2),z=X.setArraySize(n,M+D*2);for(let R=0;R=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;Cb*(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>1;l0){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=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"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;p0){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;u0?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;snew 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>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;Ynew 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;lg&&fg&&f>p?E=-k:mp?E=k:f===p&&mg?E=-90*A:m===g&&fp&&(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;h0){u=(u>>1)*2;let m=c[u-2],f=c[u-1];for(let g=0,p=u;g{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(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