"use strict";if(typeof window<"u"&&window.PIXI){let e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/"))return window.PIXI}}var Tr=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},he=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,r=e.length;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(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new wt){return s.setFromString(t)}},X=class ht{static PI=3.1415927;static PI2=ht.PI*2;static invPI2=1/ht.PI2;static radiansToDegrees=180/ht.PI;static radDeg=ht.radiansToDegrees;static degreesToRadians=ht.PI/180;static degRad=ht.degreesToRadians;static clamp(t,s,r){return tr?r:t}static cosDeg(t){return Math.cos(t*ht.degRad)}static sinDeg(t){return Math.sin(t*ht.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ht.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ht.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,r){let i=Math.random(),h=s-t;return i<=(r-t)/h?t+Math.sqrt(i*h*(r-t)):s-Math.sqrt((1-i)*h*(s-r))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ks=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},As=class extends ks{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Ir=class extends As{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},B=class Mt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,r,i,h){for(let o=s,n=i;o=s?t:Mt.setArraySize(t,s,r)}static newArray(t,s){let r=new Array(t);for(let i=0;i0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;tthis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Fr=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t>1)*o;let n=t.bone.skeleton,a=t.deform,l=this.vertices,c=this.bones;if(!c){a.length>0&&(l=a);let f=t.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&&(r=this.regions.length-1);let i=this.regions[r];s.region!=i&&(s.region=i,s.updateRegion())}getPath(t,s){let r=t,i=(this.start+s).toString();for(let h=this.digits-i.length;h>0;h--)r+="0";return r+=i,r}static nextID(){return ie._nextID++}},Is=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(Is||{}),Ms=[0,1,2,3,4,5,6],Ut=class{name;timelines=[];timelineIds=new he;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t0&&(t%=this.duration));let a=this.timelines;for(let l=0,c=a.length;l(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Ys||{}),Fs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Fs||{}),O={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(e,t){this.propertyIds=t,this.frames=B.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let r=1;rt)return r-1;return s-1}static search(e,t,s){let r=e.length;for(let i=s;it)return i-s;return r-s}},at=class extends H{curves;constructor(e,t,s){super(e,s),this.curves=B.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=B.newFloatArray(t);B.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,r,i,h,o,n,a,l,c){let d=this.curves,u=this.getFrameCount()+e*18;s==0&&(d[t]=2+u);let m=(r-h*2+n)*.03,f=(i-o*2+a)*.03,g=((h-n)*3-r+l)*.006,p=((o-a)*3-i+c)*.006,b=m*2+g,x=f*2+p,w=(h-r)*.3+m+g*.16666667,y=(o-i)*.3+f+p*.16666667,v=r+w,C=i+y;for(let S=u+18;ue){let a=this.frames[t],l=this.frames[t+s];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}let h=r+18;for(r+=2;r=e){let a=i[r-2],l=i[r-1];return l+(e-a)/(i[r]-a)*(i[r+1]-l)}t+=this.getFrameEntries();let o=i[h-2],n=i[h-1];return n+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-n)}},it=class extends at{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}let r=this.curves[s>>1];switch(r){case 0:let i=t[s],h=t[s+1];return h+(e-i)/(t[s+2]-i)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,r-2)}getRelativeValue(e,t,s,r,i){if(e>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(i==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)*i,l.g+=(d-l.g)*i,l.b+=(u-l.b)*i}}},Se=class extends it{slotIndex=0;constructor(e,t,s){super(e,t,O.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s>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(i==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)*i,(u-l.g)*i,(m-l.b)*i,(f-l.a)*i),c.r+=(g-c.r)*i,c.g+=(p-c.g)*i,c.b+=(b-c.b)*i}}},Ae=class extends at{slotIndex=0;constructor(e,t,s){super(e,t,[O.rgb+"|"+s,O.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,r,i,h,o,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=r,this.frames[e+3]=i,this.frames[e+4]=h,this.frames[e+5]=o,this.frames[e+6]=n}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,l=n.color,c=n.darkColor;if(se){let n=this.frames[t];return s[r+1]*(e-n)/(s[r]-n)}let i=r+18;for(r+=2;r=e){let n=s[r-2],a=s[r-1];return a+(e-n)/(s[r]-n)*(s[r+1]-a)}let h=s[i-2],o=s[i-1];return o+(1-o)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,r,i,h,o){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof ct)||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(i==1)if(h==3){let w=a;if(w.bones)for(let y=0;yr)this.apply(t,s,Number.MAX_VALUE,i,h,o,n),s=-1;else if(s>=a[l-1])return;if(r0&&a[c-1]==d;)c--}for(;c=a[c];c++)i.push(this.events[c])}},kt=class br extends H{static propertyIds=[""+O.drawOrder];drawOrders;constructor(t){super(t,br.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,r){this.frames[t]=s,this.drawOrders[t]=r}apply(t,s,r,i,h,o,n){if(n==1){o==0&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(r>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)*i,n.mixX=f.mixX+(c-f.mixX)*i,n.mixY=f.mixY+(d-f.mixY)*i}else n.mixRotate+=(l-n.mixRotate)*i,n.mixX+=(c-n.mixX)*i,n.mixY+=(d-n.mixY)*i}},ft=class extends it{constraintIndex=0;constructor(e,t,s,r){super(e,t,r+"|"+s),this.constraintIndex=s}apply(e,t,s,r,i,h,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,i,h,this.get(l),this.setup(l),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,i,h,this.get(n),this.setup(n)))}},Ee=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Xe=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Be=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Re=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Le=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ve=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},De=class extends ft{constructor(e,t,s){super(e,t,s,O.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ne=class yr extends H{static propertyIds=[O.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,yr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,r,i,h,o,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const l=this.frames;if(s>r)this.apply(t,s,Number.MAX_VALUE,[],h,o,n),s=-1;else if(s>=l[l.length-1])return;if(!(r=l[H.search1(l,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},_e=class mt extends H{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,r){super(t,[O.sequence+"|"+s+"|"+r.sequence.id]),this.slotIndex=s,this.attachment=r}getFrameEntries(){return mt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,r,i,h){let o=this.frames;t*=mt.ENTRIES,o[t]=s,o[t+mt.MODE]=r|i<<4,o[t+mt.DELAY]=h}apply(t,s,r,i,h,o,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let l=a.attachment,c=this.attachment;if(l!=c&&(!(l instanceof ct)||l.timelineAttachment!=c))return;if(n==1){o==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(r>4,b=this.attachment.sequence.regions.length,x=Ms[f&15];if(x!=0)switch(p+=(r-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}},Oe=class ne{static _emptyAnimation=new Ut("",[],0);static emptyAnimation(){return ne._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Es(this);propertyIDs=new he;animationsChanged=!1;trackEntryPool=new St(()=>new Ps);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let r=0,i=s.length;r0){if(h.delay-=o,h.delay>0)continue;o=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=o,this.setCurrent(r,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[r]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){let r=t.mixingFrom;if(!r)return!0;let i=this.updateMixingFrom(r,s);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((r.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=r.mixingFrom,r.mixingFrom!=null&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),i):(r.trackTime+=s*r.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,r=this.tracks,i=!1;for(let u=0,m=r.length;u0)continue;i=!0;let g=u==0?1:f.mixBlend,p=f.alpha;f.mixingFrom?p*=this.applyMixingFrom(f,t,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),r!=1&&(r=i.mixBlend));let o=h=i.alphaAttachmentThreshold):(B.webkit602BugfixHelper(A,r),n&&v instanceof kt&&S==0&&(C=0),v.apply(s,u,f,g,A,S,C))}}return t.mixDuration>0&&this.queueEvents(i,m),this.events.length=0,i.nextAnimationLast=m,i.nextTrackLast=i.trackTime,h}applyAttachmentTimeline(t,s,r,i,h){var o=s.slots[t.slotIndex];o.bone.active&&(r=0,w=g>=0;Math.abs(p)<=90&&X.signum(p)!=X.signum(f)&&(Math.abs(g-b)>180?(m+=360*X.signum(g),w=x):b!=0?m-=360*X.signum(g):w=x),w!=x&&(m+=360*X.signum(g)),o[n]=m}o[n+1]=f,l.rotation=d+m*i}queueEvents(t,s){let r=t.animationStart,i=t.animationEnd,h=i-r,o=t.trackLast%h,n=this.events,a=0,l=n.length;for(;ai||this.queue.event(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=i&&t.animationLast=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let r=s;for(;;){let i=r.mixingFrom;if(!i)break;this.queue.end(i),r.mixingFrom=null,r.mixingTo=null,r=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,r){let i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(r&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(s.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,r=!1){let i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,i,r)}setAnimationWith(t,s,r=!1){if(!s)throw new Error("animation cannot be null.");let i=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,i=!1):this.clearNext(h));let o=this.trackEntry(t,s,r,h);return this.setCurrent(t,o,i),this.queue.drain(),o}addAnimation(t,s,r=!1,i=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,r,i)}addAnimationWith(t,s,r=!1,i=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let o=this.trackEntry(t,s,r,h);return h?(h.next=o,o.previous=h,i<=0&&(i=Math.max(i+h.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(t,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(t,s=0){let r=this.setAnimationWith(t,ne.emptyAnimation(),!1);return r.mixDuration=s,r.trackEnd=s,r}addEmptyAnimation(t,s=0,r=0){let i=this.addAnimationWith(t,ne.emptyAnimation(),!1,r);return r<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let r=0,i=this.tracks.length;r0){h[a]=Bs,o[a]=d;continue t}break}h[a]=Gt}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ps=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime=0}},Es=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Xs||{}),Pr=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},zt=0,Ue=1,qe=2,Gt=3,Bs=4,We=1,Rs=2,Ls=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);this.setMixWith(r,i,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let r=e.name+"."+t.name;this.animationToMixTime[r]=s}getMix(e,t){let s=e.name+"."+t.name,r=this.animationToMixTime[s];return r===void 0?this.defaultMix:r}},ze=class vr extends ct{color=new D(1,1,1,1);constructor(t){super(t)}copy(){let t=new vr(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},pt=class Cr extends ct{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Cr(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Ge=class{_image;constructor(e){this._image=e}getImage(){return this._image}},$t=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))($t||{}),Vs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Vs||{}),Ds=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Er=class extends Ge{setFilters(e,t){}setWraps(e,t){}dispose(){}},Ht=class{pages=new Array;regions=new Array;constructor(e){let t=new Xr(e),s=new Array(4),r={};r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.format=()=>{},r.filter=l=>{l.minFilter=B.enumValue($t,s[1]),l.magFilter=B.enumValue($t,s[2])},r.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=10497),s[1].indexOf("y")!=-1&&(l.vWrap=10497)},r.pma=l=>{l.pma=s[1]=="true"};var i={};i.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},i.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},i.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},i.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},i.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},i.index=l=>{l.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let o=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)o=null,h=t.readLine();else if(o){let l=new $e(o,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=i[s[0]];if(d)d(l);else{n||(n=[]),a||(a=[]),n.push(s[0]);let 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 Ns(h.trim());t.readEntry(s,h=t.readLine())!=0;){let l=r[s[0]];l&&l(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let r=1,i=s+1;;r++){let h=t.indexOf(",",i);if(h==-1)return e[r]=t.substr(i).trim(),r;if(e[r]=t.substr(i,h-i).trim(),i=h+1,r==4)return 4}}},Ns=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},$e=class extends Ds{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},At=class ps extends ct{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=B.newFloatArray(t.length));let s=this.uvs,r=this.uvs.length,i=this.region.u,h=this.region.v,o=0,n=0;if(this.region instanceof $e){let a=this.region,l=a.page,c=l.width,d=l.height;switch(a.degrees){case 90:i-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},Kt=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Kt||{}),je=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,r,i,h,o){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=h,this.ashearY=o;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,g=(s+h)*X.degRad,p=(s+90+o)*X.degRad;this.a=Math.cos(g)*r*m,this.b=Math.cos(p)*i*m,this.c=Math.sin(g)*r*f,this.d=Math.sin(p)*i*f,this.worldX=e*m+u.x,this.worldY=t*f+u.y;return}let a=n.a,l=n.b,c=n.c,d=n.d;switch(this.worldX=a*e+l*t+n.worldX,this.worldY=c*e+d*t+n.worldY,this.inherit){case 0:{const u=(s+h)*X.degRad,m=(s+90+o)*X.degRad,f=Math.cos(u)*r,g=Math.cos(m)*i,p=Math.sin(u)*r,b=Math.sin(m)*i;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)*X.degRad,m=(s+90+o)*X.degRad;this.a=Math.cos(u)*r,this.b=Math.cos(m)*i,this.c=Math.sin(u)*r,this.d=Math.sin(m)*i;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)*X.radDeg):(a=0,c=0,g=90-Math.atan2(d,l)*X.radDeg);const p=(s+h-g)*X.degRad,b=(s+o-g+90)*X.degRad,x=Math.cos(p)*r,w=Math.cos(b)*i,y=Math.sin(p)*r,v=Math.sin(b)*i;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*=X.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*=X.degRad,o=(90+o)*X.degRad;const w=Math.cos(h)*r,y=Math.cos(o)*i,v=Math.sin(h)*r,C=Math.sin(o)*i;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 e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*X.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*X.radDeg;return}let t=e.a,s=e.b,r=e.c,i=e.d,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*o-d*n,this.ay=d*l-c*a;let 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(t*i-s*r)/(t*t+r*r);s=-r*this.skeleton.scaleX*y/this.skeleton.scaleY,i=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*i-s*r),o=i*h,n=s*h;break}case 3:case 4:let p=X.cosDeg(this.rotation),b=X.sinDeg(this.rotation);t=(t*p+s*b)/this.skeleton.scaleX,r=(r*p+i*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+r*r);x>1e-5&&(x=1/x),t*=x,r*=x,x=Math.sqrt(t*t+r*r),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let w=X.PI/2+Math.atan2(r,t);s=Math.cos(w)*x,i=Math.sin(w)*x,h=1/(t*i-s*r),o=i*h,n=s*h,a=r*h,l=t*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)*X.radDeg,this.arotation=Math.atan2(f,u)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,r=e.y-this.worldY;return e.x=s*this.d*t-r*this.b*t,e.y=r*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=X.sinDeg(e),s=X.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*X.radDeg}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),s=Math.cos(e),r=this.a,i=this.b;this.a=s*r-t*this.c,this.b=s*i-t*this.d,this.c=t*r+s*this.c,this.d=t*i+s*this.d}},Bt=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},Br=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new Us,r=new Os){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=r}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let r=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(r)};requestAnimationFrame(r)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),r(h)},(h,o)=>{const n=`Couldn't load binary ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,r=>{this.success(t,e,r)},(r,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${r}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),r(h)},(h,o)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${o}`;this.error(s,e,n),i(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const r=this.cache.assetsLoaded[e],i=r!==void 0;return i&&(this.cache.assetsLoaded[e]=r.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(t,e,h),h)).catch(h=>this.error(s,e,h))),i}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,i)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),i(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(e,n);this.success(t,e,a),r(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(e,n);this.success(t,e,a),r(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),i(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},r){let i=e.lastIndexOf("/"),h=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,n)=>{this.downloader.downloadText(e,a=>{try{const l=this.createTextureAtlas(e,a);let c=l.pages.length,d=!1;if(c===0){this.success(t,e,l),o(l);return}for(let u of l.pages)this.loadTexture(r?r[u.name]:h+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(t,e,l),o(l)))},(m,f)=>{if(!d){const g=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,g),n(g)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,c),n(c)}},(a,l)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${l}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},r){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,h)=>{this.downloader.downloadText(e,o=>{try{const n=this.createTextureAtlas(e,o);this.success(t,e,n),i(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${e}: status ${o}, ${n}`;this.error(s,e,a),h(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(r,i)=>t(i),(r,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(r,i)=>t(i),(r,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?` `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof Ht){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new Ht(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const r of s.pages)r.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),r=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&r()},s}},Os=class ae{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ae.AVAILABLE_CACHES.get(t);if(s)return s;const r=new ae;return ae.AVAILABLE_CACHES.set(t,r),r}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},Us=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,r=new Uint8Array(s),i=0;i{this.finish(e,i.status,i.responseText)};i.onload=h,i.onerror=h,i.send()}downloadJson(e,t,s){this.downloadText(e,r=>{t(JSON.parse(r))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const r=this.rawDataUris[e];if(r&&!r.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(r))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",r||e,!0),i.responseType="arraybuffer";let h=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):h()},i.onerror=h,i.send()}start(e,t,s){let r=this.callbacks[e];try{if(r)return!0;this.callbacks[e]=r=[]}finally{r.push(t,s)}}finish(e,t,s){let r=this.callbacks[e];delete this.callbacks[e];let i=t==200||t==0?[s]:[t,s];for(let h=i.length-1,o=r.length;h180?u-=360:u<-180&&(u+=360);let g=e.ascaleX,p=e.ascaleY;if(r||i){switch(e.inherit){case 3:case 4:m=t-e.worldX,f=s-e.worldY}const b=e.data.length*g;if(b>1e-4){const x=m*m+f*f;if(r&&xb*b){const w=(Math.sqrt(x)/b-1)*o+1;g*=w,h&&(p*=w)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+u*o,g,p,e.ashearX,e.ashearY)}apply2(e,t,s,r,i,h,o,n,a){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,d=e.ascaleX,u=e.ascaleY,m=d,f=u,g=t.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=t.ax,y=0,v=0,C=0,S=e.a,A=e.b,T=e.c,Y=e.d,M=Math.abs(d-u)<=1e-4;!M||h?(y=0,v=S*w+e.worldX,C=T*w+e.worldY):(y=t.ay,v=S*w+A*y+e.worldX,C=T*w+Y*y+e.worldY);let P=e.parent;if(!P)throw new Error("IK parent must itself have a parent.");S=P.a,A=P.b,T=P.c,Y=P.d;let E=S*Y-A*T,I=v-P.worldX,F=C-P.worldY;E=Math.abs(E)<=1e-4?0:1/E;let L=(I*Y-F*A)*E-l,N=(F*S-I*T)*E-c,V=Math.sqrt(L*L+N*N),_=t.data.length*g,$,W;if(V<1e-4){this.apply1(e,s,r,!1,h,!1,a),t.updateWorldTransformWith(w,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}I=s-P.worldX,F=r-P.worldY;let j=(I*Y-F*A)*E-l,R=(F*S-I*T)*E-c,U=j*j+R*R;if(n!=0){n*=d*(g+1)*.5;let J=Math.sqrt(U),Z=J-V-_*d+n;if(Z>0){let tt=Math.min(1,Z/(n*2))-1;tt=(Z-n*(1-tt*tt))/J,j-=tt*j,R-=tt*R,U=j*j+R*R}}t:if(M){_*=d;let J=(U-V*V-_*_)/(2*V*_);J<-1?(J=-1,W=Math.PI*i):J>1?(J=1,W=0,h&&(S=(Math.sqrt(U)/(V+_)-1)*a+1,m*=S,o&&(f*=S))):W=Math.acos(J)*i,S=V+_*J,A=_*Math.sin(W),$=Math.atan2(R*S-j*A,j*S+R*A)}else{S=d*_,A=u*_;let J=S*S,Z=A*A,tt=Math.atan2(R,j);T=Z*V*V+J*U-J*Z;let nt=-2*Z*V,vt=Z-J;if(Y=nt*nt-4*vt*T,Y>=0){let Ct=Math.sqrt(Y);nt<0&&(Ct=-Ct),Ct=-(nt+Ct)*.5;let Ft=Ct/vt,Ss=T/Ct,Ot=Math.abs(Ft)=0){F=Math.sqrt(Ft)*i,$=tt-Math.atan2(F,Ot),W=Math.atan2(F/u,(Ot-V)/d);break t}}let Yt=X.PI,Nt=V-S,oe=Nt*Nt,ys=0,vs=0,_t=V+S,le=_t*_t,Cs=0;T=-S*V/(J-Z),T>=-1&&T<=1&&(T=Math.acos(T),I=S*Math.cos(T)+V,F=A*Math.sin(T),Y=I*I+F*F,Yle&&(vs=T,le=Y,_t=I,Cs=F)),U<=(oe+le)*.5?($=tt-Math.atan2(ys*i,Nt),W=Yt*i):($=tt-Math.atan2(Cs*i,_t),W=vs*i)}let G=Math.atan2(y,w)*x,st=e.arotation;$=($-G)*X.radDeg+p-st,$>180?$-=360:$<-180&&($+=360),e.updateWorldTransformWith(l,c,st+$*a,m,f,0,0),st=t.arotation,W=((W+G)*X.radDeg-t.ashearX)*x+b-st,W>180?W-=360:W<-180&&(W+=360),t.updateWorldTransformWith(w,y,st+W*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Ze=class extends Bt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},ts=class extends Bt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},es=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(es||{}),ss=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ss||{}),rs=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(rs||{}),Ws=class gt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0,h=t.bones.length;i0){y=d/y*f;for(let C=1;C0?X.degRad:-X.degRad}for(let y=0,v=3;y0){let M=C.a,P=C.b,E=C.c,I=C.d,F=0,L=0,N=0;if(n?F=g[v-1]:u[y+1]==0?F=g[v+2]:F=Math.atan2(Y,T),F-=Math.atan2(E,M),w){L=Math.cos(F),N=Math.sin(F);let V=C.data.length;p+=(V*(L*M-N*E)-T)*r,b+=(V*(N*M+L*E)-Y)*r}else F+=x;F>X.PI?F-=X.PI2:F<-X.PI&&(F+=X.PI2),F*=r,L=Math.cos(F),N=Math.sin(F),C.a=L*M-N*E,C.b=L*P-N*I,C.c=N*M+L*E,C.d=N*P+L*I}C.updateAppliedTransform()}}computeWorldPositions(t,s,r){let i=this.target,h=this.position,o=this.spaces,n=B.setArraySize(this.positions,s*3+2),a=this.world,l=t.closed,c=t.worldVerticesLength,d=c/6,u=gt.NONE;if(!t.constantSpeed){let V=t.lengths;d-=l?1:2;let _=V[d];this.data.positionMode==1&&(h*=_);let $;switch(this.data.spacingMode){case 2:$=_;break;case 3:$=_/s;break;default:$=1}a=B.setArraySize(this.world,8);for(let W=0,j=0,R=0;W_){u!=gt.AFTER&&(u=gt.AFTER,t.computeWorldVertices(i,c-6,4,a,0,2)),this.addAfterPosition(G-_,a,0,n,j);continue}for(;;R++){let st=V[R];if(!(G>st)){if(R==0)G/=st;else{let J=V[R-1];G=(G-J)/(st-J)}break}}R!=u&&(u=R,l&&R==d?(t.computeWorldVertices(i,c-4,4,a,0,2),t.computeWorldVertices(i,0,4,a,4,2)):t.computeWorldVertices(i,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,j,r||W>0&&U==0)}return n}l?(c+=2,a=B.setArraySize(this.world,c),t.computeWorldVertices(i,2,c-4,a,0,2),t.computeWorldVertices(i,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=B.setArraySize(this.world,c),t.computeWorldVertices(i,2,c,a,0,2));let m=B.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,T=0,Y=0,M=0,P=0,E=0,I=0;for(let V=0,_=2;Vf){this.addAfterPosition(R-f,a,c-4,n,_);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,T=((b-w)*3-g+v)*.006,Y=((x-y)*3-p+C)*.006,M=S*2+T,P=A*2+Y,E=(b-g)*.3+S+T*.16666667,I=(x-p)*.3+A+Y*.16666667,N=Math.sqrt(E*E+I*I),L[0]=N,U=1;U<8;U++)E+=M,I+=P,M+=T,P+=Y,N+=Math.sqrt(E*E+I*I),L[U]=N;E+=M,I+=P,N+=Math.sqrt(E*E+I*I),L[8]=N,E+=M+T,I+=P+Y,N+=Math.sqrt(E*E+I*I),L[9]=N,W=0}for(R*=N;;W++){let U=L[W];if(!(R>U)){if(W==0)R/=U;else{let G=L[W-1];R=W+(R-G)/(U-G)}break}}this.addCurvePosition(R*.1,g,p,b,x,w,y,v,C,n,_,r||V>0&&j==0)}return n}addBeforePosition(t,s,r,i,h){let o=s[r],n=s[r+1],a=s[r+2]-o,l=s[r+3]-n,c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addAfterPosition(t,s,r,i,h){let o=s[r+2],n=s[r+3],a=o-s[r],l=n-s[r+1],c=Math.atan2(l,a);i[h]=o+t*Math.cos(c),i[h+1]=n+t*Math.sin(c),i[h+2]=c}addCurvePosition(t,s,r,i,h,o,n,a,l,c,d,u){if(t==0||isNaN(t)){c[d]=s,c[d+1]=r,c[d+2]=Math.atan2(h-r,i-s);return}let m=t*t,f=m*t,g=1-t,p=g*g,b=p*g,x=g*t,w=x*3,y=g*w,v=w*t,C=s*b+i*y+o*v+a*f,S=r*b+h*y+n*v+l*f;c[d]=C,c[d+1]=S,u&&(t<.001?c[d+2]=Math.atan2(h-r,i-s):c[d+2]=Math.atan2(S-(r*p+h*x*2+n*m),C-(s*p+i*x*2+o*m)))}},Rr=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let 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||r){if(s){const w=(this.ux-c)*m;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=c}if(r){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),r&&(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*t*this.data.x),r&&(o.worldY+=this.yOffset*t*this.data.y)}if(i||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),i){C=(this.data.rotate+this.data.shearX)*t;let T=Math.atan2(A+this.ty,S+this.tx)-w-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*X.invPI2-.5)*X.PI2)*m,T=this.rotateOffset*C+w,y=Math.cos(T),v=Math.sin(T),h&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(S*y+A*v)*m/T))}else{y=Math.cos(w),v=Math.sin(w);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(S*y+A*v)*m/T)}if(u=this.remaining,u>=f){p==-1&&(p=Math.pow(this.damping,60*f));const T=this.massInverse*f,Y=this.strength,M=this.wind,P=It.yDown?-this.gravity:this.gravity,E=n/g;for(;;)if(u-=f,h&&(this.scaleVelocity+=(M*y-P*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),i){if(this.rotateVelocity-=((M*v+P*y)*E+this.rotateOffset*Y)*T,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*t*this.data.scaleX;o.a*=a,o.c*=a}e!=3&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const r=s*X.degRad,i=Math.cos(r),h=Math.sin(r),o=this.cx-e,n=this.cy-t;this.translate(o*i-n*h-o,o*h+n*i-n)}},zs=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ct)||!(this.attachment instanceof ct)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Gs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Pt;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0;r0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;pX.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=e;let A=Math.cos(S),T=Math.sin(S);x.a=A*w-T*v,x.b=A*y-T*C,x.c=T*w+A*v,x.d=T*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)*t,x.worldY+=(w.y-x.worldY)*s}if(r!=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)*r)/w),x.a*=w,x.c*=w}if(i!=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)*i)/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>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.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 e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=t!=0||s!=0,n=this.target,a=n.a,l=n.b,c=n.c,d=n.d,u=a*d-l*c>0?X.degRad:-X.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let p=0,b=g.length;pX.PI?S-=X.PI2:S<-X.PI&&(S+=X.PI2),S*=e;let A=Math.cos(S),T=Math.sin(S);x.a=A*w-T*v,x.b=A*y-T*C,x.c=T*w+A*v,x.d=T*y+A*C}if(o){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=w.x*t,x.worldY+=w.y*s}if(r!=0){let w=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*r+1;x.a*=w,x.c*=w}if(i!=0){let w=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*i+1;x.b*=w,x.d*=w}if(h>0){let w=Math.atan2(d,l)-Math.atan2(c,a);w>X.PI?w-=X.PI2:w<-X.PI&&(w+=X.PI2);let y=x.b,v=x.d;w=Math.atan2(v,y)+(w-X.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 e=this.mixRotate,t=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,h=this.mixShearY,o=this.target,n=this.bones;for(let a=0,l=n.length;as.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Pt,r=new Pt;return this.getBounds(s,r,void 0,t),{x:s.x,y:s.y,width:r.x,height:r.y}}getBounds(t,s,r=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))($s||{}),Hs=class extends Bt{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Rt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,r=t.length;s=r.length&&(r.length=e+1),r[e]||(r[e]={}),r[e][t]=s}addSkin(e){for(let r=0;r= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},as=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(as||{}),os=class extends Bt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},ls=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Rt;s.name="";let r=new Ks(e),i=r.readInt32(),h=r.readInt32();s.hash=h==0&&i==0?null:h.toString(16)+i.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*t;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let n=0;n=r.readInt(!0);for(let l=0;l>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=r.readFloat()),u.position=r.readFloat(),u.positionMode==0&&(u.position*=t),u.spacing=r.readFloat(),(u.spacingMode==0||u.spacingMode==1)&&(u.spacing*=t),u.mixRotate=r.readFloat(),u.mixX=r.readFloat(),u.mixY=r.readFloat(),s.pathConstraints.push(u)}n=r.readInt(!0);for(let l=0,c;l>4,e.readFloat())}r.push(v);break}}}}}let h=e.readInt(!0);if(h>0){let a=new kt(h),l=s.slots.length;for(let c=0;c=0;b--)m[b]=-1;let f=B.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)}r.push(a)}let o=e.readInt(!0);if(o>0){let a=new Wt(o);for(let l=0;l>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let r=0;r>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),r+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),r+=3;break;default:t+=String.fromCharCode(i),r++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Lr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,r,i){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}},Vr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function et(e,t,s){let r=e.readFloat(),i=e.readFloat()*s;for(let h=0,o=0,n=t.getFrameCount()-1;t.setFrame(h,r,i),h!=n;h++){let a=e.readFloat(),l=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(h);break;case ut:q(e,t,o++,h,0,r,a,i,l,s)}r=a,i=l}return t}function hs(e,t,s){let r=e.readFloat(),i=e.readFloat()*s,h=e.readFloat()*s;for(let o=0,n=0,a=t.getFrameCount()-1;t.setFrame(o,r,i,h),o!=a;o++){let l=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case dt:t.setStepped(o);break;case ut:q(e,t,n++,o,0,r,l,i,c,s),q(e,t,n++,o,1,r,l,h,d,s)}r=l,i=c,h=d}return t}function q(e,t,s,r,i,h,o,n,a,l){t.setBezier(s,r,i,h,n,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,o,a)}var Dr=0,Nr=1,_r=2,Or=3,Ur=4,qr=5,Wr=6,zr=7,Gr=8,$r=9,Hr=10,Kr=0,jr=1,Jr=2,Qr=3,Zr=4,ti=5,ei=0,si=1,ri=0,ii=1,ni=2,ai=0,oi=1,li=2,hi=4,ci=5,di=6,ui=7,fi=8,dt=1,ut=2,js=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new St(()=>B.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,h=e.slots,o=h.length;s.length=0,i.freeAll(r),r.length=0;for(let n=0;n=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,r){let i=this.minX,h=this.minY,o=this.maxX,n=this.maxY;if(e<=i&&s<=i||t<=h&&r<=h||e>=o&&s>=o||t>=n&&r>=n)return!1;let a=(r-t)/(s-e),l=a*(i-e)+t;if(l>h&&lh&&li&&ci&&ce.minX&&this.minYe.minY}containsPoint(e,t){let s=this.polygons;for(let r=0,i=s.length;r=s||l=s){let c=r[n];c+(s-a)/(l-a)*(r[h]-c)=c&&w<=m||w>=m&&w<=c)&&(w>=t&&w<=r||w>=r&&w<=t)){let y=(l*b-a*g)/x;if((y>=d&&y<=f||y>=f&&y<=d)&&(y>=s&&y<=i||y>=i&&y<=s))return!0}c=m,d=f}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Js=class rt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new St(()=>new Array);polygonIndicesPool=new St(()=>new Array);triangulate(t){let s=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(let n=0;n3;){let n=r-1,a=0,l=1;for(;;){t:if(!h[a]){let u=i[n]<<1,m=i[a]<<1,f=i[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)%r;v!=n;v=(v+1)%r){if(!h[v])continue;let C=i[v]<<1,S=s[C],A=s[C+1];if(rt.positiveArea(w,y,g,p,S,A)&&rt.positiveArea(g,p,b,x,S,A)&&rt.positiveArea(b,x,w,y,S,A))break t}break}if(l==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=l,l=(l+1)%r}o.push(i[(r+a-1)%r]),o.push(i[a]),o.push(i[(a+1)%r]),i.splice(a,1),h.splice(a,1),r--;let c=(r+a-1)%r,d=a==r?0:a;h[c]=rt.isConcave(c,r,s,i),h[d]=rt.isConcave(d,r,s,i)}return r==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(t,s){let r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,l=0;for(let c=0,d=s.length;c0?(i.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=rt.winding(g,p,b,x,w,y),a=u)}n.length>0&&(i.push(n),h.push(o));for(let c=0,d=i.length;c=0;c--)n=i[c],n.length==0&&(i.splice(c,1),this.polygonPool.free(n),o=h[c],h.splice(c,1),this.polygonIndicesPool.free(o));return i}static isConcave(t,s,r,i){let h=i[(s+t-1)%s]<<1,o=i[t]<<1,n=i[(t+1)%s]<<1;return!this.positiveArea(r[h],r[h+1],r[o],r[o+1],r[n],r[n+1])}static positiveArea(t,s,r,i,h,o){return t*(o-i)+r*(s-o)+h*(i-s)>=0}static winding(t,s,r,i,h,o){let n=r-t,a=i-s;return h*a-o*n+n*s-t*a>=0?1:-1}},jt=class bs{triangulator=new Js;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let r=s.worldVerticesLength,i=B.setArraySize(this.clippingPolygon,r);s.computeWorldVertices(t,0,r,i,0,2);let h=this.clippingPolygon;bs.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=B.setArraySize(h,w+v*2);for(let T=0;T>1,j=this.clipOutput,R=B.setArraySize(l,I+W*m);for(let G=0;G>1,_=this.clipOutput,$=B.setArraySize(o,M+V*2),W=B.setArraySize(n,M+V*2);for(let R=0;R=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(t),d.push(s),d.push(r),d.push(i),d.push(h),d.push(o),d.push(t),d.push(s),a.length=0;let 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),E=x*(g-A)-b*(p-T);if(E>0){if(P){a.push(Y),a.push(M);continue}let I=Y-A,F=M-T,L=E/(I*x-F*b);if(L>=0&&L<=1)a.push(A+I*L),a.push(T+F*L);else{a.push(Y),a.push(M);continue}}else if(P){let I=Y-A,F=M-T,L=E/(I*x-F*b);if(L>=0&&L<=1)a.push(A+I*L),a.push(T+F*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 Ne(u,a);for(let g=0;d!=null;d=c[g+1],g++)f.setFrame(g,k(d,"time",0));i.push(f);continue}let m;if(l=="inertia")m=new Ee(u,u,a);else if(l=="strength")m=new Xe(u,u,a);else if(l=="damping")m=new Be(u,u,a);else if(l=="mass")m=new Re(u,u,a);else if(l=="wind")m=new Le(u,u,a);else if(l=="gravity")m=new Ve(u,u,a);else if(l=="mix")m=new De(u,u,a);else continue;i.push(ot(c,m,0,1))}}if(e.attachments)for(let o in e.attachments){let n=e.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let l in n){let c=n[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let 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 Te(b.length,b.length,u,g),S=k(x,"time",0);for(let A=0,T=0;;A++){let Y,M=k(x,"vertices",null);if(!M)Y=w?B.newFloatArray(v):y;else{Y=B.newFloatArray(v);let F=k(x,"offset",0);if(B.arrayCopy(M,0,Y,F,M.length),r!=1)for(let L=F,N=L+M.length;L=0;p--)d[p]==-1&&(d[p]=m[--g])}o.setFrame(a,k(c,"time",0),d)}i.push(o)}if(e.events){let o=new Wt(e.events.length),n=0;for(let a=0;a"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));import{Texture as gi,SCALE_MODES as Qs,MIPMAP_MODES as Zs,WRAP_MODES as us,BLEND_MODES as Jt}from"@pixi/core";var Vt=class bt extends Ge{static textureMap=new Map;static from(t){return bt.textureMap.has(t)?bt.textureMap.get(t):new bt(t)}texture;constructor(t){super(t.resource.source),this.texture=gi.from(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=bt.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=bt.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=bt.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return Qs.NEAREST;case 9729:case 9987:case 9985:return Qs.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case 9728:case 9729:return Zs.OFF;case 9986:case 9984:case 9987:case 9985:return Zs.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return us.CLAMP;case 33648:return us.MIRRORED_REPEAT;case 10497:return us.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return Jt.NORMAL;case 1:return Jt.ADD;case 2:return Jt.MULTIPLY;case 3:return Jt.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};import{Mesh as xi,MeshGeometry as pi,MeshMaterial as wi}from"@pixi/mesh";import{Texture as bi}from"@pixi/core";var tr=class yt extends xi{name="";static auxColor=[0,0,0,0];warnedTwoTint=!1;constructor(){const t=new pi;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const s=new wi(bi.EMPTY);super(t,s)}updateFromSpineData(t,s,r,i,h,o,n,a){this.texture=t.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 Lt("custom-skin");for(const n of this.skins){const a=i.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const h=this.animation!=null?i.findAnimation(this.animation):null;if(h==null){s.updateWorldTransform(2);const o=s.getBoundsRect(r);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;t.clearTracks(),t.setAnimationWith(0,h,!1);const c=Math.max(h.duration/this.timeStep,1);for(let u=0;u0?this.timeStep:0;t.update(m),t.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(r);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}}},Li=class K extends Pi{skeleton;state;darkTint=!1;hasNeverUpdated=!0;_debug=void 0;get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}slotMeshFactory=()=>new tr;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};_autoUpdate=!1;_ticker=nr.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??nr.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}meshesCache=new Map;static vectorAux=new Pt;static clipper=new jt;static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;static DARK_VERTEX_SIZE=12;lightColor=new D;darkColor=new D;_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}_boundsPoint=new Yi;_boundsSpineID=-1;_boundsSpineDirty=!0;constructor(t,s){if(t instanceof Rt)t={...s,skeletonData:t};else if(s)throw new Error("You cannot use options and oldOptions together.");super();const r=t instanceof Rt?t:t.skeletonData;this.skeleton=new It(r);const i=new Ls(r);this.state=new Oe(i),t?.darkTint!==void 0||s?.slotMeshFactory===void 0?(this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(h=>!!h.data.darkColor):t?.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new Zt)):this.initializeMeshFactory(s?.slotMeshFactory),t?.ticker&&(this._ticker=t.ticker),this.autoUpdate=t?.autoUpdate??!0,this.boundsProvider=t.boundsProvider}initializeMeshFactory(t){if(t){this.slotMeshFactory=t;const s=this.slotMeshFactory();s instanceof Zt&&(this.darkTint=!0),s.destroy()}else for(let s=0;snew Zt,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const r=s??this._ticker.deltaMS/1e3;this.state.update(r),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(r),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}updateTransform(){this.renderMeshes(),this.sortChildren(),this.debug?.renderDebug(this),super.updateTransform()}destroy(t){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(t)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){if(this.hasMeshForSlot(t)){let s=this.meshesCache.get(t);return s.visible=!0,s}else{let s=this.slotMeshFactory();return this.addChild(s),this.meshesCache.set(t,s),s}}slotsObject=new Map;getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}addSlotObject(t,s,r){let i=this.getSlotFromRef(t);const h=this.slotsObject.get(i)?.container;if(!(h&&h===s)){for(const[o,{container:n}]of this.slotsObject)if(o!==i&&n===s){this.removeSlotObject(o,s);break}h&&this.removeChild(h),this.slotsObject.set(i,{container:s,followAttachmentTimeline:r?.followAttachmentTimeline||!1,followSlotColor:r?.followSlotColor||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){let r=this.getSlotFromRef(t),i=this.slotsObject.get(r)?.container;i&&(s&&s!==i||(this.removeChild(i),this.slotsObject.delete(r)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}verticesCache=B.newFloatArray(1024);clippingSlotToPixiMasks={};updateSlotObject(t,s,r){const{container:i,followAttachmentTimeline:h}=t,o=h?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&o,i.visible){let n=s.bone;const a=i.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,i.transform.setFromMatrix(a),i.zIndex=r,i.alpha=this.skeleton.color.a*s.color.a,t.followSlotColor&&this.setSlotObjectTint(i,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(t,s){const r=t;"tint"in r&&(r.tint=s);for(const i of r.children??[])this.setSlotObjectTint(i,s)}currentClippingSlot;updateAndSetPixiMask(t,s){const r=t.attachment;if(r&&r instanceof pt){const o=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let i=this.currentClippingSlot;const h=this.slotsObject.get(t);if(i&&h){let o=i.mask;if(o||(o=ar.obtain(),i.mask=o,this.addChild(o)),!i.maskComputed){let n=i.slot,a=n.attachment;i.maskComputed=!0;const l=a.worldVerticesLength,c=i.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(i&&i.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof pt)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),ar.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){this.resetMeshes();let t=null,s=null;const r=this.skeleton.drawOrder;for(let i=0,h=r.length,o=0;i>1)*d,g>this.verticesCache.length&&(this.verticesCache=B.newFloatArray(g)),p.computeWorldVertices(n,0,p.worldVerticesLength,this.verticesCache,0,d),t=p.triangles,s=p.uvs,f=p.region?.texture}else if(u instanceof pt){K.clipper.clipStart(n,u);continue}else{this.hasMeshForSlot(n)&&(this.getMeshForSlot(n).visible=!1),K.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(K.clipper.isClipping())K.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,c),y=K.clipper.clippedVertices,v=y.length,C=K.clipper.clippedTriangles,S=C.length;else{const T=this.verticesCache;for(let Y=2,M=0,P=g;Ynew Ei);It.yDown=!0;import{Container as ms}from"@pixi/display";import{Graphics as lt}from"@pixi/graphics";import{Text as Vi}from"@pixi/text";var Di=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(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new ms,bones:new ms,skeletonXY:new lt,regionAttachmentsShape:new lt,meshTrianglesLine:new lt,meshHullLine:new lt,clippingPolygon:new lt,boundingBoxesRect:new lt,boundingBoxesCircle:new lt,boundingBoxesPolygon:new lt,pathsCurve:new lt,pathsLine:new lt,eventText:new ms,eventCallback:{event:(s,r)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),h=new Vi(r.data.name,{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"});h.scale.x=Math.sign(e.scale.x),h.anchor.set(.5),t.eventText.addChild(h),setTimeout(()=>{h.destroyed||h.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let i=t.bones.children.length;i>0;i--)t.bones.children[i-1].destroy({children:!0,texture:!0,baseTexture:!0});const s=Math.abs(e.scale.x||e.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,r,s),this.drawPaths&&this.drawPathsFunc(e,t,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,r),this.drawClipping&&this.drawClippingFunc(e,t,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,r),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,r){const i=e.skeleton,h=i.x,o=i.y,n=i.bones;t.skeletonXY.lineStyle(s,this.skeletonXYColor,1);for(let l=0,c=n.length;lg&&fg&&f>p?P=-T:mp?P=T:f===p&&mg?P=-90*A:m===g&&fp&&(P=0),Y.rotation=P,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;t.skeletonXY.moveTo(h-a,o-a),t.skeletonXY.lineTo(h+a,o+a),t.skeletonXY.moveTo(h+a,o-a),t.skeletonXY.lineTo(h-a,o+a)}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;t.regionAttachmentsShape.lineStyle(s,this.regionAttachmentsColor,1);for(let h=0,o=i.length;h0){u=(u>>1)*2;let m=c[u-2],f=c[u-1];for(let g=0,p=u;g{if(t.boundingBoxesPolygon.lineStyle(s,this.boundingBoxesPolygonColor,1),t.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;dgs(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(cr.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:se,extension:{type:hr.LoadParser,priority:_i.Normal,name:se},test(e){return gs(e,".atlas")},async load(e){const t=await cr.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${se}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return await t.text()},testParse(e,t){const s=gs(t.src,".atlas"),r=typeof e=="string",i=t.loadParser===se;return Promise.resolve((s||i)&&r)},unload(e){e.dispose()},async parse(e,t,s){const r=t.data||{};let i=ee.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const h=new Ht(e);if(r.images instanceof dr||typeof r.images=="string"){const a=r.images;r.images={},r.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}or.setPreferences({preferCreateImageBitmap:!1});for(const a of h.pages){const l=a.name,c=r?.images?r.images[l]:void 0;if(c instanceof dr)a.setTexture(Vt.from(c));else{const d=c??ee.path.normalize([...i.split(ee.path.sep),l].join(ee.path.sep)),u={src:Ni(d,t.src),data:{...r.imageMetadata,alphaMode:a.pma?lr.PMA:lr.UNPACK}},m=s.load(u).then(f=>{a.setTexture(Vt.from(f.baseTexture))});o.push(m)}}return await Promise.all(o),or.setPreferences({preferCreateImageBitmap:n}),h}}};Oi.add(Ui);import{LoaderParserPriority as qi,checkExtension as xs}from"@pixi/assets";import{ExtensionType as ur,settings as Wi,extensions as zi}from"@pixi/core";var re="spineSkeletonLoader";function Gi(e){return e.hasOwnProperty("bones")}function $i(e){return e instanceof Uint8Array}var Hi={extension:ur.Asset,loader:{name:re,extension:{type:ur.LoadParser,priority:qi.Normal,name:re},test(e){return xs(e,".skel")},async load(e){const t=await Wi.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${re}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=xs(t.src,".json")&&Gi(e),r=xs(t.src,".skel")&&$i(e),i=t.loadParser===re;return Promise.resolve(s||r||i)}}};zi.add(Hi);import{Geometry as Ki,Buffer as fr,TYPES as Dt}from"@pixi/core";var mr=class extends Ki{_buffer;_indexBuffer;constructor(e=!1){super(),this._buffer=new fr(void 0,e,!1),this._indexBuffer=new fr(void 0,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Dt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Dt.FLOAT).addAttribute("aColor",this._buffer,4,!0,Dt.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,Dt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Dt.FLOAT).addIndex(this._indexBuffer)}};import{extensions as ji,BatchRenderer as Ji,ExtensionType as Qi,BatchShaderGenerator as Zi,Color as gr}from"@pixi/core";var tn=` 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; } `,en=` 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; } `,xr=class extends Ji{static extension={name:"darkTintBatch",type:Qi.RendererPlugin};constructor(e){super(e),this.shaderGenerator=new Zi(tn,en),this.geometryClass=mr,this.vertexSize=7}packInterleavedGeometry(e,t,s,r,i){const{uint32View:h,float32View:o}=t,n=r/this.vertexSize,a=e.uvs,l=e.indices,c=e.vertexData,d=e._texture.baseTexture._batchLocation,u=Math.min(e.worldAlpha,1),m=gr.shared.setValue(e._tintRGB).toPremultiplied(u,!0),f=gr.shared.setValue(e._darkTintRGB).premultiply(u,!0).toPremultiplied(1,!1);for(let g=0;g