"use strict";var spine=(()=>{var We=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,xi=Object.getOwnPropertyNames,wi=Object.prototype.hasOwnProperty,et=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),bi=(e,t)=>{for(var s in t)We(e,s,{get:t[s],enumerable:!0})},yi=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xi(t))!wi.call(e,i)&&i!==s&&We(e,i,{get:()=>t[i],enumerable:!(n=pi(t,i))||n.enumerable});return e},vi=e=>yi(We({},"__esModule",{value:!0}),e),dn={};if(bi(dn,{AABBRectangleBoundsProvider:()=>Yr,ATTACH_RETAIN:()=>Ls,ATTACH_SETUP:()=>Xs,AlphaTimeline:()=>ds,Animation:()=>xe,AnimationState:()=>Ys,AnimationStateAdapter:()=>Pi,AnimationStateData:()=>In,AssetCache:()=>kn,AssetManagerBase:()=>Fi,AtlasAttachmentLoader:()=>Fn,Attachment:()=>Je,AttachmentTimeline:()=>Ut,BinaryInput:()=>Nn,BlendMode:()=>Hs,Bone:()=>Se,BoneData:()=>Ds,BonePose:()=>Te,BoneTimeline1:()=>Mt,BoneTimeline2:()=>we,BoundingBoxAttachment:()=>Vs,CURRENT:()=>Es,ClippingAttachment:()=>Bt,Color:()=>z,Constraint:()=>qt,ConstraintData:()=>zt,ConstraintTimeline1:()=>$t,CurveTimeline:()=>kt,CurveTimeline1:()=>te,DarkSlotMesh:()=>Jn,DarkTintBatchGeometry:()=>jn,DarkTintGeometry:()=>Wn,DarkTintMaterial:()=>Hn,DarkTintMesh:()=>Kn,DarkTintRenderer:()=>Zn,DebugUtils:()=>Ci,DeformTimeline:()=>ms,Downloader:()=>Mn,DrawOrder:()=>Yn,DrawOrderFolderTimeline:()=>ne,DrawOrderTimeline:()=>Et,Event:()=>Ae,EventData:()=>Os,EventQueue:()=>Sn,EventTimeline:()=>be,EventType:()=>Cn,FIRST:()=>Bs,FakeTexture:()=>ki,FromProperty:()=>Rt,FromRotate:()=>Be,FromScaleX:()=>Le,FromScaleY:()=>Ve,FromShearY:()=>De,FromX:()=>Re,FromY:()=>Xe,HOLD:()=>ie,IkConstraint:()=>En,IkConstraintData:()=>oe,IkConstraintPose:()=>Ie,IkConstraintTimeline:()=>ps,Inherit:()=>ve,InheritTimeline:()=>ls,IntSet:()=>Ti,Interpolation:()=>jt,MODE:()=>Rs,MathUtils:()=>X,MeshAttachment:()=>vt,MixFrom:()=>xn,PathAttachment:()=>re,PathConstraint:()=>Bn,PathConstraintData:()=>ae,PathConstraintMixTimeline:()=>ys,PathConstraintPose:()=>ke,PathConstraintPositionTimeline:()=>ws,PathConstraintSpacingTimeline:()=>bs,Physics:()=>Rn,PhysicsConstraint:()=>zs,PhysicsConstraintDampingTimeline:()=>Ss,PhysicsConstraintData:()=>le,PhysicsConstraintGravityTimeline:()=>Is,PhysicsConstraintInertiaTimeline:()=>vs,PhysicsConstraintMassTimeline:()=>Cs,PhysicsConstraintMixTimeline:()=>ks,PhysicsConstraintPose:()=>Me,PhysicsConstraintResetTimeline:()=>Ms,PhysicsConstraintStrengthTimeline:()=>Ts,PhysicsConstraintTimeline:()=>Tt,PhysicsConstraintWindTimeline:()=>As,PointAttachment:()=>Pn,Pool:()=>Zt,Posed:()=>Ns,PosedActive:()=>_s,PosedData:()=>ye,PositionMode:()=>Us,Pow:()=>fn,PowOut:()=>Si,Property:()=>wn,RGB2Timeline:()=>fs,RGBA2Timeline:()=>us,RGBATimeline:()=>cs,RGBTimeline:()=>hs,RegionAttachment:()=>It,RotateMode:()=>qs,RotateTimeline:()=>ee,SETUP:()=>An,ScaleTimeline:()=>ss,ScaleXTimeline:()=>ns,ScaleYMode:()=>Ce,ScaleYTimeline:()=>is,Sequence:()=>Qt,SequenceMode:()=>je,SequenceModeValues:()=>Ze,SequenceTimeline:()=>gs,SetupPoseBoundsProvider:()=>Er,ShearTimeline:()=>rs,ShearXTimeline:()=>os,ShearYTimeline:()=>as,Skeleton:()=>Gt,SkeletonBinary:()=>Dn,SkeletonBounds:()=>Un,SkeletonClipping:()=>he,SkeletonData:()=>Ye,SkeletonJson:()=>qn,SkeletonPhysicsMovement:()=>Gn,SkeletonRendererCore:()=>wr,Skin:()=>ce,SkinEntry:()=>Gs,SkinsAndAnimationBoundsProvider:()=>Br,Slider:()=>Ln,SliderData:()=>Pt,SliderMixTimeline:()=>Fs,SliderPose:()=>Fe,SliderTimeline:()=>Ps,Slot:()=>Xn,SlotCurveTimeline:()=>se,SlotData:()=>Ws,SlotMesh:()=>Qn,SlotPose:()=>Pe,SpacingMode:()=>$s,Spine:()=>Rr,SpineDebugRenderer:()=>Lr,SpineTexture:()=>de,StringSet:()=>un,Texture:()=>He,TextureAtlas:()=>pe,TextureAtlasPage:()=>pn,TextureAtlasRegion:()=>Ke,TextureFilter:()=>ge,TextureRegion:()=>gn,TextureWrap:()=>mn,TimeKeeper:()=>Ai,Timeline:()=>Q,ToProperty:()=>Xt,ToRotate:()=>Ks,ToScaleX:()=>Zs,ToScaleY:()=>Qs,ToShearY:()=>tn,ToX:()=>Js,ToY:()=>js,TrackEntry:()=>Tn,TransformConstraint:()=>Vn,TransformConstraintData:()=>K,TransformConstraintPose:()=>Ee,TransformConstraintTimeline:()=>xs,TranslateTimeline:()=>Qe,TranslateXTimeline:()=>ts,TranslateYTimeline:()=>es,Triangulator:()=>$n,Utils:()=>V,Vector2:()=>me,VertexAttachment:()=>At,WindowedMean:()=>Ii,isBoneTimeline:()=>yn,isConstraintTimeline:()=>vn,isSlotTimeline:()=>bn}),typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/"))return window.PIXI}}var Ti=class{array=[];add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},un=class{entries={};size=0;add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let s=0,n=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 Vt){return s.setFromString(t)}},X=class ut{static epsilon=1e-5;static epsilon2=ut.epsilon*ut.epsilon;static PI=3.1415927;static PI2=ut.PI*2;static invPI2=1/ut.PI2;static radiansToDegrees=180/ut.PI;static radDeg=ut.radiansToDegrees;static degreesToRadians=ut.PI/180;static degRad=ut.degreesToRadians;static clamp(t,s,n){return tn?n:t}static cosDeg(t){return Math.cos(t*ut.degRad)}static sinDeg(t){return Math.sin(t*ut.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ut.radDeg}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){const s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ut.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,n){const i=Math.random(),r=s-t;return i<=(n-t)/r?t+Math.sqrt(i*r*(n-t)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},jt=class Kt{static linear=new class extends Kt{applyInternal(t){return t}};static smooth=new class extends Kt{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends Kt{applyInternal(t){return t*t}};static fastSlow=new class extends Kt{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends Kt{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,s,n){return s===void 0||n===void 0?this.applyInternal(t):t+(s-t)*this.applyInternal(n)}},fn=class extends jt{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}},Si=class extends fn{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},V=class Jt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,n,i,r){for(let a=s,c=i;a=s?t:Jt.setArraySize(t,s,n)}static newArray(t,s){const n=[];for(let i=0;i0?this.items.pop():this.instantiator()}free(e){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)}},Ii=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(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))(ge||{}),mn=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(mn||{}),gn=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ki=class extends He{setFilters(e,t){}setWraps(e,t){}dispose(){}},pe=class{pages=[];regions=[];constructor(e){const t=new Mi(e),s=new Array(4),n={};n.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},n.format=()=>{},n.filter=o=>{o.minFilter=V.enumValue(ge,s[1]),o.magFilter=V.enumValue(ge,s[2])},n.repeat=o=>{s[1].indexOf("x")!==-1&&(o.uWrap=10497),s[1].indexOf("y")!==-1&&(o.vWrap=10497)},n.pma=o=>{o.pma=s[1]==="true"};var i={};i.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},i.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},i.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},i.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},i.rotate=o=>{const h=s[1];h==="true"?o.degrees=90:h!=="false"&&(o.degrees=parseInt(h))},i.index=o=>{o.index=parseInt(s[1])};let r=t.readLine();for(;r&&r.trim().length===0;)r=t.readLine();for(;!(!r||r.trim().length===0||t.readEntry(s,r)===0);)r=t.readLine();let a=null,c=null,l=null;for(;r!==null;)if(r.trim().length===0)a=null,r=t.readLine();else if(a){const o=new Ke(a,r);for(;;){const h=t.readEntry(s,r=t.readLine());if(h===0)break;const d=i[s[0]];if(d)d(o);else{c||(c=[]),l||(l=[]),c.push(s[0]);const m=[];for(let f=0;f0&&l&&l.length>0&&(o.names=c,o.values=l,c=null,l=null),o.u=o.x/a.width,o.v=o.y/a.height,o.degrees===90?(o.u2=(o.x+o.height)/a.width,o.v2=(o.y+o.width)/a.height):(o.u2=(o.x+o.width)/a.width,o.v2=(o.y+o.height)/a.height),this.regions.push(o)}else{for(a=new pn(r.trim());t.readEntry(s,r=t.readLine())!==0;){const o=n[s[0]];o&&o(a)}this.pages.push(a)}}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;const s=t.indexOf(":");if(s===-1)return 0;e[0]=t.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=t.indexOf(",",i);if(r===-1)return e[n]=t.substr(i).trim(),n;if(e[n]=t.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},pn=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}},Ke=class extends gn{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)}},Je=class si{static empty=[];name;timelineAttachment;timelineSlots=si.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,s,n){let i=t[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,a=this.timelineSlots.length;r>1)*c;const l=s.appliedPose.deform;let o=this.vertices;const h=this.bones;if(!h){l.length>0&&(o=l);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,x=u.a,w=u.b,b=u.c,v=u.d;for(let y=n,T=a;T=this.regions.length&&(s=this.regions.length-1),s}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,s){if(!this.pathSuffix)return t;let n=t;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return qe._nextID++}},je=(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))(je||{}),Ze=[0,1,2,3,4,5,6],xe=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=s,this.timelineIds=new un,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=e;for(let i=0;i0&&(t%=this.duration));const h=this.timelines;for(let d=0,m=h.length;d(e[e.current=0]="current",e[e.setup=1]="setup",e[e.first=2]="first",e))(xn||{}),wn=(e=>(e[e.rotate=0]="rotate",e[e.x=1]="x",e[e.y=2]="y",e[e.scaleX=3]="scaleX",e[e.scaleY=4]="scaleY",e[e.shearX=5]="shearX",e[e.shearY=6]="shearY",e[e.inherit=7]="inherit",e[e.rgb=8]="rgb",e[e.alpha=9]="alpha",e[e.rgb2=10]="rgb2",e[e.attachment=11]="attachment",e[e.deform=12]="deform",e[e.event=13]="event",e[e.drawOrder=14]="drawOrder",e[e.drawOrderFolder=15]="drawOrderFolder",e[e.ikConstraint=16]="ikConstraint",e[e.transformConstraint=17]="transformConstraint",e[e.pathConstraintPosition=18]="pathConstraintPosition",e[e.pathConstraintSpacing=19]="pathConstraintSpacing",e[e.pathConstraintMix=20]="pathConstraintMix",e[e.physicsConstraintInertia=21]="physicsConstraintInertia",e[e.physicsConstraintStrength=22]="physicsConstraintStrength",e[e.physicsConstraintDamping=23]="physicsConstraintDamping",e[e.physicsConstraintMass=24]="physicsConstraintMass",e[e.physicsConstraintWind=25]="physicsConstraintWind",e[e.physicsConstraintGravity=26]="physicsConstraintGravity",e[e.physicsConstraintMix=27]="physicsConstraintMix",e[e.physicsConstraintReset=28]="physicsConstraintReset",e[e.sequence=29]="sequence",e[e.sliderTime=30]="sliderTime",e[e.sliderMix=31]="sliderMix",e))(wn||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=V.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 search(e,t,s=1){const n=e.length;for(let i=s;it)return i-s;return n-s}};function bn(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var kt=class extends Q{curves;constructor(e,t,...s){super(e,...s),this.curves=V.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=V.newFloatArray(t);V.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,n,i,r,a,c,l,o,h){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(n-r*2+c)*.03,u=(i-a*2+l)*.03,p=((r-c)*3-n+o)*.006,g=((a-l)*3-i+h)*.006;let x=f*2+p,w=u*2+g,b=(r-n)*.3+f+p*.16666667,v=(a-i)*.3+u+g*.16666667,y=n+b,T=i+v;for(let S=m+18;me){const l=this.frames[t],o=this.frames[t+s];return o+(e-l)/(i[n]-l)*(i[n+1]-o)}const r=n+18;for(n+=2;n=e){const l=i[n-2],o=i[n-1];return o+(e-l)/(i[n]-l)*(i[n+1]-o)}t+=this.getFrameEntries();const a=i[r-2],c=i[r-1];return c+(e-a)/(this.frames[t]-a)*(this.frames[t+s]-c)}},te=class fe extends kt{constructor(t,s,n){super(t,s,n)}getFrameEntries(){return 2}setFrame(t,s,n){t<<=1,this.frames[t]=s,this.frames[t+1]=n}getCurveValue(t){const s=this.frames;let n=s.length-2;for(let r=2;r<=n;r+=2)if(s[r]>t){n=r-2;break}const i=this.curves[n>>1];switch(i){case 0:{const r=s[n],a=s[n+1];return a+(t-r)/(s[n+2]-r)*(s[n+2+1]-a)}case 1:return s[n+1]}return this.getBezierValue(t,n,1,i-2)}getRelativeValue(t,s,n,i,r,a){if(t>2];switch(m){case 0:{const f=h[d];c=h[d+1],l=h[d+2],o=h[d+3];const u=(s-f)/(h[d+4]-f);c+=(h[d+4+1]-c)*u,l+=(h[d+4+2]-l)*u,o+=(h[d+4+3]-o)*u;break}case 1:c=h[d+1],l=h[d+2],o=h[d+3];break;default:c=this.getBezierValue(s,d,1,m-2),l=this.getBezierValue(s,d,2,m+18-2),o=this.getBezierValue(s,d,3,m+36-2)}if(n!==1)if(i===1){const f=e.data.setupPose.color;c=f.r+(c-f.r)*n,l=f.g+(l-f.g)*n,o=f.b+(o-f.b)*n}else c=a.r+(c-a.r)*n,l=a.g+(l-a.g)*n,o=a.b+(o-a.b)*n;a.r=c<0?0:c>1?1:c,a.g=l<0?0:l>1?1:l,a.b=o<0?0:o>1?1:o}},ds=class extends te{slotIndex=0;constructor(e,t,s){super(e,t,`9|${s}`),this.slotIndex=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=(l?o.appliedPose:o.pose).color;let d=0;const m=this.frames;if(s1?1:d}},us=class extends se{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,n,i,r,a,c,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=c,this.frames[e+7]=l}apply1(e,t,s,n,i,r){const a=t.color,c=t.darkColor;let l=0,o=0,h=0;const d=this.frames;if(s>3];switch(x){case 0:{const w=d[g];m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],l=d[g+5],o=d[g+6],h=d[g+7];const b=(s-w)/(d[g+8]-w);m+=(d[g+8+1]-m)*b,f+=(d[g+8+2]-f)*b,u+=(d[g+8+3]-u)*b,p+=(d[g+8+4]-p)*b,l+=(d[g+8+5]-l)*b,o+=(d[g+8+6]-o)*b,h+=(d[g+8+7]-h)*b;break}case 1:m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],l=d[g+5],o=d[g+6],h=d[g+7];break;default:m=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),u=this.getBezierValue(s,g,3,x+36-2),p=this.getBezierValue(s,g,4,x+54-2),l=this.getBezierValue(s,g,5,x+72-2),o=this.getBezierValue(s,g,6,x+90-2),h=this.getBezierValue(s,g,7,x+108-2)}if(n===1)a.set(m,f,u,p);else if(i===1){const w=e.data.setupPose;let b=w.color;a.set(b.r+(m-b.r)*n,b.g+(f-b.g)*n,b.b+(u-b.b)*n,b.a+(p-b.a)*n),b=w.darkColor,l=b.r+(l-b.r)*n,o=b.g+(o-b.g)*n,h=b.b+(h-b.b)*n}else a.add((m-a.r)*n,(f-a.g)*n,(u-a.b)*n,(p-a.a)*n),l=c.r+(l-c.r)*n,o=c.g+(o-c.g)*n,h=c.b+(h-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=o<0?0:o>1?1:o,c.b=h<0?0:h>1?1:h}},fs=class extends se{constructor(e,t,s){super(e,t,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,a,c){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=c}apply1(e,t,s,n,i,r){const a=t.color,c=t.darkColor;let l=0,o=0,h=0,d=0,m=0,f=0;const u=this.frames;if(s1?1:l,a.g=o<0?0:o>1?1:o,a.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=m<0?0:m>1?1:m,c.b=f<0?0:f>1?1:f}},Ut=class extends Q{slotIndex=0;attachmentNames;constructor(e,t){super(e,`11|${t}`),this.slotIndex=t,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=l?o.appliedPose:o.pose;c||se){const c=this.frames[t];return s[n+1]*(e-c)/(s[n]-c)}const i=n+18;for(n+=2;n=e){const c=s[n-2],l=s[n-1];return l+(e-c)/(s[n]-c)*(s[n+1]-l)}const r=s[i-2],a=s[i-1];return a+(1-a)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,n,i,r,a,c,l){const o=e.slots;if(!this.attachment.isTimelineActive(o,this.slotIndex,l))return;const h=this.attachment.timelineSlots,d=this.frames;if(s=d[d.length-1])u=0,m=this.vertices[d.length-1],f=null;else{const g=Q.search(d,s);u=this.getCurvePercent(s,g),m=this.vertices[g],f=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(o[this.slotIndex],l,m,f,u,p,i,r,a);for(const g of h)this.applyToSlot(o[g],l,m,f,u,p,i,r,a)}applyBeforeFirst(e,t,s,n){if(!e.bone.active)return;const i=t?e.appliedPose:e.pose;if(i.attachment==null||i.attachment.timelineAttachment!==this.attachment)return;const r=i.deform;switch(r.length===0&&(n=1),n){case 1:r.length=0;break;case 2:{if(s===1){r.length=0;return}const a=this.vertices[0].length;r.length=a;const c=r,l=i.attachment;if(l.bones===null){const o=l.vertices;for(let h=0;h>4,o=c.attachment.sequence.regions.length;const h=Ze[r&15];if(h!==0)switch(l+=(n-i)/a+1e-5|0,h){case 1:l=Math.min(o-1,l);break;case 2:l%=o;break;case 3:{const d=(o<<1)-2;l=d===0?0:l%d,l>=o&&(l=d-l);break}case 4:l=Math.max(o-1-l,0);break;case 5:l=o-1-l%o;break;case 6:{const d=(o<<1)-2;l=d===0?0:(l+o-1)%d,l>=o&&(l=d-l)}}c.sequenceIndex=l}},be=class ri extends Q{static propertyIds=["13"];events;constructor(t){super(t,...ri.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,n,i,r,a,c,l,o){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,a,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n0&&h[m-1]===f;)m--}for(;m=h[m];m++)i.push(this.events[m])}},Et=class an extends Q{static propertyID="14";static propertyIds=[an.propertyID];drawOrders;constructor(t){super(t,...an.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,i,r,a,c,l,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n>2];switch(g){case 0:{const w=d[p];m=d[p+1],f=d[p+2],u=d[p+3];const b=(s-w)/(d[p+4]-w);m+=(d[p+4+1]-m)*b,f+=(d[p+4+2]-f)*b,u+=(d[p+4+3]-u)*b;break}case 1:m=d[p+1],f=d[p+2],u=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),f=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+36-2)}const x=r===1?o.data.setupPose:h;a?(h.mixRotate=x.mixRotate+m*i,h.mixX=x.mixX+f*i,h.mixY=x.mixY+u*i):(h.mixRotate=x.mixRotate+(m-x.mixRotate)*i,h.mixX=x.mixX+(f-x.mixX)*i,h.mixY=x.mixY+(u-x.mixY)*i)}},Tt=class extends $t{constructor(e,t,s,n){super(e,t,s,n)}apply(e,t,s,n,i,r,a,c,l){if(a&&!this.additive&&(a=!1),this.constraintIndex===-1){const o=s>=this.frames[0]?this.getCurveValue(s):0,h=e.physics;for(const d of h)if(d.active&&this.global(d.data)){const m=l?d.appliedPose:d.pose;this.set(m,this.getAbsoluteValue(s,i,r,a,this.get(m),this.get(d.data.setupPose),o))}}else{const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;this.set(h,this.getAbsoluteValue(s,i,r,a,this.get(h),this.get(o.data.setupPose)))}}}},vs=class extends Tt{constructor(e,t,s){super(e,t,s,21)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Ts=class extends Tt{constructor(e,t,s){super(e,t,s,22)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ss=class extends Tt{constructor(e,t,s){super(e,t,s,23)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Cs=class extends Tt{constructor(e,t,s){super(e,t,s,24)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},As=class extends Tt{constructor(e,t,s){super(e,t,s,25),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Is=class extends Tt{constructor(e,t,s){super(e,t,s,26),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},ks=class extends Tt{constructor(e,t,s){super(e,t,s,27)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ms=class oi extends Q{static propertyIds=["28"];constraintIndex;constructor(t,s){super(t,...oi.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,n,i,r,a,c,l,o){let h;if(this.constraintIndex!==-1&&(h=t.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(t,s,Number.MAX_VALUE,[],r,a,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n=d[Q.search(d,s)+1]))if(h!=null)h.reset(t);else for(const m of t.physics)m.active&&m.reset(t)}},Ps=class extends $t{constructor(e,t,s){super(e,t,s,30)}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.time=this.getAbsoluteValue(s,i,r,a,h.time,o.data.setupPose.time)}}},Fs=class extends $t{constructor(e,t,s){super(e,t,s,31),this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.mix=this.getAbsoluteValue(s,i,r,a,h.mix,o.data.setupPose.mix)}}},Ys=class cn{static emptyAnimation=new xe("",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Sn(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new Zt(()=>new Tn);constructor(t){this.data=t}update(t){t*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n0){if(r.delay-=a,r.delay>0)continue;a=-r.delay,r.delay=0}let c=r.next;if(c){const l=r.trackLast-c.delay;if(l>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(l/r.timeScale+t)*c.timeScale,r.trackTime+=a,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=t,c=c.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let l=r.mixingFrom;for(r.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=a}this.queue.drain()}updateMixingFrom(t,s){const n=t.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(n.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=t),n.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,t.mixTime+=s,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,l=n.length;c0)continue;i=!0;let h=o.alpha;o.mixingFrom?h*=this.applyMixingFrom(o,t):o.trackTime>=o.trackEnd&&!o.next&&(h=0);let d=o.animationLast,m=o.getAnimationTime(),f=m,u=s;o.reverse&&(f=o.animation.duration-f,u=null);const p=o.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x=o.alphaAttachmentThreshold,b=o.additive,v=b||o.shortestRotation,y=!v&&o.timelinesRotation.length!==g<<1;y&&(o.timelinesRotation.length=g<<1);for(let T=0;T0?l/c:a,h=n.animation.timelines,d=h.length,m=n.timelineMode,f=n.timelineHoldMix,u=r=n.alphaAttachmentThreshold);else{const F=!p||!(k instanceof Et)||I===0;k.apply(s,v,T,S,P,I,g,F,!1)}}return n.reverse&&r0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(t,s,n,i,r){const a=s.slots[t.slotIndex];if(!a.bone.active||!r&&a.attachmentState===this.unkeyedState+Ls)return;let c=n=0,y=x>=0;Math.abs(w)<=90&&X.signum(w)!==X.signum(g)&&(Math.abs(x-b)>180?(p+=360*X.signum(x),y=v):b!==0?p-=360*X.signum(x):y=v),y!==v&&(p+=360*X.signum(x)),a[c]=p}a[c+1]=g,h.rotation=f+p*i}queueEvents(t,s){const n=t.animationStart,i=t.animationEnd,r=i-n,a=t.reverse;let c=t.trackLast%r;a&&(c=r-c);const l=this.events;let o=0,h=l.length;for(;o=n&&m.time<=i&&this.queue.event(t,m)}let d=!1;if(t.loop)if(r===0)d=!0;else{const m=Math.floor(t.trackTime/r);d=m>0&&m>Math.floor(t.trackLast/r)}else d=s>=i&&t.animationLast=n&&m.time<=i&&this.queue.event(t,m)}}eventsReverse(t,s,n){const i=t.animation.duration,r=i-s,a=i-n,c=t.animation.timelines;for(let l=0,o=t.animation.timelines.length;l=a){for(let u=0;u=r)break;this.events.push(d[u])}}else{for(let p=0;p=r);p++)this.events.push(d[p]);let u=0;for(;u=a);u++);for(;u= 0.");if(t>=this.tracks.length)return;const s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(t,s,n){const i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,n=!1){return typeof s=="string"?this.setAnimation1(t,s,n):this.setAnimation2(t,s,n)}setAnimation1(t,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(t,i,n)}setAnimation2(t,s,n=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const a=this.trackEntry(t,s,n,r);return this.setTrack(t,a,i),this.queue.drain(),a}addAnimation(t,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(t,s,n,i):this.addAnimation2(t,s,n,i)}addAnimation1(t,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(t,r,n,i)}addAnimation2(t,s,n=!1,i=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const a=this.trackEntry(t,s,n,r);return r?(r.next=a,a.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-a.mixDuration,0))):(this.setTrack(t,a,!0),this.queue.drain(),i<0&&(i=0)),a.delay=i,a}setEmptyAnimation(t,s=0){const n=this.setAnimation(t,cn.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(t,s=0,n=0){const i=this.addAnimation(t,cn.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n0&&(a[h]=p);break}}l&&(u=u&~ie|r[h]&ie),r[h]=u}}from(t,s,n){const i=this.propertyIds;let r=An;for(let a=0,c=n.length;a= 0.");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){const s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Tn=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!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;totalAlpha=0;mixInterpolation=jt.linear;setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===jt.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=jt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const e=this.animationEnd-this.animationStart;if(e!==0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime=0}},Sn=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){this.drainDisabled=!0;for(let e=0;e(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Cn||{}),Pi=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Es=0,An=1,Bs=2,Rs=3,ie=4,Xs=1,Ls=2,In=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){return typeof e=="string"?this.setMix1(e,t,s):this.setMix2(e,t,s)}setMix1(e,t,s){const n=this.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);const i=this.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);this.setMix2(n,i,s)}setMix2(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");const n=`${e.name}.${t.name}`;this.animationToMixTime[n]=s}getMix(e,t){const s=`${e.name}.${t.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Fi=class{constructor(e,t="",s=new Mn,n=new kn){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};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)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}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((n,i)=>{this.downloader.downloadBinary(e,r=>{this.success(t,e,r),n(r)},(r,a)=>{const c=`Couldn't load binary ${e}: status ${r}, ${a}`;this.error(s,e,c),i(c)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,n=>{this.success(t,e,n)},(n,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${n}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((n,i)=>{this.downloader.downloadJson(e,r=>{this.success(t,e,r),n(r)},(r,a)=>{const c=`Couldn't load JSON ${e}: status ${r}, ${a}`;this.error(s,e,c),i(c)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const n=this.cache.getAsset(e),i=n!==void 0;return i&&(this.cache.assetsLoaded[e]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(t,e,r),r)).catch(r=>{this.error(s,e,r)})),i}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),this.reuseAssets(e,t,s))return;const n=this.texturePmaInfo[e];this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(l=>{if(l.ok)return l.blob();const o=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(o)}).then(l=>l?createImageBitmap(l,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(l=>{if(l){const o=this.createTexture(e,n,l);this.success(t,e,o),i(o)}});else{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{const o=this.createTexture(e,n,l);this.success(t,e,o),i(o)},l.onerror=()=>{const o=`Couldn't load image: ${e}`;this.error(s,e,o),r(o)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),l.src=e}})}loadTextureAtlas(e,t=()=>{},s=()=>{},n){const i=e.lastIndexOf("/"),r=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((a,c)=>{this.downloader.downloadText(e,l=>{try{const o=this.createTextureAtlas(l,r,e,n);let h=o.pages.length,d=!1;if(h===0){this.success(t,e,o),a(o);return}for(const m of o.pages)this.loadTexture(this.texturePath(r,m.name,n),(f,u)=>{d||(m.setTexture(u),--h===0&&(this.success(t,e,o),a(o)))},(f,u)=>{if(!d){const p=`Couldn't load texture ${e} page image: ${f}`;this.error(s,e,p),c(p)}d=!0})}catch(o){const h=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,h),c(h)}},(l,o)=>{const h=`Couldn't load texture atlas ${e}: status ${l}, ${o}`;this.error(s,e,h),c(h)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{}){const n=e.lastIndexOf("/"),i=n>=0?e.substring(0,n+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,a)=>{this.downloader.downloadText(e,c=>{try{const l=this.createTextureAtlas(c,i,e);this.success(t,e,l),r(l)}catch(l){const o=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,o),a(o)}},(c,l)=>{const o=`Couldn't load texture atlas ${e}: status ${c}, ${l}`;this.error(s,e,o),a(o)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(n,i)=>t(i),(n,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;const t=this.cache.assets[e];if(t)return t;const s=this.errors[e];throw Error(`Asset not found: ${e}${s?` ${s}`:""}`)}remove(e){e=this.pathPrefix+e;const 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(const e in this.cache.assets){const 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 pe){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,s,n){const i=new pe(e);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const a=this.texturePath(t,r.name,n);this.texturePmaInfo[this.pathPrefix+a]=r.pma}return i}createTexture(e,t,s){const n=this.textureLoader(s,t),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(e)&&i()},n}texturePath(e,t,s){return s?s[t]:e+t}},kn=class ze{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ze.AVAILABLE_CACHES.get(t);if(s)return s;const n=new ze;return ze.AVAILABLE_CACHES.set(t,n),n}async addAsset(t,s){return this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=s,s}getAsset(t){return this.assetsLoaded[t]}},Mn=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){var t=window.atob(e),s=t.length,n=new Uint8Array(s);for(let i=0;i{this.finish(e,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(e,t,s){this.downloadText(e,n=>{t(JSON.parse(n))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const n=this.rawDataUris[e];if(n&&!n.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(n))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const i=new XMLHttpRequest;i.open("GET",n||e,!0),i.responseType="arraybuffer";const r=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(e,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(e,t,s){let n=this.callbacks[e];try{if(n)return!0;this.callbacks[e]=n=[]}finally{n.push(t,s)}}finish(e,t,s){const n=this.callbacks[e];if(delete this.callbacks[e],t===200||t===0)for(let i=0,r=n.length;i= 0.");if(!s)throw new Error("name cannot be null.");this.index=t,this.parent=n}copy(t){const s=new di(this.index,this.name,t);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ve=(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))(ve||{}),Te=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(e){if(e==null)throw new Error("pose cannot be null.");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}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=e.scaleX,m=e.scaleY,f=(t+i)*X.degRad,u=(t+90+r)*X.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*n*m,this.worldX=this.x*d+e.x,this.worldY=this.y*m+e.y;return}const a=this.bone.parent.appliedPose;let c=a.a,l=a.b,o=a.c,h=a.d;switch(this.worldX=c*this.x+l*this.y+a.worldX,this.worldY=o*this.x+h*this.y+a.worldY,this.inherit){case 0:{const d=(t+i)*X.degRad,m=(t+90+r)*X.degRad,f=Math.cos(d)*s,u=Math.cos(m)*n,p=Math.sin(d)*s,g=Math.sin(m)*n;this.a=c*f+l*p,this.b=c*u+l*g,this.c=o*f+h*p,this.d=o*u+h*g;return}case 1:{const d=e.scaleX,m=e.scaleY,f=(t+i)*X.degRad,u=(t+90+r)*X.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*n*m;break}case 2:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m;c*=f,o*=u;let p=c*c+o*o,g=0;p>X.epsilon2?(p=Math.abs(c*h*u-l*f*o)/p,l=o*p,h=c*p,g=t-X.atan2Deg(o,c)):(c=0,o=0,g=t-90+X.atan2Deg(h,l));const x=(g+i)*X.degRad,w=(g+r+90)*X.degRad,b=Math.cos(x)*s,v=Math.cos(w)*n,y=Math.sin(x)*s,T=Math.sin(w)*n;this.a=(c*b-l*y)*d,this.b=(c*v-l*T)*d,this.c=(o*b+h*y)*m,this.d=(o*v+h*T)*m;break}case 3:case 4:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m,p=t*X.degRad,g=Math.cos(p),x=Math.sin(p);let w=(c*g+l*x)*f,b=(o*g+h*x)*u;const v=1/Math.sqrt(w*w+b*b);w*=v,b*=v;let y=-b,T=w;this.inherit===3&&c*h-l*o<0!=(d<0!=m<0)&&(y=-y,T=-T);const S=i*X.degRad,A=(90+r)*X.degRad,k=Math.cos(S)*s,C=Math.cos(A)*n,I=Math.sin(S)*s,P=Math.sin(A)*n;this.a=(w*k+y*I)*d,this.b=(w*C+y*P)*d,this.c=(b*k+T*I)*m,this.d=(b*C+T*P)*m;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,s=e.scaleY;if(!this.bone.parent){const g=1/t,x=1/s;this.x=(this.worldX-e.x)*g,this.y=(this.worldY-e.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,a=n.c,c=n.d;const l=i*c-r*a,o=1/(i*c-r*a),h=c*o,d=r*o,m=a*o,f=i*o,u=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=u*h-p*d,this.y=p*f-u*m,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,f*this.c-m*this.a,f*this.d-m*this.b,0);break;case 1:{const g=1/t,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/t,x=1/s;i*=g,a*=x;const w=this.a*g,b=this.b*g,v=this.c*x,y=this.d*x,T=1/(i*i+a*a),S=1/Math.abs(l*g*x);this.set5((i*w+a*v)*T,(i*b+a*y)*T,(i*v-a*w)*S,(i*y-a*b)*S,X.atan2Deg(a,i));break}case 3:case 4:{const g=1/t,x=1/s,w=this.a*g,b=this.b*g,v=this.c*x,y=this.d*x;let T=c*this.a-r*this.c,S=i*this.c-a*this.a;l<0&&(T=-T,S=-S);let A=X.atan2Deg(S,T);this.rotation=A,A*=X.degRad;const k=Math.cos(A),C=Math.sin(A);let I=(i*k+r*C)*g,P=(a*k+c*C)*x;const F=1/Math.sqrt(I*I+P*P);I*=F,P*=F;const B=this.inherit===3&&l<0!=(t<0!=s<0)?-1:1;this.set4(I*w+P*v,I*b+P*y,(I*v-P*w)*B,(I*y-P*b)*B)}}}set4(e,t,s,n){const i=e*e+s*s,r=t*t+n*n;i>X.epsilon2?(this.shearX=X.atan2Deg(s,e),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>X.epsilon2?(this.shearY=X.atan2Deg(n,t),e*n-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,s,n,i){this.shearX=0;const r=e*e+s*s,a=t*t+n*n;if(r>X.epsilon2){const c=X.atan2Deg(s,e);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(a),a>X.epsilon2?(this.shearY=X.atan2Deg(n,t),e*n-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(a),this.shearY=0,this.rotation=a>X.epsilon2?X.atan2Deg(n,t)-90+i:i}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e,e._update)}modifyWorld(e){const t=e._update;this.local=t,this.world=t,this.resetWorld(e,t)}resetWorld(e,t){const s=this.bone.children;for(let n=0,i=s.length;n(e[e.None=0]="None",e[e.Uniform=1]="Uniform",e[e.Volume=2]="Volume",e))(Ce||{}),Ae=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Os=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}setupPose=new Ae(-1,this);constructor(e){this.name=e}},Ie=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}},En=class Dt extends qt{bones;target;constructor(t,s){if(super(t,new Ie,new Ie),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[t.target.index]}copy(t){var s=new Dt(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Dt.apply(t,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Dt.apply(t,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(t){t.sortBone(this.target);const s=this.bones[0].bone;t.sortBone(s),t._updateCache.push(this),s.sorted=!1,t.sortReset(s.children),t.constrained(s),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,s,n,i,r,a,c,l,o,h){typeof n=="number"?Dt.apply1(t,s,n,i,r,a,c,l):Dt.apply2(t,s,n,i,r,a,c,l,o,h)}static apply1(t,s,n,i,r,a,c,l){s.modifyLocal(t);const o=s.bone.parent.appliedPose;let h=o.a,d=o.b,m=o.c,f=o.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*X.signum(t.scaleX),g=(i-s.worldY)*X.signum(t.scaleY);break;case 2:{const x=Math.abs(h*f-d*m)/Math.max(X.epsilon,h*h+m*m),w=h/t.scaleX,b=m/t.scaleY;d=-b*x*t.scaleX,f=w*x*t.scaleY,u+=X.atan2Deg(b,w)}default:{const x=n-o.worldX,w=i-o.worldY,b=h*f-d*m;Math.abs(b)<=X.epsilon?(p=0,g=0):(p=(x*f-w*d)/b-s.x,g=(w*h-x*m)/b-s.y)}}if(u+=X.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<=-180&&(u+=360),s.rotation+=u*l,r||a){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>X.epsilon){const w=p*p+g*g;if(r&&wx*x){const b=(Math.sqrt(w)/x-1)*l+1;switch(s.scaleX*=b,c){case 1:s.scaleY*=b;break;case 2:s.scaleY/=b<.7?.25+.642857*b:b}}}}}static apply2(t,s,n,i,r,a,c,l,o,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(t),n.modifyLocal(t);let d=s.x,m=s.y,f=s.scaleX,u=s.scaleY,p=n.scaleX,g=0,x=0,w=0;f<0?(f=-f,g=180,w=-1):(g=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,x=180):x=0;let b=0,v=0,y=s.a,T=s.b,S=s.c,A=s.d;const k=Math.abs(f-u)<=X.epsilon;!k||c?(n.y=0,b=y*n.x+s.worldX,v=S*n.x+s.worldY):(b=y*n.x+T*n.y+s.worldX,v=S*n.x+A*n.y+s.worldY);const C=s.bone.parent.appliedPose;y=C.a,T=C.b,S=C.c,A=C.d;let I=y*A-T*S,P=b-C.worldX,F=v-C.worldY;I=Math.abs(I)<=X.epsilon?0:1/I;const B=(P*A-F*T)*I-d,R=(F*y-P*S)*I-m;let L=Math.sqrt(B*B+R*R),O=n.bone.data.length*p,N,Y;if(L0){let $=Math.min(1,q/(o*2))-1;$=(q-o*(1-$*$))/D,E-=$*E,U-=$*U,_=E*E+U*U}}t:if(k){O*=f;let D=(_-L*L-O*O)/(2*L*O);if(D<-1)D=-1,Y=Math.PI*a;else if(D>1){if(D=1,Y=0,c)switch(y=(Math.sqrt(_)/(L+O)-1)*h+1,s.scaleX*=y,l){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else Y=Math.acos(D)*a;y=L+O*D,T=O*Math.sin(Y),N=Math.atan2(U*y-E*T,E*y+U*T)}else{y=f*O,T=u*O;const D=y*y,q=T*T,$=Math.atan2(U,E);S=q*L*L+D*_-D*q;const J=-2*q*L,st=q-D;if(A=J*J-4*st*S,A>=0){let yt=Math.sqrt(A);J<0&&(yt=-yt),yt=-(J+yt)*.5;let Ct=yt/st,ue=S/yt;const $e=Math.abs(Ct)=0){F=Math.sqrt(Ct)*a,N=$-Math.atan2(F,$e),Y=Math.atan2(F/u,($e-L)/f);break t}}let j=X.PI,nt=L-y,ot=nt*nt,it=0,pt=0,at=L+y,lt=at*at,xt=0;S=-y*L/(D-q),S>=-1&&S<=1&&(S=Math.acos(S),P=y*Math.cos(S)+L,F=T*Math.sin(S),A=P*P+F*F,Alt&&(pt=S,lt=A,at=P,xt=F)),_<=(ot+lt)*.5?(N=$-Math.atan2(it*a,nt),Y=j*a):(N=$-Math.atan2(xt*a,at),Y=pt*a)}const G=Math.atan2(n.y,n.x)*w;N=(N-G)*X.radDeg+g-s.rotation,N>180?N-=360:N<=-180&&(N+=360),s.rotation+=N*h,Y=((Y+G)*X.radDeg-n.shearX)*w+x-n.rotation,Y>180?Y-=360:Y<=-180&&(Y+=360),n.rotation+=Y*h}},oe=class extends zt{bones=[];_target=null;set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(e){super(e,new Ie)}create(e){return new En(this,e)}},ke=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}},ae=class extends zt{bones=[];set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(e){super(e,new ke)}create(e){return new Bn(this,e)}},Us=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Us||{}),$s=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))($s||{}),qs=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(qs||{}),Bn=class Nt extends qt{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,s){if(super(t,new ke,new ke),!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[t.slot.index]}copy(t){var s=new Nt(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof re))return;const i=this.appliedPose,r=i.mixRotate,a=i.mixX,c=i.mixY;if(r===0&&a===0&&c===0)return;const l=this.data,o=l.rotateMode===0,h=l.rotateMode===2,d=this.bones,m=d.length,f=o?m:m+1,u=V.setArraySize(this.spaces,f),p=h?this.lengths=V.setArraySize(this.lengths,m):[],g=i.spacing;switch(l.spacingMode){case 2:if(h)for(let T=0,S=f-1;T0){T=f/T*g;for(let S=1;S0?X.degRad:-X.degRad}for(let T=0,S=3;T0){let F=A.a,B=A.b,R=A.c,L=A.d,O=0,N=0,Y=0;if(o?O=x[S-1]:u[T+1]===0?O=x[S+2]:O=Math.atan2(P,I),O-=Math.atan2(R,F),y){N=Math.cos(O),Y=Math.sin(O);const E=A.bone.data.length;w+=(E*(N*F-Y*R)-I)*r,b+=(E*(Y*F+N*R)-P)*r}else O+=v;O>X.PI?O-=X.PI2:O<-X.PI&&(O+=X.PI2),O*=r,N=Math.cos(O),Y=Math.sin(O),A.a=N*F-Y*R,A.b=N*B-Y*L,A.c=Y*F+N*R,A.d=Y*B+N*L}}}computeWorldPositions(t,s,n,i){const r=this.slot;let a=this.appliedPose.position,c=this.spaces,l=V.setArraySize(this.positions,n*3+2),o=this.world;const h=s.closed;let d=s.worldVerticesLength,m=d/6,f=Nt.NONE;if(!s.constantSpeed){const Y=s.lengths;m-=h?1:2;const E=Y[m];this.data.positionMode===1&&(a*=E);let U;switch(this.data.spacingMode){case 2:U=E;break;case 3:U=E/n;break;default:U=1}o=V.setArraySize(this.world,8);for(let _=0,G=0,D=0;_E){f!==Nt.AFTER&&(f=Nt.AFTER,s.computeWorldVertices(t,r,d-6,4,o,0,2)),this.addAfterPosition($-E,o,0,l,G);continue}for(;;D++){const J=Y[D];if(!($>J)){if(D===0)$/=J;else{const st=Y[D-1];$=($-st)/(J-st)}break}}D!==f&&(f=D,h&&D===m?(s.computeWorldVertices(t,r,d-4,4,o,0,2),s.computeWorldVertices(t,r,0,4,o,4,2)):s.computeWorldVertices(t,r,D*6+2,8,o,0,2)),this.addCurvePosition($,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],l,G,i||_>0&&q===0)}return l}h?(d+=2,o=V.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d-4,o,0,2),s.computeWorldVertices(t,r,0,2,o,d-4,2),o[d-2]=o[0],o[d-1]=o[1]):(m--,d-=4,o=V.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d,o,0,2));const u=V.setArraySize(this.curves,m);let p=0,g=o[0],x=o[1],w=0,b=0,v=0,y=0,T=0,S=0,A=0,k=0,C=0,I=0,P=0,F=0,B=0,R=0;for(let Y=0,E=2;Yp){this.addAfterPosition(D-p,o,d-4,l,E);continue}for(;;U++){const q=u[U];if(!(D>q)){if(U===0)D/=q;else{const $=u[U-1];D=(D-$)/(q-$)}break}}if(U!==f){f=U;let q=U*6;for(g=o[q],x=o[q+1],w=o[q+2],b=o[q+3],v=o[q+4],y=o[q+5],T=o[q+6],S=o[q+7],A=(g-w*2+v)*.03,k=(x-b*2+y)*.03,C=((w-v)*3-g+T)*.006,I=((b-y)*3-x+S)*.006,P=A*2+C,F=k*2+I,B=(w-g)*.3+A+C*.16666667,R=(b-x)*.3+k+I*.16666667,N=Math.sqrt(B*B+R*R),O[0]=N,q=1;q<8;q++)B+=P,R+=F,P+=C,F+=I,N+=Math.sqrt(B*B+R*R),O[q]=N;B+=P,R+=F,N+=Math.sqrt(B*B+R*R),O[8]=N,B+=P+C,R+=F+I,N+=Math.sqrt(B*B+R*R),O[9]=N,_=0}for(D*=N;;_++){const q=O[_];if(!(D>q)){if(_===0)D/=q;else{const $=O[_-1];D=_+(D-$)/(q-$)}break}}this.addCurvePosition(D*.1,g,x,w,b,v,y,T,S,l,E,i||Y>0&&G===0)}return l}addBeforePosition(t,s,n,i,r){const a=s[n],c=s[n+1],l=s[n+2]-a,o=s[n+3]-c,h=Math.atan2(o,l);i[r]=a+t*Math.cos(h),i[r+1]=c+t*Math.sin(h),i[r+2]=h}addAfterPosition(t,s,n,i,r){const a=s[n+2],c=s[n+3],l=a-s[n],o=c-s[n+1],h=Math.atan2(o,l);i[r]=a+t*Math.cos(h),i[r+1]=c+t*Math.sin(h),i[r+2]=h}addCurvePosition(t,s,n,i,r,a,c,l,o,h,d,m){if(t===0||Number.isNaN(t)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const f=t*t,u=f*t,p=1-t,g=p*p,x=g*p,w=p*t,b=w*3,v=p*b,y=b*t,T=s*x+i*v+a*y+l*u,S=n*x+r*v+c*y+o*u;h[d]=T,h[d+1]=S,m&&(t<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*w*2+c*f),T-(s*g+i*w*2+a*f)))}sort(t){const s=this.slot.data.index,n=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,s,n),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,s,n),this.sortPath(t,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let a=0;a(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Rn||{}),Me=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(e){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}},Pe=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof At)||!(this.attachment instanceof At)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}},Xn=class fi extends Ns{skeleton;bone;attachmentState=0;constructor(t,s){if(super(t,new Pe,new Pe),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(t,s,n){const i=new fi(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(t.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},Gt=class Ge{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ge.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ge.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let s=0;s0,a=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone;let h=o.bone.data.length,d=this.data.step,m=0;if(s!==0){switch(o.modifyWorld(t),s){case 1:this.reset(t);case 2:{const f=Math.max(t.time-this.lastTime,0),u=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=o.worldX,g=o.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,w=n.inertia,b=t.data.referenceScale,v=-1,y=0,T=0,S=this.data.limit*f,A=S*Math.abs(t.scaleY);if(S*=Math.abs(t.scaleX),r||a){if(r){const k=(this.ux-p)*w;this.xOffset+=k>S?S:k<-S?-S:k,this.ux=p}if(a){const k=(this.uy-g)*w;this.yOffset+=k>A?A:k<-A?-A:k,this.uy=g}if(x>=d){const k=this.xOffset,C=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,T=n.strength;const I=b*n.wind,P=b*n.gravity,F=(I*t.windX+P*t.gravityX)*t.scaleX,B=(I*t.windY+P*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(F-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),a&&(this.yVelocity-=(B+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),x-=d;while(x>=d);this.xLag=this.xOffset-k,this.yLag=this.yOffset-C}m=Math.max(0,1-x/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c||l){let k=Math.atan2(o.c,o.a),C=0,I=0,P=0,F=this.cx-o.worldX,B=this.cy-o.worldY;if(F>S?F=S:F<-S&&(F=-S),B>A?B=A:B<-A&&(B=-A),x=this.remaining,c){P=(this.data.rotate+this.data.shearX)*i,m=this.rotateLag*Math.max(0,1-u/d);let R=Math.atan2(B+this.ty,F+this.tx)-k-(this.rotateOffset-m)*P;this.rotateOffset+=(R-Math.ceil(R*X.invPI2-.5)*X.PI2)*w,R=(this.rotateOffset-m)*P+k,C=Math.cos(R),I=Math.sin(R),l&&(R=h*o.getWorldScaleX(),R>0&&(this.scaleOffset+=(F*C+B*I)*w/R))}else{C=Math.cos(k),I=Math.sin(k);const R=h*o.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);R>0&&(this.scaleOffset+=(F*C+B*I)*w/R)}if(x>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,T=n.strength);const R=n.wind*t.windX+n.gravity*t.gravityX,L=(n.wind*t.windY+n.gravity*t.gravityY)*Gt.yDir,O=this.rotateOffset,N=this.scaleOffset,Y=h/b;for(;;)if(x-=d,l&&(this.scaleVelocity+=(R*C-L*I-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),c){if(this.rotateVelocity-=((R*I+L*C)*Y+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,x0){let x=0;this.data.rotate>0&&(x=f*this.data.rotate,u=Math.sin(x),p=Math.cos(x),g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d),x+=f*this.data.shearX,u=Math.sin(x),p=Math.cos(x),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c}else f*=this.data.rotate,u=Math.sin(f),p=Math.cos(f),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c,g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d}if(l){let f=1+(this.scaleOffset-this.scaleLag*m)*i*this.data.scaleX;switch(o.a*=f,o.c*=f,this.data.scaleYMode){case 1:o.b*=f,o.d*=f;break;case 2:f=Math.abs(f),f=f>=.7?1/f:4-3.67347*f,o.b*=f,o.d*=f}}s!==3&&(this.tx=h*o.a,this.ty=h*o.c)}}sort(t){const s=this.bone.bone;t.sortBone(s),t._updateCache.push(this),t.sortReset(s.children),t.constrained(s)}isSourceActive(){return this.bone.bone.active}},le=class extends zt{set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(e){if(e==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=e}constructor(e){super(e,new Me)}create(e){return new zs(this,e)}};typeof Math.fround>"u"&&(Math.fround=(e=>t=>(e[0]=t,e[0]))(new Float32Array(1)));var Fe=class{time=0;mix=0;set(e){this.time=e.time,this.mix=e.mix}},Ln=class hn extends qt{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,s){if(super(t,new Fe,new Fe),!s)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=s.bones[t.bone.index])}copy(t){var s=new hn(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,a=this.bone;if(a!==null){if(!a.active)return;i.local&&a.appliedPose.validateLocalTransform(t),n.time=i.offset+(i.property.value(t,a.appliedPose,i.local,hn.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=t.bones,l=r.bones;for(let o=0,h=r.bones.length;o=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=s}addSkin(e){for(let s=0;s= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.boneData=s}},Hs=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Hs||{}),Ee=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}},Vn=class gi extends qt{bones;source;constructor(t,s){if(super(t,new Ee,new Ee),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of t.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[t.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(t){var s=new gi(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,a=i.localTarget,c=i.additive,l=i.clamp,o=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(t);const d=i.properties,m=i.properties.length,f=this.bones;for(let u=0,p=this.bones.length;u0?n[K.ROTATION]:-n[K.ROTATION]);return a<0&&(a+=360),a}},Ks=class extends Xt{mix(e){return e.mixRotate}apply(e,t,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*t.mixRotate;else{const a=e.scaleX,c=e.scaleY,l=1/a,o=1/c,h=s.a*l,d=s.b*l,m=s.c*o,f=s.d*o;n*=X.degRad,r||(n-=Math.atan2(m,h)),n>X.PI?n-=X.PI2:n<-X.PI&&(n+=X.PI2),n*=t.mixRotate;const u=Math.cos(n),p=Math.sin(n);s.a=(u*h-p*m)*a,s.b=(u*d-p*f)*a,s.c=(p*h+u*m)*c,s.d=(p*d+u*f)*c}}},Re=class extends Rt{value(e,t,s,n){return s?t.x+n[K.X]:(n[K.X]*t.a+n[K.Y]*t.b+t.worldX)/e.scaleX}},Js=class extends Xt{mix(e){return e.mixX}apply(e,t,s,n,i,r){i?s.x+=(r?n:n-s.x)*t.mixX:(r||(n-=s.worldX/e.scaleX),s.worldX+=n*t.mixX*e.scaleX)}},Xe=class extends Rt{value(e,t,s,n){return s?t.y+n[K.Y]:(n[K.X]*t.c+n[K.Y]*t.d+t.worldY)/e.scaleY}},js=class extends Xt{mix(e){return e.mixY}apply(e,t,s,n,i,r){i?s.y+=(r?n:n-s.y)*t.mixY:(r||(n-=s.worldY/e.scaleY),s.worldY+=n*t.mixY*e.scaleY)}},Le=class extends Rt{value(e,t,s,n){if(s)return t.scaleX+n[K.SCALEX];const i=t.a/e.scaleX,r=t.c/e.scaleY;return Math.sqrt(i*i+r*r)+n[K.SCALEX]}},Zs=class extends Xt{mix(e){return e.mixScaleX}apply(e,t,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*t.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*t.mixScaleX);else if(r){const a=1+(n-1)*t.mixScaleX;s.a*=a,s.c*=a}else{let a=s.a/e.scaleX,c=s.c/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleX/l,s.a*=l,s.c*=l)}}},Ve=class extends Rt{value(e,t,s,n){if(s)return t.scaleY+n[K.SCALEY];const i=t.b/e.scaleX,r=t.d/e.scaleY;return Math.sqrt(i*i+r*r)+n[K.SCALEY]}},Qs=class extends Xt{mix(e){return e.mixScaleY}apply(e,t,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*t.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*t.mixScaleY);else if(r){const a=1+(n-1)*t.mixScaleY;s.b*=a,s.d*=a}else{let a=s.b/e.scaleX,c=s.d/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleY/l,s.b*=l,s.d*=l)}}},De=class extends Rt{value(e,t,s,n){if(s)return t.shearY+n[K.SHEARY];const i=1/e.scaleX,r=1/e.scaleY;return(Math.atan2(t.d*r,t.b*i)-Math.atan2(t.c*r,t.a*i))*X.radDeg-90+n[K.SHEARY]}},tn=class extends Xt{mix(e){return e.mixShearY}apply(e,t,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*t.mixShearY;else{const a=e.scaleX,c=e.scaleY,l=s.b/a,o=s.d/c,h=Math.atan2(o,l);n=(n+90)*X.degRad,r?n-=X.PI/2:(n-=h-Math.atan2(s.c/c,s.a/a),n>X.PI?n-=X.PI2:n<-X.PI&&(n+=X.PI2)),n=h+n*t.mixShearY;const d=Math.sqrt(l*l+o*o);s.b=Math.cos(n)*d*a,s.d=Math.sin(n)*d*c}}},Dn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new Ye;s.name="";const n=new Nn(e),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*t;const a=n.readBoolean();a&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let f=0;f>5;for(let b=0,v;b>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=n.readFloat());const w=g.setupPose;w.position=n.readFloat(),g.positionMode===0&&(w.position*=t),w.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(w.spacing*=t),w.mixRotate=n.readFloat(),w.mixX=n.readFloat(),w.mixY=n.readFloat(),o.push(g);break}case tr:{const g=new le(u);g.bone=l[n.readInt(!0)];let x=n.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=n.readFloat()),(x&4)!==0&&(g.y=n.readFloat()),(x&8)!==0&&(g.rotate=n.readFloat()),(x&16)!==0){let b=n.readFloat();b<-2?(g.scaleYMode=2,b=-2-b):b<0&&(g.scaleYMode=1,b=-1-b),g.scaleX=b}(x&32)!==0&&(g.shearX=n.readFloat()),g.limit=((x&64)!==0?n.readFloat():5e3)*t,g.step=1/n.readUnsignedByte();const w=g.setupPose;w.inertia=n.readFloat(),w.strength=n.readFloat(),w.damping=n.readFloat(),w.massInverse=(x&128)!==0?n.readFloat():1,w.wind=n.readFloat(),w.gravity=n.readFloat(),x=n.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),w.mix=(x&128)!==0?n.readFloat():1,o.push(g);break}case er:{const g=new Pt(u),x=n.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0){const w=n.readFloat();a&&(x&64)!==0?g.max=w:g.setupPose.time=w}if((x&16)!==0&&(g.setupPose.mix=(x&32)!==0?n.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=l[n.readInt(!0)];const w=n.readFloat();let b=1;switch(n.readByte()){case 0:g.property=new Be;break;case 1:{b=t,g.property=new Re;break}case 2:{b=t,g.property=new Xe;break}case 3:g.property=new Le;break;case 4:g.property=new Ve;break;case 5:g.property=new De;break;default:continue}g.property.offset=w*b,g.offset=n.readFloat(),g.scale=n.readFloat()/b}o.push(g);break}}}const d=this.readSkin(n,s,!0,a);d&&(s.defaultSkin=d,s.skins.push(d));{let f=s.skins.length;for(V.setArraySize(s.skins,c=f+n.readInt(!0));f0){x=[];for(let T=0;T>4,e.readFloat())}i.push(k);break}}}}}const a=s.slots.length,c=e.readInt(!0);if(c>0){const m=new Et(c);for(let f=0;f0){const m=new be(o);for(let f=0;f>>1^-(s&1)}readStringRef(){const 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="";for(let s=0;s>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}},Yi=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,n,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},_n=class{constructor(e=null,t,s=0){this.bones=e,this.vertices=t,this.length=s}};function tt(e,t,s,n){s instanceof te?Ei(e,t,s,n):Bi(e,t,s,n)}function Ei(e,t,s,n){let i=e.readFloat(),r=e.readFloat()*n;for(let a=0,c=0,l=s.getFrameCount()-1;s.setFrame(a,i,r),a!==l;a++){const o=e.readFloat(),h=e.readFloat()*n;switch(e.readByte()){case wt:s.setStepped(a);break;case bt:W(e,s,c++,a,0,i,o,r,h,n)}i=o,r=h}t.push(s)}function Bi(e,t,s,n){let i=e.readFloat(),r=e.readFloat()*n,a=e.readFloat()*n;for(let c=0,l=0,o=s.getFrameCount()-1;s.setFrame(c,i,r,a),c!==o;c++){const h=e.readFloat(),d=e.readFloat()*n,m=e.readFloat()*n;switch(e.readByte()){case wt:s.setStepped(c);break;case bt:W(e,s,l++,c,0,i,h,r,d,n),W(e,s,l++,c,1,i,h,a,m,n)}i=h,r=d,a=m}t.push(s)}function On(e,t){const s=e.readInt(!0);if(s===0)return null;const n=new Array(t).fill(-1),i=new Array(t-s);let r=0,a=0;for(let c=0;c=0;c--)n[c]===-1&&(n[c]=i[--a]);return n}function W(e,t,s,n,i,r,a,c,l,o){t.setBezier(s,n,i,r,c,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,a,l)}var Ri=0,Xi=1,Li=2,Vi=3,Di=4,Ni=5,_i=6,Oi=7,Ui=8,$i=9,qi=10,zi=0,Gi=1,Wi=2,Hi=3,Ki=4,Ji=5,ji=0,Zi=1,Qi=2,tr=3,er=4,sr=0,nr=1,ir=0,rr=1,or=2,ar=0,lr=1,cr=2,hr=4,dr=5,ur=6,fr=7,mr=8,gr=0,pr=1,wt=1,bt=2,Un=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Zt(()=>V.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=e.slots,a=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,n){const i=this.minX,r=this.minY,a=this.maxX,c=this.maxY;if(e<=i&&s<=i||t<=r&&n<=r||e>=a&&s>=a||t>=c&&n>=c)return!1;const l=(n-t)/(s-e);let o=l*(i-e)+t;if(o>r&&or&&oi&&hi&&he.minX&&this.minYe.minY}containsPoint(e,t){const s=this.polygons;for(let n=0,i=s.length;n=s||o=s){const h=n[c];h+(s-l)/(o-l)*(n[r]-h)=h&&b<=f||b>=f&&b<=h)&&(b>=t&&b<=n||b>=n&&b<=t)){const v=(o*x-l*p)/w;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=f,d=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");const t=this.boundingBoxes.indexOf(e);return t===-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},$n=class ct{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Zt(()=>[]);polygonIndicesPool=new Zt(()=>[]);triangulate(t){const s=t;let n=t.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c3;){let c=n-1,l=0,o=1;for(;;){t:if(!r[l]){const m=i[c]<<1,f=i[l]<<1,u=i[o]<<1,p=s[m],g=s[m+1],x=s[f],w=s[f+1],b=s[u],v=s[u+1];for(let y=o+10);c=l>0?l-1:n-1,o=l+10?l-1:n-1,d=l0&&(i.push(c),r.push(a),c=this.polygonPool.obtain(),a=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,x,w),c.push(b,v),a.length=0,a.push(m,f,u),o=ct.winding(p,g,x,w,b,v),l=m}c.length>0&&(i.push(c),r.push(a));for(let h=0,d=i.length;h=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),a=r[h],r.splice(h,1),this.polygonIndicesPool.free(a)):c.push(c[0],c[1]);return i}static isConcave(t,s,n,i){const r=i[t>0?t-1:s-1]<<1,a=i[t]<<1,c=i[t+1=0}static winding(t,s,n,i,r,a){return t*(a-i)+n*(s-a)+r*(i-s)>=0?1:-1}},he=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(e,t,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=V.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(e,t,0,n,i,0,2);const r=this.clippingPolygon,a=this.makeClockwise(r);a||this.inverse||s.convex?(a||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new $n),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(e){this.clipAttachment&&(e&&this.clipAttachment.endSlot!==e.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,n,i,r,a,c){return n&&i&&r&&typeof a=="boolean"&&typeof c=="number"?this.clipTrianglesRender(e,t,s,n,i,r,a,c):this.clipTrianglesNoRender(e,t,s)}clipTrianglesNoRender(e,t,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d>1,A=n.length;const k=V.setArraySize(n,A+T);V.arrayCopy(b,v,k,A,T),A=i.length;const C=V.setArraySize(i,A+3*(S-2));for(let I=1;I>1;const T=V.setArraySize(n,b+v);V.arrayCopy(o,0,T,b,v),b=i.length;const S=V.setArraySize(i,b+3*(y-2));y--;for(let A=1;A>1;let $=l.length;const J=V.setArraySize(l,$+q*c);for(let j=0;j>1;O===0&&(F=T-C,B=k-y,R=x-k,L=C-w,O=1/(F*R-B*L));const _=V.setArraySize(l,Y+U*c);for(let D=0;D>1;let D=this.clippedVerticesLength;const q=D+G*r,$=this.clippedUVsLength+G*2;a.length>1;N===0&&(B=S-I,R=C-T,L=x-C,O=I-w,N=1/(B*L-R*O));const G=E+_*r;a.length=2?(o=this.clipOutput,h=this.scratch):(o=this.scratch,h=this.clipOutput);const d=a;o.length=8;const m=o;m[0]=e,m[1]=t,m[2]=s,m[3]=n,m[4]=i,m[5]=r,m[6]=e,m[7]=t,h.length=0;const f=a.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],x=p-d[u+2],w=g-d[u+3],b=h.length,v=o;e=v[0],t=v[1];let y=w*(p-e)-x*(g-t);for(let S=2,A=o.length-2;S<=A;S+=2){s=v[S],n=v[S+1];const k=w*(p-s)-x*(g-n);if(y>0)if(k>0)h.push(s,n);else{const C=s-e,I=n-t,P=y/(C*w-I*x);P>=0&&P<=1?(h.push(e+C*P,t+I*P),l=!0):h.push(s,n)}else if(k>0){const C=s-e,I=n-t,P=y/(C*w-I*x);P>=0&&P<=1?(h.push(e+C*P,t+I*P,s,n),l=!0):h.push(s,n)}else l=!0;e=s,t=n,y=k}if(b===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),u===f)break;const T=h;h=o,h.length=0,o=T}if(c!==h){c.length=0;for(let u=0,p=h.length-2;u=2?(l=this.clipOutput,o=this.scratch):(l=this.scratch,o=this.clipOutput),l.length=8;let h=a,d=l;d[0]=e,d[1]=t,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=e,d[7]=t,o.length=0;for(let m=0;;m+=2){const f=h[m],u=h[m+1],p=f-h[m+2],g=u-h[m+3],x=o.length,w=this.inverseVertices.length;this.inverseVertices.push(0),d=l,e=d[0],t=d[1];let b=g*(f-e)-p*(u-t);for(let T=2,S=l.length-2;T<=S;T+=2){s=d[T],n=d[T+1];const A=g*(f-s)-p*(u-n);if(b>0)if(A>0)o.push(s,n);else{const k=s-e,C=n-t,I=b/(k*g-C*p);if(I>=0&&I<=1){const P=e+k*I,F=t+C*I;o.push(P,F),this.inverseVertices.push(P,F,s,n)}else o.push(s,n)}else if(A>0){const k=s-e,C=n-t,I=b/(k*g-C*p);if(I>=0&&I<=1){const P=e+k*I,F=t+C*I;this.inverseVertices.push(P,F),o.push(P,F,s,n)}else o.push(s,n)}else this.inverseVertices.push(s,n);e=s,t=n,b=A}const v=this.inverseVertices.length-w-1;if(v>=6?this.inverseVertices[w]=v:this.inverseVertices.length=w,x===o.length||(o.push(o[0],o[1]),m===c))break;const y=o;o=l,o.length=0,l=y}}makeClockwise(e){const t=e,s=e.length;let n=!0,i=!0,r=0,a=t[s-2],c=t[s-1],l=t[0],o=t[1];for(let d=2;d=0,a=l,c=o,l=m,o=f}r+=l*t[1]-t[0]*o;const h=(l-a)*(t[1]-o)-(o-c)*(t[0]-l);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,m=s-2,f=s>>1;d=0&&(n[o]>c||n[o]===c&&n[o+1]>l);o-=2)n[o+2]=n[o],n[o+3]=n[o+1];n[o+2]=c,n[o+3]=l}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let a=4;a=0&&(i-=2,i!==2););s[i]=c,s[i+1]=l}s[i]=n[t-4],s[i+1]=n[t-3];const r=i;i+=2;for(let a=t-6;a>=0;a-=2,i+=2){const c=n[a],l=n[a+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=l}e.length=i-2}},qn=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new Ye,n=typeof e=="string"?JSON.parse(e):e,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=M(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r0&&l.properties.push(y)}l.offsets[K.ROTATION]=M(r,"rotation",0),l.offsets[K.X]=M(r,"x",0)*t,l.offsets[K.Y]=M(r,"y",0)*t,l.offsets[K.SCALEX]=M(r,"scaleX",0),l.offsets[K.SCALEY]=M(r,"scaleY",0),l.offsets[K.SHEARY]=M(r,"shearY",0);const w=l.setupPose;d&&(w.mixRotate=M(r,"mixRotate",1)),m&&(w.mixX=M(r,"mixX",1)),f&&(w.mixY=M(r,"mixY",w.mixX)),u&&(w.mixScaleX=M(r,"mixScaleX",1)),p&&(w.mixScaleY=M(r,"mixScaleY",w.mixScaleX)),g&&(w.mixShearY=M(r,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new ae(a);l.skinRequired=c;for(let m=0;m0){const d=s.findConstraint(l,le);if(!d)throw new Error(`Physics constraint not found: ${l}`);h=s.constraints.indexOf(d)}for(const d in o){const m=o[d];let f=m[0];if(!f)continue;const u=m.length;let p,g=0;if(d==="reset"){const x=new Ms(u,h);for(let w=0;f!=null;f=m[w+1],w++)x.setFrame(w,M(f,"time",0));i.push(x);continue}switch(d){case"inertia":p=new vs(u,u,h);break;case"strength":p=new Ts(u,u,h);break;case"damping":p=new Ss(u,u,h);break;case"mass":p=new Cs(u,u,h);break;case"wind":p=new As(u,u,h);break;case"gravity":p=new Is(u,u,h);break;case"mix":{g=1,p=new ks(u,u,h);break}default:continue}ht(i,m,p,g,1)}}if(e.slider)for(const l in e.slider){const o=e.slider[l],h=s.findConstraint(l,Pt);if(!h)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in o){const f=o[m];if(!f[0])continue;const p=f.length;switch(m){case"time":ht(i,f,new Ps(p,p,d),1,1);break;case"mix":ht(i,f,new Fs(p,p,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const o=e.attachments[l],h=s.findSkin(l);if(!h)throw new Error(`Skin not found: ${l}`);for(const d in o){const m=o[d],f=s.findSlot(d);if(!f)throw new Error(`Attachment slot not found: ${d}`);const u=f.index;for(const p in m){const g=m[p],x=h.getAttachment(u,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const w in g){const b=g[w];let v=b[0];if(v){if(w==="deform"){const y=x.bones,T=x.vertices,S=y?T.length/3*2:T.length,A=new ms(b.length,b.length,u,x);let k=M(v,"time",0);for(let C=0,I=0;;C++){let P;const F=M(v,"vertices",null);if(!F)P=y?V.newFloatArray(S):T;else{P=V.newFloatArray(S);const O=M(v,"offset",0);if(V.arrayCopy(F,0,P,O,F.length),n!==1)for(let N=O,Y=N+F.length;N=0;o--)r[o]===-1&&(r[o]=a[--l]);return r}function H(e,t,s,n,i,r,a,c,l,o){if(e==="stepped")return t.setStepped(n),s;const h=i<<2,d=e[h],m=e[h+1]*o,f=e[h+2],u=e[h+3]*o;return t.setBezier(s,n,i,r,c,d,m,f,u,a,l),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}var Gn=class{constructor(e,t,s={}){this.skeleton=e,this.adapter=t,this.positionInheritanceFactorX=s.positionInheritanceX??0,this.positionInheritanceFactorY=s.positionInheritanceY??0,this.rotationInheritanceFactor=s.rotationInheritance??0}positionInheritanceFactorX=0;positionInheritanceFactorY=0;rotationInheritanceFactor=0;hasLastTransform=!1;lastX=0;lastY=0;lastZ=0;lastRotation=0;currentTransform={x:0,y:0,z:0,rotation:0};currentPosition={x:0,y:0,z:0};lastPosition={x:0,y:0,z:0};get positionInheritanceX(){return this.positionInheritanceFactorX}get positionInheritanceY(){return this.positionInheritanceFactorY}setPositionInheritance(e,t){const s=this.positionInheritanceFactorX===0&&this.positionInheritanceFactorY===0,n=e!==0||t!==0;this.positionInheritanceFactorX=e,this.positionInheritanceFactorY=t,s&&n&&this.resetPosition()}get rotationInheritance(){return this.rotationInheritanceFactor}set rotationInheritance(e){const t=this.rotationInheritanceFactor===0;this.rotationInheritanceFactor=e,t&&e!==0&&this.resetRotation()}resetPosition(){const e=this.currentTransform,t=!this.hasLastTransform&&this.rotationInheritanceFactor!==0;this.adapter.readTransform(e,t),this.lastX=e.x,this.lastY=e.y,this.lastZ=e.z,t&&(this.lastRotation=e.rotation),this.hasLastTransform=!0}resetRotation(){const e=this.currentTransform;this.adapter.readTransform(e,!0),this.lastRotation=e.rotation,this.hasLastTransform||(this.lastX=e.x,this.lastY=e.y,this.lastZ=e.z),this.hasLastTransform=!0}resetTransform(){const e=this.currentTransform;this.adapter.readTransform(e,!0),this.setLastTransform(e.x,e.y,e.z,e.rotation)}applyTransformMovement(){const e=this.positionInheritanceFactorX!==0||this.positionInheritanceFactorY!==0,t=this.rotationInheritanceFactor!==0;if(!e&&!t)return;const s=this.currentTransform;this.adapter.readTransform(s,t);const{x:n,y:i,z:r}=s,a=t?s.rotation:this.lastRotation,c=n!==this.lastX||i!==this.lastY||r!==this.lastZ;if(this.hasLastTransform){if(!c&&a===this.lastRotation)return;e&&c&&this.applyPositionMovement(n,i,r),t&&a!==this.lastRotation&&this.applyRotationMovement(a)}this.setLastTransform(n,i,r,a)}applyPositionMovement(e,t,s){const n=this.currentPosition;n.x=e,n.y=t,n.z=s,this.adapter.worldToSkeleton(n);const i=this.lastPosition;i.x=this.lastX,i.y=this.lastY,i.z=this.lastZ,this.adapter.worldToSkeleton(i),this.skeleton.physicsTranslate((n.x-i.x)*this.positionInheritanceFactorX,(n.y-i.y)*this.positionInheritanceFactorY)}applyRotationMovement(e){const t=this.rotationInheritanceFactor;t!==0&&this.skeleton.physicsRotate(0,0,this.getRotationDelta(e,this.lastRotation)*t)}setLastTransform(e,t,s,n){this.lastX=e,this.lastY=t,this.lastZ=s,this.lastRotation=n,this.hasLastTransform=!0}getRotationDelta(e,t){let s=e-t;return s=(s+180)%360-180,s<-180?s+360:s}},wr=class{commandPool=new br;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new he;renderCommands=[];render(e,t=!1,s,n=2,i=0){this.commandPool.reset(),this.renderCommands.length=0;const r=this.clipping;let a=0;const c=e.drawOrder.appliedPose;for(let l=0,o=c.length;l>1;const C=m.sequence,I=C.resolveIndex(d);x=C.getUVs(I),w=m.triangles,b=w.length,y=C.regions[I]?.texture}else if(m instanceof Bt){r.clipEnd(h),r.clipStart(e,h,m);continue}else{r.clipEnd(h);continue}if(!y){r.clipEnd(h);continue}const T=e.color;let S,A;if(t){let C;if(s){C=Math.floor(s[3]*T.a*f.a*v.a*255);const I=Math.floor(C*s[0]*T.r*f.r*v.r),P=Math.floor(C*s[1]*T.g*f.g*v.g),F=Math.floor(C*s[2]*T.b*f.b*v.b);S=C<<24|I<<16|P<<8|F}else{C=Math.floor(T.a*f.a*v.a*255);const I=Math.floor(C*T.r*f.r*v.r),P=Math.floor(C*T.g*f.g*v.g),F=Math.floor(C*T.b*f.b*v.b);S=C<<24|I<<16|P<<8|F}if(A=4278190080,d.darkColor){const{r:I,g:P,b:F}=d.darkColor;A=4278190080|Math.floor(I*C)<<16|Math.floor(P*C)<<8|Math.floor(F*C)}}else{if(s){const C=Math.floor(s[3]*T.a*f.a*v.a*255),I=Math.floor(s[0]*T.r*f.r*v.r*255),P=Math.floor(s[1]*T.g*f.g*v.g*255),F=Math.floor(s[2]*T.b*f.b*v.b*255);S=C<<24|I<<16|P<<8|F}else{const C=Math.floor(T.a*f.a*v.a*255),I=Math.floor(T.r*f.r*v.r*255),P=Math.floor(T.g*f.g*v.g*255),F=Math.floor(T.b*f.b*v.b*255);S=C<<24|I<<16|P<<8|F}if(A=0,d.darkColor){const{r:C,g:I,b:P}=d.darkColor;A=Math.floor(C*255)<<16|Math.floor(I*255)<<8|Math.floor(P*255)}}r.isClipping()&&(r.clipTrianglesUnpacked(p,0,w,b,x,n),p=r.clippedVerticesTyped,g=r.clippedVerticesLength/n,x=r.clippedUVsTyped,w=r.clippedTrianglesTyped,b=r.clippedTrianglesLength);const k=this.commandPool.getCommand(g,b,n);if(k.blendMode=h.data.blendMode,k.texture=y,k.positions.set(p.subarray(0,g*n)),n>=3)for(let C=2,I=g*n;C=e*s&&i._indices.length>=t){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=e,n.numIndices=t,n.positions=n._positions.subarray(0,e*s),n.uvs=n._uvs.subarray(0,e<<1),n.colors=n._colors.subarray(0,e),n.darkColors=n._darkColors.subarray(0,e),n.indices=n._indices.subarray(0,t);else{const i=new Float32Array(e*s),r=new Float32Array(e<<1),a=new Uint32Array(e),c=new Uint32Array(e),l=new Uint16Array(t);n={positions:i,uvs:r,colors:a,darkColors:c,indices:l,_positions:i,_uvs:r,_colors:a,_darkColors:c,_indices:l,numVertices:e,numIndices:t,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},Lt=et("@pixi/assets"),dt=et("@pixi/core"),mt=et("@pixi/core"),de=class _t extends He{static textureMap=new Map;static from(t){return _t.textureMap.has(t)?_t.textureMap.get(t):new _t(t)}texture;constructor(t){super(t.resource.source),this.texture=mt.Texture.from(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=_t.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=_t.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=_t.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return mt.SCALE_MODES.NEAREST;case 9729:case 9987:case 9985:return mt.SCALE_MODES.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case 9728:case 9729:return mt.MIPMAP_MODES.OFF;case 9986:case 9984:case 9987:case 9985:return mt.MIPMAP_MODES.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return mt.WRAP_MODES.CLAMP;case 33648:return mt.WRAP_MODES.MIRRORED_REPEAT;case 10497:return mt.WRAP_MODES.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return mt.BLEND_MODES.NORMAL;case 1:return mt.BLEND_MODES.ADD;case 2:return mt.BLEND_MODES.MULTIPLY;case 3:return mt.BLEND_MODES.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Ne="spineTextureAtlasLoader",yr={extension:dt.ExtensionType.Asset,resolver:{test:e=>(0,Lt.checkExtension)(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(dt.settings.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:Ne,extension:{type:dt.ExtensionType.LoadParser,priority:Lt.LoaderParserPriority.Normal,name:Ne},test(e){return(0,Lt.checkExtension)(e,".atlas")},async load(e){const t=await dt.settings.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${Ne}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return await t.text()},testParse(e,t){const s=(0,Lt.checkExtension)(t.src,".atlas"),n=typeof e=="string",i=t.loadParser===Ne;return Promise.resolve((s||i)&&n)},unload(e){e.dispose()},async parse(e,t,s){const n=t.data||{};let i=dt.utils.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const r=new pe(e);if(n.images instanceof dt.BaseTexture||typeof n.images=="string"){const l=n.images;n.images={},n.images[r.pages[0].name]=l}const a=[];let c=!0;for(const l of s.parsers)if(l.name==="loadTextures"){c=l.config?.preferCreateImageBitmap;break}Lt.Assets.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const o=l.name,h=n?.images?n.images[o]:void 0;if(h instanceof dt.BaseTexture)l.setTexture(de.from(h));else{const d=h??dt.utils.path.normalize([...i.split(dt.utils.path.sep),o].join(dt.utils.path.sep)),m={src:(0,Lt.copySearchParams)(d,t.src),data:{...n.imageMetadata,alphaMode:l.pma?dt.ALPHA_MODES.PMA:dt.ALPHA_MODES.UNPACK}},f=s.load(m).then(u=>{l.setTexture(de.from(u.baseTexture))});a.push(f)}}return await Promise.all(a),Lt.Assets.setPreferences({preferCreateImageBitmap:c}),r}}};dt.extensions.add(yr);var _e=et("@pixi/assets"),Oe=et("@pixi/core"),Ue="spineSkeletonLoader";function vr(e){return e.hasOwnProperty("bones")}function Tr(e){return e instanceof Uint8Array}var Sr={extension:Oe.ExtensionType.Asset,loader:{name:Ue,extension:{type:Oe.ExtensionType.LoadParser,priority:_e.LoaderParserPriority.Normal,name:Ue},test(e){return(0,_e.checkExtension)(e,".skel")},async load(e){const t=await Oe.settings.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${Ue}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=(0,_e.checkExtension)(t.src,".json")&&vr(e),n=(0,_e.checkExtension)(t.src,".skel")&&Tr(e),i=t.loadParser===Ue;return Promise.resolve(s||n||i)}}};Oe.extensions.add(Sr);var Cr=et("@pixi/mesh"),Wt=et("@pixi/core"),Wn=class extends Wt.Geometry{constructor(e=!1){super();const t=new Wt.Buffer(void 0),s=new Wt.Buffer(void 0,!0),n=new Wt.Buffer(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,Wt.TYPES.FLOAT),this.addAttribute("aTextureCoord",s,2,!1,Wt.TYPES.FLOAT),this.addIndex(n)}},St=et("@pixi/core"),Ar=` attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; uniform mat3 translationMatrix; uniform mat3 uTextureMatrix; varying vec2 vTextureCoord; void main(void) { gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy; } `,Ir=` varying vec2 vTextureCoord; uniform vec4 uColor; uniform vec4 uDarkColor; uniform sampler2D uSampler; void main(void) { vec4 texColor = texture2D(uSampler, vTextureCoord); gl_FragColor.a = texColor.a * uColor.a; gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb; } `,Hn=class extends St.Shader{uvMatrix;batchable;pluginName;_tintRGB;_darkTintRGB;_colorDirty;_alpha;_tintColor;_darkTintColor;constructor(e){const t={uSampler:e??St.Texture.EMPTY,alpha:1,uTextureMatrix:St.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},s={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(St.Program.from(Ar,Ir),t),this._colorDirty=!1,this.uvMatrix=new St.TextureMatrix(t.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new St.Color(s.tint),this._darkTintColor=new St.Color(s.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=s.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(e){e!==this.darkTint&&(this._darkTintColor.setValue(e),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,St.Color.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),St.Color.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}},Kn=class extends Cr.Mesh{_darkTintRGB=0;constructor(e){super(new Wn,new Hn(e),void 0,void 0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(e){this.shader.darkTint=e}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(e){const t=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=s._tintRGB,this._darkTintRGB=s._darkTintRGB,this._texture=s.texture;const n=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[n]),e.plugins[n].render(this)}},Jn=class rt extends Kn{name="";static auxColor=[0,0,0,0];constructor(){super()}updateFromSpineData(t,s,n,i,r,a,c,l){this.texture=t.texture;const o=r/(l?12:8)*2,h=this.geometry.getBuffer("aTextureCoord");h.data?.length!==o&&(h.data=new Float32Array(o));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==o&&(d.data=new Float32Array(o));let m=0;const f=h.data,u=d.data;for(let g=0;g0){const a=new ce("custom-skin");for(const c of this.skins){const l=i.findSkin(c);l!=null&&a.addSkin(l)}s.setSkin(a)}s.setupPose();const r=this.animation!=null?i.findAnimation(this.animation):null;if(r==null){s.updateWorldTransform(2);const a=s.getBoundsRect(n);return a.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:a}else{let a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimation(0,r,!1);const h=Math.max(r.duration/this.timeStep,1);for(let m=0;m0?this.timeStep:0;t.update(f),t.apply(s),s.update(f),s.updateWorldTransform(2);const u=s.getBoundsRect(n);a=Math.min(a,u.x),c=Math.min(c,u.y),l=Math.max(l,u.x+u.width),o=Math.max(o,u.y+u.height)}const d={x:a,y:c,width:l-a,height:o-c};return d.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},Rr=class Z extends ei.Container{skeleton;state;skeletonPhysics;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 Qn;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};_autoUpdate=!1;_ticker=nn.Ticker.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??nn.Ticker.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 me;static clipper=new he;static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;static DARK_VERTEX_SIZE=12;lightColor=new z;darkColor=new z;clippingVertAux=new Float32Array(6);_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 nn.Point;_boundsSpineID=-1;_boundsSpineDirty=!0;constructor(t){super(),t instanceof Ye?t={skeletonData:t}:"skeleton"in t&&(t=new.target.createOptions(t));const{autoUpdate:s=!0,boundsProvider:n,darkTint:i,skeletonData:r,ticker:a}=t;this.skeleton=new Gt(r),this.skeletonPhysics=new Gn(this.skeleton,{readTransform:(c,l)=>this.readPhysicsTransform(c,l),worldToSkeleton:c=>this.pixiWorldCoordinatesToSkeleton(c)}),this.state=new Ys(new In(r)),a&&(this._ticker=a),this.autoUpdate=s,this.boundsProvider=n,this.darkTint=i===void 0?this.skeleton.slots.some(c=>!!c.data.setupPose.darkColor):i,this.darkTint&&(this.slotMeshFactory=()=>new Jn)}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const n=s??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.skeletonPhysics.applyTransformMovement(),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}readPhysicsTransform(t,s){const n=this.worldTransform;if(t.x=n.tx,t.y=n.ty,t.z=0,!s)return;let i=0;for(let r=this;r;r=r.parent)i+=r.rotation+(r.skew.y-r.skew.x)/2;t.rotation=i*180/Math.PI}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(const s in this.clippingSlotToPixiMasks)this.clippingSlotToPixiMasks[s].destroy(),delete this.clippingSlotToPixiMasks[s];super.destroy(t)}unloadFromCache(){const t=this.skeleton?.data;if(!t)return!1;const s=Z.skeletonDataCacheKeys.get(t);return!s||Z.skeletonCache[s]!==t?!1:(delete Z.skeletonCache[s],Z.skeletonDataCacheKeys.delete(t),!0)}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){let s=this.hasMeshForSlot(t)?this.meshesCache.get(t):null;return s?s.visible=!0:(s=this.slotMeshFactory(),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,n){const i=this.getSlotFromRef(t),r=this.slotsObject.get(i)?.container;if(!(r&&r===s)){for(const[a,{container:c}]of this.slotsObject)if(a!==i&&c===s){this.removeSlotObject(a,s);break}r&&this.removeChild(r),this.slotsObject.set(i,{container:s,followAttachmentTimeline:n?.followAttachmentTimeline||!1,followSlotColor:n?.followSlotColor||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){const n=this.getSlotFromRef(t),i=this.slotsObject.get(n)?.container;i&&(s&&s!==i||(this.removeChild(i),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}verticesCache=V.newFloatArray(1024);clippingSlotToPixiMasks={};pixiMaskCleanup(t){const s=this.clippingSlotToPixiMasks[t.data.name];s&&(delete this.clippingSlotToPixiMasks[t.data.name],s.destroy())}updateSlotObject(t,s,n){const{container:i,followAttachmentTimeline:r}=t,a=s.appliedPose,c=r?!!a.attachment:!0,l=this.skeleton.drawOrder.appliedPose;if(i.visible=l.includes(s)&&c,i.visible){const o=s.bone.appliedPose,h=i.localTransform;h.a=o.a,h.b=o.c,h.c=-o.b,h.d=-o.d,h.tx=o.worldX,h.ty=o.worldY,i.transform.setFromMatrix(h),i.zIndex=n+1,i.alpha=this.skeleton.color.a*a.color.a,t.followSlotColor&&this.setSlotObjectTint(i,255*this.skeleton.color.r*a.color.r<<16|255*this.skeleton.color.g*a.color.g<<8|255*this.skeleton.color.b*a.color.b)}}setSlotObjectTint(t,s){const n=t;"tint"in n&&(n.tint=s);for(const i of n.children??[])this.setSlotObjectTint(i,s)}updateAndSetPixiMask(t,s){if(Z.clipper.isClipping()&&t){let n=this.clippingSlotToPixiMasks[t.slot.data.name];if(n||(n=new Fr.Graphics,this.clippingSlotToPixiMasks[t.slot.data.name]=n,this.addChild(n)),!t.computed){t.computed=!0;const i=t.slot.appliedPose.attachment,r=i.worldVerticesLength;this.clippingVertAux.length>1)*u,w>this.verticesCache.length&&(this.verticesCache=V.newFloatArray(w)),v.computeWorldVertices(b,o,0,v.worldVerticesLength,this.verticesCache,0,u),t=v.triangles;const y=p.sequence,T=y.resolveIndex(m);s=y.getUVs(T),x=y.regions[T]?.texture}else if(p instanceof Bt){Z.clipper.clipStart(b,o,p),n={slot:o,computed:!1};continue}else{this.hasMeshForSlot(o)&&(this.getMeshForSlot(o).visible=!1),Z.clipper.clipEnd(o),this.pixiMaskCleanup(o);continue}if(x!=null){const v=b.color,y=m.color,T=v.a*y.a*g.a;this.lightColor.set(v.r*y.r*g.r,v.g*y.g*g.g,v.b*y.b*g.b,T),m.darkColor!=null?this.darkColor.set(m.darkColor.r,m.darkColor.g,m.darkColor.b,1):this.darkColor.set(0,0,0,1);let S,A,k,C;if(Z.clipper.isClipping()&&Z.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,f,u))S=Z.clipper.clippedVertices,A=S.length,k=Z.clipper.clippedTriangles,C=k.length;else{const P=this.verticesCache;for(let F=2,B=0,R=w;F{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),r=new Xr.Text(n.data.name,{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"});r.scale.x=Math.sign(e.scale.x),r.anchor.set(.5),t.eventText.addChild(r),setTimeout(()=>{r.destroyed||r.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),n=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,n,s),this.drawPaths&&this.drawPathsFunc(e,t,n),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,n),this.drawClipping&&this.drawClippingFunc(e,t,n),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,n),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,n),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,n){const i=e.skeleton,r=i.x,a=i.y,c=i.bones;t.skeletonXY.lineStyle(s,this.skeletonXYColor,1);for(let o=0,h=c.length;og&&pg&&p>x?F=-C:ux?F=C:p===x&&ug?F=-90*k:u===g&&px&&(F=0),I.rotation=F,I.lineStyle(s+P/2.4,this.bonesColor,1),I.beginFill(0,.6),I.drawCircle(0,S,P*1.2),I.endFill()}const l=s*3;t.skeletonXY.moveTo(r-l,a-l),t.skeletonXY.lineTo(r+l,a+l),t.skeletonXY.moveTo(r+l,a-l),t.skeletonXY.lineTo(r-l,a+l)}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;t.regionAttachmentsShape.lineStyle(s,this.regionAttachmentsColor,1);for(let r=0,a=i.length;r0){m=(m>>1)*2;let f=h[m-2],u=h[m-1];for(let p=0,g=m;p{if(t.boundingBoxesPolygon.lineStyle(s,this.boundingBoxesPolygonColor,1),t.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),l<3)throw new Error("Polygon must contain at least 3 vertices");const o=[],h=s*2;for(let d=0,m=a.length;d