@esotericsoftware/spine-phaser-v3 4.2.93 → 4.2.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var spine=(()=>{var Sr=Object.create,ct=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,Ir=Object.getOwnPropertyNames,Mr=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty,Rr=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),kr=(t,e)=>{for(var s in e)ct(t,s,{get:e[s],enumerable:!0})},si=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ir(e))!Er.call(t,r)&&r!==s&&ct(t,r,{get:()=>e[r],enumerable:!(i=Tr(e,r))||i.enumerable});return t},Yr=(t,e,s)=>(s=t!=null?Sr(Mr(t)):{},si(e||!t||!t.__esModule?ct(s,"default",{value:t,enumerable:!0}):s,t)),Fr=t=>si(ct({},"__esModule",{value:!0}),t),ii={};if(kr(ii,{AABBRectangleBoundsProvider:()=>Vn,Alpha:()=>$i,AlphaMixin:()=>lr,AlphaTimeline:()=>Kt,Animation:()=>dt,AnimationState:()=>gs,AnimationStateAdapter:()=>Or,AnimationStateData:()=>pi,AssetCache:()=>Ai,AssetManager:()=>Li,AssetManagerBase:()=>yi,AtlasAttachmentLoader:()=>ys,Attachment:()=>Vt,AttachmentTimeline:()=>We,BinaryInput:()=>ki,BlendMode:()=>Xs,Bone:()=>Cs,BoneData:()=>As,BoundingBoxAttachment:()=>bs,CURRENT:()=>gi,CameraController:()=>Sn,ClippingAttachment:()=>rt,Color:()=>K,Color2Attribute:()=>Oi,ColorAttribute:()=>At,ComputedSize:()=>_i,ComputedSizeMixin:()=>er,ConstraintData:()=>nt,CurveTimeline:()=>Te,CurveTimeline1:()=>Ce,CurveTimeline2:()=>ut,DebugUtils:()=>Xr,DeformTimeline:()=>es,Depth:()=>Hi,DepthMixin:()=>tr,Downloader:()=>Ss,DrawOrderTimeline:()=>je,Event:()=>Ts,EventData:()=>Is,EventQueue:()=>ui,EventTimeline:()=>ft,EventType:()=>fi,FIRST:()=>ps,FakeTexture:()=>Vr,Flip:()=>ji,FlipMixin:()=>sr,GLTexture:()=>ze,HOLD_FIRST:()=>gt,HOLD_MIX:()=>mi,HOLD_SUBSEQUENT:()=>xs,IkConstraint:()=>Ci,IkConstraintData:()=>Ms,IkConstraintTimeline:()=>ts,Inherit:()=>bt,InheritTimeline:()=>jt,Input:()=>Ds,IntSet:()=>Pr,Interpolation:()=>ri,LoadingScreen:()=>Rn,M00:()=>O,M01:()=>G,M02:()=>z,M03:()=>V,M10:()=>q,M11:()=>D,M12:()=>_,M13:()=>N,M20:()=>H,M21:()=>j,M22:()=>U,M23:()=>W,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>xe,MathUtils:()=>L,Matrix4:()=>lt,Mesh:()=>Ns,MeshAttachment:()=>Ge,MixBlend:()=>hi,MixDirection:()=>ci,Origin:()=>Qi,OriginMixin:()=>ar,OrthoCamera:()=>Xi,PathAttachment:()=>Ze,PathConstraint:()=>Si,PathConstraintData:()=>Es,PathConstraintMixTimeline:()=>ns,PathConstraintPositionTimeline:()=>is,PathConstraintSpacingTimeline:()=>rs,Physics:()=>Mi,PhysicsConstraintDampingTimeline:()=>os,PhysicsConstraintGravityTimeline:()=>ds,PhysicsConstraintInertiaTimeline:()=>as,PhysicsConstraintMassTimeline:()=>hs,PhysicsConstraintMixTimeline:()=>us,PhysicsConstraintResetTimeline:()=>fs,PhysicsConstraintStrengthTimeline:()=>ls,PhysicsConstraintTimeline:()=>Oe,PhysicsConstraintWindTimeline:()=>cs,PointAttachment:()=>vi,PolygonBatcher:()=>Ws,Pool:()=>st,Position2Attribute:()=>yt,Position3Attribute:()=>Tn,PositionMode:()=>Rs,Pow:()=>ni,PowOut:()=>Lr,RGB2Timeline:()=>$t,RGBA2Timeline:()=>Qt,RGBATimeline:()=>Zt,RGBTimeline:()=>Jt,RegionAttachment:()=>ce,ResizeMode:()=>qi,RotateMode:()=>Ys,RotateTimeline:()=>it,SETUP:()=>ws,SUBSEQUENT:()=>mt,ScaleTimeline:()=>Wt,ScaleXTimeline:()=>Gt,ScaleYTimeline:()=>zt,SceneRenderer:()=>zs,ScrollFactor:()=>Zi,ScrollFactorMixin:()=>ir,SequenceTimeline:()=>ms,SetupPoseBoundsProvider:()=>or,Shader:()=>Me,ShapeRenderer:()=>Gs,ShapeType:()=>Wi,ShearTimeline:()=>qt,ShearXTimeline:()=>_t,ShearYTimeline:()=>Ht,Skeleton:()=>Je,SkeletonBinary:()=>Ri,SkeletonBounds:()=>Yi,SkeletonClipping:()=>vt,SkeletonData:()=>Fs,SkeletonDebugRenderer:()=>Gi,SkeletonJson:()=>Pi,SkeletonRenderer:()=>zi,Skin:()=>at,SkinEntry:()=>Ps,SkinsAndAnimationBoundsProvider:()=>Dn,Slot:()=>Ti,SlotData:()=>Ls,SpacingMode:()=>ks,SpineCanvas:()=>Fn,SpineGameObject:()=>js,SpinePlugin:()=>Zs,StringSet:()=>Bt,TexCoordAttribute:()=>Us,Texture:()=>pt,TextureAtlas:()=>wt,TextureAtlasPage:()=>bi,TextureAtlasRegion:()=>vs,TextureFilter:()=>xt,TextureRegion:()=>wi,TextureWrap:()=>xi,TimeKeeper:()=>Ot,Timeline:()=>fe,Touch:()=>Bi,TrackEntry:()=>di,Transform:()=>Ji,TransformConstraint:()=>Ii,TransformConstraintData:()=>Bs,TransformConstraintTimeline:()=>ss,TransformMixin:()=>rr,TranslateTimeline:()=>Dt,TranslateXTimeline:()=>Nt,TranslateYTimeline:()=>Ut,Triangulator:()=>Fi,Utils:()=>X,Vector2:()=>Ue,Vector3:()=>Se,VertexAttachment:()=>Fe,VertexAttribute:()=>Ke,VertexAttributeType:()=>Vi,Visible:()=>Ki,VisibleMixin:()=>nr,WindowedMean:()=>Br,createMixin:()=>Be}),typeof window<"u"&&window.Phaser){let t=window.require;window.require=e=>{if(t)return t(e);if(e==="Phaser")return window.Phaser}}var Pr=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Bt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},K=class _e{constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}static WHITE=new _e(1,1,1,1);static RED=new _e(1,0,0,1);static GREEN=new _e(0,1,0,1);static BLUE=new _e(0,0,1,1);static MAGENTA=new _e(1,0,1,1);set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new _e){return s.setFromString(e)}},L=class ke{static PI=3.1415927;static PI2=ke.PI*2;static invPI2=1/ke.PI2;static radiansToDegrees=180/ke.PI;static radDeg=ke.radiansToDegrees;static degreesToRadians=ke.PI/180;static degRad=ke.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*ke.degRad)}static sinDeg(e){return Math.sin(e*ke.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ke.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ke.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),h=s-e;return r<=(i-e)/h?e+Math.sqrt(r*h*(i-e)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},ri=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},ni=class extends ri{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Lr=class extends ni{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},X=class tt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,h){for(let l=s,n=r;l<s+h;l++,n++)i[n]=e[l]}static arrayFill(e,s,i,r){for(let h=s;h<i;h++)e[h]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let h=r;h<s;h++)e[h]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:tt.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(tt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(tt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return tt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return tt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Xr=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},st=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Ue=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Ot=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Br=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Vt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},Fe=class mr extends Vt{static nextID=0;id=mr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,h,l){i=h+(i>>1)*l;let n=e.bone.skeleton,a=e.deform,o=this.vertices,c=this.bones;if(!c){a.length>0&&(o=a);let f=e.bone,g=f.worldX,x=f.worldY,b=f.a,p=f.b,w=f.c,v=f.d;for(let y=s,A=h;A<i;y+=2,A+=l){let C=o[y],S=o[y+1];r[A]=C*b+S*p+g,r[A+1]=C*w+S*v+x}return}let d=0,u=0;for(let f=0;f<s;f+=2){let g=c[d];d+=g+1,u+=g}let m=n.bones;if(a.length==0)for(let f=h,g=u*3;f<i;f+=l){let x=0,b=0,p=c[d++];for(p+=d;d<p;d++,g+=3){let w=m[c[d]],v=o[g],y=o[g+1],A=o[g+2];x+=(v*w.a+y*w.b+w.worldX)*A,b+=(v*w.c+y*w.d+w.worldY)*A}r[f]=x,r[f+1]=b}else{let f=a;for(let g=h,x=u*3,b=u<<1;g<i;g+=l){let p=0,w=0,v=c[d++];for(v+=d;d<v;d++,x+=3,b+=2){let y=m[c[d]],A=o[x]+f[b],C=o[x+1]+f[b+1],S=o[x+2];p+=(A*y.a+C*y.b+y.worldX)*S,w+=(A*y.c+C*y.d+y.worldY)*S}r[g]=p,r[g+1]=w}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),X.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=X.newFloatArray(this.vertices.length),X.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ai=class kt{static _nextID=0;id=kt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new kt(this.regions.length);return X.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return kt._nextID++}},li=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(li||{}),oi=[0,1,2,3,4,5,6],dt=class{name;timelines=[];timelineIds=new Bt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,h,l,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let o=0,c=a.length;o<c;o++)a[o].apply(t,e,s,r,h,l,n)}},hi=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(hi||{}),ci=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(ci||{}),ie={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},fe=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=X.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},Te=class extends fe{curves;constructor(t,e,s){super(t,s),this.curves=X.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=X.newFloatArray(e);X.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,h,l,n,a,o,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-h*2+n)*.03,f=(r-l*2+a)*.03,g=((h-n)*3-i+o)*.006,x=((l-a)*3-r+c)*.006,b=m*2+g,p=f*2+x,w=(h-i)*.3+m+g*.16666667,v=(l-r)*.3+f+x*.16666667,y=i+w,A=r+v;for(let C=u+18;u<C;u+=2)d[u]=y,d[u+1]=A,w+=b,v+=p,b+=g,p+=x,y+=w,A+=v}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],o=this.frames[e+s];return o+(t-a)/(r[i]-a)*(r[i+1]-o)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=t){let a=r[i-2],o=r[i-1];return o+(t-a)/(r[i]-a)*(r[i+1]-o)}e+=this.getFrameEntries();let l=r[h-2],n=r[h-1];return n+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-n)}},Ce=class extends Te{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],h=e[s+1];return h+(t-r)/(e[s+2]-r)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);switch(s){case 0:return r+h*e;case 1:case 2:h+=r-i}return i+h*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);return s==0?r+(h-r)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,r,h){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}return s==0?r+(h-r)*e:i+(h-i)*e}getScaleValue(t,e,s,i,r,h){const l=this.frames;if(t<l[0]){switch(s){case 0:return h;case 1:return r+(h-r)*e}return r}let n=this.getCurveValue(t)*h;if(e==1)return s==3?r+n-h:n;if(i==1)switch(s){case 0:return h+(Math.abs(n)*L.signum(h)-h)*e;case 1:case 2:return r+(Math.abs(n)*L.signum(r)-r)*e}else{let a=0;switch(s){case 0:return a=Math.abs(h)*L.signum(n),a+(n-a)*e;case 1:case 2:return a=Math.abs(r)*L.signum(n),a+(n-a)*e}}return r+(n-h)*e}},ut=class extends Te{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},it=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,h,n.rotation,n.data.rotation))}},Dt=class extends ut{boneIndex=0;constructor(t,e,s){super(t,e,ie.x+"|"+s,ie.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let o=0,c=0,d=fe.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*f,c+=(a[d+3+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.x=n.data.x+o*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+o-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=o*r,n.y+=c*r}}},Nt=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,h,n.x,n.data.x))}},Ut=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,h,n.y,n.data.y))}},Wt=class extends ut{boneIndex=0;constructor(t,e,s){super(t,e,ie.scaleX+"|"+s,ie.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let o,c,d=fe.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*f,c+=(a[d+3+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(o*=n.data.scaleX,c*=n.data.scaleY,r==1)h==3?(n.scaleX+=o-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=o,n.scaleY=c);else{let m=0,f=0;if(l==1)switch(h){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(o)*L.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*L.signum(f)-f)*r;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(o)*L.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*L.signum(f)-f)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(h){case 0:m=Math.abs(n.data.scaleX)*L.signum(o),f=Math.abs(n.data.scaleY)*L.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=f+(c-f)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*L.signum(o),f=Math.abs(n.scaleY)*L.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=f+(c-f)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Gt=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,h,l,n.scaleX,n.data.scaleX))}},zt=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,h,l,n.scaleY,n.data.scaleY))}},qt=class extends ut{boneIndex=0;constructor(t,e,s){super(t,e,ie.shearX+"|"+s,ie.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let o=0,c=0,d=fe.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*f,c+=(a[d+3+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.shearX=n.data.shearX+o*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+o-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=o*r,n.shearY+=c*r}}},_t=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,h,n.shearX,n.data.shearX))}},Ht=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,h,n.shearY,n.data.shearY))}},jt=class extends fe{boneIndex=0;constructor(t,e){super(t,[ie.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;if(l==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[fe.search(a,s,2)+1]}},Zt=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s,ie.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let x=n.data.color;switch(h){case 0:o.setFromColor(x);return;case 1:o.add((x.r-o.r)*r,(x.g-o.g)*r,(x.b-o.b)*r,(x.a-o.a)*r)}return}let c=0,d=0,u=0,m=0,f=fe.search(a,s,5),g=this.curves[f/5];switch(g){case 0:let x=a[f];c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];let b=(s-x)/(a[f+5]-x);c+=(a[f+5+1]-c)*b,d+=(a[f+5+2]-d)*b,u+=(a[f+5+3]-u)*b,m+=(a[f+5+4]-m)*b;break;case 1:c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+18*2-2),m=this.getBezierValue(s,f,4,g+18*3-2)}r==1?o.set(c,d,u,m):(h==0&&o.setFromColor(n.data.color),o.add((c-o.r)*r,(d-o.g)*r,(u-o.b)*r,(m-o.a)*r))}},Jt=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let g=n.data.color;switch(h){case 0:o.r=g.r,o.g=g.g,o.b=g.b;return;case 1:o.r+=(g.r-o.r)*r,o.g+=(g.g-o.g)*r,o.b+=(g.b-o.b)*r}return}let c=0,d=0,u=0,m=fe.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let g=a[m];c=a[m+1],d=a[m+2],u=a[m+3];let x=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*x,d+=(a[m+4+2]-d)*x,u+=(a[m+4+3]-u)*x;break;case 1:c=a[m+1],d=a[m+2],u=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+18*2-2)}if(r==1)o.r=c,o.g=d,o.b=u;else{if(h==0){let g=n.data.color;o.r=g.r,o.g=g.g,o.b=g.b}o.r+=(c-o.r)*r,o.g+=(d-o.g)*r,o.b+=(u-o.b)*r}}},Kt=class extends Ce{slotIndex=0;constructor(t,e,s){super(t,e,ie.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let o=this.getCurveValue(s);r==1?a.a=o:(h==0&&(a.a=n.data.color.a),a.a+=(o-a.a)*r)}},Qt=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s,ie.alpha+"|"+s,ie.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,h,l,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(s<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.add((v.r-o.r)*r,(v.g-o.g)*r,(v.b-o.b)*r,(v.a-o.a)*r),c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,x=0,b=0,p=fe.search(a,s,8),w=this.curves[p>>3];switch(w){case 0:let v=a[p];d=a[p+1],u=a[p+2],m=a[p+3],f=a[p+4],g=a[p+5],x=a[p+6],b=a[p+7];let y=(s-v)/(a[p+8]-v);d+=(a[p+8+1]-d)*y,u+=(a[p+8+2]-u)*y,m+=(a[p+8+3]-m)*y,f+=(a[p+8+4]-f)*y,g+=(a[p+8+5]-g)*y,x+=(a[p+8+6]-x)*y,b+=(a[p+8+7]-b)*y;break;case 1:d=a[p+1],u=a[p+2],m=a[p+3],f=a[p+4],g=a[p+5],x=a[p+6],b=a[p+7];break;default:d=this.getBezierValue(s,p,1,w-2),u=this.getBezierValue(s,p,2,w+18-2),m=this.getBezierValue(s,p,3,w+18*2-2),f=this.getBezierValue(s,p,4,w+18*3-2),g=this.getBezierValue(s,p,5,w+18*4-2),x=this.getBezierValue(s,p,6,w+18*5-2),b=this.getBezierValue(s,p,7,w+18*6-2)}if(r==1)o.set(d,u,m,f),c.r=g,c.g=x,c.b=b;else{if(h==0){o.setFromColor(n.data.color);let v=n.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}o.add((d-o.r)*r,(u-o.g)*r,(m-o.b)*r,(f-o.a)*r),c.r+=(g-c.r)*r,c.g+=(x-c.g)*r,c.b+=(b-c.b)*r}}},$t=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s,ie.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,l,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=n}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(s<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.r+=(v.r-o.r)*r,o.g+=(v.g-o.g)*r,o.b+=(v.b-o.b)*r,c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,x=0,b=0,p=fe.search(a,s,7),w=this.curves[p/7];switch(w){case 0:let v=a[p];d=a[p+1],u=a[p+2],m=a[p+3],g=a[p+4],x=a[p+5],b=a[p+6];let y=(s-v)/(a[p+7]-v);d+=(a[p+7+1]-d)*y,u+=(a[p+7+2]-u)*y,m+=(a[p+7+3]-m)*y,g+=(a[p+7+4]-g)*y,x+=(a[p+7+5]-x)*y,b+=(a[p+7+6]-b)*y;break;case 1:d=a[p+1],u=a[p+2],m=a[p+3],g=a[p+4],x=a[p+5],b=a[p+6];break;default:d=this.getBezierValue(s,p,1,w-2),u=this.getBezierValue(s,p,2,w+18-2),m=this.getBezierValue(s,p,3,w+18*2-2),g=this.getBezierValue(s,p,4,w+18*3-2),x=this.getBezierValue(s,p,5,w+18*4-2),b=this.getBezierValue(s,p,6,w+18*5-2)}if(r==1)o.r=d,o.g=u,o.b=m,c.r=g,c.g=x,c.b=b;else{if(h==0){let v=n.data.color,y=n.data.darkColor;o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}o.r+=(d-o.r)*r,o.g+=(u-o.g)*r,o.b+=(m-o.b)*r,c.r+=(g-c.r)*r,c.g+=(x-c.g)*r,c.b+=(b-c.b)*r}}},We=class extends fe{slotIndex=0;attachmentNames;constructor(t,e){super(t,[ie.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(n.bone.active){if(l==1){h==0&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[fe.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},es=class extends Te{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[ie.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,h,l,n,a,o,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-h*2+n)*.03,f=a*.03-l*.06,g=((h-n)*3-i+o)*.006,x=(l-a+.33333333)*.018,b=m*2+g,p=f*2+x,w=(h-i)*.3+m+g*.16666667,v=l*.3+f+x*.16666667,y=i+w,A=v;for(let C=u+18;u<C;u+=2)d[u]=y,d[u+1]=A,w+=b,v+=p,b+=g,p+=x,y+=w,A+=v}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let h=s[r-2],l=s[r-1];return l+(1-l)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof Fe)||a.timelineAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(h=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case 0:o.length=0;return;case 1:if(r==1){o.length=0;return}o.length=d;let p=a;if(p.bones){r=1-r;for(var m=0;m<d;m++)o[m]*=r}else{let w=p.vertices;for(var m=0;m<d;m++)o[m]+=(w[m]-o[m])*r}}return}if(o.length=d,s>=u[u.length-1]){let p=c[u.length-1];if(r==1)if(h==3){let w=a;if(w.bones)for(let v=0;v<d;v++)o[v]+=p[v];else{let v=w.vertices;for(let y=0;y<d;y++)o[y]+=p[y]-v[y]}}else X.arrayCopy(p,0,o,0,d);else switch(h){case 0:{let v=a;if(v.bones)for(let y=0;y<d;y++)o[y]=p[y]*r;else{let y=v.vertices;for(let A=0;A<d;A++){let C=y[A];o[A]=C+(p[A]-C)*r}}break}case 1:case 2:for(let v=0;v<d;v++)o[v]+=(p[v]-o[v])*r;break;case 3:let w=a;if(w.bones)for(let v=0;v<d;v++)o[v]+=p[v]*r;else{let v=w.vertices;for(let y=0;y<d;y++)o[y]+=(p[y]-v[y])*r}}return}let f=fe.search1(u,s),g=this.getCurvePercent(s,f),x=c[f],b=c[f+1];if(r==1)if(h==3){let p=a;if(p.bones)for(let w=0;w<d;w++){let v=x[w];o[w]+=v+(b[w]-v)*g}else{let w=p.vertices;for(let v=0;v<d;v++){let y=x[v];o[v]+=y+(b[v]-y)*g-w[v]}}}else for(let p=0;p<d;p++){let w=x[p];o[p]=w+(b[p]-w)*g}else switch(h){case 0:{let w=a;if(w.bones)for(let v=0;v<d;v++){let y=x[v];o[v]=(y+(b[v]-y)*g)*r}else{let v=w.vertices;for(let y=0;y<d;y++){let A=x[y],C=v[y];o[y]=C+(A+(b[y]-A)*g-C)*r}}break}case 1:case 2:for(let w=0;w<d;w++){let v=x[w];o[w]+=(v+(b[w]-v)*g-o[w])*r}break;case 3:let p=a;if(p.bones)for(let w=0;w<d;w++){let v=x[w];o[w]+=(v+(b[w]-v)*g)*r}else{let w=p.vertices;for(let v=0;v<d;v++){let y=x[v];o[v]+=(y+(b[v]-y)*g-w[v])*r}}}}},ft=class gr extends fe{static propertyIds=[""+ie.event];events;constructor(e){super(e,gr.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,h,l,n){if(!r)return;let a=this.frames,o=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,h,l,n),s=-1;else if(s>=a[o-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=fe.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<o&&i>=a[c];c++)r.push(this.events[c])}},je=class pr extends fe{static propertyIds=[""+ie.drawOrder];drawOrders;constructor(e){super(e,pr.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,h,l,n){if(n==1){l==0&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(l==0||l==1)&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=fe.search1(this.frames,i),o=this.drawOrders[a];if(!o)X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let u=0,m=o.length;u<m;u++)c[u]=d[o[u]]}}},ts=class extends Te{constraintIndex=0;constructor(t,e,s){super(t,e,[ie.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,h,l){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,i,r,h,l){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let o=0,c=0,d=fe.search(a,s,6),u=this.curves[d/6];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+6]-m);o+=(a[d+6+1]-o)*f,c+=(a[d+6+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==0?(n.mix=n.data.mix+(o-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,l==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(o-n.mix)*r,n.softness+=(c-n.softness)*r,l==0&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},ss=class extends Te{constraintIndex=0;constructor(t,e,s){super(t,e,[ie.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,l,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=h,a[t+5]=l,a[t+6]=n}apply(t,e,s,i,r,h,l){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*r,n.mixX+=(b.mixX-n.mixX)*r,n.mixY+=(b.mixY-n.mixY)*r,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(b.mixShearY-n.mixShearY)*r}return}let o,c,d,u,m,f,g=fe.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let b=a[g];o=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];let p=(s-b)/(a[g+7]-b);o+=(a[g+7+1]-o)*p,c+=(a[g+7+2]-c)*p,d+=(a[g+7+3]-d)*p,u+=(a[g+7+4]-u)*p,m+=(a[g+7+5]-m)*p,f+=(a[g+7+6]-f)*p;break;case 1:o=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];break;default:o=this.getBezierValue(s,g,1,x-2),c=this.getBezierValue(s,g,2,x+18-2),d=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),m=this.getBezierValue(s,g,5,x+18*4-2),f=this.getBezierValue(s,g,6,x+18*5-2)}if(h==0){let b=n.data;n.mixRotate=b.mixRotate+(o-b.mixRotate)*r,n.mixX=b.mixX+(c-b.mixX)*r,n.mixY=b.mixY+(d-b.mixY)*r,n.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*r,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*r,n.mixShearY=b.mixShearY+(f-b.mixShearY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(u-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(f-n.mixShearY)*r}},is=class extends Ce{constraintIndex=0;constructor(t,e,s){super(t,e,ie.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,l){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,h,n.position,n.data.position))}},rs=class extends Ce{constraintIndex=0;constructor(t,e,s){super(t,e,ie.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,l){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,h,n.spacing,n.data.spacing))}},ns=class extends Te{constraintIndex=0;constructor(t,e,s){super(t,e,[ie.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=r}apply(t,e,s,i,r,h,l){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let o,c,d,u=fe.search(a,s,4),m=this.curves[u>>2];switch(m){case 0:let f=a[u];o=a[u+1],c=a[u+2],d=a[u+3];let g=(s-f)/(a[u+4]-f);o+=(a[u+4+1]-o)*g,c+=(a[u+4+2]-c)*g,d+=(a[u+4+3]-d)*g;break;case 1:o=a[u+1],c=a[u+2],d=a[u+3];break;default:o=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(h==0){let f=n.data;n.mixRotate=f.mixRotate+(o-f.mixRotate)*r,n.mixX=f.mixX+(c-f.mixX)*r,n.mixY=f.mixY+(d-f.mixY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Oe=class extends Ce{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,l){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const o of t.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,r,h,this.get(o),this.setup(o),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,h,this.get(n),this.setup(n)))}},as=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ls=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},os=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},hs=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},cs=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ds=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},us=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},fs=class xr extends fe{static propertyIds=[ie.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,xr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,h,l,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const o=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],h,l,n),s=-1;else if(s>=o[o.length-1])return;if(!(i<o[0])&&(s<o[0]||i>=o[fe.search1(o,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},ms=class De extends fe{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[ie.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return De.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,h){let l=this.frames;e*=De.ENTRIES,l[e]=s,l[e+De.MODE]=i|r<<4,l[e+De.DELAY]=h}apply(e,s,i,r,h,l,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let o=a.attachment,c=this.attachment;if(o!=c&&(!(o instanceof Fe)||o.timelineAttachment!=c))return;if(n==1){l==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(l==0||l==1)&&(a.sequenceIndex=-1);return}let u=fe.search(d,i,De.ENTRIES),m=d[u],f=d[u+De.MODE],g=d[u+De.DELAY];if(!this.attachment.sequence)return;let x=f>>4,b=this.attachment.sequence.regions.length,p=oi[f&15];if(p!=0)switch(x+=(i-m)/g+1e-5|0,p){case 1:x=Math.min(b-1,x);break;case 2:x%=b;break;case 3:{let w=(b<<1)-2;x=w==0?0:x%w,x>=b&&(x=w-x);break}case 4:x=Math.max(b-1-x,0);break;case 5:x=b-1-x%b;break;case 6:{let w=(b<<1)-2;x=w==0?0:(x+b-1)%w,x>=b&&(x=w-x)}}a.sequenceIndex=x}},gs=class Yt{static _emptyAnimation=new dt("<empty>",[],0);static emptyAnimation(){return Yt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ui(this);propertyIDs=new Bt;animationsChanged=!1;trackEntryPool=new st(()=>new di);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let l=e*h.timeScale;if(h.delay>0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+e)*n.timeScale,h.trackTime+=l,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let u=0,m=i.length;u<m;u++){let f=i[u];if(!f||f.delay>0)continue;r=!0;let g=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,g):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let b=x>=f.alphaAttachmentThreshold,p=f.animationLast,w=f.getAnimationTime(),v=w,y=s;f.reverse&&(v=f.animation.duration-v,y=null);let A=f.animation.timelines,C=A.length;if(u==0&&x==1||g==3){u==0&&(b=!0);for(let S=0;S<C;S++){X.webkit602BugfixHelper(x,g);var h=A[S];h instanceof We?this.applyAttachmentTimeline(h,e,v,g,b):h.apply(e,p,v,y,x,g,0)}}else{let S=f.timelineMode,I=f.shortestRotation,k=!I&&f.timelinesRotation.length!=C<<1;k&&(f.timelinesRotation.length=C<<1);for(let Y=0;Y<C;Y++){let F=A[Y],P=S[Y]==mt?g:0;!I&&F instanceof it?this.applyRotateTimeline(F,e,v,x,P,f.timelinesRotation,Y<<1,k):F instanceof We?this.applyAttachmentTimeline(F,e,v,g,b):(X.webkit602BugfixHelper(x,g),F.apply(e,p,v,y,x,P,0))}}this.queueEvents(f,w),s.length=0,f.nextAnimationLast=w,f.nextTrackLast=f.trackTime}for(var l=this.unkeyedState+ws,n=e.slots,a=0,o=e.slots.length;a<o;a++){var c=n[a];if(c.attachmentState==l){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;e.mixDuration==0?(h=1,i==1&&(i=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let l=h<r.mixAttachmentThreshold,n=h<r.mixDrawOrderThreshold,a=r.animation.timelines,o=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-h),u=r.animationLast,m=r.getAnimationTime(),f=m,g=null;if(r.reverse?f=r.animation.duration-f:h<r.eventThreshold&&(g=this.events),i==3)for(let x=0;x<o;x++)a[x].apply(s,u,f,g,d,i,1);else{let x=r.timelineMode,b=r.timelineHoldMix,p=r.shortestRotation,w=!p&&r.timelinesRotation.length!=o<<1;w&&(r.timelinesRotation.length=o<<1),r.totalAlpha=0;for(let v=0;v<o;v++){let y=a[v],A=1,C,S=0;switch(x[v]){case mt:if(!n&&y instanceof je)continue;C=i,S=d;break;case ps:C=0,S=d;break;case xs:C=i,S=c;break;case gt:C=0,S=c;break;default:C=0;let I=b[v];S=c*Math.max(0,1-I.mixTime/I.mixDuration);break}r.totalAlpha+=S,!p&&y instanceof it?this.applyRotateTimeline(y,s,f,S,C,r.timelinesRotation,v<<1,w):y instanceof We?this.applyAttachmentTimeline(y,s,f,C,l&&S>=r.alphaAttachmentThreshold):(X.webkit602BugfixHelper(S,i),n&&y instanceof je&&C==0&&(A=0),y.apply(s,u,f,g,S,C,A))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(e,s,i,r,h){var l=s.slots[e.slotIndex];l.bone.active&&(i<e.frames[0]?(r==0||r==1)&&this.setAttachment(s,l,l.data.attachmentName,h):this.setAttachment(s,l,e.attachmentNames[fe.search1(e.frames,i)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+ws))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+gi)}applyRotateTimeline(e,s,i,r,h,l,n,a){if(a&&(l[n]=0),r==1){e.apply(s,0,i,null,1,h,0);return}let o=s.bones[e.boneIndex];if(!o.active)return;let c=e.frames,d=0,u=0;if(i<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:d=o.rotation,u=o.data.rotation}else d=h==0?o.data.rotation:o.rotation,u=o.data.rotation+e.getCurveValue(i);let m=0,f=u-d;if(f-=Math.ceil(f/360-.5)*360,f==0)m=l[n];else{let g=0,x=0;a?(g=0,x=f):(g=l[n],x=l[n+1]);let b=g-g%360;m=f+b;let p=f>=0,w=g>=0;Math.abs(x)<=90&&L.signum(x)!=L.signum(f)&&(Math.abs(g-b)>180?(m+=360*L.signum(g),w=p):b!=0?m-=360*L.signum(g):w=p),w!=p&&(m+=360*L.signum(g)),l[n]=m}l[n+1]=f,o.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,h=r-i,l=e.trackLast%h,n=this.events,a=0,o=n.length;for(;a<o;a++){let d=n[a];if(d.time<l)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(h==0)c=!0;else{const d=Math.floor(e.trackTime/h);c=d>0&&d>Math.floor(e.trackLast/h)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<o;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let l=this.trackEntry(e,s,i,h);return this.setCurrent(e,l,r),this.queue.drain(),l}addAnimation(e,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(e,s,i,h);return h?(h.next=l,l.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(e,l,!0),this.queue.drain(),r<0&&(r=0)),l.delay=r,l}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,Yt.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,Yt.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let h=this.tracks[i];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(X.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=i,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=r?this.data.getMix(r.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,h=e.timelineMode;h.length=r;let l=e.timelineHoldMix;l.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)h[a]=n.addAll(i[a].getPropertyIds())?gt:xs;return}e:for(let a=0;a<r;a++){let o=i[a],c=o.getPropertyIds();if(!n.addAll(c))h[a]=mt;else if(!s||o instanceof We||o instanceof je||o instanceof ft||!s.animation.hasTimeline(c))h[a]=ps;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){h[a]=mi,l[a]=d;continue e}break}h[a]=gt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},di=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ui=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],r=t[s+1];switch(i){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let l=0;l<e.length;l++){let n=e[l];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let l=0;l<e.length;l++){let n=e[l];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let l=0;l<e.length;l++){let n=e[l];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let l=0;l<e.length;l++){let n=e[l];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case 4:r.listener&&r.listener.complete&&r.listener.complete(r);for(let l=0;l<e.length;l++){let n=e[l];n.complete&&n.complete(r)}break;case 5:let h=t[s+++2];r.listener&&r.listener.event&&r.listener.event(r,h);for(let l=0;l<e.length;l++){let n=e[l];n.event&&n.event(r,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},fi=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(fi||{}),Or=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},mt=0,ps=1,xs=2,gt=3,mi=4,ws=1,gi=2,pi=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},bs=class wr extends Fe{color=new K(1,1,1,1);constructor(e){super(e)}copy(){let e=new wr(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},rt=class br extends Fe{endSlot=null;color=new K(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new br(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},pt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},xt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(xt||{}),xi=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(xi||{}),wi=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Vr=class extends pt{setFilters(t,e){}setWraps(t,e){}dispose(){}},wt=class{pages=new Array;regions=new Array;constructor(t){let e=new Dr(t),s=new Array(4),i={};i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.format=()=>{},i.filter=o=>{o.minFilter=X.enumValue(xt,s[1]),o.magFilter=X.enumValue(xt,s[2])},i.repeat=o=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},i.pma=o=>{o.pma=s[1]=="true"};var r={};r.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},r.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},r.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},r.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},r.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},r.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},r.rotate=o=>{let c=s[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},r.index=o=>{o.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let l=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)l=null,h=e.readLine();else if(l){let o=new vs(l,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(o);else{n||(n=[]),a||(a=[]),n.push(s[0]);let u=[];for(let m=0;m<c;m++)u.push(parseInt(s[m+1]));a.push(u)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height),n&&n.length>0&&a&&a.length>0&&(o.names=n,o.values=a,n=null,a=null),o.u=o.x/l.width,o.v=o.y/l.height,o.degrees==90?(o.u2=(o.x+o.height)/l.width,o.v2=(o.y+o.width)/l.height):(o.u2=(o.x+o.width)/l.width,o.v2=(o.y+o.height)/l.height),this.regions.push(o)}else{for(l=new bi(h.trim());e.readEntry(s,h=e.readLine())!=0;){let o=i[s[0]];o&&o(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Dr=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=e.indexOf(",",r);if(h==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},bi=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},vs=class extends wi{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Ge=class Qs extends Fe{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new K(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new K(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=X.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,l=0,n=0;if(this.region instanceof vs){let a=this.region,o=a.page,c=o.width,d=o.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+e[u+1]*l,s[u+1]=h+(1-e[u])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/d,l=a.originalWidth/c,n=a.originalHeight/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u])*l,s[u+1]=h+(1-e[u+1])*n;return;case 270:r-=a.offsetY/c,h-=a.offsetX/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u+1])*l,s[u+1]=h+e[u]*n;return}r-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/d,l=a.originalWidth/c,n=a.originalHeight/d}else this.region?(l=this.region.u2-r,n=this.region.v2-h):(r=h=0,l=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*l,s[a+1]=h+e[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new Qs(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),X.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?X.newFloatArray(this.uvs.length):new Array(this.uvs.length),X.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),X.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),X.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,h,l){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,h,l)}newLinkedMesh(){let e=new Qs(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ze=class vr extends Fe{lengths=[];closed=!1;constantSpeed=!1;color=new K(1,1,1,1);constructor(e){super(e)}copy(){let e=new vr(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),X.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},vi=class yr extends Fe{x=0;y=0;rotation=0;color=new K(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*L.degRad,i=Math.cos(s),r=Math.sin(s),h=i*e.a+r*e.b,l=i*e.c+r*e.d;return L.atan2Deg(l,h)}copy(){let e=new yr(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ce=class Ar extends Vt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new K(1,1,1,1);path;region=null;sequence=null;offset=X.newFloatArray(8);uvs=X.newFloatArray(8);tempColor=new K(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*i,l=-this.height/2*this.scaleY+this.region.offsetY*r,n=h+this.region.width*i,a=l+this.region.height*r,o=this.rotation*L.degRad,c=Math.cos(o),d=Math.sin(o),u=this.x,m=this.y,f=h*c+u,g=h*d,x=l*c+m,b=l*d,p=n*c+u,w=n*d,v=a*c+m,y=a*d,A=this.offset;A[0]=f-b,A[1]=x+g,A[2]=f-y,A[3]=v+g,A[4]=p-y,A[5]=v+w,A[6]=p-b,A[7]=x+w,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,l=this.offset,n=h.worldX,a=h.worldY,o=h.a,c=h.b,d=h.c,u=h.d,m=0,f=0;m=l[0],f=l[1],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=l[2],f=l[3],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=l[4],f=l[5],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=l[6],f=l[7],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a}copy(){let e=new Ar(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,X.arrayCopy(this.uvs,0,e.uvs,0,8),X.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},ys=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let l=s.getPath(e,r),n=this.atlas.findRegion(l);if(n==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new ce(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=h}return r}newMeshAttachment(t,e,s,i){let r=new Ge(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=h}return r}newBoundingBoxAttachment(t,e){return new bs(e)}newPathAttachment(t,e){return new Ze(e)}newPointAttachment(t,e){return new vi(e)}newClippingAttachment(t,e){return new rt(e)}},As=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new K;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},bt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(bt||{}),Cs=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,r,h,l){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,g=(s+h)*L.degRad,x=(s+90+l)*L.degRad;this.a=Math.cos(g)*i*m,this.b=Math.cos(x)*r*m,this.c=Math.sin(g)*i*f,this.d=Math.sin(x)*r*f,this.worldX=t*m+u.x,this.worldY=e*f+u.y;return}let a=n.a,o=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+o*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case 0:{const u=(s+h)*L.degRad,m=(s+90+l)*L.degRad,f=Math.cos(u)*i,g=Math.cos(m)*r,x=Math.sin(u)*i,b=Math.sin(m)*r;this.a=a*f+o*x,this.b=a*g+o*b,this.c=c*f+d*x,this.d=c*g+d*b;return}case 1:{const u=(s+h)*L.degRad,m=(s+90+l)*L.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(m)*r,this.c=Math.sin(u)*i,this.d=Math.sin(m)*r;break}case 2:{let u=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=u,c*=m;let f=a*a+c*c,g=0;f>1e-4?(f=Math.abs(a*d*m-o*u*c)/f,o=c*f,d=a*f,g=Math.atan2(c,a)*L.radDeg):(a=0,c=0,g=90-Math.atan2(d,o)*L.radDeg);const x=(s+h-g)*L.degRad,b=(s+l-g+90)*L.degRad,p=Math.cos(x)*i,w=Math.cos(b)*r,v=Math.sin(x)*i,y=Math.sin(b)*r;this.a=a*p-o*v,this.b=a*w-o*y,this.c=c*p+d*v,this.d=c*w+d*y;break}case 3:case 4:{s*=L.degRad;const u=Math.cos(s),m=Math.sin(s);let f=(a*u+o*m)/this.skeleton.scaleX,g=(c*u+d*m)/this.skeleton.scaleY,x=Math.sqrt(f*f+g*g);x>1e-5&&(x=1/x),f*=x,g*=x,x=Math.sqrt(f*f+g*g),this.inherit==3&&a*d-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x),s=Math.PI/2+Math.atan2(g,f);const b=Math.cos(s)*x,p=Math.sin(s)*x;h*=L.degRad,l=(90+l)*L.degRad;const w=Math.cos(h)*i,v=Math.cos(l)*r,y=Math.sin(h)*i,A=Math.sin(l)*r;this.a=f*w+b*y,this.b=f*v+b*A,this.c=g*w+p*y,this.d=g*v+p*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*L.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*L.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,h=1/(e*r-s*i),l=r*h,n=s*h,a=i*h,o=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*l-d*n,this.ay=d*o-c*a;let u,m,f,g;if(this.inherit==1)u=this.a,m=this.b,f=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,r=e*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(e*r-s*i),l=r*h,n=s*h;break}case 3:case 4:let x=L.cosDeg(this.rotation),b=L.sinDeg(this.rotation);e=(e*x+s*b)/this.skeleton.scaleX,i=(i*x+r*b)/this.skeleton.scaleY;let p=Math.sqrt(e*e+i*i);p>1e-5&&(p=1/p),e*=p,i*=p,p=Math.sqrt(e*e+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let w=L.PI/2+Math.atan2(i,e);s=Math.cos(w)*p,r=Math.sin(w)*p,h=1/(e*r-s*i),l=r*h,n=s*h,a=i*h,o=e*h}u=l*this.a-n*this.c,m=l*this.b-n*this.d,f=o*this.c-a*this.a,g=o*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){let x=u*g-m*f;this.ascaleY=x/this.ascaleX,this.ashearY=-Math.atan2(u*m+f*g,x)*L.radDeg,this.arotation=Math.atan2(f,u)*L.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*L.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*L.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*L.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=L.sinDeg(t),s=L.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*L.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=L.sinDeg(t),s=L.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*L.radDeg}rotateWorld(t){t*=L.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},nt=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},yi=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ss,i=new Ai){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),i(h)},(h,l)=>{const n=`Couldn't load binary ${t}: status ${h}, ${l}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),i(h)},(h,l)=>{const n=`Couldn't load JSON ${t}: status ${h}, ${l}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),h=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((l,n)=>{this.downloader.downloadText(t,a=>{try{let o=new wt(a),c=o.pages.length,d=!1;for(let u of o.pages)this.loadTexture(i?i[u.name]:h+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(e,t,o),l(o)))},(m,f)=>{if(!d){const g=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,g),n(g)}d=!0})}catch(o){const c=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,c),n(c)}},(a,o)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${o}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,h)=>{this.downloader.downloadText(t,l=>{try{const n=new wt(l);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),h(a)}},(l,n)=>{const a=`Couldn't load texture atlas ${t}: status ${l}, ${n}`;this.error(s,t,a),h(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
2
- `+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){--this.cache.assetsRefCount[t]===0&&this.remove(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Ai=class Ft{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Ft.AVAILABLE_CACHES.get(e);if(s)return s;const i=new Ft;return Ft.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},Ss=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let h=()=>{this.finish(t,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let h=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let h=r.length-1,l=i.length;h<l;h+=2)i[h].apply(null,r)}},Ts=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Is=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Ci=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,h,l){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,o=n.b,c=n.c,d=n.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*L.signum(t.skeleton.scaleX),f=(s-t.worldY)*L.signum(t.skeleton.scaleY);break;case 2:let b=Math.abs(a*d-o*c)/Math.max(1e-4,a*a+c*c),p=a/t.skeleton.scaleX,w=c/t.skeleton.scaleY;o=-w*b*t.skeleton.scaleX,d=p*b*t.skeleton.scaleY,u+=Math.atan2(w,p)*L.radDeg;default:let v=e-n.worldX,y=s-n.worldY,A=a*d-o*c;Math.abs(A)<=1e-4?(m=0,f=0):(m=(v*d-y*o)/A-t.ax,f=(y*a-v*c)/A-t.ay)}u+=Math.atan2(f,m)*L.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,x=t.ascaleY;if(i||r){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const b=t.data.length*g;if(b>1e-4){const p=m*m+f*f;if(i&&p<b*b||r&&p>b*b){const w=(Math.sqrt(p)/b-1)*l+1;g*=w,h&&(x*=w)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,h,l,n,a){if(t.inherit!=0||e.inherit!=0)return;let o=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX,x=0,b=0,p=0;d<0?(d=-d,x=180,p=-1):(x=0,p=1),u<0&&(u=-u,p=-p),g<0?(g=-g,b=180):b=0;let w=e.ax,v=0,y=0,A=0,C=t.a,S=t.b,I=t.c,k=t.d,Y=Math.abs(d-u)<=1e-4;!Y||h?(v=0,y=C*w+t.worldX,A=I*w+t.worldY):(v=e.ay,y=C*w+S*v+t.worldX,A=I*w+k*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,S=F.b,I=F.c,k=F.d;let P=C*k-S*I,M=y-F.worldX,R=A-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let B=(M*k-R*S)*P-o,se=(R*C-M*I)*P-c,te=Math.sqrt(B*B+se*se),re=e.data.length*g,de,oe;if(te<1e-4){this.apply1(t,s,i,!1,h,!1,a),e.updateWorldTransformWith(w,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}M=s-F.worldX,R=i-F.worldY;let me=(M*k-R*S)*P-o,Z=(R*C-M*I)*P-c,ne=me*me+Z*Z;if(n!=0){n*=d*(g+1)*.5;let ge=Math.sqrt(ne),we=ge-te-re*d+n;if(we>0){let be=Math.min(1,we/(n*2))-1;be=(we-n*(1-be*be))/ge,me-=be*me,Z-=be*Z,ne=me*me+Z*Z}}e:if(Y){re*=d;let ge=(ne-te*te-re*re)/(2*te*re);ge<-1?(ge=-1,oe=Math.PI*r):ge>1?(ge=1,oe=0,h&&(C=(Math.sqrt(ne)/(te+re)-1)*a+1,m*=C,l&&(f*=C))):oe=Math.acos(ge)*r,C=te+re*ge,S=re*Math.sin(oe),de=Math.atan2(Z*C-me*S,me*C+Z*S)}else{C=d*re,S=u*re;let ge=C*C,we=S*S,be=Math.atan2(Z,me);I=we*te*te+ge*ne-ge*we;let Re=-2*we*te,$e=we-ge;if(k=Re*Re-4*$e*I,k>=0){let et=Math.sqrt(k);Re<0&&(et=-et),et=-(Re+et)*.5;let ht=et/$e,fr=I/et,Rt=Math.abs(ht)<Math.abs(fr)?ht:fr;if(ht=ne-Rt*Rt,ht>=0){R=Math.sqrt(ht)*r,de=be-Math.atan2(R,Rt),oe=Math.atan2(R/u,(Rt-te)/d);break e}}let ot=L.PI,Mt=te-C,Js=Mt*Mt,cr=0,dr=0,Et=te+C,Ks=Et*Et,ur=0;I=-C*te/(ge-we),I>=-1&&I<=1&&(I=Math.acos(I),M=C*Math.cos(I)+te,R=S*Math.sin(I),k=M*M+R*R,k<Js&&(ot=I,Js=k,Mt=M,cr=R),k>Ks&&(dr=I,Ks=k,Et=M,ur=R)),ne<=(Js+Ks)*.5?(de=be-Math.atan2(cr*r,Mt),oe=ot*r):(de=be-Math.atan2(ur*r,Et),oe=dr*r)}let he=Math.atan2(v,w)*p,ve=t.arotation;de=(de-he)*L.radDeg+x-ve,de>180?de-=360:de<-180&&(de+=360),t.updateWorldTransformWith(o,c,ve+de*a,m,f,0,0),ve=e.arotation,oe=((oe+he)*L.radDeg-e.ashearX)*p+b-ve,oe>180?oe-=360:oe<-180&&(oe+=360),e.updateWorldTransformWith(w,v,ve+oe*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Ms=class extends nt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},Es=class extends nt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Rs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Rs||{}),ks=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ks||{}),Ys=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Ys||{}),Si=class Ne{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,h=e.bones.length;r<h;r++){let l=s.findBone(e.bones[r].name);if(!l)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(l)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ze))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==0&&h==0)return;let l=this.data,n=l.rotateMode==0,a=l.rotateMode==2,o=this.bones,c=o.length,d=n?c:c+1,u=X.setArraySize(this.spaces,d),m=a?this.lengths=X.setArraySize(this.lengths,c):[],f=this.spacing;switch(l.spacingMode){case 2:if(a)for(let A=0,C=d-1;A<C;A++){let S=o[A],I=S.data.length,k=I*S.a,Y=I*S.c;m[A]=Math.sqrt(k*k+Y*Y)}X.arrayFill(u,1,d,f);break;case 3:let v=0;for(let A=0,C=d-1;A<C;){let S=o[A],I=S.data.length;if(I<Ne.epsilon)a&&(m[A]=0),u[++A]=f;else{let k=I*S.a,Y=I*S.c,F=Math.sqrt(k*k+Y*Y);a&&(m[A]=F),u[++A]=F,v+=F}}if(v>0){v=d/v*f;for(let A=1;A<d;A++)u[A]*=v}break;default:let y=l.spacingMode==0;for(let A=0,C=d-1;A<C;){let S=o[A],I=S.data.length;if(I<Ne.epsilon)a&&(m[A]=0),u[++A]=f;else{let k=I*S.a,Y=I*S.c,F=Math.sqrt(k*k+Y*Y);a&&(m[A]=F),u[++A]=(y?I+f:f)*F/I}}}let g=this.computeWorldPositions(s,d,n),x=g[0],b=g[1],p=l.offsetRotation,w=!1;if(p==0)w=l.rotateMode==1;else{w=!1;let v=this.target.bone;p*=v.a*v.d-v.b*v.c>0?L.degRad:-L.degRad}for(let v=0,y=3;v<c;v++,y+=3){let A=o[v];A.worldX+=(x-A.worldX)*r,A.worldY+=(b-A.worldY)*h;let C=g[y],S=g[y+1],I=C-x,k=S-b;if(a){let Y=m[v];if(Y!=0){let F=(Math.sqrt(I*I+k*k)/Y-1)*i+1;A.a*=F,A.c*=F}}if(x=C,b=S,i>0){let Y=A.a,F=A.b,P=A.c,M=A.d,R=0,B=0,se=0;if(n?R=g[y-1]:u[v+1]==0?R=g[y+2]:R=Math.atan2(k,I),R-=Math.atan2(P,Y),w){B=Math.cos(R),se=Math.sin(R);let te=A.data.length;x+=(te*(B*Y-se*P)-I)*i,b+=(te*(se*Y+B*P)-k)*i}else R+=p;R>L.PI?R-=L.PI2:R<-L.PI&&(R+=L.PI2),R*=i,B=Math.cos(R),se=Math.sin(R),A.a=B*Y-se*P,A.b=B*F-se*M,A.c=se*Y+B*P,A.d=se*F+B*M}A.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,h=this.position,l=this.spaces,n=X.setArraySize(this.positions,s*3+2),a=this.world,o=e.closed,c=e.worldVerticesLength,d=c/6,u=Ne.NONE;if(!e.constantSpeed){let te=e.lengths;d-=o?1:2;let re=te[d];this.data.positionMode==1&&(h*=re);let de;switch(this.data.spacingMode){case 2:de=re;break;case 3:de=re/s;break;default:de=1}a=X.setArraySize(this.world,8);for(let oe=0,me=0,Z=0;oe<s;oe++,me+=3){let ne=l[oe]*de;h+=ne;let he=h;if(o)he%=re,he<0&&(he+=re),Z=0;else if(he<0){u!=Ne.BEFORE&&(u=Ne.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(he,a,0,n,me);continue}else if(he>re){u!=Ne.AFTER&&(u=Ne.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(he-re,a,0,n,me);continue}for(;;Z++){let ve=te[Z];if(!(he>ve)){if(Z==0)he/=ve;else{let ge=te[Z-1];he=(he-ge)/(ve-ge)}break}}Z!=u&&(u=Z,o&&Z==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,Z*6+2,8,a,0,2)),this.addCurvePosition(he,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,me,i||oe>0&&ne==0)}return n}o?(c+=2,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=X.setArraySize(this.curves,d),f=0,g=a[0],x=a[1],b=0,p=0,w=0,v=0,y=0,A=0,C=0,S=0,I=0,k=0,Y=0,F=0,P=0,M=0;for(let te=0,re=2;te<d;te++,re+=6)b=a[re],p=a[re+1],w=a[re+2],v=a[re+3],y=a[re+4],A=a[re+5],C=(g-b*2+w)*.1875,S=(x-p*2+v)*.1875,I=((b-w)*3-g+y)*.09375,k=((p-v)*3-x+A)*.09375,Y=C*2+I,F=S*2+k,P=(b-g)*.75+C+I*.16666667,M=(p-x)*.75+S+k*.16666667,f+=Math.sqrt(P*P+M*M),P+=Y,M+=F,Y+=I,F+=k,f+=Math.sqrt(P*P+M*M),P+=Y,M+=F,f+=Math.sqrt(P*P+M*M),P+=Y+I,M+=F+k,f+=Math.sqrt(P*P+M*M),m[te]=f,g=y,x=A;this.data.positionMode==1&&(h*=f);let R;switch(this.data.spacingMode){case 2:R=f;break;case 3:R=f/s;break;default:R=1}let B=this.segments,se=0;for(let te=0,re=0,de=0,oe=0;te<s;te++,re+=3){let me=l[te]*R;h+=me;let Z=h;if(o)Z%=f,Z<0&&(Z+=f),de=0;else if(Z<0){this.addBeforePosition(Z,a,0,n,re);continue}else if(Z>f){this.addAfterPosition(Z-f,a,c-4,n,re);continue}for(;;de++){let ne=m[de];if(!(Z>ne)){if(de==0)Z/=ne;else{let he=m[de-1];Z=(Z-he)/(ne-he)}break}}if(de!=u){u=de;let ne=de*6;for(g=a[ne],x=a[ne+1],b=a[ne+2],p=a[ne+3],w=a[ne+4],v=a[ne+5],y=a[ne+6],A=a[ne+7],C=(g-b*2+w)*.03,S=(x-p*2+v)*.03,I=((b-w)*3-g+y)*.006,k=((p-v)*3-x+A)*.006,Y=C*2+I,F=S*2+k,P=(b-g)*.3+C+I*.16666667,M=(p-x)*.3+S+k*.16666667,se=Math.sqrt(P*P+M*M),B[0]=se,ne=1;ne<8;ne++)P+=Y,M+=F,Y+=I,F+=k,se+=Math.sqrt(P*P+M*M),B[ne]=se;P+=Y,M+=F,se+=Math.sqrt(P*P+M*M),B[8]=se,P+=Y+I,M+=F+k,se+=Math.sqrt(P*P+M*M),B[9]=se,oe=0}for(Z*=se;;oe++){let ne=B[oe];if(!(Z>ne)){if(oe==0)Z/=ne;else{let he=B[oe-1];Z=oe+(Z-he)/(ne-he)}break}}this.addCurvePosition(Z*.1,g,x,b,p,w,v,y,A,n,re,i||te>0&&me==0)}return n}addBeforePosition(e,s,i,r,h){let l=s[i],n=s[i+1],a=s[i+2]-l,o=s[i+3]-n,c=Math.atan2(o,a);r[h]=l+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addAfterPosition(e,s,i,r,h){let l=s[i+2],n=s[i+3],a=l-s[i],o=n-s[i+1],c=Math.atan2(o,a);r[h]=l+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addCurvePosition(e,s,i,r,h,l,n,a,o,c,d,u){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=e*e,f=m*e,g=1-e,x=g*g,b=x*g,p=g*e,w=p*3,v=g*w,y=w*e,A=s*b+r*v+l*y+a*f,C=i*b+h*v+n*y+o*f;c[d]=A,c[d+1]=C,u&&(e<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(C-(i*x+h*p*2+n*m),A-(s*x+r*p*2+l*m)))}},Nr=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,n=l.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=a.time;const c=l.worldX,d=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,x=-1,b=this.data.limit*o,p=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||i){if(s){const w=(this.ux-c)*m;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=c}if(i){const w=(this.uy-d)*m;this.yOffset+=w>p?p:w<-p?-p:w,this.uy=d}if(u>=f){x=Math.pow(this.damping,60*f);const w=this.massInverse*f,v=this.strength,y=this.wind*g*a.scaleX,A=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*w,this.xOffset+=this.xVelocity*f,this.xVelocity*=x),i&&(this.yVelocity-=(A+this.yOffset*v)*w,this.yOffset+=this.yVelocity*f,this.yVelocity*=x),u-=f;while(u>=f)}s&&(l.worldX+=this.xOffset*e*this.data.x),i&&(l.worldY+=this.yOffset*e*this.data.y)}if(r||h){let w=Math.atan2(l.c,l.a),v=0,y=0,A=0,C=this.cx-l.worldX,S=this.cy-l.worldY;if(C>b?C=b:C<-b&&(C=-b),S>p?S=p:S<-p&&(S=-p),r){A=(this.data.rotate+this.data.shearX)*e;let I=Math.atan2(S+this.ty,C+this.tx)-w-this.rotateOffset*A;this.rotateOffset+=(I-Math.ceil(I*L.invPI2-.5)*L.PI2)*m,I=this.rotateOffset*A+w,v=Math.cos(I),y=Math.sin(I),h&&(I=n*l.getWorldScaleX(),I>0&&(this.scaleOffset+=(C*v+S*y)*m/I))}else{v=Math.cos(w),y=Math.sin(w);const I=n*l.getWorldScaleX();I>0&&(this.scaleOffset+=(C*v+S*y)*m/I)}if(u=this.remaining,u>=f){x==-1&&(x=Math.pow(this.damping,60*f));const I=this.massInverse*f,k=this.strength,Y=this.wind,F=Je.yDown?-this.gravity:this.gravity,P=n/g;for(;;)if(u-=f,h&&(this.scaleVelocity+=(Y*v-F*y-this.scaleOffset*k)*I,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=x),r){if(this.rotateVelocity-=((Y*y+F*v)*P+this.rotateOffset*k)*I,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=x,u<f)break;const M=this.rotateOffset*A+w;v=Math.cos(M),y=Math.sin(M)}else if(u<f)break}}this.remaining=u}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*e*this.data.x),i&&(l.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,o=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=a*this.data.rotate,o=Math.sin(u),c=Math.cos(u),d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d),u+=a*this.data.shearX,o=Math.sin(u),c=Math.cos(u),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c}else a*=this.data.rotate,o=Math.sin(a),c=Math.cos(a),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c,d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d}if(h){const a=1+this.scaleOffset*e*this.data.scaleX;l.a*=a,l.c*=a}t!=3&&(this.tx=n*l.a,this.ty=n*l.c),l.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*L.degRad,r=Math.cos(i),h=Math.sin(i),l=this.cx-t,n=this.cy-e;this.translate(l*r-n*h-l,l*h+n*r-n)}},Ti=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new K,this.darkColor=t.darkColor?new K:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof Fe)||!(this.attachment instanceof Fe)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Ii=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ue;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=e!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,u=a*d-o*c>0?L.degRad:-L.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let x=0,b=g.length;x<b;x++){let p=g[x];if(t!=0){let w=p.a,v=p.b,y=p.c,A=p.d,C=Math.atan2(c,a)-Math.atan2(y,w)+m;C>L.PI?C-=L.PI2:C<-L.PI&&(C+=L.PI2),C*=t;let S=Math.cos(C),I=Math.sin(C);p.a=S*w-I*y,p.b=S*v-I*A,p.c=I*w+S*y,p.d=I*v+S*A}if(l){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(w.x-p.worldX)*e,p.worldY+=(w.y-p.worldY)*s}if(i!=0){let w=Math.sqrt(p.a*p.a+p.c*p.c);w!=0&&(w=(w+(Math.sqrt(a*a+c*c)-w+this.data.offsetScaleX)*i)/w),p.a*=w,p.c*=w}if(r!=0){let w=Math.sqrt(p.b*p.b+p.d*p.d);w!=0&&(w=(w+(Math.sqrt(o*o+d*d)-w+this.data.offsetScaleY)*r)/w),p.b*=w,p.d*=w}if(h>0){let w=p.b,v=p.d,y=Math.atan2(v,w),A=Math.atan2(d,o)-Math.atan2(c,a)-(y-Math.atan2(p.c,p.a));A>L.PI?A-=L.PI2:A<-L.PI&&(A+=L.PI2),A=y+(A+f)*h;let C=Math.sqrt(w*w+v*v);p.b=Math.cos(A)*C,p.d=Math.sin(A)*C}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=e!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,u=a*d-o*c>0?L.degRad:-L.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let x=0,b=g.length;x<b;x++){let p=g[x];if(t!=0){let w=p.a,v=p.b,y=p.c,A=p.d,C=Math.atan2(c,a)+m;C>L.PI?C-=L.PI2:C<-L.PI&&(C+=L.PI2),C*=t;let S=Math.cos(C),I=Math.sin(C);p.a=S*w-I*y,p.b=S*v-I*A,p.c=I*w+S*y,p.d=I*v+S*A}if(l){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),p.worldX+=w.x*e,p.worldY+=w.y*s}if(i!=0){let w=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;p.a*=w,p.c*=w}if(r!=0){let w=(Math.sqrt(o*o+d*d)-1+this.data.offsetScaleY)*r+1;p.b*=w,p.d*=w}if(h>0){let w=Math.atan2(d,o)-Math.atan2(c,a);w>L.PI?w-=L.PI2:w<-L.PI&&(w+=L.PI2);let v=p.b,y=p.d;w=Math.atan2(y,v)+(w-L.PI/2+f)*h;let A=Math.sqrt(v*v+y*y);p.b=Math.cos(w)*A,p.d=Math.sin(w)*A}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(l.arotation-d+this.data.offsetRotation)*t);let u=c.ax,m=c.ay;u+=(l.ax-u+this.data.offsetX)*e,m+=(l.ay-m+this.data.offsetY)*s;let f=c.ascaleX,g=c.ascaleY;i!=0&&f!=0&&(f=(f+(l.ascaleX-f+this.data.offsetScaleX)*i)/f),r!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*r)/g);let x=c.ashearY;h!=0&&(x+=(l.ashearY-x+this.data.offsetShearY)*h),c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,x)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],d=c.arotation+(l.arotation+this.data.offsetRotation)*t,u=c.ax+(l.ax+this.data.offsetX)*e,m=c.ay+(l.ay+this.data.offsetY)*s,f=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*r+1),x=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,x)}}},Je=class $s{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return $s.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new Cs(i,this,null);else{let h=this.bones[i.parent.index];r=new Cs(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],h=new Ti(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new Ci(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new Ii(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new Si(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new Nr(i,this))}this.color=new K(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let u=0,m=s.length;u<m;u++){let f=s[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let g=this.bones[u[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,l=this.physicsConstraints,n=i.length,a=r.length,o=h.length,c=this.physicsConstraints.length,d=n+a+o+c;e:for(let u=0;u<d;u++){for(let m=0;m<n;m++){let f=i[m];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let m=0;m<a;m++){let f=r[m];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let m=0;m<o;m++){let f=h[m];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let m=0;m<c;m++){const f=l[m];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,m=s.length;u<m;u++)this.sortBone(s[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,o=this.data.skins.length;a<o;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let h=s.getAttachment();h instanceof Ze&&this.sortPathConstraintAttachmentWith(h,r);let l=e.bones,n=l.length;for(let a=0;a<n;a++)this.sortBone(l[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(l[a].children);for(let a=0;a<n;a++)l[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let h=s[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ze))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,l=i.length;h<l;){let n=i[h++];for(n+=h;h<n;)this.sortBone(r[i[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&X.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,h=s.length;r<h;r++){let l=s[r];l.ax=l.x,l.ay=l.y,l.arotation=l.rotation,l.ascaleX=l.scaleX,l.ascaleY=l.scaleY,l.ashearX=l.shearX,l.ashearY=l.shearY}let i=this._updateCache;for(let r=0,h=i.length;r<h;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let x=1,b=i.length;x<b;x++){let p=i[x];p.ax=p.x,p.ay=p.y,p.arotation=p.rotation,p.ascaleX=p.scaleX,p.ascaleY=p.scaleY,p.ashearX=p.shearX,p.ashearY=p.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,l=s.b,n=s.c,a=s.d;r.worldX=h*this.x+l*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const o=(r.rotation+r.shearX)*L.degRad,c=(r.rotation+90+r.shearY)*L.degRad,d=Math.cos(o)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(o)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(h*d+l*m)*this.scaleX,r.b=(h*u+l*f)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*u+a*f)*this.scaleY;let g=this._updateCache;for(let x=0,b=g.length;x<b;x++){let p=g[x];p!=r&&p.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;X.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i],l=h.data.attachmentName;if(l){let n=e.getAttachment(i,l);n&&h.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,h=i.length;r<h;r++){let l=i[r];if(l.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);l.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Ue,i=new Ue;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let u=h[c];if(!u.bone.active)continue;let m=0,f=null,g=null,x=u.getAttachment();if(x instanceof ce)m=8,f=X.setArraySize(i,m,0),x.computeWorldVertices(u,f,0,2),g=$s.quadTriangles;else if(x instanceof Ge){let b=x;m=b.worldVerticesLength,f=X.setArraySize(i,m,0),b.computeWorldVertices(u,0,m,f,0,2),g=b.triangles}else if(x instanceof rt&&r!=null){r.clipStart(u,x);continue}if(f&&g){r!=null&&r.isClipping()&&(r.clipTriangles(f,g,g.length),f=r.clippedVertices,m=r.clippedVertices.length);for(let b=0,p=f.length;b<p;b+=2){let w=f[b],v=f[b+1];l=Math.min(l,w),n=Math.min(n,v),a=Math.max(a,w),o=Math.max(o,v)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(l,n),s.set(a-l,o-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let h=0,l=r.length;h<l;h++)r[h].rotate(e,s,i)}},Mi=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(Mi||{}),Ei=class extends nt{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},Fs=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},Ps=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},at=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new K(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof Ge?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Ps(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Ps(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],h=r.getAttachment();if(h&&s<e.attachments.length){let l=e.attachments[s];for(let n in l){let a=l[n];if(h==a){let o=this.getAttachment(s,n);o&&r.setAttachment(o);break}}}s++}}},Ls=class{index=0;name;boneData;color=new K(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Xs=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Xs||{}),Bs=class extends nt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Ri=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Fs;s.name="";let i=new ki(t),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let l=i.readBoolean();l&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=o==0?null:s.bones[i.readInt(!0)],u=new As(o,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),l&&(K.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new Ls(o,c,d);K.rgba8888ToColor(u.color,i.readInt32());let m=i.readInt32();m!=-1&&K.rgb888ToColor(u.darkColor=new K,m),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),l&&(u.visible=i.readBoolean()),s.slots.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new Ms(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=(m&2)!=0?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,(m&32)!=0&&(u.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new Bs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,(m&8)!=0&&(u.offsetRotation=i.readFloat()),(m&16)!=0&&(u.offsetX=i.readFloat()*e),(m&32)!=0&&(u.offsetY=i.readFloat()*e),(m&64)!=0&&(u.offsetScaleX=i.readFloat()),(m&128)!=0&&(u.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(u.offsetShearY=i.readFloat()),(m&2)!=0&&(u.mixRotate=i.readFloat()),(m&4)!=0&&(u.mixX=i.readFloat()),(m&8)!=0&&(u.mixY=i.readFloat()),(m&16)!=0&&(u.mixScaleX=i.readFloat()),(m&32)!=0&&(u.mixScaleY=i.readFloat()),(m&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new Es(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const m=i.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==0&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==0||u.spacingMode==1)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Ei(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,(m&2)!=0&&(u.x=i.readFloat()),(m&4)!=0&&(u.y=i.readFloat()),(m&8)!=0&&(u.rotate=i.readFloat()),(m&16)!=0&&(u.scaleX=i.readFloat()),(m&32)!=0&&(u.shearX=i.readFloat()),u.limit=((m&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(m&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(u.inertiaGlobal=!0),(m&2)!=0&&(u.strengthGlobal=!0),(m&4)!=0&&(u.dampingGlobal=!0),(m&8)!=0&&(u.massGlobal=!0),(m&16)!=0&&(u.windGlobal=!0),(m&32)!=0&&(u.gravityGlobal=!0),(m&64)!=0&&(u.mixGlobal=!0),u.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let a=this.readSkin(i,s,!0,l);a&&(s.defaultSkin=a,s.skins.push(a));{let o=s.skins.length;for(X.setArraySize(s.skins,n=o+i.readInt(!0));o<n;o++){let c=this.readSkin(i,s,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[o]=c}}n=this.linkedMeshes.length;for(let o=0;o<n;o++){let c=this.linkedMeshes[o];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new Is(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;r=new at("default")}else{let l=t.readString();if(!l)throw new Error("Skin name must not be null.");r=new at(l),i&&K.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let l=0;l<h;l++){let n=t.readInt(!0);for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,h){let l=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let o=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let u=(n&128)!=0?t.readFloat():0,m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat(),p=t.readFloat();o||(o=a);let w=this.attachmentLoader.newRegionAttachment(s,a,o,d);return w?(w.path=o,w.x=m*l,w.y=f*l,w.scaleX=g,w.scaleY=x,w.rotation=u,w.width=b*l,w.height=p*l,K.rgba8888ToColor(w.color,c),w.sequence=d,d==null&&w.updateRegion(),w):null}case 1:{let o=this.readVertices(t,(n&16)!=0),c=h?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,h&&K.rgba8888ToColor(d.color,c),d):null}case 2:{let o=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),f=this.readFloatArray(t,m.length,1),g=this.readShortArray(t,(m.length-u-2)*3);let x=[],b=0,p=0;h&&(x=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),p=t.readFloat()),o||(o=a);let w=this.attachmentLoader.newMeshAttachment(s,a,o,d);return w?(w.path=o,K.rgba8888ToColor(w.color,c),w.bones=m.bones,w.vertices=m.vertices,w.worldVerticesLength=m.length,w.triangles=g,w.regionUVs=f,d==null&&w.updateRegion(),w.hullLength=u<<1,w.sequence=d,h&&(w.edges=x,w.width=b*l,w.height=p*l),w):null}case 3:{const o=(n&16)!=0?t.readStringRef():a;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=(n&128)!=0,m=t.readInt(!0),f=t.readStringRef();let g=0,x=0;h&&(g=t.readFloat(),x=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,o,d);return b?(b.path=o,K.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*l,b.height=x*l),this.linkedMeshes.push(new Ur(b,m,i,f,u)),b):null}case 4:{const o=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),u=X.newArray(d.length/6,0);for(let g=0,x=u.length;g<x;g++)u[g]=t.readFloat()*l;const m=h?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=o,f.constantSpeed=c,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,h&&K.rgba8888ToColor(f.color,m),f):null}case 5:{const o=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*l,m.y=d*l,m.rotation=o,h&&K.rgba8888ToColor(m.color,u),m):null}case 6:{const o=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=h?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,a);return u?(u.endSlot=e.slots[o],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,h&&K.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new ai(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Wr;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let h=new Array,l=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);l.push(a);for(let o=0;o<a;o++)l.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return r.vertices=X.toFloatArray(h),r.bones=l,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0),g=f-1;switch(m){case en:{let x=new We(f,c);for(let b=0;b<f;b++)x.setFrame(b,t.readFloat(),t.readStringRef());i.push(x);break}case tn:{let x=t.readInt(!0),b=new Zt(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let C=0,S=0;b.setFrame(C,p,w,v,y,A),C!=g;C++){let I=t.readFloat(),k=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(C);break;case Le:ae(t,b,S++,C,0,p,I,w,k,1),ae(t,b,S++,C,1,p,I,v,Y,1),ae(t,b,S++,C,2,p,I,y,F,1),ae(t,b,S++,C,3,p,I,A,P,1)}p=I,w=k,v=Y,y=F,A=P}i.push(b);break}case sn:{let x=t.readInt(!0),b=new Jt(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,p,w,v,y),A!=g;A++){let S=t.readFloat(),I=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(A);break;case Le:ae(t,b,C++,A,0,p,S,w,I,1),ae(t,b,C++,A,1,p,S,v,k,1),ae(t,b,C++,A,2,p,S,y,Y,1)}p=S,w=I,v=k,y=Y}i.push(b);break}case rn:{let x=t.readInt(!0),b=new Qt(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let k=0,Y=0;b.setFrame(k,p,w,v,y,A,C,S,I),k!=g;k++){let F=t.readFloat(),P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,se=t.readUnsignedByte()/255,te=t.readUnsignedByte()/255,re=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(k);break;case Le:ae(t,b,Y++,k,0,p,F,w,P,1),ae(t,b,Y++,k,1,p,F,v,M,1),ae(t,b,Y++,k,2,p,F,y,R,1),ae(t,b,Y++,k,3,p,F,A,B,1),ae(t,b,Y++,k,4,p,F,C,se,1),ae(t,b,Y++,k,5,p,F,S,te,1),ae(t,b,Y++,k,6,p,F,I,re,1)}p=F,w=P,v=M,y=R,A=B,C=se,S=te,I=re}i.push(b);break}case nn:{let x=t.readInt(!0),b=new $t(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255;for(let I=0,k=0;b.setFrame(I,p,w,v,y,A,C,S),I!=g;I++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,se=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(I);break;case Le:ae(t,b,k++,I,0,p,Y,w,F,1),ae(t,b,k++,I,1,p,Y,v,P,1),ae(t,b,k++,I,2,p,Y,y,M,1),ae(t,b,k++,I,3,p,Y,A,R,1),ae(t,b,k++,I,4,p,Y,C,B,1),ae(t,b,k++,I,5,p,Y,S,se,1)}p=Y,w=F,v=P,y=M,A=R,C=B,S=se}i.push(b);break}case an:{let x=new Kt(f,t.readInt(!0),c),b=t.readFloat(),p=t.readUnsignedByte()/255;for(let w=0,v=0;x.setFrame(w,b,p),w!=g;w++){let y=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:x.setStepped(w);break;case Le:ae(t,x,v++,w,0,b,y,p,A,1)}b=y,p=A}i.push(x)}}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0);if(m==$r){let x=new jt(f,c);for(let b=0;b<f;b++)x.setFrame(b,t.readFloat(),t.readByte());i.push(x);continue}let g=t.readInt(!0);switch(m){case Gr:i.push(pe(t,new it(f,g,c),1));break;case zr:i.push(Os(t,new Dt(f,g,c),r));break;case qr:i.push(pe(t,new Nt(f,g,c),r));break;case _r:i.push(pe(t,new Ut(f,g,c),r));break;case Hr:i.push(Os(t,new Wt(f,g,c),1));break;case jr:i.push(pe(t,new Gt(f,g,c),1));break;case Zr:i.push(pe(t,new zt(f,g,c),1));break;case Jr:i.push(Os(t,new qt(f,g,c),1));break;case Kr:i.push(pe(t,new _t(f,g,c),1));break;case Qr:i.push(pe(t,new Ht(f,g,c),1))}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new ts(d,t.readInt(!0),c),f=t.readByte(),g=t.readFloat(),x=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,b=(f&4)!=0?t.readFloat()*r:0;for(let p=0,w=0;m.setFrame(p,g,x,b,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),p!=u;p++){f=t.readByte();const v=t.readFloat(),y=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,A=(f&4)!=0?t.readFloat()*r:0;(f&64)!=0?m.setStepped(p):(f&128)!=0&&(ae(t,m,w++,p,0,g,v,x,y,1),ae(t,m,w++,p,1,g,v,b,A,r)),g=v,x=y,b=A}i.push(m)}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new ss(d,t.readInt(!0),c),f=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat(),p=t.readFloat(),w=t.readFloat(),v=t.readFloat();for(let y=0,A=0;m.setFrame(y,f,g,x,b,p,w,v),y!=u;y++){let C=t.readFloat(),S=t.readFloat(),I=t.readFloat(),k=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Pe:m.setStepped(y);break;case Le:ae(t,m,A++,y,0,f,C,g,S,1),ae(t,m,A++,y,1,f,C,x,I,1),ae(t,m,A++,y,2,f,C,b,k,1),ae(t,m,A++,y,3,f,C,p,Y,1),ae(t,m,A++,y,4,f,C,w,F,1),ae(t,m,A++,y,5,f,C,v,P,1)}f=C,g=S,x=I,b=k,p=Y,w=F,v=P}i.push(m)}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,m=t.readInt(!0);u<m;u++){const f=t.readByte(),g=t.readInt(!0),x=t.readInt(!0);switch(f){case hn:i.push(pe(t,new is(g,x,c),d.positionMode==0?r:1));break;case cn:i.push(pe(t,new rs(g,x,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case dn:let b=new ns(g,x,c),p=t.readFloat(),w=t.readFloat(),v=t.readFloat(),y=t.readFloat();for(let A=0,C=0,S=b.getFrameCount()-1;b.setFrame(A,p,w,v,y),A!=S;A++){let I=t.readFloat(),k=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case Pe:b.setStepped(A);break;case Le:ae(t,b,C++,A,0,p,I,w,k,1),ae(t,b,C++,A,1,p,I,v,Y,1),ae(t,b,C++,A,2,p,I,y,F,1)}p=I,w=k,v=Y,y=F}i.push(b)}}}for(let a=0,o=t.readInt(!0);a<o;a++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const m=t.readByte(),f=t.readInt(!0);if(m==bn){const x=new fs(f,c);for(let b=0;b<f;b++)x.setFrame(b,t.readFloat());i.push(x);continue}const g=t.readInt(!0);switch(m){case un:i.push(pe(t,new as(f,g,c),1));break;case fn:i.push(pe(t,new ls(f,g,c),1));break;case mn:i.push(pe(t,new os(f,g,c),1));break;case gn:i.push(pe(t,new hs(f,g,c),1));break;case pn:i.push(pe(t,new cs(f,g,c),1));break;case xn:i.push(pe(t,new ds(f,g,c),1));break;case wn:i.push(pe(t,new us(f,g,c),1))}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readInt(!0);for(let f=0,g=t.readInt(!0);f<g;f++){let x=t.readStringRef();if(!x)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,x),p=t.readByte(),w=t.readInt(!0),v=w-1;switch(p){case ln:{let y=b,A=y.bones,C=y.vertices,S=A?C.length/3*2:C.length,I=t.readInt(!0),k=new es(w,I,m,y),Y=t.readFloat();for(let F=0,P=0;;F++){let M,R=t.readInt(!0);if(R==0)M=A?X.newFloatArray(S):C;else{M=X.newFloatArray(S);let se=t.readInt(!0);if(R+=se,r==1)for(let te=se;te<R;te++)M[te]=t.readFloat();else for(let te=se;te<R;te++)M[te]=t.readFloat()*r;if(!A)for(let te=0,re=M.length;te<re;te++)M[te]+=C[te]}if(k.setFrame(F,Y,M),F==v)break;let B=t.readFloat();switch(t.readByte()){case Pe:k.setStepped(F);break;case Le:ae(t,k,P++,F,0,Y,B,0,1,1)}Y=B}i.push(k);break}case on:{let y=new ms(w,m,b);for(let A=0;A<w;A++){let C=t.readFloat(),S=t.readInt32();y.setFrame(A,C,oi[S&15],S>>4,t.readFloat())}i.push(y);break}}}}}let h=t.readInt(!0);if(h>0){let a=new je(h),o=s.slots.length;for(let c=0;c<h;c++){let d=t.readFloat(),u=t.readInt(!0),m=X.newArray(o,0);for(let b=o-1;b>=0;b--)m[b]=-1;let f=X.newArray(o-u,0),g=0,x=0;for(let b=0;b<u;b++){let p=t.readInt(!0);for(;g!=p;)f[x++]=g++;m[g+t.readInt(!0)]=g++}for(;g<o;)f[x++]=g++;for(let b=o-1;b>=0;b--)m[b]==-1&&(m[b]=f[--x]);a.setFrame(c,d,m)}i.push(a)}let l=t.readInt(!0);if(l>0){let a=new ft(l);for(let o=0;o<l;o++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new Ts(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(o,u)}i.push(a)}let n=0;for(let a=0,o=i.length;a<o;a++)n=Math.max(n,i[a].getDuration());return new dt(e,i,n)}},ki=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Ur=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Wr=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function pe(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let h=0,l=0,n=e.getFrameCount()-1;e.setFrame(h,i,r),h!=n;h++){let a=t.readFloat(),o=t.readFloat()*s;switch(t.readByte()){case Pe:e.setStepped(h);break;case Le:ae(t,e,l++,h,0,i,a,r,o,s)}i=a,r=o}return e}function Os(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,h=t.readFloat()*s;for(let l=0,n=0,a=e.getFrameCount()-1;e.setFrame(l,i,r,h),l!=a;l++){let o=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case Pe:e.setStepped(l);break;case Le:ae(t,e,n++,l,0,i,o,r,c,s),ae(t,e,n++,l,1,i,o,h,d,s)}i=o,r=c,h=d}return e}function ae(t,e,s,i,r,h,l,n,a,o){e.setBezier(s,i,r,h,n,t.readFloat(),t.readFloat()*o,t.readFloat(),t.readFloat()*o,l,a)}var Gr=0,zr=1,qr=2,_r=3,Hr=4,jr=5,Zr=6,Jr=7,Kr=8,Qr=9,$r=10,en=0,tn=1,sn=2,rn=3,nn=4,an=5,ln=0,on=1,hn=0,cn=1,dn=2,un=0,fn=1,mn=2,gn=4,pn=5,xn=6,wn=7,bn=8,Pe=1,Le=2,Yi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new st(()=>X.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=t.slots,l=h.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<l;n++){let a=h[n];if(!a.bone.active)continue;let o=a.getAttachment();if(o instanceof bs){let c=o;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=X.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let h=0,l=r.length;h<l;h++){let n=r[h],a=n;for(let o=0,c=n.length;o<c;o+=2){let d=a[o],u=a[o+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,h=this.minY,l=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=h&&i<=h||t>=l&&s>=l||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),o=a*(r-t)+e;if(o>h&&o<n||(o=a*(l-t)+e,o>h&&o<n))return!0;let c=(h-e)/a+t;return c>r&&c<l||(c=(n-e)/a+t,c>r&&c<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,h=r-2,l=!1;for(let n=0;n<r;n+=2){let a=i[n+1],o=i[h+1];if(a<s&&o>=s||o<s&&a>=s){let c=i[n];c+(s-a)/(o-a)*(i[h]-c)<e&&(l=!l)}h=n}return l}intersectsSegment(t,e,s,i){let r=this.polygons;for(let h=0,l=r.length;h<l;h++)if(this.intersectsSegmentPolygon(r[h],t,e,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,i,r){let h=t,l=t.length,n=e-i,a=s-r,o=e*r-s*i,c=h[l-2],d=h[l-1];for(let u=0;u<l;u+=2){let m=h[u],f=h[u+1],g=c*f-d*m,x=c-m,b=d-f,p=n*b-a*x,w=(o*x-n*g)/p;if((w>=c&&w<=m||w>=m&&w<=c)&&(w>=e&&w<=i||w>=i&&w<=e)){let v=(o*b-a*g)/p;if((v>=d&&v<=f||v>=f&&v<=d)&&(v>=s&&v<=r||v>=r&&v<=s))return!0}c=m,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Fi=class Ae{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new st(()=>new Array);polygonIndicesPool=new st(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=i;n<a;++n)h[n]=Ae.isConcave(n,i,s,r);let l=this.triangles;for(l.length=0;i>3;){let n=i-1,a=0,o=1;for(;;){e:if(!h[a]){let u=r[n]<<1,m=r[a]<<1,f=r[o]<<1,g=s[u],x=s[u+1],b=s[m],p=s[m+1],w=s[f],v=s[f+1];for(let y=(o+1)%i;y!=n;y=(y+1)%i){if(!h[y])continue;let A=r[y]<<1,C=s[A],S=s[A+1];if(Ae.positiveArea(w,v,g,x,C,S)&&Ae.positiveArea(g,x,b,p,C,S)&&Ae.positiveArea(b,p,w,v,C,S))break e}break}if(o==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=o,o=(o+1)%i}l.push(r[(i+a-1)%i]),l.push(r[a]),l.push(r[(a+1)%i]),r.splice(a,1),h.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;h[c]=Ae.isConcave(c,i,s,r),h[d]=Ae.isConcave(d,i,s,r)}return i==3&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,o=0;for(let c=0,d=s.length;c<d;c+=3){let u=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,g=i[u],x=i[u+1],b=i[m],p=i[m+1],w=i[f],v=i[f+1],y=!1;if(a==u){let A=n.length-4,C=Ae.winding(n[A],n[A+1],n[A+2],n[A+3],w,v),S=Ae.winding(w,v,n[0],n[1],n[2],n[3]);C==o&&S==o&&(n.push(w),n.push(v),l.push(f),y=!0)}y||(n.length>0?(r.push(n),h.push(l)):(this.polygonPool.free(n),this.polygonIndicesPool.free(l)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(x),n.push(b),n.push(p),n.push(w),n.push(v),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(u),l.push(m),l.push(f),o=Ae.winding(g,x,b,p,w,v),a=u)}n.length>0&&(r.push(n),h.push(l));for(let c=0,d=r.length;c<d;c++){if(l=h[c],l.length==0)continue;let u=l[0],m=l[l.length-1];n=r[c];let f=n.length-4,g=n[f],x=n[f+1],b=n[f+2],p=n[f+3],w=n[0],v=n[1],y=n[2],A=n[3],C=Ae.winding(g,x,b,p,w,v);for(let S=0;S<d;S++){if(S==c)continue;let I=h[S];if(I.length!=3)continue;let k=I[0],Y=I[1],F=I[2],P=r[S],M=P[P.length-2],R=P[P.length-1];if(k!=u||Y!=m)continue;let B=Ae.winding(g,x,b,p,M,R),se=Ae.winding(M,R,w,v,y,A);B==C&&se==C&&(P.length=0,I.length=0,n.push(M),n.push(R),l.push(F),g=b,x=p,b=M,p=R,S=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return r}static isConcave(e,s,i,r){let h=r[(s+e-1)%s]<<1,l=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[l],i[l+1],i[n],i[n+1])}static positiveArea(e,s,i,r,h,l){return e*(l-r)+i*(s-l)+h*(r-s)>=0}static winding(e,s,i,r,h,l){let n=i-e,a=r-s;return h*a-l*n+n*s-e*a>=0?1:-1}},vt=class ei{triangulator=new Fi;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=X.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let h=this.clippingPolygon;ei.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=l.length;n<a;n++){let o=l[n];ei.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,h,l,n,a){let o,c,d,u,m,f;typeof s=="number"?(o=i,c=r,d=h,u=l,m=n,f=a):(o=s,c=i,d=r,u=h,m=l,f=n),d&&u&&m&&typeof f=="boolean"?this.clipTrianglesRender(e,o,c,d,u,m,f):this.clipTrianglesNoRender(e,o,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,h=this.clippedVertices,l=this.clippedTriangles,n=this.clippingPolygons,a=n.length,o=0;h.length=0,l.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,u=e[d],m=e[d+1];d=s[c+1]<<1;let f=e[d],g=e[d+1];d=s[c+2]<<1;let x=e[d],b=e[d+1];for(let p=0;p<a;p++){let w=h.length;if(this.clip(u,m,f,g,x,b,n[p],r)){let v=r.length;if(v==0)continue;let y=v>>1,A=this.clipOutput,C=X.setArraySize(h,w+y*2);for(let I=0;I<v;I+=2,w+=2){let k=A[I],Y=A[I+1];C[w]=k,C[w+1]=Y}w=l.length;let S=X.setArraySize(l,w+3*(y-2));y--;for(let I=1;I<y;I++,w+=3)S[w]=o,S[w+1]=o+I,S[w+2]=o+I+1;o+=y+1}else{let v=X.setArraySize(h,w+6);v[w]=u,v[w+1]=m,v[w+2]=f,v[w+3]=g,v[w+4]=x,v[w+5]=b,w=l.length;let y=X.setArraySize(l,w+3);y[w]=o,y[w+1]=o+1,y[w+2]=o+2,o+=3;break}}}}clipTrianglesRender(e,s,i,r,h,l,n){let a=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=n?12:8,f=0;o.length=0,c.length=0;for(let g=0;g<i;g+=3){let x=s[g]<<1,b=e[x],p=e[x+1],w=r[x],v=r[x+1];x=s[g+1]<<1;let y=e[x],A=e[x+1],C=r[x],S=r[x+1];x=s[g+2]<<1;let I=e[x],k=e[x+1],Y=r[x],F=r[x+1];for(let P=0;P<u;P++){let M=o.length;if(this.clip(b,p,y,A,I,k,d[P],a)){let R=a.length;if(R==0)continue;let B=A-k,se=I-y,te=b-I,re=k-p,de=1/(B*te+se*(p-k)),oe=R>>1,me=this.clipOutput,Z=X.setArraySize(o,M+oe*m);for(let he=0;he<R;he+=2,M+=m){let ve=me[he],ge=me[he+1];Z[M]=ve,Z[M+1]=ge,Z[M+2]=h.r,Z[M+3]=h.g,Z[M+4]=h.b,Z[M+5]=h.a;let we=ve-I,be=ge-k,Re=(B*we+se*be)*de,$e=(re*we+te*be)*de,ot=1-Re-$e;Z[M+6]=w*Re+C*$e+Y*ot,Z[M+7]=v*Re+S*$e+F*ot,n&&(Z[M+8]=l.r,Z[M+9]=l.g,Z[M+10]=l.b,Z[M+11]=l.a)}M=c.length;let ne=X.setArraySize(c,M+3*(oe-2));oe--;for(let he=1;he<oe;he++,M+=3)ne[M]=f,ne[M+1]=f+he,ne[M+2]=f+he+1;f+=oe+1}else{let R=X.setArraySize(o,M+3*m);R[M]=b,R[M+1]=p,R[M+2]=h.r,R[M+3]=h.g,R[M+4]=h.b,R[M+5]=h.a,n?(R[M+6]=w,R[M+7]=v,R[M+8]=l.r,R[M+9]=l.g,R[M+10]=l.b,R[M+11]=l.a,R[M+12]=y,R[M+13]=A,R[M+14]=h.r,R[M+15]=h.g,R[M+16]=h.b,R[M+17]=h.a,R[M+18]=C,R[M+19]=S,R[M+20]=l.r,R[M+21]=l.g,R[M+22]=l.b,R[M+23]=l.a,R[M+24]=I,R[M+25]=k,R[M+26]=h.r,R[M+27]=h.g,R[M+28]=h.b,R[M+29]=h.a,R[M+30]=Y,R[M+31]=F,R[M+32]=l.r,R[M+33]=l.g,R[M+34]=l.b,R[M+35]=l.a):(R[M+6]=w,R[M+7]=v,R[M+8]=y,R[M+9]=A,R[M+10]=h.r,R[M+11]=h.g,R[M+12]=h.b,R[M+13]=h.a,R[M+14]=C,R[M+15]=S,R[M+16]=I,R[M+17]=k,R[M+18]=h.r,R[M+19]=h.g,R[M+20]=h.b,R[M+21]=h.a,R[M+22]=Y,R[M+23]=F),M=c.length;let B=X.setArraySize(c,M+3);B[M]=f,B[M+1]=f+1,B[M+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let h=this.clipOutput,l=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,o=this.clippingPolygons,c=o.length,d=0;l.length=0,n.length=0,a.length=0;for(let u=0;u<i;u+=3){let m=s[u]<<1,f=e[m],g=e[m+1],x=r[m],b=r[m+1];m=s[u+1]<<1;let p=e[m],w=e[m+1],v=r[m],y=r[m+1];m=s[u+2]<<1;let A=e[m],C=e[m+1],S=r[m],I=r[m+1];for(let k=0;k<c;k++){let Y=l.length;if(this.clip(f,g,p,w,A,C,o[k],h)){let F=h.length;if(F==0)continue;let P=w-C,M=A-p,R=f-A,B=C-g,se=1/(P*R+M*(g-C)),te=F>>1,re=this.clipOutput,de=X.setArraySize(l,Y+te*2),oe=X.setArraySize(n,Y+te*2);for(let Z=0;Z<F;Z+=2,Y+=2){let ne=re[Z],he=re[Z+1];de[Y]=ne,de[Y+1]=he;let ve=ne-A,ge=he-C,we=(P*ve+M*ge)*se,be=(B*ve+R*ge)*se,Re=1-we-be;oe[Y]=x*we+v*be+S*Re,oe[Y+1]=b*we+y*be+I*Re}Y=a.length;let me=X.setArraySize(a,Y+3*(te-2));te--;for(let Z=1;Z<te;Z++,Y+=3)me[Y]=d,me[Y+1]=d+Z,me[Y+2]=d+Z+1;d+=te+1}else{let F=X.setArraySize(l,Y+6);F[Y]=f,F[Y+1]=g,F[Y+2]=p,F[Y+3]=w,F[Y+4]=A,F[Y+5]=C;let P=X.setArraySize(n,Y+3*2);P[Y]=x,P[Y+1]=b,P[Y+2]=v,P[Y+3]=y,P[Y+4]=S,P[Y+5]=I,Y=a.length;let M=X.setArraySize(a,Y+3);M[Y]=d,M[Y+1]=d+1,M[Y+2]=d+2,d+=3;break}}}}clip(e,s,i,r,h,l,n,a){let o=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(h),d.push(l),d.push(e),d.push(s),a.length=0;let u=n.length-4,m=n;for(let f=0;;f+=2){let g=m[f],x=m[f+1],b=g-m[f+2],p=x-m[f+3],w=a.length,v=d;for(let A=0,C=d.length-2;A<C;){let S=v[A],I=v[A+1];A+=2;let k=v[A],Y=v[A+1],F=p*(g-k)>b*(x-Y),P=p*(g-S)-b*(x-I);if(P>0){if(F){a.push(k),a.push(Y);continue}let M=k-S,R=Y-I,B=P/(M*p-R*b);if(B>=0&&B<=1)a.push(S+M*B),a.push(I+R*B);else{a.push(k),a.push(Y);continue}}else if(F){let M=k-S,R=Y-I,B=P/(M*p-R*b);if(B>=0&&B<=1)a.push(S+M*B),a.push(I+R*B),a.push(k),a.push(Y);else{a.push(k),a.push(Y);continue}}c=!0}if(w==a.length)return o.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==u)break;let y=a;a=d,a.length=0,d=y}if(o!=a){o.length=0;for(let f=0,g=a.length-2;f<g;f++)o[f]=a[f]}else o.length=o.length-2;return c}static makeClockwise(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,l=0,n=0,a=0;for(let o=0,c=i-3;o<c;o+=2)h=s[o],l=s[o+1],n=s[o+2],a=s[o+3],r+=h*a-n*l;if(!(r<0))for(let o=0,c=i-2,d=i>>1;o<d;o+=2){let u=s[o],m=s[o+1],f=c-o;s[o]=s[f],s[o+1]=s[f+1],s[f]=u,s[f+1]=m}}},Pi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Fs,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=E(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let l=i.bones[h],n=null,a=E(l,"parent",null);a&&(n=s.findBone(a));let o=new As(s.bones.length,l.name,n);o.length=E(l,"length",0)*e,o.x=E(l,"x",0)*e,o.y=E(l,"y",0)*e,o.rotation=E(l,"rotation",0),o.scaleX=E(l,"scaleX",1),o.scaleY=E(l,"scaleY",1),o.shearX=E(l,"shearX",0),o.shearY=E(l,"shearY",0),o.inherit=X.enumValue(bt,E(l,"inherit","Normal")),o.skinRequired=E(l,"skin",!1);let c=E(l,"color",null);c&&o.color.setFromString(c),s.bones.push(o)}if(i.slots)for(let h=0;h<i.slots.length;h++){let l=i.slots[h],n=l.name,a=s.findBone(l.bone);if(!a)throw new Error(`Couldn't find bone ${l.bone} for slot ${n}`);let o=new Ls(s.slots.length,n,a),c=E(l,"color",null);c&&o.color.setFromString(c);let d=E(l,"dark",null);d&&(o.darkColor=K.fromString(d)),o.attachmentName=E(l,"attachment",null),o.blendMode=X.enumValue(Xs,E(l,"blend","normal")),o.visible=E(l,"visible",!0),s.slots.push(o)}if(i.ik)for(let h=0;h<i.ik.length;h++){let l=i.ik[h],n=new Ms(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let o=0;o<l.bones.length;o++){let c=s.findBone(l.bones[o]);if(!c)throw new Error(`Couldn't find bone ${l.bones[o]} for IK constraint ${l.name}.`);n.bones.push(c)}let a=s.findBone(l.target);if(!a)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);n.target=a,n.mix=E(l,"mix",1),n.softness=E(l,"softness",0)*e,n.bendDirection=E(l,"bendPositive",!0)?1:-1,n.compress=E(l,"compress",!1),n.stretch=E(l,"stretch",!1),n.uniform=E(l,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let h=0;h<i.transform.length;h++){let l=i.transform[h],n=new Bs(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);n.bones.push(u)}let a=l.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${l.name}.`);n.target=o,n.local=E(l,"local",!1),n.relative=E(l,"relative",!1),n.offsetRotation=E(l,"rotation",0),n.offsetX=E(l,"x",0)*e,n.offsetY=E(l,"y",0)*e,n.offsetScaleX=E(l,"scaleX",0),n.offsetScaleY=E(l,"scaleY",0),n.offsetShearY=E(l,"shearY",0),n.mixRotate=E(l,"mixRotate",1),n.mixX=E(l,"mixX",1),n.mixY=E(l,"mixY",n.mixX),n.mixScaleX=E(l,"mixScaleX",1),n.mixScaleY=E(l,"mixScaleY",n.mixScaleX),n.mixShearY=E(l,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let h=0;h<i.path.length;h++){let l=i.path[h],n=new Es(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);n.bones.push(u)}let a=l.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${l.name}.`);n.target=o,n.positionMode=X.enumValue(Rs,E(l,"positionMode","Percent")),n.spacingMode=X.enumValue(ks,E(l,"spacingMode","Length")),n.rotateMode=X.enumValue(Ys,E(l,"rotateMode","Tangent")),n.offsetRotation=E(l,"rotation",0),n.position=E(l,"position",0),n.positionMode==0&&(n.position*=e),n.spacing=E(l,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=e),n.mixRotate=E(l,"mixRotate",1),n.mixX=E(l,"mixX",1),n.mixY=E(l,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let h=0;h<i.physics.length;h++){const l=i.physics[h],n=new Ei(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);const a=l.bone,o=s.findBone(a);if(o==null)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=E(l,"x",0),n.y=E(l,"y",0),n.rotate=E(l,"rotate",0),n.scaleX=E(l,"scaleX",0),n.shearX=E(l,"shearX",0),n.limit=E(l,"limit",5e3)*e,n.step=1/E(l,"fps",60),n.inertia=E(l,"inertia",1),n.strength=E(l,"strength",100),n.damping=E(l,"damping",1),n.massInverse=1/E(l,"mass",1),n.wind=E(l,"wind",0),n.gravity=E(l,"gravity",0),n.mix=E(l,"mix",1),n.inertiaGlobal=E(l,"inertiaGlobal",!1),n.strengthGlobal=E(l,"strengthGlobal",!1),n.dampingGlobal=E(l,"dampingGlobal",!1),n.massGlobal=E(l,"massGlobal",!1),n.windGlobal=E(l,"windGlobal",!1),n.gravityGlobal=E(l,"gravityGlobal",!1),n.mixGlobal=E(l,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let h=0;h<i.skins.length;h++){let l=i.skins[h],n=new at(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let o=l.bones[a],c=s.findBone(o);if(!c)throw new Error(`Couldn't find bone ${o} for skin ${l.name}.`);n.bones.push(c)}if(l.ik)for(let a=0;a<l.ik.length;a++){let o=l.ik[a],c=s.findIkConstraint(o);if(!c)throw new Error(`Couldn't find IK constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.transform)for(let a=0;a<l.transform.length;a++){let o=l.transform[a],c=s.findTransformConstraint(o);if(!c)throw new Error(`Couldn't find transform constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.path)for(let a=0;a<l.path.length;a++){let o=l.path[a],c=s.findPathConstraint(o);if(!c)throw new Error(`Couldn't find path constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.physics)for(let a=0;a<l.physics.length;a++){let o=l.physics[a],c=s.findPhysicsConstraint(o);if(!c)throw new Error(`Couldn't find physics constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}for(let a in l.attachments){let o=s.findSlot(a);if(!o)throw new Error(`Couldn't find slot ${a} for skin ${l.name}.`);let c=l.attachments[a];for(let d in c){let u=this.readAttachment(c[d],n,o.index,d,s);u&&n.setAttachment(o.index,d,u)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let o=a.getAttachment(n.slotIndex,n.parent);if(!o)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?o:n.mesh,n.mesh.setParentMesh(o),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let l=i.events[h],n=new Is(h);n.intValue=E(l,"int",0),n.floatValue=E(l,"float",0),n.stringValue=E(l,"string",""),n.audioPath=E(l,"audio",null),n.audioPath&&(n.volume=E(l,"volume",1),n.balance=E(l,"balance",0)),s.events.push(n)}if(i.animations)for(let h in i.animations){let l=i.animations[h];this.readAnimation(l,h,s)}return s}readAttachment(t,e,s,i,r){let h=this.scale;switch(i=E(t,"name",i),E(t,"type","region")){case"region":{let l=E(t,"path",i),n=this.readSequence(E(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,l,n);if(!a)return null;a.path=l,a.x=E(t,"x",0)*h,a.y=E(t,"y",0)*h,a.scaleX=E(t,"scaleX",1),a.scaleY=E(t,"scaleY",1),a.rotation=E(t,"rotation",0),a.width=t.width*h,a.height=t.height*h,a.sequence=n;let o=E(t,"color",null);return o&&a.color.setFromString(o),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let n=E(t,"color",null);return n&&l.color.setFromString(n),l}case"mesh":case"linkedmesh":{let l=E(t,"path",i),n=this.readSequence(E(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,l,n);if(!a)return null;a.path=l;let o=E(t,"color",null);o&&a.color.setFromString(o),a.width=E(t,"width",0)*h,a.height=E(t,"height",0)*h,a.sequence=n;let c=E(t,"parent",null);if(c)return this.linkedMeshes.push(new vn(a,E(t,"skin",null),s,c,E(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=E(t,"edges",null),a.hullLength=E(t,"hull",0)*2,a}case"path":{let l=this.attachmentLoader.newPathAttachment(e,i);if(!l)return null;l.closed=E(t,"closed",!1),l.constantSpeed=E(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,l,n<<1);let a=X.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*h;l.lengths=a;let o=E(t,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,i);if(!l)return null;l.x=E(t,"x",0)*h,l.y=E(t,"y",0)*h,l.rotation=E(t,"rotation",0);let n=E(t,"color",null);return n&&l.color.setFromString(n),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,i);if(!l)return null;let n=E(t,"end",null);n&&(l.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,l,a<<1);let o=E(t,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(t){if(t==null)return null;let e=new ai(E(t,"count",0));return e.start=E(t,"start",1),e.digits=E(t,"digits",0),e.setupIndex=E(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=X.toFloatArray(r);if(i!=1)for(let a=0,o=r.length;a<o;a++)n[a]*=i;e.vertices=n;return}let h=new Array,l=new Array;for(let n=0,a=r.length;n<a;){let o=r[n++];l.push(o);for(let c=n+o*4;n<c;n+=4)l.push(r[n]),h.push(r[n+1]*i),h.push(r[n+2]*i),h.push(r[n+3])}e.bones=l,e.vertices=X.toFloatArray(h)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let l in t.slots){let n=t.slots[l],a=s.findSlot(l);if(!a)throw new Error("Slot not found: "+l);let o=a.index;for(let c in n){let d=n[c];if(!d)continue;let u=d.length;if(c=="attachment"){let m=new We(u,o);for(let f=0;f<u;f++){let g=d[f];m.setFrame(f,E(g,"time",0),E(g,"name",null))}r.push(m)}else if(c=="rgba"){let m=new Zt(u,u<<2,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.color);for(let b=0,p=0;;b++){m.setFrame(b,g,x.r,x.g,x.b,x.a);let w=d[b+1];if(!w){m.shrink(p);break}let v=E(w,"time",0),y=K.fromString(w.color),A=f.curve;A&&(p=le(A,m,p,b,0,g,v,x.r,y.r,1),p=le(A,m,p,b,1,g,v,x.g,y.g,1),p=le(A,m,p,b,2,g,v,x.b,y.b,1),p=le(A,m,p,b,3,g,v,x.a,y.a,1)),g=v,x=y,f=w}r.push(m)}else if(c=="rgb"){let m=new Jt(u,u*3,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.color);for(let b=0,p=0;;b++){m.setFrame(b,g,x.r,x.g,x.b);let w=d[b+1];if(!w){m.shrink(p);break}let v=E(w,"time",0),y=K.fromString(w.color),A=f.curve;A&&(p=le(A,m,p,b,0,g,v,x.r,y.r,1),p=le(A,m,p,b,1,g,v,x.g,y.g,1),p=le(A,m,p,b,2,g,v,x.b,y.b,1)),g=v,x=y,f=w}r.push(m)}else if(c=="alpha")r.push(Ie(d,new Kt(u,u,o),0,1));else if(c=="rgba2"){let m=new Qt(u,u*7,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.light),b=K.fromString(f.dark);for(let p=0,w=0;;p++){m.setFrame(p,g,x.r,x.g,x.b,x.a,b.r,b.g,b.b);let v=d[p+1];if(!v){m.shrink(w);break}let y=E(v,"time",0),A=K.fromString(v.light),C=K.fromString(v.dark),S=f.curve;S&&(w=le(S,m,w,p,0,g,y,x.r,A.r,1),w=le(S,m,w,p,1,g,y,x.g,A.g,1),w=le(S,m,w,p,2,g,y,x.b,A.b,1),w=le(S,m,w,p,3,g,y,x.a,A.a,1),w=le(S,m,w,p,4,g,y,b.r,C.r,1),w=le(S,m,w,p,5,g,y,b.g,C.g,1),w=le(S,m,w,p,6,g,y,b.b,C.b,1)),g=y,x=A,b=C,f=v}r.push(m)}else if(c=="rgb2"){let m=new $t(u,u*6,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.light),b=K.fromString(f.dark);for(let p=0,w=0;;p++){m.setFrame(p,g,x.r,x.g,x.b,b.r,b.g,b.b);let v=d[p+1];if(!v){m.shrink(w);break}let y=E(v,"time",0),A=K.fromString(v.light),C=K.fromString(v.dark),S=f.curve;S&&(w=le(S,m,w,p,0,g,y,x.r,A.r,1),w=le(S,m,w,p,1,g,y,x.g,A.g,1),w=le(S,m,w,p,2,g,y,x.b,A.b,1),w=le(S,m,w,p,3,g,y,b.r,C.r,1),w=le(S,m,w,p,4,g,y,b.g,C.g,1),w=le(S,m,w,p,5,g,y,b.b,C.b,1)),g=y,x=A,b=C,f=v}r.push(m)}}}if(t.bones)for(let l in t.bones){let n=t.bones[l],a=s.findBone(l);if(!a)throw new Error("Bone not found: "+l);let o=a.index;for(let c in n){let d=n[c],u=d.length;if(u!=0){if(c==="rotate")r.push(Ie(d,new it(u,u,o),0,1));else if(c==="translate"){let m=new Dt(u,u<<1,o);r.push(Vs(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new Nt(u,u,o);r.push(Ie(d,m,0,i))}else if(c==="translatey"){let m=new Ut(u,u,o);r.push(Ie(d,m,0,i))}else if(c==="scale"){let m=new Wt(u,u<<1,o);r.push(Vs(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Gt(u,u,o);r.push(Ie(d,m,1,1))}else if(c==="scaley"){let m=new zt(u,u,o);r.push(Ie(d,m,1,1))}else if(c==="shear"){let m=new qt(u,u<<1,o);r.push(Vs(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new _t(u,u,o);r.push(Ie(d,m,0,1))}else if(c==="sheary"){let m=new Ht(u,u,o);r.push(Ie(d,m,0,1))}else if(c==="inherit"){let m=new jt(u,a.index);for(let f=0;f<d.length;f++){let g=d[f];m.setFrame(f,E(g,"time",0),X.enumValue(bt,E(g,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let l in t.ik){let n=t.ik[l],a=n[0];if(!a)continue;let o=s.findIkConstraint(l);if(!o)throw new Error("IK Constraint not found: "+l);let c=s.ikConstraints.indexOf(o),d=new ts(n.length,n.length<<1,c),u=E(a,"time",0),m=E(a,"mix",1),f=E(a,"softness",0)*i;for(let g=0,x=0;;g++){d.setFrame(g,u,m,f,E(a,"bendPositive",!0)?1:-1,E(a,"compress",!1),E(a,"stretch",!1));let b=n[g+1];if(!b){d.shrink(x);break}let p=E(b,"time",0),w=E(b,"mix",1),v=E(b,"softness",0)*i,y=a.curve;y&&(x=le(y,d,x,g,0,u,p,m,w,1),x=le(y,d,x,g,1,u,p,f,v,i)),u=p,m=w,f=v,a=b}r.push(d)}if(t.transform)for(let l in t.transform){let n=t.transform[l],a=n[0];if(!a)continue;let o=s.findTransformConstraint(l);if(!o)throw new Error("Transform constraint not found: "+l);let c=s.transformConstraints.indexOf(o),d=new ss(n.length,n.length*6,c),u=E(a,"time",0),m=E(a,"mixRotate",1),f=E(a,"mixX",1),g=E(a,"mixY",f),x=E(a,"mixScaleX",1),b=E(a,"mixScaleY",x),p=E(a,"mixShearY",1);for(let w=0,v=0;;w++){d.setFrame(w,u,m,f,g,x,b,p);let y=n[w+1];if(!y){d.shrink(v);break}let A=E(y,"time",0),C=E(y,"mixRotate",1),S=E(y,"mixX",1),I=E(y,"mixY",S),k=E(y,"mixScaleX",1),Y=E(y,"mixScaleY",k),F=E(y,"mixShearY",1),P=a.curve;P&&(v=le(P,d,v,w,0,u,A,m,C,1),v=le(P,d,v,w,1,u,A,f,S,1),v=le(P,d,v,w,2,u,A,g,I,1),v=le(P,d,v,w,3,u,A,x,k,1),v=le(P,d,v,w,4,u,A,b,Y,1),v=le(P,d,v,w,5,u,A,p,F,1)),u=A,m=C,f=S,g=I,x=k,b=Y,x=k,a=y}r.push(d)}if(t.path)for(let l in t.path){let n=t.path[l],a=s.findPathConstraint(l);if(!a)throw new Error("Path constraint not found: "+l);let o=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],u=d[0];if(!u)continue;let m=d.length;if(c==="position"){let f=new is(m,m,o);r.push(Ie(d,f,0,a.positionMode==0?i:1))}else if(c==="spacing"){let f=new rs(m,m,o);r.push(Ie(d,f,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let f=new ns(m,m*3,o),g=E(u,"time",0),x=E(u,"mixRotate",1),b=E(u,"mixX",1),p=E(u,"mixY",b);for(let w=0,v=0;;w++){f.setFrame(w,g,x,b,p);let y=d[w+1];if(!y){f.shrink(v);break}let A=E(y,"time",0),C=E(y,"mixRotate",1),S=E(y,"mixX",1),I=E(y,"mixY",S),k=u.curve;k&&(v=le(k,f,v,w,0,g,A,x,C,1),v=le(k,f,v,w,1,g,A,b,S,1),v=le(k,f,v,w,2,g,A,p,I,1)),g=A,x=C,b=S,p=I,u=y}r.push(f)}}}if(t.physics)for(let l in t.physics){let n=t.physics[l],a=-1;if(l.length>0){let o=s.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);a=s.physicsConstraints.indexOf(o)}for(let o in n){let c=n[o],d=c[0];if(!d)continue;let u=c.length;if(o=="reset"){const f=new fs(u,a);for(let g=0;d!=null;d=c[g+1],g++)f.setFrame(g,E(d,"time",0));r.push(f);continue}let m;if(o=="inertia")m=new as(u,u,a);else if(o=="strength")m=new ls(u,u,a);else if(o=="damping")m=new os(u,u,a);else if(o=="mass")m=new hs(u,u,a);else if(o=="wind")m=new cs(u,u,a);else if(o=="gravity")m=new ds(u,u,a);else if(o=="mix")m=new us(u,u,a);else continue;r.push(Ie(c,m,0,1))}}if(t.attachments)for(let l in t.attachments){let n=t.attachments[l],a=s.findSkin(l);if(!a)throw new Error("Skin not found: "+l);for(let o in n){let c=n[o],d=s.findSlot(o);if(!d)throw new Error("Slot not found: "+o);let u=d.index;for(let m in c){let f=c[m],g=a.getAttachment(u,m);for(let x in f){let b=f[x],p=b[0];if(p){if(x=="deform"){let w=g.bones,v=g.vertices,y=w?v.length/3*2:v.length,A=new es(b.length,b.length,u,g),C=E(p,"time",0);for(let S=0,I=0;;S++){let k,Y=E(p,"vertices",null);if(!Y)k=w?X.newFloatArray(y):v;else{k=X.newFloatArray(y);let R=E(p,"offset",0);if(X.arrayCopy(Y,0,k,R,Y.length),i!=1)for(let B=R,se=B+Y.length;B<se;B++)k[B]*=i;if(!w)for(let B=0;B<y;B++)k[B]+=v[B]}A.setFrame(S,C,k);let F=b[S+1];if(!F){A.shrink(I);break}let P=E(F,"time",0),M=p.curve;M&&(I=le(M,A,I,S,0,C,P,0,1,1)),C=P,p=F}r.push(A)}else if(x=="sequence"){let w=new ms(b.length,u,g),v=0;for(let y=0;y<b.length;y++){let A=E(p,"delay",v),C=E(p,"time",0),S=li[E(p,"mode","hold")],I=E(p,"index",0);w.setFrame(y,C,S,I,A),v=A,p=b[y+1]}r.push(w)}}}}}}if(t.drawOrder){let l=new je(t.drawOrder.length),n=s.slots.length,a=0;for(let o=0;o<t.drawOrder.length;o++,a++){let c=t.drawOrder[o],d=null,u=E(c,"offsets",null);if(u){d=X.newArray(n,-1);let m=X.newArray(n-u.length,0),f=0,g=0;for(let x=0;x<u.length;x++){let b=u[x],p=s.findSlot(b.slot);if(!p)throw new Error("Slot not found: "+p);let w=p.index;for(;f!=w;)m[g++]=f++;d[f+b.offset]=f++}for(;f<n;)m[g++]=f++;for(let x=n-1;x>=0;x--)d[x]==-1&&(d[x]=m[--g])}l.setFrame(a,E(c,"time",0),d)}r.push(l)}if(t.events){let l=new ft(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let o=t.events[a],c=s.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let d=new Ts(X.toSinglePrecision(E(o,"time",0)),c);d.intValue=E(o,"int",c.intValue),d.floatValue=E(o,"float",c.floatValue),d.stringValue=E(o,"string",c.stringValue),d.data.audioPath&&(d.volume=E(o,"volume",1),d.balance=E(o,"balance",0)),l.setFrame(n,d)}r.push(l)}let h=0;for(let l=0,n=r.length;l<n;l++)h=Math.max(h,r[l].getDuration());s.animations.push(new dt(e,r,h))}},vn=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function Ie(t,e,s,i){let r=t[0],h=E(r,"time",0),l=E(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,h,l);let o=t[a+1];if(!o)return e.shrink(n),e;let c=E(o,"time",0),d=E(o,"value",s)*i;r.curve&&(n=le(r.curve,e,n,a,0,h,c,l,d,i)),h=c,l=d,r=o}}function Vs(t,e,s,i,r,h){let l=t[0],n=E(l,"time",0),a=E(l,s,r)*h,o=E(l,i,r)*h,c=0;for(let d=0;;d++){e.setFrame(d,n,a,o);let u=t[d+1];if(!u)return e.shrink(c),e;let m=E(u,"time",0),f=E(u,s,r)*h,g=E(u,i,r)*h,x=l.curve;x&&(c=le(x,e,c,d,0,n,m,a,f,h),c=le(x,e,c,d,1,n,m,o,g,h)),n=m,a=f,o=g,l=u}}function le(t,e,s,i,r,h,l,n,a,o){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],u=t[c+1]*o,m=t[c+2],f=t[c+3]*o;return e.setBezier(s,i,r,h,n,d,u,m,f,l,a),s+1}function E(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var yn=class extends pt{constructor(t){super(t)}setFilters(t,e){}setWraps(t,e){}dispose(){}},An=X.newFloatArray(8),Cn=class Pt{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=X.newFloatArray(8*1024);tempColor=new K;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,i=this.tempColor,r=e.color,h=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let l=0,n=h.length;l<n;l++){let a=h[l],o=a.bone;if(!o.active)continue;let c=a.getAttachment();if(!(c instanceof ce))continue;c.computeWorldVertices(a,An,0,2);let d=c.region,u=d.texture.getImage(),m=a.color,f=c.color;i.set(r.r*m.r*f.r,r.g*m.g*f.g,r.b*m.b*f.b,r.a*m.a*f.a),s.save(),s.transform(o.a,o.c,o.b,o.d,o.worldX,o.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let g=c.width/d.originalWidth;s.scale(g*c.scaleX,g*c.scaleY);let x=d.width,b=d.height;if(s.translate(x/2,b/2),c.region.degrees==90){let p=x;x=b,b=p,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-x/2,-b/2),s.globalAlpha=i.a,s.drawImage(u,u.width*d.u,u.height*d.v,x,b,0,0,x,b),this.debugRendering&&s.strokeRect(0,0,x,b),s.restore()}}drawTriangles(e){let s=this.ctx,i=this.tempColor,r=e.color,h=e.drawOrder,l=null,n=this.vertices,a=null;for(let c=0,d=h.length;c<d;c++){let u=h[c],m=u.getAttachment(),f,g;if(m instanceof ce){let x=m;n=this.computeRegionVertices(u,x,!1),a=Pt.QUAD_TRIANGLES,f=x.region.texture.getImage()}else if(m instanceof Ge){let x=m;n=this.computeMeshVertices(u,x,!1),a=x.triangles,f=x.region.texture.getImage()}else continue;if(f){u.data.blendMode!=l&&(l=u.data.blendMode);let x=u.color,b=m.color;i.set(r.r*x.r*b.r,r.g*x.g*b.g,r.b*x.b*b.b,r.a*x.a*b.a),s.globalAlpha=i.a;for(var o=0;o<a.length;o+=3){let p=a[o]*8,w=a[o+1]*8,v=a[o+2]*8,y=n[p],A=n[p+1],C=n[p+6],S=n[p+7],I=n[w],k=n[w+1],Y=n[w+6],F=n[w+7],P=n[v],M=n[v+1],R=n[v+6],B=n[v+7];this.drawTriangle(f,y,A,C,S,I,k,Y,F,P,M,R,B),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(y,A),s.lineTo(I,k),s.lineTo(P,M),s.lineTo(y,A),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,i,r,h,l,n,a,o,c,d,u,m){let f=this.ctx;const g=e.width-1,x=e.height-1;r*=g,h*=x,a*=g,o*=x,u*=g,m*=x,f.beginPath(),f.moveTo(s,i),f.lineTo(l,n),f.lineTo(c,d),f.closePath(),l-=s,n-=i,c-=s,d-=i,a-=r,o-=h,u-=r,m-=h;let b=a*m-u*o;if(b==0)return;b=1/b;const p=(m*l-o*c)*b,w=(m*n-o*d)*b,v=(a*c-u*l)*b,y=(a*d-u*n)*b,A=s-p*r-v*h,C=i-w*r-y*h;f.save(),f.transform(p,w,v,y,A,C),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,s,i){let r=e.bone.skeleton.color,h=e.color,l=s.color,n=r.a*h.a*l.a,a=i?n:1,o=this.tempColor;o.set(r.r*h.r*l.r*a,r.g*h.g*l.g*a,r.b*h.b*l.b*a,n),s.computeWorldVertices(e,this.vertices,0,Pt.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[ce.C1R]=o.r,c[ce.C1G]=o.g,c[ce.C1B]=o.b,c[ce.C1A]=o.a,c[ce.U1]=d[0],c[ce.V1]=d[1],c[ce.C2R]=o.r,c[ce.C2G]=o.g,c[ce.C2B]=o.b,c[ce.C2A]=o.a,c[ce.U2]=d[2],c[ce.V2]=d[3],c[ce.C3R]=o.r,c[ce.C3G]=o.g,c[ce.C3B]=o.b,c[ce.C3A]=o.a,c[ce.U3]=d[4],c[ce.V3]=d[5],c[ce.C4R]=o.r,c[ce.C4G]=o.g,c[ce.C4B]=o.b,c[ce.C4A]=o.a,c[ce.U4]=d[6],c[ce.V4]=d[7],c}computeMeshVertices(e,s,i){let r=e.bone.skeleton.color,h=e.color,l=s.color,n=r.a*h.a*l.a,a=i?n:1,o=this.tempColor;o.set(r.r*h.r*l.r*a,r.g*h.g*l.g*a,r.b*h.b*l.b*a,n);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=X.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,Pt.VERTEX_SIZE);let u=s.uvs;for(let m=0,f=0,g=2;m<c;m++)d[g++]=o.r,d[g++]=o.g,d[g++]=o.b,d[g++]=o.a,d[g++]=u[f++],d[g++]=u[f++],g+=2;return d}},xe=class{canvas;gl;restorables=[];constructor(t,e={alpha:!0}){if(t instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext)this.gl=t,this.canvas=this.gl.canvas;else{const s=t;this.gl=s.getContext("webgl2",e)||s.getContext("webgl",e),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=t=>{t&&t.preventDefault()};contextRestoredHandler=()=>{for(let t=0,e=this.restorables.length;t<e;t++)this.restorables[t].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(t){this.restorables.push(t)}removeRestorable(t){const e=this.restorables.indexOf(t);e>-1&&this.restorables.splice(e,1)}},ze=class Lt extends pt{context;texture=null;boundUnit=0;useMipMaps=!1;static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;constructor(e,s,i=!1){super(s),this.context=e instanceof xe?e:new xe(e),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(e,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Lt.validateMagFilter(s)),this.useMipMaps=Lt.usesMipMaps(e),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(e){switch(e){case 9987:case 9985:case 9986:case 9984:return 9729;default:return e}}static usesMipMaps(e){switch(e){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(e,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(e){let s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Lt.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this._image),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e?s.LINEAR_MIPMAP_LINEAR:s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),e&&s.generateMipmap(s.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(e=0){let s=this.context.gl;this.boundUnit=e,s.activeTexture(s.TEXTURE0+e),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){let e=this.context.gl;e.activeTexture(e.TEXTURE0+this.boundUnit),e.bindTexture(e.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},Li=class extends yi{constructor(t,e="",s=new Ss){super(i=>new ze(t,i),e,s)}},Se=class{x=0;y=0;z=0;constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.z=s}setFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}set(t,e,s){return this.x=t,this.y=e,this.z=s,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}normalize(){let t=this.length();return t==0?this:(t=1/t,this.x*=t,this.y*=t,this.z*=t,this)}cross(t){return this.set(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}multiply(t){let e=t.values;return this.set(this.x*e[O]+this.y*e[G]+this.z*e[z]+e[V],this.x*e[q]+this.y*e[D]+this.z*e[_]+e[N],this.x*e[H]+this.y*e[j]+this.z*e[U]+e[W])}project(t){let e=t.values,s=1/(this.x*e[Q]+this.y*e[$]+this.z*e[ee]+e[J]);return this.set((this.x*e[O]+this.y*e[G]+this.z*e[z]+e[V])*s,(this.x*e[q]+this.y*e[D]+this.z*e[_]+e[N])*s,(this.x*e[H]+this.y*e[j]+this.z*e[U]+e[W])*s)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(t){let e=t.x-this.x,s=t.y-this.y,i=t.z-this.z;return Math.sqrt(e*e+s*s+i*i)}},O=0,G=4,z=8,V=12,q=1,D=5,_=9,N=13,H=2,j=6,U=10,W=14,Q=3,$=7,ee=11,J=15,lt=class Ye{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new Se;static yAxis=new Se;static zAxis=new Se;static tmpMatrix=new Ye;constructor(){let e=this.values;e[O]=1,e[D]=1,e[U]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,s=this.values;return e[O]=s[O],e[G]=s[q],e[z]=s[H],e[V]=s[Q],e[q]=s[G],e[D]=s[D],e[_]=s[j],e[N]=s[$],e[H]=s[z],e[j]=s[_],e[U]=s[U],e[W]=s[ee],e[Q]=s[V],e[$]=s[N],e[ee]=s[W],e[J]=s[J],this.set(e)}identity(){let e=this.values;return e[O]=1,e[G]=0,e[z]=0,e[V]=0,e[q]=0,e[D]=1,e[_]=0,e[N]=0,e[H]=0,e[j]=0,e[U]=1,e[W]=0,e[Q]=0,e[$]=0,e[ee]=0,e[J]=1,this}invert(){let e=this.values,s=this.temp,i=e[Q]*e[j]*e[_]*e[V]-e[H]*e[$]*e[_]*e[V]-e[Q]*e[D]*e[U]*e[V]+e[q]*e[$]*e[U]*e[V]+e[H]*e[D]*e[ee]*e[V]-e[q]*e[j]*e[ee]*e[V]-e[Q]*e[j]*e[z]*e[N]+e[H]*e[$]*e[z]*e[N]+e[Q]*e[G]*e[U]*e[N]-e[O]*e[$]*e[U]*e[N]-e[H]*e[G]*e[ee]*e[N]+e[O]*e[j]*e[ee]*e[N]+e[Q]*e[D]*e[z]*e[W]-e[q]*e[$]*e[z]*e[W]-e[Q]*e[G]*e[_]*e[W]+e[O]*e[$]*e[_]*e[W]+e[q]*e[G]*e[ee]*e[W]-e[O]*e[D]*e[ee]*e[W]-e[H]*e[D]*e[z]*e[J]+e[q]*e[j]*e[z]*e[J]+e[H]*e[G]*e[_]*e[J]-e[O]*e[j]*e[_]*e[J]-e[q]*e[G]*e[U]*e[J]+e[O]*e[D]*e[U]*e[J];if(i==0)throw new Error("non-invertible matrix");let r=1/i;return s[O]=e[_]*e[W]*e[$]-e[N]*e[U]*e[$]+e[N]*e[j]*e[ee]-e[D]*e[W]*e[ee]-e[_]*e[j]*e[J]+e[D]*e[U]*e[J],s[G]=e[V]*e[U]*e[$]-e[z]*e[W]*e[$]-e[V]*e[j]*e[ee]+e[G]*e[W]*e[ee]+e[z]*e[j]*e[J]-e[G]*e[U]*e[J],s[z]=e[z]*e[N]*e[$]-e[V]*e[_]*e[$]+e[V]*e[D]*e[ee]-e[G]*e[N]*e[ee]-e[z]*e[D]*e[J]+e[G]*e[_]*e[J],s[V]=e[V]*e[_]*e[j]-e[z]*e[N]*e[j]-e[V]*e[D]*e[U]+e[G]*e[N]*e[U]+e[z]*e[D]*e[W]-e[G]*e[_]*e[W],s[q]=e[N]*e[U]*e[Q]-e[_]*e[W]*e[Q]-e[N]*e[H]*e[ee]+e[q]*e[W]*e[ee]+e[_]*e[H]*e[J]-e[q]*e[U]*e[J],s[D]=e[z]*e[W]*e[Q]-e[V]*e[U]*e[Q]+e[V]*e[H]*e[ee]-e[O]*e[W]*e[ee]-e[z]*e[H]*e[J]+e[O]*e[U]*e[J],s[_]=e[V]*e[_]*e[Q]-e[z]*e[N]*e[Q]-e[V]*e[q]*e[ee]+e[O]*e[N]*e[ee]+e[z]*e[q]*e[J]-e[O]*e[_]*e[J],s[N]=e[z]*e[N]*e[H]-e[V]*e[_]*e[H]+e[V]*e[q]*e[U]-e[O]*e[N]*e[U]-e[z]*e[q]*e[W]+e[O]*e[_]*e[W],s[H]=e[D]*e[W]*e[Q]-e[N]*e[j]*e[Q]+e[N]*e[H]*e[$]-e[q]*e[W]*e[$]-e[D]*e[H]*e[J]+e[q]*e[j]*e[J],s[j]=e[V]*e[j]*e[Q]-e[G]*e[W]*e[Q]-e[V]*e[H]*e[$]+e[O]*e[W]*e[$]+e[G]*e[H]*e[J]-e[O]*e[j]*e[J],s[U]=e[G]*e[N]*e[Q]-e[V]*e[D]*e[Q]+e[V]*e[q]*e[$]-e[O]*e[N]*e[$]-e[G]*e[q]*e[J]+e[O]*e[D]*e[J],s[W]=e[V]*e[D]*e[H]-e[G]*e[N]*e[H]-e[V]*e[q]*e[j]+e[O]*e[N]*e[j]+e[G]*e[q]*e[W]-e[O]*e[D]*e[W],s[Q]=e[_]*e[j]*e[Q]-e[D]*e[U]*e[Q]-e[_]*e[H]*e[$]+e[q]*e[U]*e[$]+e[D]*e[H]*e[ee]-e[q]*e[j]*e[ee],s[$]=e[G]*e[U]*e[Q]-e[z]*e[j]*e[Q]+e[z]*e[H]*e[$]-e[O]*e[U]*e[$]-e[G]*e[H]*e[ee]+e[O]*e[j]*e[ee],s[ee]=e[z]*e[D]*e[Q]-e[G]*e[_]*e[Q]-e[z]*e[q]*e[$]+e[O]*e[_]*e[$]+e[G]*e[q]*e[ee]-e[O]*e[D]*e[ee],s[J]=e[G]*e[_]*e[H]-e[z]*e[D]*e[H]+e[z]*e[q]*e[j]-e[O]*e[_]*e[j]-e[G]*e[q]*e[U]+e[O]*e[D]*e[U],e[O]=s[O]*r,e[G]=s[G]*r,e[z]=s[z]*r,e[V]=s[V]*r,e[q]=s[q]*r,e[D]=s[D]*r,e[_]=s[_]*r,e[N]=s[N]*r,e[H]=s[H]*r,e[j]=s[j]*r,e[U]=s[U]*r,e[W]=s[W]*r,e[Q]=s[Q]*r,e[$]=s[$]*r,e[ee]=s[ee]*r,e[J]=s[J]*r,this}determinant(){let e=this.values;return e[Q]*e[j]*e[_]*e[V]-e[H]*e[$]*e[_]*e[V]-e[Q]*e[D]*e[U]*e[V]+e[q]*e[$]*e[U]*e[V]+e[H]*e[D]*e[ee]*e[V]-e[q]*e[j]*e[ee]*e[V]-e[Q]*e[j]*e[z]*e[N]+e[H]*e[$]*e[z]*e[N]+e[Q]*e[G]*e[U]*e[N]-e[O]*e[$]*e[U]*e[N]-e[H]*e[G]*e[ee]*e[N]+e[O]*e[j]*e[ee]*e[N]+e[Q]*e[D]*e[z]*e[W]-e[q]*e[$]*e[z]*e[W]-e[Q]*e[G]*e[_]*e[W]+e[O]*e[$]*e[_]*e[W]+e[q]*e[G]*e[ee]*e[W]-e[O]*e[D]*e[ee]*e[W]-e[H]*e[D]*e[z]*e[J]+e[q]*e[j]*e[z]*e[J]+e[H]*e[G]*e[_]*e[J]-e[O]*e[j]*e[_]*e[J]-e[q]*e[G]*e[U]*e[J]+e[O]*e[D]*e[U]*e[J]}translate(e,s,i){let r=this.values;return r[V]+=e,r[N]+=s,r[W]+=i,this}copy(){return new Ye().set(this.values)}projection(e,s,i,r){this.identity();let h=1/Math.tan(i*(Math.PI/180)/2),l=(s+e)/(e-s),n=2*s*e/(e-s),a=this.values;return a[O]=h/r,a[q]=0,a[H]=0,a[Q]=0,a[G]=0,a[D]=h,a[j]=0,a[$]=0,a[z]=0,a[_]=0,a[U]=l,a[ee]=-1,a[V]=0,a[N]=0,a[W]=n,a[J]=0,this}ortho2d(e,s,i,r){return this.ortho(e,e+i,s,s+r,0,1)}ortho(e,s,i,r,h,l){this.identity();let n=2/(s-e),a=2/(r-i),o=-2/(l-h),c=-(s+e)/(s-e),d=-(r+i)/(r-i),u=-(l+h)/(l-h),m=this.values;return m[O]=n,m[q]=0,m[H]=0,m[Q]=0,m[G]=0,m[D]=a,m[j]=0,m[$]=0,m[z]=0,m[_]=0,m[U]=o,m[ee]=0,m[V]=c,m[N]=d,m[W]=u,m[J]=1,this}multiply(e){let s=this.temp,i=this.values,r=e.values;return s[O]=i[O]*r[O]+i[G]*r[q]+i[z]*r[H]+i[V]*r[Q],s[G]=i[O]*r[G]+i[G]*r[D]+i[z]*r[j]+i[V]*r[$],s[z]=i[O]*r[z]+i[G]*r[_]+i[z]*r[U]+i[V]*r[ee],s[V]=i[O]*r[V]+i[G]*r[N]+i[z]*r[W]+i[V]*r[J],s[q]=i[q]*r[O]+i[D]*r[q]+i[_]*r[H]+i[N]*r[Q],s[D]=i[q]*r[G]+i[D]*r[D]+i[_]*r[j]+i[N]*r[$],s[_]=i[q]*r[z]+i[D]*r[_]+i[_]*r[U]+i[N]*r[ee],s[N]=i[q]*r[V]+i[D]*r[N]+i[_]*r[W]+i[N]*r[J],s[H]=i[H]*r[O]+i[j]*r[q]+i[U]*r[H]+i[W]*r[Q],s[j]=i[H]*r[G]+i[j]*r[D]+i[U]*r[j]+i[W]*r[$],s[U]=i[H]*r[z]+i[j]*r[_]+i[U]*r[U]+i[W]*r[ee],s[W]=i[H]*r[V]+i[j]*r[N]+i[U]*r[W]+i[W]*r[J],s[Q]=i[Q]*r[O]+i[$]*r[q]+i[ee]*r[H]+i[J]*r[Q],s[$]=i[Q]*r[G]+i[$]*r[D]+i[ee]*r[j]+i[J]*r[$],s[ee]=i[Q]*r[z]+i[$]*r[_]+i[ee]*r[U]+i[J]*r[ee],s[J]=i[Q]*r[V]+i[$]*r[N]+i[ee]*r[W]+i[J]*r[J],this.set(this.temp)}multiplyLeft(e){let s=this.temp,i=this.values,r=e.values;return s[O]=r[O]*i[O]+r[G]*i[q]+r[z]*i[H]+r[V]*i[Q],s[G]=r[O]*i[G]+r[G]*i[D]+r[z]*i[j]+r[V]*i[$],s[z]=r[O]*i[z]+r[G]*i[_]+r[z]*i[U]+r[V]*i[ee],s[V]=r[O]*i[V]+r[G]*i[N]+r[z]*i[W]+r[V]*i[J],s[q]=r[q]*i[O]+r[D]*i[q]+r[_]*i[H]+r[N]*i[Q],s[D]=r[q]*i[G]+r[D]*i[D]+r[_]*i[j]+r[N]*i[$],s[_]=r[q]*i[z]+r[D]*i[_]+r[_]*i[U]+r[N]*i[ee],s[N]=r[q]*i[V]+r[D]*i[N]+r[_]*i[W]+r[N]*i[J],s[H]=r[H]*i[O]+r[j]*i[q]+r[U]*i[H]+r[W]*i[Q],s[j]=r[H]*i[G]+r[j]*i[D]+r[U]*i[j]+r[W]*i[$],s[U]=r[H]*i[z]+r[j]*i[_]+r[U]*i[U]+r[W]*i[ee],s[W]=r[H]*i[V]+r[j]*i[N]+r[U]*i[W]+r[W]*i[J],s[Q]=r[Q]*i[O]+r[$]*i[q]+r[ee]*i[H]+r[J]*i[Q],s[$]=r[Q]*i[G]+r[$]*i[D]+r[ee]*i[j]+r[J]*i[$],s[ee]=r[Q]*i[z]+r[$]*i[_]+r[ee]*i[U]+r[J]*i[ee],s[J]=r[Q]*i[V]+r[$]*i[N]+r[ee]*i[W]+r[J]*i[J],this.set(this.temp)}lookAt(e,s,i){let r=Ye.xAxis,h=Ye.yAxis,l=Ye.zAxis;l.setFrom(s).normalize(),r.setFrom(s).normalize(),r.cross(i).normalize(),h.setFrom(r).cross(l).normalize(),this.identity();let n=this.values;return n[O]=r.x,n[G]=r.y,n[z]=r.z,n[q]=h.x,n[D]=h.y,n[_]=h.z,n[H]=-l.x,n[j]=-l.y,n[U]=-l.z,Ye.tmpMatrix.identity(),Ye.tmpMatrix.values[V]=-e.x,Ye.tmpMatrix.values[N]=-e.y,Ye.tmpMatrix.values[W]=-e.z,this.multiply(Ye.tmpMatrix),this}},Xi=class{position=new Se(0,0,0);direction=new Se(0,0,-1);up=new Se(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new lt;inverseProjectionView=new lt;projection=new lt;view=new lt;constructor(t,e){this.viewportWidth=t,this.viewportHeight=e,this.update()}update(){let t=this.projection,e=this.view,s=this.projectionView,i=this.inverseProjectionView,r=this.zoom,h=this.viewportWidth,l=this.viewportHeight;t.ortho(r*(-h/2),r*(h/2),r*(-l/2),r*(l/2),this.near,this.far),e.lookAt(this.position,this.direction,this.up),s.set(t.values),s.multiply(e),i.set(s.values).invert()}screenToWorld(t,e,s){let i=t.x,r=s-t.y-1;return t.x=2*i/e-1,t.y=2*r/s-1,t.z=2*t.z-1,t.project(this.inverseProjectionView),t}worldToScreen(t,e,s){return t.project(this.projectionView),t.x=e*(t.x+1)/2,t.y=s*(t.y+1)/2,t.z=(t.z+1)/2,t}setViewport(t,e){this.viewportWidth=t,this.viewportHeight=e}},Ds=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;autoPreventDefault;isTouch=!1;callbacks;constructor(t,e=!0){this.element=t,this.autoPreventDefault=e,this.callbacks=this.setupCallbacks(t)}setupCallbacks(t){const e=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,a)})}},s=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,a):c.moved&&c.moved(this.mouseX,this.mouseY,a)})}},i=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,a)})}},r=a=>{this.autoPreventDefault&&a.preventDefault();let o=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(o*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(o*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a.deltaY,a)})},h=a=>{if(this.isTouch=!0,!this.touch0||!this.touch1){var o=a.changedTouches;let c=o.item(0);if(!c)return;let d=t.getBoundingClientRect(),u=c.clientX-d.left,m=c.clientY-d.top,f=new Bi(c.identifier,u,m);if(this.mouseX=u,this.mouseY=m,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(g=>{g.down&&g.down(f.x,f.y,a)});else if(!this.touch1){this.touch1=f;let g=this.touch1.x-this.touch0.x,x=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(g*g+x*x),this.listeners.map(b=>{b.zoom&&b.zoom(this.initialPinchDistance,this.initialPinchDistance,a)})}}this.autoPreventDefault&&a.preventDefault()},l=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let u=t.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-u.left,f=d.clientY-u.top;this.touch0.identifier===d.identifier&&(this.touch0.x=this.mouseX=m,this.touch0.y=this.mouseY=f,this.listeners.map(g=>{g.dragged&&g.dragged(m,f,a)})),this.touch1&&this.touch1.identifier===d.identifier&&(this.touch1.x=this.mouseX=m,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let m=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,g=Math.sqrt(m*m+f*f);this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,g,a)})}}this.autoPreventDefault&&a.preventDefault()},n=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let u=t.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-u.left,f=d.clientY-u.top;if(this.touch0.identifier===d.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=f,this.listeners.map(g=>{g.up&&g.up(m,f,a)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(g=>{g.down&&g.down(this.touch0.x,this.touch0.y,a)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}this.autoPreventDefault&&a.preventDefault()};return t.addEventListener("mousedown",e,!0),t.addEventListener("mousemove",s,!0),t.addEventListener("mouseup",i,!0),t.addEventListener("wheel",r,!0),t.addEventListener("touchstart",h,{passive:!1,capture:!1}),t.addEventListener("touchmove",l,{passive:!1,capture:!1}),t.addEventListener("touchend",n,{passive:!1,capture:!1}),t.addEventListener("touchcancel",n),{mouseDown:e,mouseMove:s,mouseUp:i,mouseWheel:r,touchStart:h,touchMove:l,touchEnd:n}}dispose(){const t=this.element;t.removeEventListener("mousedown",this.callbacks.mouseDown,!0),t.removeEventListener("mousemove",this.callbacks.mouseMove,!0),t.removeEventListener("mouseup",this.callbacks.mouseUp,!0),t.removeEventListener("wheel",this.callbacks.mouseWheel,!0),t.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),t.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),t.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),t.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(t){this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},Bi=class{constructor(t,e,s){this.identifier=t,this.x=e,this.y=s}},Sn=class{constructor(t,e){this.canvas=t,this.camera=e;let s=0,i=0,r=0,h=0,l=0,n=0,a=0,o=0;new Ds(t).addListener({down:(c,d)=>{s=e.position.x,i=e.position.y,h=n=c,l=a=d,o=e.zoom},dragged:(c,d)=>{let u=c-h,m=d-l,f=e.screenToWorld(new Se(0,0),t.clientWidth,t.clientHeight),g=e.screenToWorld(new Se(u,m),t.clientWidth,t.clientHeight).sub(f);e.position.set(s-g.x,i-g.y,0),e.update(),n=c,a=d},wheel:c=>{let d=c/200*e.zoom,u=e.zoom+d;if(u>0){let m=0,f=0;if(c<0)m=n,f=a;else{let b=new Se(t.clientWidth/2+15,t.clientHeight/2),p=n-b.x,w=t.clientHeight-1-a-b.y;m=b.x-p,f=t.clientHeight-1-b.y+w}let g=e.screenToWorld(new Se(m,f),t.clientWidth,t.clientHeight);e.zoom=u,e.update();let x=e.screenToWorld(new Se(m,f),t.clientWidth,t.clientHeight);e.position.add(g.sub(x)),e.update()}},zoom:(c,d)=>{let u=c/d;e.zoom=o*u},up:(c,d)=>{n=c,a=d},moved:(c,d)=>{n=c,a=d}})}},Me=class ue{constructor(e,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=e instanceof xe?e:new xe(e),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let e=this.context.gl;try{if(this.vs=this.compileShader(e.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(e.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(s){throw this.dispose(),s}}compileShader(e,s){let i=this.context.gl,r=i.createShader(e);if(!r)throw new Error("Couldn't create shader.");if(i.shaderSource(r,s),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS)){let h="Couldn't compile shader: "+i.getShaderInfoLog(r);if(i.deleteShader(r),!i.isContextLost())throw new Error(h)}return r}compileProgram(e,s){let i=this.context.gl,r=i.createProgram();if(!r)throw new Error("Couldn't compile program.");if(i.attachShader(r,e),i.attachShader(r,s),i.linkProgram(r),!i.getProgramParameter(r,i.LINK_STATUS)){let h="Couldn't compile shader program: "+i.getProgramInfoLog(r);if(i.deleteProgram(r),!i.isContextLost())throw new Error(h)}return r}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,s){this.context.gl.uniform1i(this.getUniformLocation(e),s)}setUniformf(e,s){this.context.gl.uniform1f(this.getUniformLocation(e),s)}setUniform2f(e,s,i){this.context.gl.uniform2f(this.getUniformLocation(e),s,i)}setUniform3f(e,s,i,r){this.context.gl.uniform3f(this.getUniformLocation(e),s,i,r)}setUniform4f(e,s,i,r,h){this.context.gl.uniform4f(this.getUniformLocation(e),s,i,r,h)}setUniform2x2f(e,s){let i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,s){let i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,s){let i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getUniformLocation(this.program,e);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return i}getAttributeLocation(e){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getAttribLocation(this.program,e);if(i==-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return i}dispose(){this.context.removeRestorable(this);let e=this.context.gl;this.vs&&(e.deleteShader(this.vs),this.vs=null),this.fs&&(e.deleteShader(this.fs),this.fs=null),this.program&&(e.deleteProgram(this.program),this.program=null)}static newColoredTextured(e){let s=`
1
+ "use strict";var spine=(()=>{var Sr=Object.create,ct=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,Ir=Object.getOwnPropertyNames,Mr=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty,Rr=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),kr=(t,e)=>{for(var s in e)ct(t,s,{get:e[s],enumerable:!0})},si=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ir(e))!Er.call(t,r)&&r!==s&&ct(t,r,{get:()=>e[r],enumerable:!(i=Tr(e,r))||i.enumerable});return t},Yr=(t,e,s)=>(s=t!=null?Sr(Mr(t)):{},si(e||!t||!t.__esModule?ct(s,"default",{value:t,enumerable:!0}):s,t)),Fr=t=>si(ct({},"__esModule",{value:!0}),t),ii={};if(kr(ii,{AABBRectangleBoundsProvider:()=>Vn,Alpha:()=>$i,AlphaMixin:()=>lr,AlphaTimeline:()=>Kt,Animation:()=>dt,AnimationState:()=>gs,AnimationStateAdapter:()=>Or,AnimationStateData:()=>pi,AssetCache:()=>Ai,AssetManager:()=>Li,AssetManagerBase:()=>yi,AtlasAttachmentLoader:()=>ys,Attachment:()=>Vt,AttachmentTimeline:()=>We,BinaryInput:()=>ki,BlendMode:()=>Xs,Bone:()=>Cs,BoneData:()=>As,BoundingBoxAttachment:()=>bs,CURRENT:()=>gi,CameraController:()=>Sn,ClippingAttachment:()=>rt,Color:()=>K,Color2Attribute:()=>Oi,ColorAttribute:()=>At,ComputedSize:()=>_i,ComputedSizeMixin:()=>er,ConstraintData:()=>nt,CurveTimeline:()=>Te,CurveTimeline1:()=>Ce,CurveTimeline2:()=>ut,DebugUtils:()=>Xr,DeformTimeline:()=>es,Depth:()=>Hi,DepthMixin:()=>tr,Downloader:()=>Ss,DrawOrderTimeline:()=>je,Event:()=>Ts,EventData:()=>Is,EventQueue:()=>ui,EventTimeline:()=>ft,EventType:()=>fi,FIRST:()=>ps,FakeTexture:()=>Vr,Flip:()=>ji,FlipMixin:()=>sr,GLTexture:()=>ze,HOLD_FIRST:()=>gt,HOLD_MIX:()=>mi,HOLD_SUBSEQUENT:()=>xs,IkConstraint:()=>Ci,IkConstraintData:()=>Ms,IkConstraintTimeline:()=>ts,Inherit:()=>bt,InheritTimeline:()=>jt,Input:()=>Ds,IntSet:()=>Pr,Interpolation:()=>ri,LoadingScreen:()=>Rn,M00:()=>O,M01:()=>G,M02:()=>z,M03:()=>V,M10:()=>q,M11:()=>D,M12:()=>_,M13:()=>N,M20:()=>H,M21:()=>j,M22:()=>U,M23:()=>W,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>xe,MathUtils:()=>L,Matrix4:()=>lt,Mesh:()=>Ns,MeshAttachment:()=>Ge,MixBlend:()=>hi,MixDirection:()=>ci,Origin:()=>Qi,OriginMixin:()=>ar,OrthoCamera:()=>Xi,PathAttachment:()=>Ze,PathConstraint:()=>Si,PathConstraintData:()=>Es,PathConstraintMixTimeline:()=>ns,PathConstraintPositionTimeline:()=>is,PathConstraintSpacingTimeline:()=>rs,Physics:()=>Mi,PhysicsConstraintDampingTimeline:()=>os,PhysicsConstraintGravityTimeline:()=>ds,PhysicsConstraintInertiaTimeline:()=>as,PhysicsConstraintMassTimeline:()=>hs,PhysicsConstraintMixTimeline:()=>us,PhysicsConstraintResetTimeline:()=>fs,PhysicsConstraintStrengthTimeline:()=>ls,PhysicsConstraintTimeline:()=>Oe,PhysicsConstraintWindTimeline:()=>cs,PointAttachment:()=>vi,PolygonBatcher:()=>Ws,Pool:()=>st,Position2Attribute:()=>yt,Position3Attribute:()=>Tn,PositionMode:()=>Rs,Pow:()=>ni,PowOut:()=>Lr,RGB2Timeline:()=>$t,RGBA2Timeline:()=>Qt,RGBATimeline:()=>Zt,RGBTimeline:()=>Jt,RegionAttachment:()=>ce,ResizeMode:()=>qi,RotateMode:()=>Ys,RotateTimeline:()=>it,SETUP:()=>ws,SUBSEQUENT:()=>mt,ScaleTimeline:()=>Wt,ScaleXTimeline:()=>Gt,ScaleYTimeline:()=>zt,SceneRenderer:()=>zs,ScrollFactor:()=>Zi,ScrollFactorMixin:()=>ir,SequenceTimeline:()=>ms,SetupPoseBoundsProvider:()=>or,Shader:()=>Me,ShapeRenderer:()=>Gs,ShapeType:()=>Wi,ShearTimeline:()=>qt,ShearXTimeline:()=>_t,ShearYTimeline:()=>Ht,Skeleton:()=>Je,SkeletonBinary:()=>Ri,SkeletonBounds:()=>Yi,SkeletonClipping:()=>vt,SkeletonData:()=>Fs,SkeletonDebugRenderer:()=>Gi,SkeletonJson:()=>Pi,SkeletonRenderer:()=>zi,Skin:()=>at,SkinEntry:()=>Ps,SkinsAndAnimationBoundsProvider:()=>Dn,Slot:()=>Ti,SlotData:()=>Ls,SpacingMode:()=>ks,SpineCanvas:()=>Fn,SpineGameObject:()=>js,SpinePlugin:()=>Zs,StringSet:()=>Bt,TexCoordAttribute:()=>Us,Texture:()=>pt,TextureAtlas:()=>wt,TextureAtlasPage:()=>bi,TextureAtlasRegion:()=>vs,TextureFilter:()=>xt,TextureRegion:()=>wi,TextureWrap:()=>xi,TimeKeeper:()=>Ot,Timeline:()=>fe,Touch:()=>Bi,TrackEntry:()=>di,Transform:()=>Ji,TransformConstraint:()=>Ii,TransformConstraintData:()=>Bs,TransformConstraintTimeline:()=>ss,TransformMixin:()=>rr,TranslateTimeline:()=>Dt,TranslateXTimeline:()=>Nt,TranslateYTimeline:()=>Ut,Triangulator:()=>Fi,Utils:()=>X,Vector2:()=>Ue,Vector3:()=>Se,VertexAttachment:()=>Fe,VertexAttribute:()=>Ke,VertexAttributeType:()=>Vi,Visible:()=>Ki,VisibleMixin:()=>nr,WindowedMean:()=>Br,createMixin:()=>Be}),typeof window<"u"&&window.Phaser){let t=window.require;window.require=e=>{if(t)return t(e);if(e==="Phaser")return window.Phaser}}var Pr=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Bt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},K=class _e{constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}static WHITE=new _e(1,1,1,1);static RED=new _e(1,0,0,1);static GREEN=new _e(0,1,0,1);static BLUE=new _e(0,0,1,1);static MAGENTA=new _e(1,0,1,1);set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new _e){return s.setFromString(e)}},L=class ke{static PI=3.1415927;static PI2=ke.PI*2;static invPI2=1/ke.PI2;static radiansToDegrees=180/ke.PI;static radDeg=ke.radiansToDegrees;static degreesToRadians=ke.PI/180;static degRad=ke.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*ke.degRad)}static sinDeg(e){return Math.sin(e*ke.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ke.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return ke.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),h=s-e;return r<=(i-e)/h?e+Math.sqrt(r*h*(i-e)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},ri=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},ni=class extends ri{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Lr=class extends ni{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},X=class tt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,h){for(let l=s,n=r;l<s+h;l++,n++)i[n]=e[l]}static arrayFill(e,s,i,r){for(let h=s;h<i;h++)e[h]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let h=r;h<s;h++)e[h]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:tt.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(tt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(tt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return tt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return tt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},Xr=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},st=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Ue=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Ot=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Br=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Vt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},Fe=class mr extends Vt{static nextID=0;id=mr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,h,l){i=h+(i>>1)*l;let n=e.bone.skeleton,a=e.deform,o=this.vertices,c=this.bones;if(!c){a.length>0&&(o=a);let f=e.bone,g=f.worldX,x=f.worldY,b=f.a,p=f.b,w=f.c,v=f.d;for(let y=s,A=h;A<i;y+=2,A+=l){let C=o[y],S=o[y+1];r[A]=C*b+S*p+g,r[A+1]=C*w+S*v+x}return}let d=0,u=0;for(let f=0;f<s;f+=2){let g=c[d];d+=g+1,u+=g}let m=n.bones;if(a.length==0)for(let f=h,g=u*3;f<i;f+=l){let x=0,b=0,p=c[d++];for(p+=d;d<p;d++,g+=3){let w=m[c[d]],v=o[g],y=o[g+1],A=o[g+2];x+=(v*w.a+y*w.b+w.worldX)*A,b+=(v*w.c+y*w.d+w.worldY)*A}r[f]=x,r[f+1]=b}else{let f=a;for(let g=h,x=u*3,b=u<<1;g<i;g+=l){let p=0,w=0,v=c[d++];for(v+=d;d<v;d++,x+=3,b+=2){let y=m[c[d]],A=o[x]+f[b],C=o[x+1]+f[b+1],S=o[x+2];p+=(A*y.a+C*y.b+y.worldX)*S,w+=(A*y.c+C*y.d+y.worldY)*S}r[g]=p,r[g+1]=w}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),X.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=X.newFloatArray(this.vertices.length),X.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},ai=class kt{static _nextID=0;id=kt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new kt(this.regions.length);return X.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return kt._nextID++}},li=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(li||{}),oi=[0,1,2,3,4,5,6],dt=class{name;timelines=[];timelineIds=new Bt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,h,l,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let o=0,c=a.length;o<c;o++)a[o].apply(t,e,s,r,h,l,n)}},hi=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(hi||{}),ci=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(ci||{}),ie={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},fe=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=X.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},Te=class extends fe{curves;constructor(t,e,s){super(t,s),this.curves=X.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=X.newFloatArray(e);X.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,h,l,n,a,o,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-h*2+n)*.03,f=(r-l*2+a)*.03,g=((h-n)*3-i+o)*.006,x=((l-a)*3-r+c)*.006,b=m*2+g,p=f*2+x,w=(h-i)*.3+m+g*.16666667,v=(l-r)*.3+f+x*.16666667,y=i+w,A=r+v;for(let C=u+18;u<C;u+=2)d[u]=y,d[u+1]=A,w+=b,v+=p,b+=g,p+=x,y+=w,A+=v}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],o=this.frames[e+s];return o+(t-a)/(r[i]-a)*(r[i+1]-o)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=t){let a=r[i-2],o=r[i-1];return o+(t-a)/(r[i]-a)*(r[i+1]-o)}e+=this.getFrameEntries();let l=r[h-2],n=r[h-1];return n+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-n)}},Ce=class extends Te{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],h=e[s+1];return h+(t-r)/(e[s+2]-r)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);switch(s){case 0:return r+h*e;case 1:case 2:h+=r-i}return i+h*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}let h=this.getCurveValue(t);return s==0?r+(h-r)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,r,h){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*e}return i}return s==0?r+(h-r)*e:i+(h-i)*e}getScaleValue(t,e,s,i,r,h){const l=this.frames;if(t<l[0]){switch(s){case 0:return h;case 1:return r+(h-r)*e}return r}let n=this.getCurveValue(t)*h;if(e==1)return s==3?r+n-h:n;if(i==1)switch(s){case 0:return h+(Math.abs(n)*L.signum(h)-h)*e;case 1:case 2:return r+(Math.abs(n)*L.signum(r)-r)*e}else{let a=0;switch(s){case 0:return a=Math.abs(h)*L.signum(n),a+(n-a)*e;case 1:case 2:return a=Math.abs(r)*L.signum(n),a+(n-a)*e}}return r+(n-h)*e}},ut=class extends Te{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},it=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,h,n.rotation,n.data.rotation))}},Dt=class extends ut{boneIndex=0;constructor(t,e,s){super(t,e,ie.x+"|"+s,ie.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let o=0,c=0,d=fe.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*f,c+=(a[d+3+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.x=n.data.x+o*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+o-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=o*r,n.y+=c*r}}},Nt=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,h,n.x,n.data.x))}},Ut=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,h,n.y,n.data.y))}},Wt=class extends ut{boneIndex=0;constructor(t,e,s){super(t,e,ie.scaleX+"|"+s,ie.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let o,c,d=fe.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*f,c+=(a[d+3+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(o*=n.data.scaleX,c*=n.data.scaleY,r==1)h==3?(n.scaleX+=o-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=o,n.scaleY=c);else{let m=0,f=0;if(l==1)switch(h){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(o)*L.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*L.signum(f)-f)*r;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(o)*L.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*L.signum(f)-f)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(h){case 0:m=Math.abs(n.data.scaleX)*L.signum(o),f=Math.abs(n.data.scaleY)*L.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=f+(c-f)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*L.signum(o),f=Math.abs(n.scaleY)*L.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=f+(c-f)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Gt=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,h,l,n.scaleX,n.data.scaleX))}},zt=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,h,l,n.scaleY,n.data.scaleY))}},qt=class extends ut{boneIndex=0;constructor(t,e,s){super(t,e,ie.shearX+"|"+s,ie.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let o=0,c=0,d=fe.search(a,s,3),u=this.curves[d/3];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*f,c+=(a[d+3+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case 0:n.shearX=n.data.shearX+o*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+o-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=o*r,n.shearY+=c*r}}},_t=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,h,n.shearX,n.data.shearX))}},Ht=class extends Ce{boneIndex=0;constructor(t,e,s){super(t,e,ie.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,h,n.shearY,n.data.shearY))}},jt=class extends fe{boneIndex=0;constructor(t,e){super(t,[ie.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;if(l==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[fe.search(a,s,2)+1]}},Zt=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s,ie.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let x=n.data.color;switch(h){case 0:o.setFromColor(x);return;case 1:o.add((x.r-o.r)*r,(x.g-o.g)*r,(x.b-o.b)*r,(x.a-o.a)*r)}return}let c=0,d=0,u=0,m=0,f=fe.search(a,s,5),g=this.curves[f/5];switch(g){case 0:let x=a[f];c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];let b=(s-x)/(a[f+5]-x);c+=(a[f+5+1]-c)*b,d+=(a[f+5+2]-d)*b,u+=(a[f+5+3]-u)*b,m+=(a[f+5+4]-m)*b;break;case 1:c=a[f+1],d=a[f+2],u=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+18*2-2),m=this.getBezierValue(s,f,4,g+18*3-2)}r==1?o.set(c,d,u,m):(h==0&&o.setFromColor(n.data.color),o.add((c-o.r)*r,(d-o.g)*r,(u-o.b)*r,(m-o.a)*r))}},Jt=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let g=n.data.color;switch(h){case 0:o.r=g.r,o.g=g.g,o.b=g.b;return;case 1:o.r+=(g.r-o.r)*r,o.g+=(g.g-o.g)*r,o.b+=(g.b-o.b)*r}return}let c=0,d=0,u=0,m=fe.search(a,s,4),f=this.curves[m>>2];switch(f){case 0:let g=a[m];c=a[m+1],d=a[m+2],u=a[m+3];let x=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*x,d+=(a[m+4+2]-d)*x,u+=(a[m+4+3]-u)*x;break;case 1:c=a[m+1],d=a[m+2],u=a[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+18*2-2)}if(r==1)o.r=c,o.g=d,o.b=u;else{if(h==0){let g=n.data.color;o.r=g.r,o.g=g.g,o.b=g.b}o.r+=(c-o.r)*r,o.g+=(d-o.g)*r,o.b+=(u-o.b)*r}}},Kt=class extends Ce{slotIndex=0;constructor(t,e,s){super(t,e,ie.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let o=this.getCurveValue(s);r==1?a.a=o:(h==0&&(a.a=n.data.color.a),a.a+=(o-a.a)*r)}},Qt=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s,ie.alpha+"|"+s,ie.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,h,l,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(s<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.add((v.r-o.r)*r,(v.g-o.g)*r,(v.b-o.b)*r,(v.a-o.a)*r),c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,x=0,b=0,p=fe.search(a,s,8),w=this.curves[p>>3];switch(w){case 0:let v=a[p];d=a[p+1],u=a[p+2],m=a[p+3],f=a[p+4],g=a[p+5],x=a[p+6],b=a[p+7];let y=(s-v)/(a[p+8]-v);d+=(a[p+8+1]-d)*y,u+=(a[p+8+2]-u)*y,m+=(a[p+8+3]-m)*y,f+=(a[p+8+4]-f)*y,g+=(a[p+8+5]-g)*y,x+=(a[p+8+6]-x)*y,b+=(a[p+8+7]-b)*y;break;case 1:d=a[p+1],u=a[p+2],m=a[p+3],f=a[p+4],g=a[p+5],x=a[p+6],b=a[p+7];break;default:d=this.getBezierValue(s,p,1,w-2),u=this.getBezierValue(s,p,2,w+18-2),m=this.getBezierValue(s,p,3,w+18*2-2),f=this.getBezierValue(s,p,4,w+18*3-2),g=this.getBezierValue(s,p,5,w+18*4-2),x=this.getBezierValue(s,p,6,w+18*5-2),b=this.getBezierValue(s,p,7,w+18*6-2)}if(r==1)o.set(d,u,m,f),c.r=g,c.g=x,c.b=b;else{if(h==0){o.setFromColor(n.data.color);let v=n.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}o.add((d-o.r)*r,(u-o.g)*r,(m-o.b)*r,(f-o.a)*r),c.r+=(g-c.r)*r,c.g+=(x-c.g)*r,c.b+=(b-c.b)*r}}},$t=class extends Te{slotIndex=0;constructor(t,e,s){super(t,e,[ie.rgb+"|"+s,ie.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,l,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=n}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(s<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.r+=(v.r-o.r)*r,o.g+=(v.g-o.g)*r,o.b+=(v.b-o.b)*r,c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,x=0,b=0,p=fe.search(a,s,7),w=this.curves[p/7];switch(w){case 0:let v=a[p];d=a[p+1],u=a[p+2],m=a[p+3],g=a[p+4],x=a[p+5],b=a[p+6];let y=(s-v)/(a[p+7]-v);d+=(a[p+7+1]-d)*y,u+=(a[p+7+2]-u)*y,m+=(a[p+7+3]-m)*y,g+=(a[p+7+4]-g)*y,x+=(a[p+7+5]-x)*y,b+=(a[p+7+6]-b)*y;break;case 1:d=a[p+1],u=a[p+2],m=a[p+3],g=a[p+4],x=a[p+5],b=a[p+6];break;default:d=this.getBezierValue(s,p,1,w-2),u=this.getBezierValue(s,p,2,w+18-2),m=this.getBezierValue(s,p,3,w+18*2-2),g=this.getBezierValue(s,p,4,w+18*3-2),x=this.getBezierValue(s,p,5,w+18*4-2),b=this.getBezierValue(s,p,6,w+18*5-2)}if(r==1)o.r=d,o.g=u,o.b=m,c.r=g,c.g=x,c.b=b;else{if(h==0){let v=n.data.color,y=n.data.darkColor;o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}o.r+=(d-o.r)*r,o.g+=(u-o.g)*r,o.b+=(m-o.b)*r,c.r+=(g-c.r)*r,c.g+=(x-c.g)*r,c.b+=(b-c.b)*r}}},We=class extends fe{slotIndex=0;attachmentNames;constructor(t,e){super(t,[ie.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(n.bone.active){if(l==1){h==0&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[fe.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},es=class extends Te{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[ie.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,h,l,n,a,o,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let m=(i-h*2+n)*.03,f=a*.03-l*.06,g=((h-n)*3-i+o)*.006,x=(l-a+.33333333)*.018,b=m*2+g,p=f*2+x,w=(h-i)*.3+m+g*.16666667,v=l*.3+f+x*.16666667,y=i+w,A=v;for(let C=u+18;u<C;u+=2)d[u]=y,d[u+1]=A,w+=b,v+=p,b+=g,p+=x,y+=w,A+=v}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let h=s[r-2],l=s[r-1];return l+(1-l)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof Fe)||a.timelineAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(h=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case 0:o.length=0;return;case 1:if(r==1){o.length=0;return}o.length=d;let p=a;if(p.bones){r=1-r;for(var m=0;m<d;m++)o[m]*=r}else{let w=p.vertices;for(var m=0;m<d;m++)o[m]+=(w[m]-o[m])*r}}return}if(o.length=d,s>=u[u.length-1]){let p=c[u.length-1];if(r==1)if(h==3){let w=a;if(w.bones)for(let v=0;v<d;v++)o[v]+=p[v];else{let v=w.vertices;for(let y=0;y<d;y++)o[y]+=p[y]-v[y]}}else X.arrayCopy(p,0,o,0,d);else switch(h){case 0:{let v=a;if(v.bones)for(let y=0;y<d;y++)o[y]=p[y]*r;else{let y=v.vertices;for(let A=0;A<d;A++){let C=y[A];o[A]=C+(p[A]-C)*r}}break}case 1:case 2:for(let v=0;v<d;v++)o[v]+=(p[v]-o[v])*r;break;case 3:let w=a;if(w.bones)for(let v=0;v<d;v++)o[v]+=p[v]*r;else{let v=w.vertices;for(let y=0;y<d;y++)o[y]+=(p[y]-v[y])*r}}return}let f=fe.search1(u,s),g=this.getCurvePercent(s,f),x=c[f],b=c[f+1];if(r==1)if(h==3){let p=a;if(p.bones)for(let w=0;w<d;w++){let v=x[w];o[w]+=v+(b[w]-v)*g}else{let w=p.vertices;for(let v=0;v<d;v++){let y=x[v];o[v]+=y+(b[v]-y)*g-w[v]}}}else for(let p=0;p<d;p++){let w=x[p];o[p]=w+(b[p]-w)*g}else switch(h){case 0:{let w=a;if(w.bones)for(let v=0;v<d;v++){let y=x[v];o[v]=(y+(b[v]-y)*g)*r}else{let v=w.vertices;for(let y=0;y<d;y++){let A=x[y],C=v[y];o[y]=C+(A+(b[y]-A)*g-C)*r}}break}case 1:case 2:for(let w=0;w<d;w++){let v=x[w];o[w]+=(v+(b[w]-v)*g-o[w])*r}break;case 3:let p=a;if(p.bones)for(let w=0;w<d;w++){let v=x[w];o[w]+=(v+(b[w]-v)*g)*r}else{let w=p.vertices;for(let v=0;v<d;v++){let y=x[v];o[v]+=(y+(b[v]-y)*g-w[v])*r}}}}},ft=class gr extends fe{static propertyIds=[""+ie.event];events;constructor(e){super(e,gr.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,h,l,n){if(!r)return;let a=this.frames,o=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,h,l,n),s=-1;else if(s>=a[o-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=fe.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<o&&i>=a[c];c++)r.push(this.events[c])}},je=class pr extends fe{static propertyIds=[""+ie.drawOrder];drawOrders;constructor(e){super(e,pr.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,h,l,n){if(n==1){l==0&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(l==0||l==1)&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=fe.search1(this.frames,i),o=this.drawOrders[a];if(!o)X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let u=0,m=o.length;u<m;u++)c[u]=d[o[u]]}}},ts=class extends Te{constraintIndex=0;constructor(t,e,s){super(t,e,[ie.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,h,l){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,i,r,h,l){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let o=0,c=0,d=fe.search(a,s,6),u=this.curves[d/6];switch(u){case 0:let m=a[d];o=a[d+1],c=a[d+2];let f=(s-m)/(a[d+6]-m);o+=(a[d+6+1]-o)*f,c+=(a[d+6+2]-c)*f;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==0?(n.mix=n.data.mix+(o-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,l==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(o-n.mix)*r,n.softness+=(c-n.softness)*r,l==0&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},ss=class extends Te{constraintIndex=0;constructor(t,e,s){super(t,e,[ie.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,h,l,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=h,a[t+5]=l,a[t+6]=n}apply(t,e,s,i,r,h,l){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*r,n.mixX+=(b.mixX-n.mixX)*r,n.mixY+=(b.mixY-n.mixY)*r,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(b.mixShearY-n.mixShearY)*r}return}let o,c,d,u,m,f,g=fe.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let b=a[g];o=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];let p=(s-b)/(a[g+7]-b);o+=(a[g+7+1]-o)*p,c+=(a[g+7+2]-c)*p,d+=(a[g+7+3]-d)*p,u+=(a[g+7+4]-u)*p,m+=(a[g+7+5]-m)*p,f+=(a[g+7+6]-f)*p;break;case 1:o=a[g+1],c=a[g+2],d=a[g+3],u=a[g+4],m=a[g+5],f=a[g+6];break;default:o=this.getBezierValue(s,g,1,x-2),c=this.getBezierValue(s,g,2,x+18-2),d=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),m=this.getBezierValue(s,g,5,x+18*4-2),f=this.getBezierValue(s,g,6,x+18*5-2)}if(h==0){let b=n.data;n.mixRotate=b.mixRotate+(o-b.mixRotate)*r,n.mixX=b.mixX+(c-b.mixX)*r,n.mixY=b.mixY+(d-b.mixY)*r,n.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*r,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*r,n.mixShearY=b.mixShearY+(f-b.mixShearY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(u-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(f-n.mixShearY)*r}},is=class extends Ce{constraintIndex=0;constructor(t,e,s){super(t,e,ie.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,l){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,h,n.position,n.data.position))}},rs=class extends Ce{constraintIndex=0;constructor(t,e,s){super(t,e,ie.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,l){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,h,n.spacing,n.data.spacing))}},ns=class extends Te{constraintIndex=0;constructor(t,e,s){super(t,e,[ie.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=r}apply(t,e,s,i,r,h,l){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let o,c,d,u=fe.search(a,s,4),m=this.curves[u>>2];switch(m){case 0:let f=a[u];o=a[u+1],c=a[u+2],d=a[u+3];let g=(s-f)/(a[u+4]-f);o+=(a[u+4+1]-o)*g,c+=(a[u+4+2]-c)*g,d+=(a[u+4+3]-d)*g;break;case 1:o=a[u+1],c=a[u+2],d=a[u+3];break;default:o=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2),d=this.getBezierValue(s,u,3,m+18*2-2)}if(h==0){let f=n.data;n.mixRotate=f.mixRotate+(o-f.mixRotate)*r,n.mixX=f.mixX+(c-f.mixX)*r,n.mixY=f.mixY+(d-f.mixY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Oe=class extends Ce{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,h,l){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const o of t.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,r,h,this.get(o),this.setup(o),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,h,this.get(n),this.setup(n)))}},as=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ls=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},os=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},hs=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},cs=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ds=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},us=class extends Oe{constructor(t,e,s){super(t,e,s,ie.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},fs=class xr extends fe{static propertyIds=[ie.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,xr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,h,l,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const o=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],h,l,n),s=-1;else if(s>=o[o.length-1])return;if(!(i<o[0])&&(s<o[0]||i>=o[fe.search1(o,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},ms=class De extends fe{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[ie.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return De.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,h){let l=this.frames;e*=De.ENTRIES,l[e]=s,l[e+De.MODE]=i|r<<4,l[e+De.DELAY]=h}apply(e,s,i,r,h,l,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let o=a.attachment,c=this.attachment;if(o!=c&&(!(o instanceof Fe)||o.timelineAttachment!=c))return;if(n==1){l==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(l==0||l==1)&&(a.sequenceIndex=-1);return}let u=fe.search(d,i,De.ENTRIES),m=d[u],f=d[u+De.MODE],g=d[u+De.DELAY];if(!this.attachment.sequence)return;let x=f>>4,b=this.attachment.sequence.regions.length,p=oi[f&15];if(p!=0)switch(x+=(i-m)/g+1e-5|0,p){case 1:x=Math.min(b-1,x);break;case 2:x%=b;break;case 3:{let w=(b<<1)-2;x=w==0?0:x%w,x>=b&&(x=w-x);break}case 4:x=Math.max(b-1-x,0);break;case 5:x=b-1-x%b;break;case 6:{let w=(b<<1)-2;x=w==0?0:(x+b-1)%w,x>=b&&(x=w-x)}}a.sequenceIndex=x}},gs=class Yt{static _emptyAnimation=new dt("<empty>",[],0);static emptyAnimation(){return Yt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ui(this);propertyIDs=new Bt;animationsChanged=!1;trackEntryPool=new st(()=>new di);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let l=e*h.timeScale;if(h.delay>0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+e)*n.timeScale,h.trackTime+=l,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let u=0,m=i.length;u<m;u++){let f=i[u];if(!f||f.delay>0)continue;r=!0;let g=u==0?1:f.mixBlend,x=f.alpha;f.mixingFrom?x*=this.applyMixingFrom(f,e,g):f.trackTime>=f.trackEnd&&!f.next&&(x=0);let b=x>=f.alphaAttachmentThreshold,p=f.animationLast,w=f.getAnimationTime(),v=w,y=s;f.reverse&&(v=f.animation.duration-v,y=null);let A=f.animation.timelines,C=A.length;if(u==0&&x==1||g==3){u==0&&(b=!0);for(let S=0;S<C;S++){X.webkit602BugfixHelper(x,g);var h=A[S];h instanceof We?this.applyAttachmentTimeline(h,e,v,g,b):h.apply(e,p,v,y,x,g,0)}}else{let S=f.timelineMode,I=f.shortestRotation,k=!I&&f.timelinesRotation.length!=C<<1;k&&(f.timelinesRotation.length=C<<1);for(let Y=0;Y<C;Y++){let F=A[Y],P=S[Y]==mt?g:0;!I&&F instanceof it?this.applyRotateTimeline(F,e,v,x,P,f.timelinesRotation,Y<<1,k):F instanceof We?this.applyAttachmentTimeline(F,e,v,g,b):(X.webkit602BugfixHelper(x,g),F.apply(e,p,v,y,x,P,0))}}this.queueEvents(f,w),s.length=0,f.nextAnimationLast=w,f.nextTrackLast=f.trackTime}for(var l=this.unkeyedState+ws,n=e.slots,a=0,o=e.slots.length;a<o;a++){var c=n[a];if(c.attachmentState==l){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;e.mixDuration==0?(h=1,i==1&&(i=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let l=h<r.mixAttachmentThreshold,n=h<r.mixDrawOrderThreshold,a=r.animation.timelines,o=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-h),u=r.animationLast,m=r.getAnimationTime(),f=m,g=null;if(r.reverse?f=r.animation.duration-f:h<r.eventThreshold&&(g=this.events),i==3)for(let x=0;x<o;x++)a[x].apply(s,u,f,g,d,i,1);else{let x=r.timelineMode,b=r.timelineHoldMix,p=r.shortestRotation,w=!p&&r.timelinesRotation.length!=o<<1;w&&(r.timelinesRotation.length=o<<1),r.totalAlpha=0;for(let v=0;v<o;v++){let y=a[v],A=1,C,S=0;switch(x[v]){case mt:if(!n&&y instanceof je)continue;C=i,S=d;break;case ps:C=0,S=d;break;case xs:C=i,S=c;break;case gt:C=0,S=c;break;default:C=0;let I=b[v];S=c*Math.max(0,1-I.mixTime/I.mixDuration);break}r.totalAlpha+=S,!p&&y instanceof it?this.applyRotateTimeline(y,s,f,S,C,r.timelinesRotation,v<<1,w):y instanceof We?this.applyAttachmentTimeline(y,s,f,C,l&&S>=r.alphaAttachmentThreshold):(X.webkit602BugfixHelper(S,i),n&&y instanceof je&&C==0&&(A=0),y.apply(s,u,f,g,S,C,A))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(e,s,i,r,h){var l=s.slots[e.slotIndex];l.bone.active&&(i<e.frames[0]?(r==0||r==1)&&this.setAttachment(s,l,l.data.attachmentName,h):this.setAttachment(s,l,e.attachmentNames[fe.search1(e.frames,i)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+ws))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+gi)}applyRotateTimeline(e,s,i,r,h,l,n,a){if(a&&(l[n]=0),r==1){e.apply(s,0,i,null,1,h,0);return}let o=s.bones[e.boneIndex];if(!o.active)return;let c=e.frames,d=0,u=0;if(i<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:d=o.rotation,u=o.data.rotation}else d=h==0?o.data.rotation:o.rotation,u=o.data.rotation+e.getCurveValue(i);let m=0,f=u-d;if(f-=Math.ceil(f/360-.5)*360,f==0)m=l[n];else{let g=0,x=0;a?(g=0,x=f):(g=l[n],x=l[n+1]);let b=g-g%360;m=f+b;let p=f>=0,w=g>=0;Math.abs(x)<=90&&L.signum(x)!=L.signum(f)&&(Math.abs(g-b)>180?(m+=360*L.signum(g),w=p):b!=0?m-=360*L.signum(g):w=p),w!=p&&(m+=360*L.signum(g)),l[n]=m}l[n+1]=f,o.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,h=r-i,l=e.trackLast%h,n=this.events,a=0,o=n.length;for(;a<o;a++){let d=n[a];if(d.time<l)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(h==0)c=!0;else{const d=Math.floor(e.trackTime/h);c=d>0&&d>Math.floor(e.trackLast/h)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<o;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let l=this.trackEntry(e,s,i,h);return this.setCurrent(e,l,r),this.queue.drain(),l}addAnimation(e,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,h,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(e,s,i,h);return h?(h.next=l,l.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(e,l,!0),this.queue.drain(),r<0&&(r=0)),l.delay=r,l}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,Yt.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,Yt.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let h=this.tracks[i];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(X.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=s,h.loop=i,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=r?this.data.getMix(r.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,h=e.timelineMode;h.length=r;let l=e.timelineHoldMix;l.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)h[a]=n.addAll(i[a].getPropertyIds())?gt:xs;return}e:for(let a=0;a<r;a++){let o=i[a],c=o.getPropertyIds();if(!n.addAll(c))h[a]=mt;else if(!s||o instanceof We||o instanceof je||o instanceof ft||!s.animation.hasTimeline(c))h[a]=ps;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){h[a]=mi,l[a]=d;continue e}break}h[a]=gt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},di=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ui=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],r=t[s+1];switch(i){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let l=0;l<e.length;l++){let n=e[l];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let l=0;l<e.length;l++){let n=e[l];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let l=0;l<e.length;l++){let n=e[l];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let l=0;l<e.length;l++){let n=e[l];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case 4:r.listener&&r.listener.complete&&r.listener.complete(r);for(let l=0;l<e.length;l++){let n=e[l];n.complete&&n.complete(r)}break;case 5:let h=t[s+++2];r.listener&&r.listener.event&&r.listener.event(r,h);for(let l=0;l<e.length;l++){let n=e[l];n.event&&n.event(r,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},fi=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(fi||{}),Or=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},mt=0,ps=1,xs=2,gt=3,mi=4,ws=1,gi=2,pi=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},bs=class wr extends Fe{color=new K(1,1,1,1);constructor(e){super(e)}copy(){let e=new wr(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},rt=class br extends Fe{endSlot=null;color=new K(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new br(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},pt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},xt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(xt||{}),xi=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(xi||{}),wi=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Vr=class extends pt{setFilters(t,e){}setWraps(t,e){}dispose(){}},wt=class{pages=new Array;regions=new Array;constructor(t){let e=new Dr(t),s=new Array(4),i={};i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.format=()=>{},i.filter=o=>{o.minFilter=X.enumValue(xt,s[1]),o.magFilter=X.enumValue(xt,s[2])},i.repeat=o=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},i.pma=o=>{o.pma=s[1]=="true"};var r={};r.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},r.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},r.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},r.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},r.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},r.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},r.rotate=o=>{let c=s[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},r.index=o=>{o.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let l=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)l=null,h=e.readLine();else if(l){let o=new vs(l,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(o);else{n||(n=[]),a||(a=[]),n.push(s[0]);let u=[];for(let m=0;m<c;m++)u.push(parseInt(s[m+1]));a.push(u)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height),n&&n.length>0&&a&&a.length>0&&(o.names=n,o.values=a,n=null,a=null),o.u=o.x/l.width,o.v=o.y/l.height,o.degrees==90?(o.u2=(o.x+o.height)/l.width,o.v2=(o.y+o.width)/l.height):(o.u2=(o.x+o.width)/l.width,o.v2=(o.y+o.height)/l.height),this.regions.push(o)}else{for(l=new bi(h.trim());e.readEntry(s,h=e.readLine())!=0;){let o=i[s[0]];o&&o(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Dr=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=e.indexOf(",",r);if(h==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},bi=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},vs=class extends wi{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Ge=class Qs extends Fe{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new K(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new K(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=X.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,l=0,n=0;if(this.region instanceof vs){let a=this.region,o=a.page,c=o.width,d=o.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+e[u+1]*l,s[u+1]=h+(1-e[u])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/d,l=a.originalWidth/c,n=a.originalHeight/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u])*l,s[u+1]=h+(1-e[u+1])*n;return;case 270:r-=a.offsetY/c,h-=a.offsetX/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let u=0;u<i;u+=2)s[u]=r+(1-e[u+1])*l,s[u+1]=h+e[u]*n;return}r-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/d,l=a.originalWidth/c,n=a.originalHeight/d}else this.region?(l=this.region.u2-r,n=this.region.v2-h):(r=h=0,l=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*l,s[a+1]=h+e[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new Qs(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),X.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?X.newFloatArray(this.uvs.length):new Array(this.uvs.length),X.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),X.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),X.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,h,l){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,h,l)}newLinkedMesh(){let e=new Qs(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ze=class vr extends Fe{lengths=[];closed=!1;constantSpeed=!1;color=new K(1,1,1,1);constructor(e){super(e)}copy(){let e=new vr(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),X.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},vi=class yr extends Fe{x=0;y=0;rotation=0;color=new K(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*L.degRad,i=Math.cos(s),r=Math.sin(s),h=i*e.a+r*e.b,l=i*e.c+r*e.d;return L.atan2Deg(l,h)}copy(){let e=new yr(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ce=class Ar extends Vt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new K(1,1,1,1);path;region=null;sequence=null;offset=X.newFloatArray(8);uvs=X.newFloatArray(8);tempColor=new K(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*i,l=-this.height/2*this.scaleY+this.region.offsetY*r,n=h+this.region.width*i,a=l+this.region.height*r,o=this.rotation*L.degRad,c=Math.cos(o),d=Math.sin(o),u=this.x,m=this.y,f=h*c+u,g=h*d,x=l*c+m,b=l*d,p=n*c+u,w=n*d,v=a*c+m,y=a*d,A=this.offset;A[0]=f-b,A[1]=x+g,A[2]=f-y,A[3]=v+g,A[4]=p-y,A[5]=v+w,A[6]=p-b,A[7]=x+w,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,l=this.offset,n=h.worldX,a=h.worldY,o=h.a,c=h.b,d=h.c,u=h.d,m=0,f=0;m=l[0],f=l[1],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=l[2],f=l[3],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=l[4],f=l[5],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a,i+=r,m=l[6],f=l[7],s[i]=m*o+f*c+n,s[i+1]=m*d+f*u+a}copy(){let e=new Ar(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,X.arrayCopy(this.uvs,0,e.uvs,0,8),X.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},ys=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let l=s.getPath(e,r),n=this.atlas.findRegion(l);if(n==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new ce(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=h}return r}newMeshAttachment(t,e,s,i){let r=new Ge(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=h}return r}newBoundingBoxAttachment(t,e){return new bs(e)}newPathAttachment(t,e){return new Ze(e)}newPointAttachment(t,e){return new vi(e)}newClippingAttachment(t,e){return new rt(e)}},As=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new K;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},bt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(bt||{}),Cs=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,r,h,l){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l;let n=this.parent;if(!n){let u=this.skeleton;const m=u.scaleX,f=u.scaleY,g=(s+h)*L.degRad,x=(s+90+l)*L.degRad;this.a=Math.cos(g)*i*m,this.b=Math.cos(x)*r*m,this.c=Math.sin(g)*i*f,this.d=Math.sin(x)*r*f,this.worldX=t*m+u.x,this.worldY=e*f+u.y;return}let a=n.a,o=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+o*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case 0:{const u=(s+h)*L.degRad,m=(s+90+l)*L.degRad,f=Math.cos(u)*i,g=Math.cos(m)*r,x=Math.sin(u)*i,b=Math.sin(m)*r;this.a=a*f+o*x,this.b=a*g+o*b,this.c=c*f+d*x,this.d=c*g+d*b;return}case 1:{const u=(s+h)*L.degRad,m=(s+90+l)*L.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(m)*r,this.c=Math.sin(u)*i,this.d=Math.sin(m)*r;break}case 2:{let u=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=u,c*=m;let f=a*a+c*c,g=0;f>1e-4?(f=Math.abs(a*d*m-o*u*c)/f,o=c*f,d=a*f,g=Math.atan2(c,a)*L.radDeg):(a=0,c=0,g=90-Math.atan2(d,o)*L.radDeg);const x=(s+h-g)*L.degRad,b=(s+l-g+90)*L.degRad,p=Math.cos(x)*i,w=Math.cos(b)*r,v=Math.sin(x)*i,y=Math.sin(b)*r;this.a=a*p-o*v,this.b=a*w-o*y,this.c=c*p+d*v,this.d=c*w+d*y;break}case 3:case 4:{s*=L.degRad;const u=Math.cos(s),m=Math.sin(s);let f=(a*u+o*m)/this.skeleton.scaleX,g=(c*u+d*m)/this.skeleton.scaleY,x=Math.sqrt(f*f+g*g);x>1e-5&&(x=1/x),f*=x,g*=x,x=Math.sqrt(f*f+g*g),this.inherit==3&&a*d-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x),s=Math.PI/2+Math.atan2(g,f);const b=Math.cos(s)*x,p=Math.sin(s)*x;h*=L.degRad,l=(90+l)*L.degRad;const w=Math.cos(h)*i,v=Math.cos(l)*r,y=Math.sin(h)*i,A=Math.sin(l)*r;this.a=f*w+b*y,this.b=f*v+b*A,this.c=g*w+p*y,this.d=g*v+p*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*L.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*L.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,h=1/(e*r-s*i),l=r*h,n=s*h,a=i*h,o=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*l-d*n,this.ay=d*o-c*a;let u,m,f,g;if(this.inherit==1)u=this.a,m=this.b,f=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,r=e*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(e*r-s*i),l=r*h,n=s*h;break}case 3:case 4:let x=L.cosDeg(this.rotation),b=L.sinDeg(this.rotation);e=(e*x+s*b)/this.skeleton.scaleX,i=(i*x+r*b)/this.skeleton.scaleY;let p=Math.sqrt(e*e+i*i);p>1e-5&&(p=1/p),e*=p,i*=p,p=Math.sqrt(e*e+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let w=L.PI/2+Math.atan2(i,e);s=Math.cos(w)*p,r=Math.sin(w)*p,h=1/(e*r-s*i),l=r*h,n=s*h,a=i*h,o=e*h}u=l*this.a-n*this.c,m=l*this.b-n*this.d,f=o*this.c-a*this.a,g=o*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){let x=u*g-m*f;this.ascaleY=x/this.ascaleX,this.ashearY=-Math.atan2(u*m+f*g,x)*L.radDeg,this.arotation=Math.atan2(f,u)*L.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*L.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*L.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*L.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=L.sinDeg(t),s=L.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*L.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=L.sinDeg(t),s=L.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*L.radDeg}rotateWorld(t){t*=L.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},nt=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},yi=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ss,i=new Ai){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),i(h)},(h,l)=>{const n=`Couldn't load binary ${t}: status ${h}, ${l}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),i(h)},(h,l)=>{const n=`Couldn't load JSON ${t}: status ${h}, ${l}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(t,n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(t,n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),h=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((l,n)=>{this.downloader.downloadText(t,a=>{try{const o=this.createTextureAtlas(t,a);let c=o.pages.length,d=!1;for(let u of o.pages)this.loadTexture(i?i[u.name]:h+u.name,(m,f)=>{d||(u.setTexture(f),--c==0&&(this.success(e,t,o),l(o)))},(m,f)=>{if(!d){const g=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,g),n(g)}d=!0})}catch(o){const c=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,c),n(c)}},(a,o)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${o}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,h)=>{this.downloader.downloadText(t,l=>{try{const n=this.createTextureAtlas(t,l);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),h(a)}},(l,n)=>{const a=`Couldn't load texture atlas ${t}: status ${l}, ${n}`;this.error(s,t,a),h(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
2
+ `+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof wt){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new wt(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},Ai=class Ft{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Ft.AVAILABLE_CACHES.get(e);if(s)return s;const i=new Ft;return Ft.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},Ss=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let h=()=>{this.finish(t,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let h=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let h=r.length-1,l=i.length;h<l;h+=2)i[h].apply(null,r)}},Ts=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Is=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Ci=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,h,l){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,o=n.b,c=n.c,d=n.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*L.signum(t.skeleton.scaleX),f=(s-t.worldY)*L.signum(t.skeleton.scaleY);break;case 2:let b=Math.abs(a*d-o*c)/Math.max(1e-4,a*a+c*c),p=a/t.skeleton.scaleX,w=c/t.skeleton.scaleY;o=-w*b*t.skeleton.scaleX,d=p*b*t.skeleton.scaleY,u+=Math.atan2(w,p)*L.radDeg;default:let v=e-n.worldX,y=s-n.worldY,A=a*d-o*c;Math.abs(A)<=1e-4?(m=0,f=0):(m=(v*d-y*o)/A-t.ax,f=(y*a-v*c)/A-t.ay)}u+=Math.atan2(f,m)*L.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,x=t.ascaleY;if(i||r){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const b=t.data.length*g;if(b>1e-4){const p=m*m+f*f;if(i&&p<b*b||r&&p>b*b){const w=(Math.sqrt(p)/b-1)*l+1;g*=w,h&&(x*=w)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,h,l,n,a){if(t.inherit!=0||e.inherit!=0)return;let o=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX,x=0,b=0,p=0;d<0?(d=-d,x=180,p=-1):(x=0,p=1),u<0&&(u=-u,p=-p),g<0?(g=-g,b=180):b=0;let w=e.ax,v=0,y=0,A=0,C=t.a,S=t.b,I=t.c,k=t.d,Y=Math.abs(d-u)<=1e-4;!Y||h?(v=0,y=C*w+t.worldX,A=I*w+t.worldY):(v=e.ay,y=C*w+S*v+t.worldX,A=I*w+k*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,S=F.b,I=F.c,k=F.d;let P=C*k-S*I,M=y-F.worldX,R=A-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let B=(M*k-R*S)*P-o,se=(R*C-M*I)*P-c,te=Math.sqrt(B*B+se*se),re=e.data.length*g,de,oe;if(te<1e-4){this.apply1(t,s,i,!1,h,!1,a),e.updateWorldTransformWith(w,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}M=s-F.worldX,R=i-F.worldY;let me=(M*k-R*S)*P-o,Z=(R*C-M*I)*P-c,ne=me*me+Z*Z;if(n!=0){n*=d*(g+1)*.5;let ge=Math.sqrt(ne),we=ge-te-re*d+n;if(we>0){let be=Math.min(1,we/(n*2))-1;be=(we-n*(1-be*be))/ge,me-=be*me,Z-=be*Z,ne=me*me+Z*Z}}e:if(Y){re*=d;let ge=(ne-te*te-re*re)/(2*te*re);ge<-1?(ge=-1,oe=Math.PI*r):ge>1?(ge=1,oe=0,h&&(C=(Math.sqrt(ne)/(te+re)-1)*a+1,m*=C,l&&(f*=C))):oe=Math.acos(ge)*r,C=te+re*ge,S=re*Math.sin(oe),de=Math.atan2(Z*C-me*S,me*C+Z*S)}else{C=d*re,S=u*re;let ge=C*C,we=S*S,be=Math.atan2(Z,me);I=we*te*te+ge*ne-ge*we;let Re=-2*we*te,$e=we-ge;if(k=Re*Re-4*$e*I,k>=0){let et=Math.sqrt(k);Re<0&&(et=-et),et=-(Re+et)*.5;let ht=et/$e,fr=I/et,Rt=Math.abs(ht)<Math.abs(fr)?ht:fr;if(ht=ne-Rt*Rt,ht>=0){R=Math.sqrt(ht)*r,de=be-Math.atan2(R,Rt),oe=Math.atan2(R/u,(Rt-te)/d);break e}}let ot=L.PI,Mt=te-C,Js=Mt*Mt,cr=0,dr=0,Et=te+C,Ks=Et*Et,ur=0;I=-C*te/(ge-we),I>=-1&&I<=1&&(I=Math.acos(I),M=C*Math.cos(I)+te,R=S*Math.sin(I),k=M*M+R*R,k<Js&&(ot=I,Js=k,Mt=M,cr=R),k>Ks&&(dr=I,Ks=k,Et=M,ur=R)),ne<=(Js+Ks)*.5?(de=be-Math.atan2(cr*r,Mt),oe=ot*r):(de=be-Math.atan2(ur*r,Et),oe=dr*r)}let he=Math.atan2(v,w)*p,ve=t.arotation;de=(de-he)*L.radDeg+x-ve,de>180?de-=360:de<-180&&(de+=360),t.updateWorldTransformWith(o,c,ve+de*a,m,f,0,0),ve=e.arotation,oe=((oe+he)*L.radDeg-e.ashearX)*p+b-ve,oe>180?oe-=360:oe<-180&&(oe+=360),e.updateWorldTransformWith(w,v,ve+oe*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Ms=class extends nt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},Es=class extends nt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Rs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Rs||{}),ks=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ks||{}),Ys=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Ys||{}),Si=class Ne{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,h=e.bones.length;r<h;r++){let l=s.findBone(e.bones[r].name);if(!l)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(l)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ze))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==0&&h==0)return;let l=this.data,n=l.rotateMode==0,a=l.rotateMode==2,o=this.bones,c=o.length,d=n?c:c+1,u=X.setArraySize(this.spaces,d),m=a?this.lengths=X.setArraySize(this.lengths,c):[],f=this.spacing;switch(l.spacingMode){case 2:if(a)for(let A=0,C=d-1;A<C;A++){let S=o[A],I=S.data.length,k=I*S.a,Y=I*S.c;m[A]=Math.sqrt(k*k+Y*Y)}X.arrayFill(u,1,d,f);break;case 3:let v=0;for(let A=0,C=d-1;A<C;){let S=o[A],I=S.data.length;if(I<Ne.epsilon)a&&(m[A]=0),u[++A]=f;else{let k=I*S.a,Y=I*S.c,F=Math.sqrt(k*k+Y*Y);a&&(m[A]=F),u[++A]=F,v+=F}}if(v>0){v=d/v*f;for(let A=1;A<d;A++)u[A]*=v}break;default:let y=l.spacingMode==0;for(let A=0,C=d-1;A<C;){let S=o[A],I=S.data.length;if(I<Ne.epsilon)a&&(m[A]=0),u[++A]=f;else{let k=I*S.a,Y=I*S.c,F=Math.sqrt(k*k+Y*Y);a&&(m[A]=F),u[++A]=(y?I+f:f)*F/I}}}let g=this.computeWorldPositions(s,d,n),x=g[0],b=g[1],p=l.offsetRotation,w=!1;if(p==0)w=l.rotateMode==1;else{w=!1;let v=this.target.bone;p*=v.a*v.d-v.b*v.c>0?L.degRad:-L.degRad}for(let v=0,y=3;v<c;v++,y+=3){let A=o[v];A.worldX+=(x-A.worldX)*r,A.worldY+=(b-A.worldY)*h;let C=g[y],S=g[y+1],I=C-x,k=S-b;if(a){let Y=m[v];if(Y!=0){let F=(Math.sqrt(I*I+k*k)/Y-1)*i+1;A.a*=F,A.c*=F}}if(x=C,b=S,i>0){let Y=A.a,F=A.b,P=A.c,M=A.d,R=0,B=0,se=0;if(n?R=g[y-1]:u[v+1]==0?R=g[y+2]:R=Math.atan2(k,I),R-=Math.atan2(P,Y),w){B=Math.cos(R),se=Math.sin(R);let te=A.data.length;x+=(te*(B*Y-se*P)-I)*i,b+=(te*(se*Y+B*P)-k)*i}else R+=p;R>L.PI?R-=L.PI2:R<-L.PI&&(R+=L.PI2),R*=i,B=Math.cos(R),se=Math.sin(R),A.a=B*Y-se*P,A.b=B*F-se*M,A.c=se*Y+B*P,A.d=se*F+B*M}A.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,h=this.position,l=this.spaces,n=X.setArraySize(this.positions,s*3+2),a=this.world,o=e.closed,c=e.worldVerticesLength,d=c/6,u=Ne.NONE;if(!e.constantSpeed){let te=e.lengths;d-=o?1:2;let re=te[d];this.data.positionMode==1&&(h*=re);let de;switch(this.data.spacingMode){case 2:de=re;break;case 3:de=re/s;break;default:de=1}a=X.setArraySize(this.world,8);for(let oe=0,me=0,Z=0;oe<s;oe++,me+=3){let ne=l[oe]*de;h+=ne;let he=h;if(o)he%=re,he<0&&(he+=re),Z=0;else if(he<0){u!=Ne.BEFORE&&(u=Ne.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(he,a,0,n,me);continue}else if(he>re){u!=Ne.AFTER&&(u=Ne.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(he-re,a,0,n,me);continue}for(;;Z++){let ve=te[Z];if(!(he>ve)){if(Z==0)he/=ve;else{let ge=te[Z-1];he=(he-ge)/(ve-ge)}break}}Z!=u&&(u=Z,o&&Z==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,Z*6+2,8,a,0,2)),this.addCurvePosition(he,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,me,i||oe>0&&ne==0)}return n}o?(c+=2,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=X.setArraySize(this.curves,d),f=0,g=a[0],x=a[1],b=0,p=0,w=0,v=0,y=0,A=0,C=0,S=0,I=0,k=0,Y=0,F=0,P=0,M=0;for(let te=0,re=2;te<d;te++,re+=6)b=a[re],p=a[re+1],w=a[re+2],v=a[re+3],y=a[re+4],A=a[re+5],C=(g-b*2+w)*.1875,S=(x-p*2+v)*.1875,I=((b-w)*3-g+y)*.09375,k=((p-v)*3-x+A)*.09375,Y=C*2+I,F=S*2+k,P=(b-g)*.75+C+I*.16666667,M=(p-x)*.75+S+k*.16666667,f+=Math.sqrt(P*P+M*M),P+=Y,M+=F,Y+=I,F+=k,f+=Math.sqrt(P*P+M*M),P+=Y,M+=F,f+=Math.sqrt(P*P+M*M),P+=Y+I,M+=F+k,f+=Math.sqrt(P*P+M*M),m[te]=f,g=y,x=A;this.data.positionMode==1&&(h*=f);let R;switch(this.data.spacingMode){case 2:R=f;break;case 3:R=f/s;break;default:R=1}let B=this.segments,se=0;for(let te=0,re=0,de=0,oe=0;te<s;te++,re+=3){let me=l[te]*R;h+=me;let Z=h;if(o)Z%=f,Z<0&&(Z+=f),de=0;else if(Z<0){this.addBeforePosition(Z,a,0,n,re);continue}else if(Z>f){this.addAfterPosition(Z-f,a,c-4,n,re);continue}for(;;de++){let ne=m[de];if(!(Z>ne)){if(de==0)Z/=ne;else{let he=m[de-1];Z=(Z-he)/(ne-he)}break}}if(de!=u){u=de;let ne=de*6;for(g=a[ne],x=a[ne+1],b=a[ne+2],p=a[ne+3],w=a[ne+4],v=a[ne+5],y=a[ne+6],A=a[ne+7],C=(g-b*2+w)*.03,S=(x-p*2+v)*.03,I=((b-w)*3-g+y)*.006,k=((p-v)*3-x+A)*.006,Y=C*2+I,F=S*2+k,P=(b-g)*.3+C+I*.16666667,M=(p-x)*.3+S+k*.16666667,se=Math.sqrt(P*P+M*M),B[0]=se,ne=1;ne<8;ne++)P+=Y,M+=F,Y+=I,F+=k,se+=Math.sqrt(P*P+M*M),B[ne]=se;P+=Y,M+=F,se+=Math.sqrt(P*P+M*M),B[8]=se,P+=Y+I,M+=F+k,se+=Math.sqrt(P*P+M*M),B[9]=se,oe=0}for(Z*=se;;oe++){let ne=B[oe];if(!(Z>ne)){if(oe==0)Z/=ne;else{let he=B[oe-1];Z=oe+(Z-he)/(ne-he)}break}}this.addCurvePosition(Z*.1,g,x,b,p,w,v,y,A,n,re,i||te>0&&me==0)}return n}addBeforePosition(e,s,i,r,h){let l=s[i],n=s[i+1],a=s[i+2]-l,o=s[i+3]-n,c=Math.atan2(o,a);r[h]=l+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addAfterPosition(e,s,i,r,h){let l=s[i+2],n=s[i+3],a=l-s[i],o=n-s[i+1],c=Math.atan2(o,a);r[h]=l+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addCurvePosition(e,s,i,r,h,l,n,a,o,c,d,u){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=e*e,f=m*e,g=1-e,x=g*g,b=x*g,p=g*e,w=p*3,v=g*w,y=w*e,A=s*b+r*v+l*y+a*f,C=i*b+h*v+n*y+o*f;c[d]=A,c[d+1]=C,u&&(e<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(C-(i*x+h*p*2+n*m),A-(s*x+r*p*2+l*m)))}},Nr=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,n=l.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=a.time;const c=l.worldX,d=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,x=-1,b=this.data.limit*o,p=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||i){if(s){const w=(this.ux-c)*m;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=c}if(i){const w=(this.uy-d)*m;this.yOffset+=w>p?p:w<-p?-p:w,this.uy=d}if(u>=f){x=Math.pow(this.damping,60*f);const w=this.massInverse*f,v=this.strength,y=this.wind*g*a.scaleX,A=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*w,this.xOffset+=this.xVelocity*f,this.xVelocity*=x),i&&(this.yVelocity-=(A+this.yOffset*v)*w,this.yOffset+=this.yVelocity*f,this.yVelocity*=x),u-=f;while(u>=f)}s&&(l.worldX+=this.xOffset*e*this.data.x),i&&(l.worldY+=this.yOffset*e*this.data.y)}if(r||h){let w=Math.atan2(l.c,l.a),v=0,y=0,A=0,C=this.cx-l.worldX,S=this.cy-l.worldY;if(C>b?C=b:C<-b&&(C=-b),S>p?S=p:S<-p&&(S=-p),r){A=(this.data.rotate+this.data.shearX)*e;let I=Math.atan2(S+this.ty,C+this.tx)-w-this.rotateOffset*A;this.rotateOffset+=(I-Math.ceil(I*L.invPI2-.5)*L.PI2)*m,I=this.rotateOffset*A+w,v=Math.cos(I),y=Math.sin(I),h&&(I=n*l.getWorldScaleX(),I>0&&(this.scaleOffset+=(C*v+S*y)*m/I))}else{v=Math.cos(w),y=Math.sin(w);const I=n*l.getWorldScaleX();I>0&&(this.scaleOffset+=(C*v+S*y)*m/I)}if(u=this.remaining,u>=f){x==-1&&(x=Math.pow(this.damping,60*f));const I=this.massInverse*f,k=this.strength,Y=this.wind,F=Je.yDown?-this.gravity:this.gravity,P=n/g;for(;;)if(u-=f,h&&(this.scaleVelocity+=(Y*v-F*y-this.scaleOffset*k)*I,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=x),r){if(this.rotateVelocity-=((Y*y+F*v)*P+this.rotateOffset*k)*I,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=x,u<f)break;const M=this.rotateOffset*A+w;v=Math.cos(M),y=Math.sin(M)}else if(u<f)break}}this.remaining=u}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*e*this.data.x),i&&(l.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,o=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=a*this.data.rotate,o=Math.sin(u),c=Math.cos(u),d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d),u+=a*this.data.shearX,o=Math.sin(u),c=Math.cos(u),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c}else a*=this.data.rotate,o=Math.sin(a),c=Math.cos(a),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c,d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d}if(h){const a=1+this.scaleOffset*e*this.data.scaleX;l.a*=a,l.c*=a}t!=3&&(this.tx=n*l.a,this.ty=n*l.c),l.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*L.degRad,r=Math.cos(i),h=Math.sin(i),l=this.cx-t,n=this.cy-e;this.translate(l*r-n*h-l,l*h+n*r-n)}},Ti=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new K,this.darkColor=t.darkColor?new K:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof Fe)||!(this.attachment instanceof Fe)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Ii=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ue;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=e!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,u=a*d-o*c>0?L.degRad:-L.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let x=0,b=g.length;x<b;x++){let p=g[x];if(t!=0){let w=p.a,v=p.b,y=p.c,A=p.d,C=Math.atan2(c,a)-Math.atan2(y,w)+m;C>L.PI?C-=L.PI2:C<-L.PI&&(C+=L.PI2),C*=t;let S=Math.cos(C),I=Math.sin(C);p.a=S*w-I*y,p.b=S*v-I*A,p.c=I*w+S*y,p.d=I*v+S*A}if(l){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(w.x-p.worldX)*e,p.worldY+=(w.y-p.worldY)*s}if(i!=0){let w=Math.sqrt(p.a*p.a+p.c*p.c);w!=0&&(w=(w+(Math.sqrt(a*a+c*c)-w+this.data.offsetScaleX)*i)/w),p.a*=w,p.c*=w}if(r!=0){let w=Math.sqrt(p.b*p.b+p.d*p.d);w!=0&&(w=(w+(Math.sqrt(o*o+d*d)-w+this.data.offsetScaleY)*r)/w),p.b*=w,p.d*=w}if(h>0){let w=p.b,v=p.d,y=Math.atan2(v,w),A=Math.atan2(d,o)-Math.atan2(c,a)-(y-Math.atan2(p.c,p.a));A>L.PI?A-=L.PI2:A<-L.PI&&(A+=L.PI2),A=y+(A+f)*h;let C=Math.sqrt(w*w+v*v);p.b=Math.cos(A)*C,p.d=Math.sin(A)*C}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=e!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,u=a*d-o*c>0?L.degRad:-L.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let x=0,b=g.length;x<b;x++){let p=g[x];if(t!=0){let w=p.a,v=p.b,y=p.c,A=p.d,C=Math.atan2(c,a)+m;C>L.PI?C-=L.PI2:C<-L.PI&&(C+=L.PI2),C*=t;let S=Math.cos(C),I=Math.sin(C);p.a=S*w-I*y,p.b=S*v-I*A,p.c=I*w+S*y,p.d=I*v+S*A}if(l){let w=this.temp;n.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),p.worldX+=w.x*e,p.worldY+=w.y*s}if(i!=0){let w=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;p.a*=w,p.c*=w}if(r!=0){let w=(Math.sqrt(o*o+d*d)-1+this.data.offsetScaleY)*r+1;p.b*=w,p.d*=w}if(h>0){let w=Math.atan2(d,o)-Math.atan2(c,a);w>L.PI?w-=L.PI2:w<-L.PI&&(w+=L.PI2);let v=p.b,y=p.d;w=Math.atan2(y,v)+(w-L.PI/2+f)*h;let A=Math.sqrt(v*v+y*y);p.b=Math.cos(w)*A,p.d=Math.sin(w)*A}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(l.arotation-d+this.data.offsetRotation)*t);let u=c.ax,m=c.ay;u+=(l.ax-u+this.data.offsetX)*e,m+=(l.ay-m+this.data.offsetY)*s;let f=c.ascaleX,g=c.ascaleY;i!=0&&f!=0&&(f=(f+(l.ascaleX-f+this.data.offsetScaleX)*i)/f),r!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*r)/g);let x=c.ashearY;h!=0&&(x+=(l.ashearY-x+this.data.offsetShearY)*h),c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,x)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],d=c.arotation+(l.arotation+this.data.offsetRotation)*t,u=c.ax+(l.ax+this.data.offsetX)*e,m=c.ay+(l.ay+this.data.offsetY)*s,f=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*r+1),x=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(u,m,d,f,g,c.ashearX,x)}}},Je=class $s{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return $s.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new Cs(i,this,null);else{let h=this.bones[i.parent.index];r=new Cs(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],h=new Ti(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new Ci(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new Ii(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new Si(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new Nr(i,this))}this.color=new K(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let u=0,m=s.length;u<m;u++){let f=s[u];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let u=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let g=this.bones[u[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,l=this.physicsConstraints,n=i.length,a=r.length,o=h.length,c=this.physicsConstraints.length,d=n+a+o+c;e:for(let u=0;u<d;u++){for(let m=0;m<n;m++){let f=i[m];if(f.data.order==u){this.sortIkConstraint(f);continue e}}for(let m=0;m<a;m++){let f=r[m];if(f.data.order==u){this.sortTransformConstraint(f);continue e}}for(let m=0;m<o;m++){let f=h[m];if(f.data.order==u){this.sortPathConstraint(f);continue e}}for(let m=0;m<c;m++){const f=l[m];if(f.data.order==u){this.sortPhysicsConstraint(f);continue e}}}for(let u=0,m=s.length;u<m;u++)this.sortBone(s[u])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,o=this.data.skins.length;a<o;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let h=s.getAttachment();h instanceof Ze&&this.sortPathConstraintAttachmentWith(h,r);let l=e.bones,n=l.length;for(let a=0;a<n;a++)this.sortBone(l[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(l[a].children);for(let a=0;a<n;a++)l[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let h=s[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ze))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,l=i.length;h<l;){let n=i[h++];for(n+=h;h<n;)this.sortBone(r[i[h++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&X.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,h=s.length;r<h;r++){let l=s[r];l.ax=l.x,l.ay=l.y,l.arotation=l.rotation,l.ascaleX=l.scaleX,l.ascaleY=l.scaleY,l.ashearX=l.shearX,l.ashearY=l.shearY}let i=this._updateCache;for(let r=0,h=i.length;r<h;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let x=1,b=i.length;x<b;x++){let p=i[x];p.ax=p.x,p.ay=p.y,p.arotation=p.rotation,p.ascaleX=p.scaleX,p.ascaleY=p.scaleY,p.ashearX=p.shearX,p.ashearY=p.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,l=s.b,n=s.c,a=s.d;r.worldX=h*this.x+l*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const o=(r.rotation+r.shearX)*L.degRad,c=(r.rotation+90+r.shearY)*L.degRad,d=Math.cos(o)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(o)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(h*d+l*m)*this.scaleX,r.b=(h*u+l*f)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*u+a*f)*this.scaleY;let g=this._updateCache;for(let x=0,b=g.length;x<b;x++){let p=g[x];p!=r&&p.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;X.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==e)return h}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i],l=h.data.attachmentName;if(l){let n=e.getAttachment(i,l);n&&h.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,h=i.length;r<h;r++){let l=i[r];if(l.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);l.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new Ue,i=new Ue;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let u=h[c];if(!u.bone.active)continue;let m=0,f=null,g=null,x=u.getAttachment();if(x instanceof ce)m=8,f=X.setArraySize(i,m,0),x.computeWorldVertices(u,f,0,2),g=$s.quadTriangles;else if(x instanceof Ge){let b=x;m=b.worldVerticesLength,f=X.setArraySize(i,m,0),b.computeWorldVertices(u,0,m,f,0,2),g=b.triangles}else if(x instanceof rt&&r!=null){r.clipStart(u,x);continue}if(f&&g){r!=null&&r.isClipping()&&(r.clipTriangles(f,g,g.length),f=r.clippedVertices,m=r.clippedVertices.length);for(let b=0,p=f.length;b<p;b+=2){let w=f[b],v=f[b+1];l=Math.min(l,w),n=Math.min(n,v),a=Math.max(a,w),o=Math.max(o,v)}}r?.clipEndWithSlot(u)}r?.clipEnd(),e.set(l,n),s.set(a-l,o-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let h=0,l=r.length;h<l;h++)r[h].rotate(e,s,i)}},Mi=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(Mi||{}),Ei=class extends nt{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},Fs=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},Ps=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},at=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new K(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof Ge?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Ps(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Ps(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],h=r.getAttachment();if(h&&s<e.attachments.length){let l=e.attachments[s];for(let n in l){let a=l[n];if(h==a){let o=this.getAttachment(s,n);o&&r.setAttachment(o);break}}}s++}}},Ls=class{index=0;name;boneData;color=new K(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Xs=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Xs||{}),Bs=class extends nt{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Ri=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Fs;s.name="";let i=new ki(t),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let l=i.readBoolean();l&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=o==0?null:s.bones[i.readInt(!0)],u=new As(o,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),l&&(K.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new Ls(o,c,d);K.rgba8888ToColor(u.color,i.readInt32());let m=i.readInt32();m!=-1&&K.rgb888ToColor(u.darkColor=new K,m),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),l&&(u.visible=i.readBoolean()),s.slots.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new Ms(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=(m&2)!=0?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,(m&32)!=0&&(u.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new Bs(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,(m&8)!=0&&(u.offsetRotation=i.readFloat()),(m&16)!=0&&(u.offsetX=i.readFloat()*e),(m&32)!=0&&(u.offsetY=i.readFloat()*e),(m&64)!=0&&(u.offsetScaleX=i.readFloat()),(m&128)!=0&&(u.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(u.offsetShearY=i.readFloat()),(m&2)!=0&&(u.mixRotate=i.readFloat()),(m&4)!=0&&(u.mixX=i.readFloat()),(m&8)!=0&&(u.mixY=i.readFloat()),(m&16)!=0&&(u.mixScaleX=i.readFloat()),(m&32)!=0&&(u.mixScaleY=i.readFloat()),(m&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new Es(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let f=0;f<c;f++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const m=i.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,(m&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==0&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==0||u.spacingMode==1)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}n=i.readInt(!0);for(let o=0,c;o<n;o++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Ei(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,(m&2)!=0&&(u.x=i.readFloat()),(m&4)!=0&&(u.y=i.readFloat()),(m&8)!=0&&(u.rotate=i.readFloat()),(m&16)!=0&&(u.scaleX=i.readFloat()),(m&32)!=0&&(u.shearX=i.readFloat()),u.limit=((m&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(m&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(u.inertiaGlobal=!0),(m&2)!=0&&(u.strengthGlobal=!0),(m&4)!=0&&(u.dampingGlobal=!0),(m&8)!=0&&(u.massGlobal=!0),(m&16)!=0&&(u.windGlobal=!0),(m&32)!=0&&(u.gravityGlobal=!0),(m&64)!=0&&(u.mixGlobal=!0),u.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let a=this.readSkin(i,s,!0,l);a&&(s.defaultSkin=a,s.skins.push(a));{let o=s.skins.length;for(X.setArraySize(s.skins,n=o+i.readInt(!0));o<n;o++){let c=this.readSkin(i,s,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[o]=c}}n=this.linkedMeshes.length;for(let o=0;o<n;o++){let c=this.linkedMeshes[o];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new Is(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;r=new at("default")}else{let l=t.readString();if(!l)throw new Error("Skin name must not be null.");r=new at(l),i&&K.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let l=0;l<h;l++){let n=t.readInt(!0);for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,h){let l=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let o=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let u=(n&128)!=0?t.readFloat():0,m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat(),p=t.readFloat();o||(o=a);let w=this.attachmentLoader.newRegionAttachment(s,a,o,d);return w?(w.path=o,w.x=m*l,w.y=f*l,w.scaleX=g,w.scaleY=x,w.rotation=u,w.width=b*l,w.height=p*l,K.rgba8888ToColor(w.color,c),w.sequence=d,d==null&&w.updateRegion(),w):null}case 1:{let o=this.readVertices(t,(n&16)!=0),c=h?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,h&&K.rgba8888ToColor(d.color,c),d):null}case 2:{let o=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),f=this.readFloatArray(t,m.length,1),g=this.readShortArray(t,(m.length-u-2)*3);let x=[],b=0,p=0;h&&(x=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),p=t.readFloat()),o||(o=a);let w=this.attachmentLoader.newMeshAttachment(s,a,o,d);return w?(w.path=o,K.rgba8888ToColor(w.color,c),w.bones=m.bones,w.vertices=m.vertices,w.worldVerticesLength=m.length,w.triangles=g,w.regionUVs=f,d==null&&w.updateRegion(),w.hullLength=u<<1,w.sequence=d,h&&(w.edges=x,w.width=b*l,w.height=p*l),w):null}case 3:{const o=(n&16)!=0?t.readStringRef():a;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,u=(n&128)!=0,m=t.readInt(!0),f=t.readStringRef();let g=0,x=0;h&&(g=t.readFloat(),x=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,o,d);return b?(b.path=o,K.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*l,b.height=x*l),this.linkedMeshes.push(new Ur(b,m,i,f,u)),b):null}case 4:{const o=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),u=X.newArray(d.length/6,0);for(let g=0,x=u.length;g<x;g++)u[g]=t.readFloat()*l;const m=h?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,a);return f?(f.closed=o,f.constantSpeed=c,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=u,h&&K.rgba8888ToColor(f.color,m),f):null}case 5:{const o=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*l,m.y=d*l,m.rotation=o,h&&K.rgba8888ToColor(m.color,u),m):null}case 6:{const o=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=h?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,a);return u?(u.endSlot=e.slots[o],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,h&&K.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new ai(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Wr;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let h=new Array,l=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);l.push(a);for(let o=0;o<a;o++)l.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return r.vertices=X.toFloatArray(h),r.bones=l,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0),g=f-1;switch(m){case en:{let x=new We(f,c);for(let b=0;b<f;b++)x.setFrame(b,t.readFloat(),t.readStringRef());i.push(x);break}case tn:{let x=t.readInt(!0),b=new Zt(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let C=0,S=0;b.setFrame(C,p,w,v,y,A),C!=g;C++){let I=t.readFloat(),k=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(C);break;case Le:ae(t,b,S++,C,0,p,I,w,k,1),ae(t,b,S++,C,1,p,I,v,Y,1),ae(t,b,S++,C,2,p,I,y,F,1),ae(t,b,S++,C,3,p,I,A,P,1)}p=I,w=k,v=Y,y=F,A=P}i.push(b);break}case sn:{let x=t.readInt(!0),b=new Jt(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,p,w,v,y),A!=g;A++){let S=t.readFloat(),I=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(A);break;case Le:ae(t,b,C++,A,0,p,S,w,I,1),ae(t,b,C++,A,1,p,S,v,k,1),ae(t,b,C++,A,2,p,S,y,Y,1)}p=S,w=I,v=k,y=Y}i.push(b);break}case rn:{let x=t.readInt(!0),b=new Qt(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let k=0,Y=0;b.setFrame(k,p,w,v,y,A,C,S,I),k!=g;k++){let F=t.readFloat(),P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,se=t.readUnsignedByte()/255,te=t.readUnsignedByte()/255,re=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(k);break;case Le:ae(t,b,Y++,k,0,p,F,w,P,1),ae(t,b,Y++,k,1,p,F,v,M,1),ae(t,b,Y++,k,2,p,F,y,R,1),ae(t,b,Y++,k,3,p,F,A,B,1),ae(t,b,Y++,k,4,p,F,C,se,1),ae(t,b,Y++,k,5,p,F,S,te,1),ae(t,b,Y++,k,6,p,F,I,re,1)}p=F,w=P,v=M,y=R,A=B,C=se,S=te,I=re}i.push(b);break}case nn:{let x=t.readInt(!0),b=new $t(f,x,c),p=t.readFloat(),w=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255;for(let I=0,k=0;b.setFrame(I,p,w,v,y,A,C,S),I!=g;I++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,se=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:b.setStepped(I);break;case Le:ae(t,b,k++,I,0,p,Y,w,F,1),ae(t,b,k++,I,1,p,Y,v,P,1),ae(t,b,k++,I,2,p,Y,y,M,1),ae(t,b,k++,I,3,p,Y,A,R,1),ae(t,b,k++,I,4,p,Y,C,B,1),ae(t,b,k++,I,5,p,Y,S,se,1)}p=Y,w=F,v=P,y=M,A=R,C=B,S=se}i.push(b);break}case an:{let x=new Kt(f,t.readInt(!0),c),b=t.readFloat(),p=t.readUnsignedByte()/255;for(let w=0,v=0;x.setFrame(w,b,p),w!=g;w++){let y=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case Pe:x.setStepped(w);break;case Le:ae(t,x,v++,w,0,b,y,p,A,1)}b=y,p=A}i.push(x)}}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readByte(),f=t.readInt(!0);if(m==$r){let x=new jt(f,c);for(let b=0;b<f;b++)x.setFrame(b,t.readFloat(),t.readByte());i.push(x);continue}let g=t.readInt(!0);switch(m){case Gr:i.push(pe(t,new it(f,g,c),1));break;case zr:i.push(Os(t,new Dt(f,g,c),r));break;case qr:i.push(pe(t,new Nt(f,g,c),r));break;case _r:i.push(pe(t,new Ut(f,g,c),r));break;case Hr:i.push(Os(t,new Wt(f,g,c),1));break;case jr:i.push(pe(t,new Gt(f,g,c),1));break;case Zr:i.push(pe(t,new zt(f,g,c),1));break;case Jr:i.push(Os(t,new qt(f,g,c),1));break;case Kr:i.push(pe(t,new _t(f,g,c),1));break;case Qr:i.push(pe(t,new Ht(f,g,c),1))}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new ts(d,t.readInt(!0),c),f=t.readByte(),g=t.readFloat(),x=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,b=(f&4)!=0?t.readFloat()*r:0;for(let p=0,w=0;m.setFrame(p,g,x,b,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),p!=u;p++){f=t.readByte();const v=t.readFloat(),y=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,A=(f&4)!=0?t.readFloat()*r:0;(f&64)!=0?m.setStepped(p):(f&128)!=0&&(ae(t,m,w++,p,0,g,v,x,y,1),ae(t,m,w++,p,1,g,v,b,A,r)),g=v,x=y,b=A}i.push(m)}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,m=new ss(d,t.readInt(!0),c),f=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat(),p=t.readFloat(),w=t.readFloat(),v=t.readFloat();for(let y=0,A=0;m.setFrame(y,f,g,x,b,p,w,v),y!=u;y++){let C=t.readFloat(),S=t.readFloat(),I=t.readFloat(),k=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Pe:m.setStepped(y);break;case Le:ae(t,m,A++,y,0,f,C,g,S,1),ae(t,m,A++,y,1,f,C,x,I,1),ae(t,m,A++,y,2,f,C,b,k,1),ae(t,m,A++,y,3,f,C,p,Y,1),ae(t,m,A++,y,4,f,C,w,F,1),ae(t,m,A++,y,5,f,C,v,P,1)}f=C,g=S,x=I,b=k,p=Y,w=F,v=P}i.push(m)}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,m=t.readInt(!0);u<m;u++){const f=t.readByte(),g=t.readInt(!0),x=t.readInt(!0);switch(f){case hn:i.push(pe(t,new is(g,x,c),d.positionMode==0?r:1));break;case cn:i.push(pe(t,new rs(g,x,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case dn:let b=new ns(g,x,c),p=t.readFloat(),w=t.readFloat(),v=t.readFloat(),y=t.readFloat();for(let A=0,C=0,S=b.getFrameCount()-1;b.setFrame(A,p,w,v,y),A!=S;A++){let I=t.readFloat(),k=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case Pe:b.setStepped(A);break;case Le:ae(t,b,C++,A,0,p,I,w,k,1),ae(t,b,C++,A,1,p,I,v,Y,1),ae(t,b,C++,A,2,p,I,y,F,1)}p=I,w=k,v=Y,y=F}i.push(b)}}}for(let a=0,o=t.readInt(!0);a<o;a++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const m=t.readByte(),f=t.readInt(!0);if(m==bn){const x=new fs(f,c);for(let b=0;b<f;b++)x.setFrame(b,t.readFloat());i.push(x);continue}const g=t.readInt(!0);switch(m){case un:i.push(pe(t,new as(f,g,c),1));break;case fn:i.push(pe(t,new ls(f,g,c),1));break;case mn:i.push(pe(t,new os(f,g,c),1));break;case gn:i.push(pe(t,new hs(f,g,c),1));break;case pn:i.push(pe(t,new cs(f,g,c),1));break;case xn:i.push(pe(t,new ds(f,g,c),1));break;case wn:i.push(pe(t,new us(f,g,c),1))}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let m=t.readInt(!0);for(let f=0,g=t.readInt(!0);f<g;f++){let x=t.readStringRef();if(!x)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,x),p=t.readByte(),w=t.readInt(!0),v=w-1;switch(p){case ln:{let y=b,A=y.bones,C=y.vertices,S=A?C.length/3*2:C.length,I=t.readInt(!0),k=new es(w,I,m,y),Y=t.readFloat();for(let F=0,P=0;;F++){let M,R=t.readInt(!0);if(R==0)M=A?X.newFloatArray(S):C;else{M=X.newFloatArray(S);let se=t.readInt(!0);if(R+=se,r==1)for(let te=se;te<R;te++)M[te]=t.readFloat();else for(let te=se;te<R;te++)M[te]=t.readFloat()*r;if(!A)for(let te=0,re=M.length;te<re;te++)M[te]+=C[te]}if(k.setFrame(F,Y,M),F==v)break;let B=t.readFloat();switch(t.readByte()){case Pe:k.setStepped(F);break;case Le:ae(t,k,P++,F,0,Y,B,0,1,1)}Y=B}i.push(k);break}case on:{let y=new ms(w,m,b);for(let A=0;A<w;A++){let C=t.readFloat(),S=t.readInt32();y.setFrame(A,C,oi[S&15],S>>4,t.readFloat())}i.push(y);break}}}}}let h=t.readInt(!0);if(h>0){let a=new je(h),o=s.slots.length;for(let c=0;c<h;c++){let d=t.readFloat(),u=t.readInt(!0),m=X.newArray(o,0);for(let b=o-1;b>=0;b--)m[b]=-1;let f=X.newArray(o-u,0),g=0,x=0;for(let b=0;b<u;b++){let p=t.readInt(!0);for(;g!=p;)f[x++]=g++;m[g+t.readInt(!0)]=g++}for(;g<o;)f[x++]=g++;for(let b=o-1;b>=0;b--)m[b]==-1&&(m[b]=f[--x]);a.setFrame(c,d,m)}i.push(a)}let l=t.readInt(!0);if(l>0){let a=new ft(l);for(let o=0;o<l;o++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new Ts(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),a.setFrame(o,u)}i.push(a)}let n=0;for(let a=0,o=i.length;a<o;a++)n=Math.max(n,i[a].getDuration());return new dt(e,i,n)}},ki=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Ur=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Wr=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function pe(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let h=0,l=0,n=e.getFrameCount()-1;e.setFrame(h,i,r),h!=n;h++){let a=t.readFloat(),o=t.readFloat()*s;switch(t.readByte()){case Pe:e.setStepped(h);break;case Le:ae(t,e,l++,h,0,i,a,r,o,s)}i=a,r=o}return e}function Os(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,h=t.readFloat()*s;for(let l=0,n=0,a=e.getFrameCount()-1;e.setFrame(l,i,r,h),l!=a;l++){let o=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case Pe:e.setStepped(l);break;case Le:ae(t,e,n++,l,0,i,o,r,c,s),ae(t,e,n++,l,1,i,o,h,d,s)}i=o,r=c,h=d}return e}function ae(t,e,s,i,r,h,l,n,a,o){e.setBezier(s,i,r,h,n,t.readFloat(),t.readFloat()*o,t.readFloat(),t.readFloat()*o,l,a)}var Gr=0,zr=1,qr=2,_r=3,Hr=4,jr=5,Zr=6,Jr=7,Kr=8,Qr=9,$r=10,en=0,tn=1,sn=2,rn=3,nn=4,an=5,ln=0,on=1,hn=0,cn=1,dn=2,un=0,fn=1,mn=2,gn=4,pn=5,xn=6,wn=7,bn=8,Pe=1,Le=2,Yi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new st(()=>X.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=t.slots,l=h.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<l;n++){let a=h[n];if(!a.bone.active)continue;let o=a.getAttachment();if(o instanceof bs){let c=o;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=X.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let h=0,l=r.length;h<l;h++){let n=r[h],a=n;for(let o=0,c=n.length;o<c;o+=2){let d=a[o],u=a[o+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,h=this.minY,l=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=h&&i<=h||t>=l&&s>=l||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),o=a*(r-t)+e;if(o>h&&o<n||(o=a*(l-t)+e,o>h&&o<n))return!0;let c=(h-e)/a+t;return c>r&&c<l||(c=(n-e)/a+t,c>r&&c<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,h=r-2,l=!1;for(let n=0;n<r;n+=2){let a=i[n+1],o=i[h+1];if(a<s&&o>=s||o<s&&a>=s){let c=i[n];c+(s-a)/(o-a)*(i[h]-c)<e&&(l=!l)}h=n}return l}intersectsSegment(t,e,s,i){let r=this.polygons;for(let h=0,l=r.length;h<l;h++)if(this.intersectsSegmentPolygon(r[h],t,e,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,i,r){let h=t,l=t.length,n=e-i,a=s-r,o=e*r-s*i,c=h[l-2],d=h[l-1];for(let u=0;u<l;u+=2){let m=h[u],f=h[u+1],g=c*f-d*m,x=c-m,b=d-f,p=n*b-a*x,w=(o*x-n*g)/p;if((w>=c&&w<=m||w>=m&&w<=c)&&(w>=e&&w<=i||w>=i&&w<=e)){let v=(o*b-a*g)/p;if((v>=d&&v<=f||v>=f&&v<=d)&&(v>=s&&v<=r||v>=r&&v<=s))return!0}c=m,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Fi=class Ae{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new st(()=>new Array);polygonIndicesPool=new st(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=i;n<a;++n)h[n]=Ae.isConcave(n,i,s,r);let l=this.triangles;for(l.length=0;i>3;){let n=i-1,a=0,o=1;for(;;){e:if(!h[a]){let u=r[n]<<1,m=r[a]<<1,f=r[o]<<1,g=s[u],x=s[u+1],b=s[m],p=s[m+1],w=s[f],v=s[f+1];for(let y=(o+1)%i;y!=n;y=(y+1)%i){if(!h[y])continue;let A=r[y]<<1,C=s[A],S=s[A+1];if(Ae.positiveArea(w,v,g,x,C,S)&&Ae.positiveArea(g,x,b,p,C,S)&&Ae.positiveArea(b,p,w,v,C,S))break e}break}if(o==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=o,o=(o+1)%i}l.push(r[(i+a-1)%i]),l.push(r[a]),l.push(r[(a+1)%i]),r.splice(a,1),h.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;h[c]=Ae.isConcave(c,i,s,r),h[d]=Ae.isConcave(d,i,s,r)}return i==3&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,o=0;for(let c=0,d=s.length;c<d;c+=3){let u=s[c]<<1,m=s[c+1]<<1,f=s[c+2]<<1,g=i[u],x=i[u+1],b=i[m],p=i[m+1],w=i[f],v=i[f+1],y=!1;if(a==u){let A=n.length-4,C=Ae.winding(n[A],n[A+1],n[A+2],n[A+3],w,v),S=Ae.winding(w,v,n[0],n[1],n[2],n[3]);C==o&&S==o&&(n.push(w),n.push(v),l.push(f),y=!0)}y||(n.length>0?(r.push(n),h.push(l)):(this.polygonPool.free(n),this.polygonIndicesPool.free(l)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(x),n.push(b),n.push(p),n.push(w),n.push(v),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(u),l.push(m),l.push(f),o=Ae.winding(g,x,b,p,w,v),a=u)}n.length>0&&(r.push(n),h.push(l));for(let c=0,d=r.length;c<d;c++){if(l=h[c],l.length==0)continue;let u=l[0],m=l[l.length-1];n=r[c];let f=n.length-4,g=n[f],x=n[f+1],b=n[f+2],p=n[f+3],w=n[0],v=n[1],y=n[2],A=n[3],C=Ae.winding(g,x,b,p,w,v);for(let S=0;S<d;S++){if(S==c)continue;let I=h[S];if(I.length!=3)continue;let k=I[0],Y=I[1],F=I[2],P=r[S],M=P[P.length-2],R=P[P.length-1];if(k!=u||Y!=m)continue;let B=Ae.winding(g,x,b,p,M,R),se=Ae.winding(M,R,w,v,y,A);B==C&&se==C&&(P.length=0,I.length=0,n.push(M),n.push(R),l.push(F),g=b,x=p,b=M,p=R,S=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return r}static isConcave(e,s,i,r){let h=r[(s+e-1)%s]<<1,l=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[l],i[l+1],i[n],i[n+1])}static positiveArea(e,s,i,r,h,l){return e*(l-r)+i*(s-l)+h*(r-s)>=0}static winding(e,s,i,r,h,l){let n=i-e,a=r-s;return h*a-l*n+n*s-e*a>=0?1:-1}},vt=class ei{triangulator=new Fi;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=X.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let h=this.clippingPolygon;ei.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=l.length;n<a;n++){let o=l[n];ei.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,h,l,n,a){let o,c,d,u,m,f;typeof s=="number"?(o=i,c=r,d=h,u=l,m=n,f=a):(o=s,c=i,d=r,u=h,m=l,f=n),d&&u&&m&&typeof f=="boolean"?this.clipTrianglesRender(e,o,c,d,u,m,f):this.clipTrianglesNoRender(e,o,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,h=this.clippedVertices,l=this.clippedTriangles,n=this.clippingPolygons,a=n.length,o=0;h.length=0,l.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,u=e[d],m=e[d+1];d=s[c+1]<<1;let f=e[d],g=e[d+1];d=s[c+2]<<1;let x=e[d],b=e[d+1];for(let p=0;p<a;p++){let w=h.length;if(this.clip(u,m,f,g,x,b,n[p],r)){let v=r.length;if(v==0)continue;let y=v>>1,A=this.clipOutput,C=X.setArraySize(h,w+y*2);for(let I=0;I<v;I+=2,w+=2){let k=A[I],Y=A[I+1];C[w]=k,C[w+1]=Y}w=l.length;let S=X.setArraySize(l,w+3*(y-2));y--;for(let I=1;I<y;I++,w+=3)S[w]=o,S[w+1]=o+I,S[w+2]=o+I+1;o+=y+1}else{let v=X.setArraySize(h,w+6);v[w]=u,v[w+1]=m,v[w+2]=f,v[w+3]=g,v[w+4]=x,v[w+5]=b,w=l.length;let y=X.setArraySize(l,w+3);y[w]=o,y[w+1]=o+1,y[w+2]=o+2,o+=3;break}}}}clipTrianglesRender(e,s,i,r,h,l,n){let a=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=n?12:8,f=0;o.length=0,c.length=0;for(let g=0;g<i;g+=3){let x=s[g]<<1,b=e[x],p=e[x+1],w=r[x],v=r[x+1];x=s[g+1]<<1;let y=e[x],A=e[x+1],C=r[x],S=r[x+1];x=s[g+2]<<1;let I=e[x],k=e[x+1],Y=r[x],F=r[x+1];for(let P=0;P<u;P++){let M=o.length;if(this.clip(b,p,y,A,I,k,d[P],a)){let R=a.length;if(R==0)continue;let B=A-k,se=I-y,te=b-I,re=k-p,de=1/(B*te+se*(p-k)),oe=R>>1,me=this.clipOutput,Z=X.setArraySize(o,M+oe*m);for(let he=0;he<R;he+=2,M+=m){let ve=me[he],ge=me[he+1];Z[M]=ve,Z[M+1]=ge,Z[M+2]=h.r,Z[M+3]=h.g,Z[M+4]=h.b,Z[M+5]=h.a;let we=ve-I,be=ge-k,Re=(B*we+se*be)*de,$e=(re*we+te*be)*de,ot=1-Re-$e;Z[M+6]=w*Re+C*$e+Y*ot,Z[M+7]=v*Re+S*$e+F*ot,n&&(Z[M+8]=l.r,Z[M+9]=l.g,Z[M+10]=l.b,Z[M+11]=l.a)}M=c.length;let ne=X.setArraySize(c,M+3*(oe-2));oe--;for(let he=1;he<oe;he++,M+=3)ne[M]=f,ne[M+1]=f+he,ne[M+2]=f+he+1;f+=oe+1}else{let R=X.setArraySize(o,M+3*m);R[M]=b,R[M+1]=p,R[M+2]=h.r,R[M+3]=h.g,R[M+4]=h.b,R[M+5]=h.a,n?(R[M+6]=w,R[M+7]=v,R[M+8]=l.r,R[M+9]=l.g,R[M+10]=l.b,R[M+11]=l.a,R[M+12]=y,R[M+13]=A,R[M+14]=h.r,R[M+15]=h.g,R[M+16]=h.b,R[M+17]=h.a,R[M+18]=C,R[M+19]=S,R[M+20]=l.r,R[M+21]=l.g,R[M+22]=l.b,R[M+23]=l.a,R[M+24]=I,R[M+25]=k,R[M+26]=h.r,R[M+27]=h.g,R[M+28]=h.b,R[M+29]=h.a,R[M+30]=Y,R[M+31]=F,R[M+32]=l.r,R[M+33]=l.g,R[M+34]=l.b,R[M+35]=l.a):(R[M+6]=w,R[M+7]=v,R[M+8]=y,R[M+9]=A,R[M+10]=h.r,R[M+11]=h.g,R[M+12]=h.b,R[M+13]=h.a,R[M+14]=C,R[M+15]=S,R[M+16]=I,R[M+17]=k,R[M+18]=h.r,R[M+19]=h.g,R[M+20]=h.b,R[M+21]=h.a,R[M+22]=Y,R[M+23]=F),M=c.length;let B=X.setArraySize(c,M+3);B[M]=f,B[M+1]=f+1,B[M+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let h=this.clipOutput,l=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,o=this.clippingPolygons,c=o.length,d=0;l.length=0,n.length=0,a.length=0;for(let u=0;u<i;u+=3){let m=s[u]<<1,f=e[m],g=e[m+1],x=r[m],b=r[m+1];m=s[u+1]<<1;let p=e[m],w=e[m+1],v=r[m],y=r[m+1];m=s[u+2]<<1;let A=e[m],C=e[m+1],S=r[m],I=r[m+1];for(let k=0;k<c;k++){let Y=l.length;if(this.clip(f,g,p,w,A,C,o[k],h)){let F=h.length;if(F==0)continue;let P=w-C,M=A-p,R=f-A,B=C-g,se=1/(P*R+M*(g-C)),te=F>>1,re=this.clipOutput,de=X.setArraySize(l,Y+te*2),oe=X.setArraySize(n,Y+te*2);for(let Z=0;Z<F;Z+=2,Y+=2){let ne=re[Z],he=re[Z+1];de[Y]=ne,de[Y+1]=he;let ve=ne-A,ge=he-C,we=(P*ve+M*ge)*se,be=(B*ve+R*ge)*se,Re=1-we-be;oe[Y]=x*we+v*be+S*Re,oe[Y+1]=b*we+y*be+I*Re}Y=a.length;let me=X.setArraySize(a,Y+3*(te-2));te--;for(let Z=1;Z<te;Z++,Y+=3)me[Y]=d,me[Y+1]=d+Z,me[Y+2]=d+Z+1;d+=te+1}else{let F=X.setArraySize(l,Y+6);F[Y]=f,F[Y+1]=g,F[Y+2]=p,F[Y+3]=w,F[Y+4]=A,F[Y+5]=C;let P=X.setArraySize(n,Y+3*2);P[Y]=x,P[Y+1]=b,P[Y+2]=v,P[Y+3]=y,P[Y+4]=S,P[Y+5]=I,Y=a.length;let M=X.setArraySize(a,Y+3);M[Y]=d,M[Y+1]=d+1,M[Y+2]=d+2,d+=3;break}}}}clip(e,s,i,r,h,l,n,a){let o=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(h),d.push(l),d.push(e),d.push(s),a.length=0;let u=n.length-4,m=n;for(let f=0;;f+=2){let g=m[f],x=m[f+1],b=g-m[f+2],p=x-m[f+3],w=a.length,v=d;for(let A=0,C=d.length-2;A<C;){let S=v[A],I=v[A+1];A+=2;let k=v[A],Y=v[A+1],F=p*(g-k)>b*(x-Y),P=p*(g-S)-b*(x-I);if(P>0){if(F){a.push(k),a.push(Y);continue}let M=k-S,R=Y-I,B=P/(M*p-R*b);if(B>=0&&B<=1)a.push(S+M*B),a.push(I+R*B);else{a.push(k),a.push(Y);continue}}else if(F){let M=k-S,R=Y-I,B=P/(M*p-R*b);if(B>=0&&B<=1)a.push(S+M*B),a.push(I+R*B),a.push(k),a.push(Y);else{a.push(k),a.push(Y);continue}}c=!0}if(w==a.length)return o.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==u)break;let y=a;a=d,a.length=0,d=y}if(o!=a){o.length=0;for(let f=0,g=a.length-2;f<g;f++)o[f]=a[f]}else o.length=o.length-2;return c}static makeClockwise(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,l=0,n=0,a=0;for(let o=0,c=i-3;o<c;o+=2)h=s[o],l=s[o+1],n=s[o+2],a=s[o+3],r+=h*a-n*l;if(!(r<0))for(let o=0,c=i-2,d=i>>1;o<d;o+=2){let u=s[o],m=s[o+1],f=c-o;s[o]=s[f],s[o+1]=s[f+1],s[f]=u,s[f+1]=m}}},Pi=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Fs,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=E(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let l=i.bones[h],n=null,a=E(l,"parent",null);a&&(n=s.findBone(a));let o=new As(s.bones.length,l.name,n);o.length=E(l,"length",0)*e,o.x=E(l,"x",0)*e,o.y=E(l,"y",0)*e,o.rotation=E(l,"rotation",0),o.scaleX=E(l,"scaleX",1),o.scaleY=E(l,"scaleY",1),o.shearX=E(l,"shearX",0),o.shearY=E(l,"shearY",0),o.inherit=X.enumValue(bt,E(l,"inherit","Normal")),o.skinRequired=E(l,"skin",!1);let c=E(l,"color",null);c&&o.color.setFromString(c),s.bones.push(o)}if(i.slots)for(let h=0;h<i.slots.length;h++){let l=i.slots[h],n=l.name,a=s.findBone(l.bone);if(!a)throw new Error(`Couldn't find bone ${l.bone} for slot ${n}`);let o=new Ls(s.slots.length,n,a),c=E(l,"color",null);c&&o.color.setFromString(c);let d=E(l,"dark",null);d&&(o.darkColor=K.fromString(d)),o.attachmentName=E(l,"attachment",null),o.blendMode=X.enumValue(Xs,E(l,"blend","normal")),o.visible=E(l,"visible",!0),s.slots.push(o)}if(i.ik)for(let h=0;h<i.ik.length;h++){let l=i.ik[h],n=new Ms(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let o=0;o<l.bones.length;o++){let c=s.findBone(l.bones[o]);if(!c)throw new Error(`Couldn't find bone ${l.bones[o]} for IK constraint ${l.name}.`);n.bones.push(c)}let a=s.findBone(l.target);if(!a)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);n.target=a,n.mix=E(l,"mix",1),n.softness=E(l,"softness",0)*e,n.bendDirection=E(l,"bendPositive",!0)?1:-1,n.compress=E(l,"compress",!1),n.stretch=E(l,"stretch",!1),n.uniform=E(l,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let h=0;h<i.transform.length;h++){let l=i.transform[h],n=new Bs(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);n.bones.push(u)}let a=l.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${l.name}.`);n.target=o,n.local=E(l,"local",!1),n.relative=E(l,"relative",!1),n.offsetRotation=E(l,"rotation",0),n.offsetX=E(l,"x",0)*e,n.offsetY=E(l,"y",0)*e,n.offsetScaleX=E(l,"scaleX",0),n.offsetScaleY=E(l,"scaleY",0),n.offsetShearY=E(l,"shearY",0),n.mixRotate=E(l,"mixRotate",1),n.mixX=E(l,"mixX",1),n.mixY=E(l,"mixY",n.mixX),n.mixScaleX=E(l,"mixScaleX",1),n.mixScaleY=E(l,"mixScaleY",n.mixScaleX),n.mixShearY=E(l,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let h=0;h<i.path.length;h++){let l=i.path[h],n=new Es(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);n.bones.push(u)}let a=l.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${l.name}.`);n.target=o,n.positionMode=X.enumValue(Rs,E(l,"positionMode","Percent")),n.spacingMode=X.enumValue(ks,E(l,"spacingMode","Length")),n.rotateMode=X.enumValue(Ys,E(l,"rotateMode","Tangent")),n.offsetRotation=E(l,"rotation",0),n.position=E(l,"position",0),n.positionMode==0&&(n.position*=e),n.spacing=E(l,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=e),n.mixRotate=E(l,"mixRotate",1),n.mixX=E(l,"mixX",1),n.mixY=E(l,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let h=0;h<i.physics.length;h++){const l=i.physics[h],n=new Ei(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);const a=l.bone,o=s.findBone(a);if(o==null)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=E(l,"x",0),n.y=E(l,"y",0),n.rotate=E(l,"rotate",0),n.scaleX=E(l,"scaleX",0),n.shearX=E(l,"shearX",0),n.limit=E(l,"limit",5e3)*e,n.step=1/E(l,"fps",60),n.inertia=E(l,"inertia",1),n.strength=E(l,"strength",100),n.damping=E(l,"damping",1),n.massInverse=1/E(l,"mass",1),n.wind=E(l,"wind",0),n.gravity=E(l,"gravity",0),n.mix=E(l,"mix",1),n.inertiaGlobal=E(l,"inertiaGlobal",!1),n.strengthGlobal=E(l,"strengthGlobal",!1),n.dampingGlobal=E(l,"dampingGlobal",!1),n.massGlobal=E(l,"massGlobal",!1),n.windGlobal=E(l,"windGlobal",!1),n.gravityGlobal=E(l,"gravityGlobal",!1),n.mixGlobal=E(l,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let h=0;h<i.skins.length;h++){let l=i.skins[h],n=new at(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let o=l.bones[a],c=s.findBone(o);if(!c)throw new Error(`Couldn't find bone ${o} for skin ${l.name}.`);n.bones.push(c)}if(l.ik)for(let a=0;a<l.ik.length;a++){let o=l.ik[a],c=s.findIkConstraint(o);if(!c)throw new Error(`Couldn't find IK constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.transform)for(let a=0;a<l.transform.length;a++){let o=l.transform[a],c=s.findTransformConstraint(o);if(!c)throw new Error(`Couldn't find transform constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.path)for(let a=0;a<l.path.length;a++){let o=l.path[a],c=s.findPathConstraint(o);if(!c)throw new Error(`Couldn't find path constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.physics)for(let a=0;a<l.physics.length;a++){let o=l.physics[a],c=s.findPhysicsConstraint(o);if(!c)throw new Error(`Couldn't find physics constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}for(let a in l.attachments){let o=s.findSlot(a);if(!o)throw new Error(`Couldn't find slot ${a} for skin ${l.name}.`);let c=l.attachments[a];for(let d in c){let u=this.readAttachment(c[d],n,o.index,d,s);u&&n.setAttachment(o.index,d,u)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let o=a.getAttachment(n.slotIndex,n.parent);if(!o)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?o:n.mesh,n.mesh.setParentMesh(o),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let l=i.events[h],n=new Is(h);n.intValue=E(l,"int",0),n.floatValue=E(l,"float",0),n.stringValue=E(l,"string",""),n.audioPath=E(l,"audio",null),n.audioPath&&(n.volume=E(l,"volume",1),n.balance=E(l,"balance",0)),s.events.push(n)}if(i.animations)for(let h in i.animations){let l=i.animations[h];this.readAnimation(l,h,s)}return s}readAttachment(t,e,s,i,r){let h=this.scale;switch(i=E(t,"name",i),E(t,"type","region")){case"region":{let l=E(t,"path",i),n=this.readSequence(E(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,l,n);if(!a)return null;a.path=l,a.x=E(t,"x",0)*h,a.y=E(t,"y",0)*h,a.scaleX=E(t,"scaleX",1),a.scaleY=E(t,"scaleY",1),a.rotation=E(t,"rotation",0),a.width=t.width*h,a.height=t.height*h,a.sequence=n;let o=E(t,"color",null);return o&&a.color.setFromString(o),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let n=E(t,"color",null);return n&&l.color.setFromString(n),l}case"mesh":case"linkedmesh":{let l=E(t,"path",i),n=this.readSequence(E(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,l,n);if(!a)return null;a.path=l;let o=E(t,"color",null);o&&a.color.setFromString(o),a.width=E(t,"width",0)*h,a.height=E(t,"height",0)*h,a.sequence=n;let c=E(t,"parent",null);if(c)return this.linkedMeshes.push(new vn(a,E(t,"skin",null),s,c,E(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=E(t,"edges",null),a.hullLength=E(t,"hull",0)*2,a}case"path":{let l=this.attachmentLoader.newPathAttachment(e,i);if(!l)return null;l.closed=E(t,"closed",!1),l.constantSpeed=E(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,l,n<<1);let a=X.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*h;l.lengths=a;let o=E(t,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,i);if(!l)return null;l.x=E(t,"x",0)*h,l.y=E(t,"y",0)*h,l.rotation=E(t,"rotation",0);let n=E(t,"color",null);return n&&l.color.setFromString(n),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,i);if(!l)return null;let n=E(t,"end",null);n&&(l.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,l,a<<1);let o=E(t,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(t){if(t==null)return null;let e=new ai(E(t,"count",0));return e.start=E(t,"start",1),e.digits=E(t,"digits",0),e.setupIndex=E(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=X.toFloatArray(r);if(i!=1)for(let a=0,o=r.length;a<o;a++)n[a]*=i;e.vertices=n;return}let h=new Array,l=new Array;for(let n=0,a=r.length;n<a;){let o=r[n++];l.push(o);for(let c=n+o*4;n<c;n+=4)l.push(r[n]),h.push(r[n+1]*i),h.push(r[n+2]*i),h.push(r[n+3])}e.bones=l,e.vertices=X.toFloatArray(h)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let l in t.slots){let n=t.slots[l],a=s.findSlot(l);if(!a)throw new Error("Slot not found: "+l);let o=a.index;for(let c in n){let d=n[c];if(!d)continue;let u=d.length;if(c=="attachment"){let m=new We(u,o);for(let f=0;f<u;f++){let g=d[f];m.setFrame(f,E(g,"time",0),E(g,"name",null))}r.push(m)}else if(c=="rgba"){let m=new Zt(u,u<<2,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.color);for(let b=0,p=0;;b++){m.setFrame(b,g,x.r,x.g,x.b,x.a);let w=d[b+1];if(!w){m.shrink(p);break}let v=E(w,"time",0),y=K.fromString(w.color),A=f.curve;A&&(p=le(A,m,p,b,0,g,v,x.r,y.r,1),p=le(A,m,p,b,1,g,v,x.g,y.g,1),p=le(A,m,p,b,2,g,v,x.b,y.b,1),p=le(A,m,p,b,3,g,v,x.a,y.a,1)),g=v,x=y,f=w}r.push(m)}else if(c=="rgb"){let m=new Jt(u,u*3,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.color);for(let b=0,p=0;;b++){m.setFrame(b,g,x.r,x.g,x.b);let w=d[b+1];if(!w){m.shrink(p);break}let v=E(w,"time",0),y=K.fromString(w.color),A=f.curve;A&&(p=le(A,m,p,b,0,g,v,x.r,y.r,1),p=le(A,m,p,b,1,g,v,x.g,y.g,1),p=le(A,m,p,b,2,g,v,x.b,y.b,1)),g=v,x=y,f=w}r.push(m)}else if(c=="alpha")r.push(Ie(d,new Kt(u,u,o),0,1));else if(c=="rgba2"){let m=new Qt(u,u*7,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.light),b=K.fromString(f.dark);for(let p=0,w=0;;p++){m.setFrame(p,g,x.r,x.g,x.b,x.a,b.r,b.g,b.b);let v=d[p+1];if(!v){m.shrink(w);break}let y=E(v,"time",0),A=K.fromString(v.light),C=K.fromString(v.dark),S=f.curve;S&&(w=le(S,m,w,p,0,g,y,x.r,A.r,1),w=le(S,m,w,p,1,g,y,x.g,A.g,1),w=le(S,m,w,p,2,g,y,x.b,A.b,1),w=le(S,m,w,p,3,g,y,x.a,A.a,1),w=le(S,m,w,p,4,g,y,b.r,C.r,1),w=le(S,m,w,p,5,g,y,b.g,C.g,1),w=le(S,m,w,p,6,g,y,b.b,C.b,1)),g=y,x=A,b=C,f=v}r.push(m)}else if(c=="rgb2"){let m=new $t(u,u*6,o),f=d[0],g=E(f,"time",0),x=K.fromString(f.light),b=K.fromString(f.dark);for(let p=0,w=0;;p++){m.setFrame(p,g,x.r,x.g,x.b,b.r,b.g,b.b);let v=d[p+1];if(!v){m.shrink(w);break}let y=E(v,"time",0),A=K.fromString(v.light),C=K.fromString(v.dark),S=f.curve;S&&(w=le(S,m,w,p,0,g,y,x.r,A.r,1),w=le(S,m,w,p,1,g,y,x.g,A.g,1),w=le(S,m,w,p,2,g,y,x.b,A.b,1),w=le(S,m,w,p,3,g,y,b.r,C.r,1),w=le(S,m,w,p,4,g,y,b.g,C.g,1),w=le(S,m,w,p,5,g,y,b.b,C.b,1)),g=y,x=A,b=C,f=v}r.push(m)}}}if(t.bones)for(let l in t.bones){let n=t.bones[l],a=s.findBone(l);if(!a)throw new Error("Bone not found: "+l);let o=a.index;for(let c in n){let d=n[c],u=d.length;if(u!=0){if(c==="rotate")r.push(Ie(d,new it(u,u,o),0,1));else if(c==="translate"){let m=new Dt(u,u<<1,o);r.push(Vs(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new Nt(u,u,o);r.push(Ie(d,m,0,i))}else if(c==="translatey"){let m=new Ut(u,u,o);r.push(Ie(d,m,0,i))}else if(c==="scale"){let m=new Wt(u,u<<1,o);r.push(Vs(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Gt(u,u,o);r.push(Ie(d,m,1,1))}else if(c==="scaley"){let m=new zt(u,u,o);r.push(Ie(d,m,1,1))}else if(c==="shear"){let m=new qt(u,u<<1,o);r.push(Vs(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new _t(u,u,o);r.push(Ie(d,m,0,1))}else if(c==="sheary"){let m=new Ht(u,u,o);r.push(Ie(d,m,0,1))}else if(c==="inherit"){let m=new jt(u,a.index);for(let f=0;f<d.length;f++){let g=d[f];m.setFrame(f,E(g,"time",0),X.enumValue(bt,E(g,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let l in t.ik){let n=t.ik[l],a=n[0];if(!a)continue;let o=s.findIkConstraint(l);if(!o)throw new Error("IK Constraint not found: "+l);let c=s.ikConstraints.indexOf(o),d=new ts(n.length,n.length<<1,c),u=E(a,"time",0),m=E(a,"mix",1),f=E(a,"softness",0)*i;for(let g=0,x=0;;g++){d.setFrame(g,u,m,f,E(a,"bendPositive",!0)?1:-1,E(a,"compress",!1),E(a,"stretch",!1));let b=n[g+1];if(!b){d.shrink(x);break}let p=E(b,"time",0),w=E(b,"mix",1),v=E(b,"softness",0)*i,y=a.curve;y&&(x=le(y,d,x,g,0,u,p,m,w,1),x=le(y,d,x,g,1,u,p,f,v,i)),u=p,m=w,f=v,a=b}r.push(d)}if(t.transform)for(let l in t.transform){let n=t.transform[l],a=n[0];if(!a)continue;let o=s.findTransformConstraint(l);if(!o)throw new Error("Transform constraint not found: "+l);let c=s.transformConstraints.indexOf(o),d=new ss(n.length,n.length*6,c),u=E(a,"time",0),m=E(a,"mixRotate",1),f=E(a,"mixX",1),g=E(a,"mixY",f),x=E(a,"mixScaleX",1),b=E(a,"mixScaleY",x),p=E(a,"mixShearY",1);for(let w=0,v=0;;w++){d.setFrame(w,u,m,f,g,x,b,p);let y=n[w+1];if(!y){d.shrink(v);break}let A=E(y,"time",0),C=E(y,"mixRotate",1),S=E(y,"mixX",1),I=E(y,"mixY",S),k=E(y,"mixScaleX",1),Y=E(y,"mixScaleY",k),F=E(y,"mixShearY",1),P=a.curve;P&&(v=le(P,d,v,w,0,u,A,m,C,1),v=le(P,d,v,w,1,u,A,f,S,1),v=le(P,d,v,w,2,u,A,g,I,1),v=le(P,d,v,w,3,u,A,x,k,1),v=le(P,d,v,w,4,u,A,b,Y,1),v=le(P,d,v,w,5,u,A,p,F,1)),u=A,m=C,f=S,g=I,x=k,b=Y,x=k,a=y}r.push(d)}if(t.path)for(let l in t.path){let n=t.path[l],a=s.findPathConstraint(l);if(!a)throw new Error("Path constraint not found: "+l);let o=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],u=d[0];if(!u)continue;let m=d.length;if(c==="position"){let f=new is(m,m,o);r.push(Ie(d,f,0,a.positionMode==0?i:1))}else if(c==="spacing"){let f=new rs(m,m,o);r.push(Ie(d,f,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let f=new ns(m,m*3,o),g=E(u,"time",0),x=E(u,"mixRotate",1),b=E(u,"mixX",1),p=E(u,"mixY",b);for(let w=0,v=0;;w++){f.setFrame(w,g,x,b,p);let y=d[w+1];if(!y){f.shrink(v);break}let A=E(y,"time",0),C=E(y,"mixRotate",1),S=E(y,"mixX",1),I=E(y,"mixY",S),k=u.curve;k&&(v=le(k,f,v,w,0,g,A,x,C,1),v=le(k,f,v,w,1,g,A,b,S,1),v=le(k,f,v,w,2,g,A,p,I,1)),g=A,x=C,b=S,p=I,u=y}r.push(f)}}}if(t.physics)for(let l in t.physics){let n=t.physics[l],a=-1;if(l.length>0){let o=s.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);a=s.physicsConstraints.indexOf(o)}for(let o in n){let c=n[o],d=c[0];if(!d)continue;let u=c.length;if(o=="reset"){const f=new fs(u,a);for(let g=0;d!=null;d=c[g+1],g++)f.setFrame(g,E(d,"time",0));r.push(f);continue}let m;if(o=="inertia")m=new as(u,u,a);else if(o=="strength")m=new ls(u,u,a);else if(o=="damping")m=new os(u,u,a);else if(o=="mass")m=new hs(u,u,a);else if(o=="wind")m=new cs(u,u,a);else if(o=="gravity")m=new ds(u,u,a);else if(o=="mix")m=new us(u,u,a);else continue;r.push(Ie(c,m,0,1))}}if(t.attachments)for(let l in t.attachments){let n=t.attachments[l],a=s.findSkin(l);if(!a)throw new Error("Skin not found: "+l);for(let o in n){let c=n[o],d=s.findSlot(o);if(!d)throw new Error("Slot not found: "+o);let u=d.index;for(let m in c){let f=c[m],g=a.getAttachment(u,m);for(let x in f){let b=f[x],p=b[0];if(p){if(x=="deform"){let w=g.bones,v=g.vertices,y=w?v.length/3*2:v.length,A=new es(b.length,b.length,u,g),C=E(p,"time",0);for(let S=0,I=0;;S++){let k,Y=E(p,"vertices",null);if(!Y)k=w?X.newFloatArray(y):v;else{k=X.newFloatArray(y);let R=E(p,"offset",0);if(X.arrayCopy(Y,0,k,R,Y.length),i!=1)for(let B=R,se=B+Y.length;B<se;B++)k[B]*=i;if(!w)for(let B=0;B<y;B++)k[B]+=v[B]}A.setFrame(S,C,k);let F=b[S+1];if(!F){A.shrink(I);break}let P=E(F,"time",0),M=p.curve;M&&(I=le(M,A,I,S,0,C,P,0,1,1)),C=P,p=F}r.push(A)}else if(x=="sequence"){let w=new ms(b.length,u,g),v=0;for(let y=0;y<b.length;y++){let A=E(p,"delay",v),C=E(p,"time",0),S=li[E(p,"mode","hold")],I=E(p,"index",0);w.setFrame(y,C,S,I,A),v=A,p=b[y+1]}r.push(w)}}}}}}if(t.drawOrder){let l=new je(t.drawOrder.length),n=s.slots.length,a=0;for(let o=0;o<t.drawOrder.length;o++,a++){let c=t.drawOrder[o],d=null,u=E(c,"offsets",null);if(u){d=X.newArray(n,-1);let m=X.newArray(n-u.length,0),f=0,g=0;for(let x=0;x<u.length;x++){let b=u[x],p=s.findSlot(b.slot);if(!p)throw new Error("Slot not found: "+p);let w=p.index;for(;f!=w;)m[g++]=f++;d[f+b.offset]=f++}for(;f<n;)m[g++]=f++;for(let x=n-1;x>=0;x--)d[x]==-1&&(d[x]=m[--g])}l.setFrame(a,E(c,"time",0),d)}r.push(l)}if(t.events){let l=new ft(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let o=t.events[a],c=s.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let d=new Ts(X.toSinglePrecision(E(o,"time",0)),c);d.intValue=E(o,"int",c.intValue),d.floatValue=E(o,"float",c.floatValue),d.stringValue=E(o,"string",c.stringValue),d.data.audioPath&&(d.volume=E(o,"volume",1),d.balance=E(o,"balance",0)),l.setFrame(n,d)}r.push(l)}let h=0;for(let l=0,n=r.length;l<n;l++)h=Math.max(h,r[l].getDuration());s.animations.push(new dt(e,r,h))}},vn=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function Ie(t,e,s,i){let r=t[0],h=E(r,"time",0),l=E(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,h,l);let o=t[a+1];if(!o)return e.shrink(n),e;let c=E(o,"time",0),d=E(o,"value",s)*i;r.curve&&(n=le(r.curve,e,n,a,0,h,c,l,d,i)),h=c,l=d,r=o}}function Vs(t,e,s,i,r,h){let l=t[0],n=E(l,"time",0),a=E(l,s,r)*h,o=E(l,i,r)*h,c=0;for(let d=0;;d++){e.setFrame(d,n,a,o);let u=t[d+1];if(!u)return e.shrink(c),e;let m=E(u,"time",0),f=E(u,s,r)*h,g=E(u,i,r)*h,x=l.curve;x&&(c=le(x,e,c,d,0,n,m,a,f,h),c=le(x,e,c,d,1,n,m,o,g,h)),n=m,a=f,o=g,l=u}}function le(t,e,s,i,r,h,l,n,a,o){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],u=t[c+1]*o,m=t[c+2],f=t[c+3]*o;return e.setBezier(s,i,r,h,n,d,u,m,f,l,a),s+1}function E(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var yn=class extends pt{constructor(t){super(t)}setFilters(t,e){}setWraps(t,e){}dispose(){}},An=X.newFloatArray(8),Cn=class Pt{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=X.newFloatArray(8*1024);tempColor=new K;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,i=this.tempColor,r=e.color,h=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let l=0,n=h.length;l<n;l++){let a=h[l],o=a.bone;if(!o.active)continue;let c=a.getAttachment();if(!(c instanceof ce))continue;c.computeWorldVertices(a,An,0,2);let d=c.region,u=d.texture.getImage(),m=a.color,f=c.color;i.set(r.r*m.r*f.r,r.g*m.g*f.g,r.b*m.b*f.b,r.a*m.a*f.a),s.save(),s.transform(o.a,o.c,o.b,o.d,o.worldX,o.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let g=c.width/d.originalWidth;s.scale(g*c.scaleX,g*c.scaleY);let x=d.width,b=d.height;if(s.translate(x/2,b/2),c.region.degrees==90){let p=x;x=b,b=p,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-x/2,-b/2),s.globalAlpha=i.a,s.drawImage(u,u.width*d.u,u.height*d.v,x,b,0,0,x,b),this.debugRendering&&s.strokeRect(0,0,x,b),s.restore()}}drawTriangles(e){let s=this.ctx,i=this.tempColor,r=e.color,h=e.drawOrder,l=null,n=this.vertices,a=null;for(let c=0,d=h.length;c<d;c++){let u=h[c],m=u.getAttachment(),f,g;if(m instanceof ce){let x=m;n=this.computeRegionVertices(u,x,!1),a=Pt.QUAD_TRIANGLES,f=x.region.texture.getImage()}else if(m instanceof Ge){let x=m;n=this.computeMeshVertices(u,x,!1),a=x.triangles,f=x.region.texture.getImage()}else continue;if(f){u.data.blendMode!=l&&(l=u.data.blendMode);let x=u.color,b=m.color;i.set(r.r*x.r*b.r,r.g*x.g*b.g,r.b*x.b*b.b,r.a*x.a*b.a),s.globalAlpha=i.a;for(var o=0;o<a.length;o+=3){let p=a[o]*8,w=a[o+1]*8,v=a[o+2]*8,y=n[p],A=n[p+1],C=n[p+6],S=n[p+7],I=n[w],k=n[w+1],Y=n[w+6],F=n[w+7],P=n[v],M=n[v+1],R=n[v+6],B=n[v+7];this.drawTriangle(f,y,A,C,S,I,k,Y,F,P,M,R,B),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(y,A),s.lineTo(I,k),s.lineTo(P,M),s.lineTo(y,A),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,i,r,h,l,n,a,o,c,d,u,m){let f=this.ctx;const g=e.width-1,x=e.height-1;r*=g,h*=x,a*=g,o*=x,u*=g,m*=x,f.beginPath(),f.moveTo(s,i),f.lineTo(l,n),f.lineTo(c,d),f.closePath(),l-=s,n-=i,c-=s,d-=i,a-=r,o-=h,u-=r,m-=h;let b=a*m-u*o;if(b==0)return;b=1/b;const p=(m*l-o*c)*b,w=(m*n-o*d)*b,v=(a*c-u*l)*b,y=(a*d-u*n)*b,A=s-p*r-v*h,C=i-w*r-y*h;f.save(),f.transform(p,w,v,y,A,C),f.clip(),f.drawImage(e,0,0),f.restore()}computeRegionVertices(e,s,i){let r=e.bone.skeleton.color,h=e.color,l=s.color,n=r.a*h.a*l.a,a=i?n:1,o=this.tempColor;o.set(r.r*h.r*l.r*a,r.g*h.g*l.g*a,r.b*h.b*l.b*a,n),s.computeWorldVertices(e,this.vertices,0,Pt.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[ce.C1R]=o.r,c[ce.C1G]=o.g,c[ce.C1B]=o.b,c[ce.C1A]=o.a,c[ce.U1]=d[0],c[ce.V1]=d[1],c[ce.C2R]=o.r,c[ce.C2G]=o.g,c[ce.C2B]=o.b,c[ce.C2A]=o.a,c[ce.U2]=d[2],c[ce.V2]=d[3],c[ce.C3R]=o.r,c[ce.C3G]=o.g,c[ce.C3B]=o.b,c[ce.C3A]=o.a,c[ce.U3]=d[4],c[ce.V3]=d[5],c[ce.C4R]=o.r,c[ce.C4G]=o.g,c[ce.C4B]=o.b,c[ce.C4A]=o.a,c[ce.U4]=d[6],c[ce.V4]=d[7],c}computeMeshVertices(e,s,i){let r=e.bone.skeleton.color,h=e.color,l=s.color,n=r.a*h.a*l.a,a=i?n:1,o=this.tempColor;o.set(r.r*h.r*l.r*a,r.g*h.g*l.g*a,r.b*h.b*l.b*a,n);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=X.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,Pt.VERTEX_SIZE);let u=s.uvs;for(let m=0,f=0,g=2;m<c;m++)d[g++]=o.r,d[g++]=o.g,d[g++]=o.b,d[g++]=o.a,d[g++]=u[f++],d[g++]=u[f++],g+=2;return d}},xe=class{canvas;gl;restorables=[];constructor(t,e={alpha:!0}){if(t instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext)this.gl=t,this.canvas=this.gl.canvas;else{const s=t;this.gl=s.getContext("webgl2",e)||s.getContext("webgl",e),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=t=>{t&&t.preventDefault()};contextRestoredHandler=()=>{for(let t=0,e=this.restorables.length;t<e;t++)this.restorables[t].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(t){this.restorables.push(t)}removeRestorable(t){const e=this.restorables.indexOf(t);e>-1&&this.restorables.splice(e,1)}},ze=class Lt extends pt{context;texture=null;boundUnit=0;useMipMaps=!1;static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;constructor(e,s,i=!1){super(s),this.context=e instanceof xe?e:new xe(e),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(e,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Lt.validateMagFilter(s)),this.useMipMaps=Lt.usesMipMaps(e),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(e){switch(e){case 9987:case 9985:case 9986:case 9984:return 9729;default:return e}}static usesMipMaps(e){switch(e){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(e,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(e){let s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Lt.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this._image),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e?s.LINEAR_MIPMAP_LINEAR:s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),e&&s.generateMipmap(s.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(e=0){let s=this.context.gl;this.boundUnit=e,s.activeTexture(s.TEXTURE0+e),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){let e=this.context.gl;e.activeTexture(e.TEXTURE0+this.boundUnit),e.bindTexture(e.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},Li=class extends yi{constructor(t,e="",s=new Ss){super(i=>new ze(t,i),e,s)}},Se=class{x=0;y=0;z=0;constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.z=s}setFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}set(t,e,s){return this.x=t,this.y=e,this.z=s,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}normalize(){let t=this.length();return t==0?this:(t=1/t,this.x*=t,this.y*=t,this.z*=t,this)}cross(t){return this.set(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}multiply(t){let e=t.values;return this.set(this.x*e[O]+this.y*e[G]+this.z*e[z]+e[V],this.x*e[q]+this.y*e[D]+this.z*e[_]+e[N],this.x*e[H]+this.y*e[j]+this.z*e[U]+e[W])}project(t){let e=t.values,s=1/(this.x*e[Q]+this.y*e[$]+this.z*e[ee]+e[J]);return this.set((this.x*e[O]+this.y*e[G]+this.z*e[z]+e[V])*s,(this.x*e[q]+this.y*e[D]+this.z*e[_]+e[N])*s,(this.x*e[H]+this.y*e[j]+this.z*e[U]+e[W])*s)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(t){let e=t.x-this.x,s=t.y-this.y,i=t.z-this.z;return Math.sqrt(e*e+s*s+i*i)}},O=0,G=4,z=8,V=12,q=1,D=5,_=9,N=13,H=2,j=6,U=10,W=14,Q=3,$=7,ee=11,J=15,lt=class Ye{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new Se;static yAxis=new Se;static zAxis=new Se;static tmpMatrix=new Ye;constructor(){let e=this.values;e[O]=1,e[D]=1,e[U]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,s=this.values;return e[O]=s[O],e[G]=s[q],e[z]=s[H],e[V]=s[Q],e[q]=s[G],e[D]=s[D],e[_]=s[j],e[N]=s[$],e[H]=s[z],e[j]=s[_],e[U]=s[U],e[W]=s[ee],e[Q]=s[V],e[$]=s[N],e[ee]=s[W],e[J]=s[J],this.set(e)}identity(){let e=this.values;return e[O]=1,e[G]=0,e[z]=0,e[V]=0,e[q]=0,e[D]=1,e[_]=0,e[N]=0,e[H]=0,e[j]=0,e[U]=1,e[W]=0,e[Q]=0,e[$]=0,e[ee]=0,e[J]=1,this}invert(){let e=this.values,s=this.temp,i=e[Q]*e[j]*e[_]*e[V]-e[H]*e[$]*e[_]*e[V]-e[Q]*e[D]*e[U]*e[V]+e[q]*e[$]*e[U]*e[V]+e[H]*e[D]*e[ee]*e[V]-e[q]*e[j]*e[ee]*e[V]-e[Q]*e[j]*e[z]*e[N]+e[H]*e[$]*e[z]*e[N]+e[Q]*e[G]*e[U]*e[N]-e[O]*e[$]*e[U]*e[N]-e[H]*e[G]*e[ee]*e[N]+e[O]*e[j]*e[ee]*e[N]+e[Q]*e[D]*e[z]*e[W]-e[q]*e[$]*e[z]*e[W]-e[Q]*e[G]*e[_]*e[W]+e[O]*e[$]*e[_]*e[W]+e[q]*e[G]*e[ee]*e[W]-e[O]*e[D]*e[ee]*e[W]-e[H]*e[D]*e[z]*e[J]+e[q]*e[j]*e[z]*e[J]+e[H]*e[G]*e[_]*e[J]-e[O]*e[j]*e[_]*e[J]-e[q]*e[G]*e[U]*e[J]+e[O]*e[D]*e[U]*e[J];if(i==0)throw new Error("non-invertible matrix");let r=1/i;return s[O]=e[_]*e[W]*e[$]-e[N]*e[U]*e[$]+e[N]*e[j]*e[ee]-e[D]*e[W]*e[ee]-e[_]*e[j]*e[J]+e[D]*e[U]*e[J],s[G]=e[V]*e[U]*e[$]-e[z]*e[W]*e[$]-e[V]*e[j]*e[ee]+e[G]*e[W]*e[ee]+e[z]*e[j]*e[J]-e[G]*e[U]*e[J],s[z]=e[z]*e[N]*e[$]-e[V]*e[_]*e[$]+e[V]*e[D]*e[ee]-e[G]*e[N]*e[ee]-e[z]*e[D]*e[J]+e[G]*e[_]*e[J],s[V]=e[V]*e[_]*e[j]-e[z]*e[N]*e[j]-e[V]*e[D]*e[U]+e[G]*e[N]*e[U]+e[z]*e[D]*e[W]-e[G]*e[_]*e[W],s[q]=e[N]*e[U]*e[Q]-e[_]*e[W]*e[Q]-e[N]*e[H]*e[ee]+e[q]*e[W]*e[ee]+e[_]*e[H]*e[J]-e[q]*e[U]*e[J],s[D]=e[z]*e[W]*e[Q]-e[V]*e[U]*e[Q]+e[V]*e[H]*e[ee]-e[O]*e[W]*e[ee]-e[z]*e[H]*e[J]+e[O]*e[U]*e[J],s[_]=e[V]*e[_]*e[Q]-e[z]*e[N]*e[Q]-e[V]*e[q]*e[ee]+e[O]*e[N]*e[ee]+e[z]*e[q]*e[J]-e[O]*e[_]*e[J],s[N]=e[z]*e[N]*e[H]-e[V]*e[_]*e[H]+e[V]*e[q]*e[U]-e[O]*e[N]*e[U]-e[z]*e[q]*e[W]+e[O]*e[_]*e[W],s[H]=e[D]*e[W]*e[Q]-e[N]*e[j]*e[Q]+e[N]*e[H]*e[$]-e[q]*e[W]*e[$]-e[D]*e[H]*e[J]+e[q]*e[j]*e[J],s[j]=e[V]*e[j]*e[Q]-e[G]*e[W]*e[Q]-e[V]*e[H]*e[$]+e[O]*e[W]*e[$]+e[G]*e[H]*e[J]-e[O]*e[j]*e[J],s[U]=e[G]*e[N]*e[Q]-e[V]*e[D]*e[Q]+e[V]*e[q]*e[$]-e[O]*e[N]*e[$]-e[G]*e[q]*e[J]+e[O]*e[D]*e[J],s[W]=e[V]*e[D]*e[H]-e[G]*e[N]*e[H]-e[V]*e[q]*e[j]+e[O]*e[N]*e[j]+e[G]*e[q]*e[W]-e[O]*e[D]*e[W],s[Q]=e[_]*e[j]*e[Q]-e[D]*e[U]*e[Q]-e[_]*e[H]*e[$]+e[q]*e[U]*e[$]+e[D]*e[H]*e[ee]-e[q]*e[j]*e[ee],s[$]=e[G]*e[U]*e[Q]-e[z]*e[j]*e[Q]+e[z]*e[H]*e[$]-e[O]*e[U]*e[$]-e[G]*e[H]*e[ee]+e[O]*e[j]*e[ee],s[ee]=e[z]*e[D]*e[Q]-e[G]*e[_]*e[Q]-e[z]*e[q]*e[$]+e[O]*e[_]*e[$]+e[G]*e[q]*e[ee]-e[O]*e[D]*e[ee],s[J]=e[G]*e[_]*e[H]-e[z]*e[D]*e[H]+e[z]*e[q]*e[j]-e[O]*e[_]*e[j]-e[G]*e[q]*e[U]+e[O]*e[D]*e[U],e[O]=s[O]*r,e[G]=s[G]*r,e[z]=s[z]*r,e[V]=s[V]*r,e[q]=s[q]*r,e[D]=s[D]*r,e[_]=s[_]*r,e[N]=s[N]*r,e[H]=s[H]*r,e[j]=s[j]*r,e[U]=s[U]*r,e[W]=s[W]*r,e[Q]=s[Q]*r,e[$]=s[$]*r,e[ee]=s[ee]*r,e[J]=s[J]*r,this}determinant(){let e=this.values;return e[Q]*e[j]*e[_]*e[V]-e[H]*e[$]*e[_]*e[V]-e[Q]*e[D]*e[U]*e[V]+e[q]*e[$]*e[U]*e[V]+e[H]*e[D]*e[ee]*e[V]-e[q]*e[j]*e[ee]*e[V]-e[Q]*e[j]*e[z]*e[N]+e[H]*e[$]*e[z]*e[N]+e[Q]*e[G]*e[U]*e[N]-e[O]*e[$]*e[U]*e[N]-e[H]*e[G]*e[ee]*e[N]+e[O]*e[j]*e[ee]*e[N]+e[Q]*e[D]*e[z]*e[W]-e[q]*e[$]*e[z]*e[W]-e[Q]*e[G]*e[_]*e[W]+e[O]*e[$]*e[_]*e[W]+e[q]*e[G]*e[ee]*e[W]-e[O]*e[D]*e[ee]*e[W]-e[H]*e[D]*e[z]*e[J]+e[q]*e[j]*e[z]*e[J]+e[H]*e[G]*e[_]*e[J]-e[O]*e[j]*e[_]*e[J]-e[q]*e[G]*e[U]*e[J]+e[O]*e[D]*e[U]*e[J]}translate(e,s,i){let r=this.values;return r[V]+=e,r[N]+=s,r[W]+=i,this}copy(){return new Ye().set(this.values)}projection(e,s,i,r){this.identity();let h=1/Math.tan(i*(Math.PI/180)/2),l=(s+e)/(e-s),n=2*s*e/(e-s),a=this.values;return a[O]=h/r,a[q]=0,a[H]=0,a[Q]=0,a[G]=0,a[D]=h,a[j]=0,a[$]=0,a[z]=0,a[_]=0,a[U]=l,a[ee]=-1,a[V]=0,a[N]=0,a[W]=n,a[J]=0,this}ortho2d(e,s,i,r){return this.ortho(e,e+i,s,s+r,0,1)}ortho(e,s,i,r,h,l){this.identity();let n=2/(s-e),a=2/(r-i),o=-2/(l-h),c=-(s+e)/(s-e),d=-(r+i)/(r-i),u=-(l+h)/(l-h),m=this.values;return m[O]=n,m[q]=0,m[H]=0,m[Q]=0,m[G]=0,m[D]=a,m[j]=0,m[$]=0,m[z]=0,m[_]=0,m[U]=o,m[ee]=0,m[V]=c,m[N]=d,m[W]=u,m[J]=1,this}multiply(e){let s=this.temp,i=this.values,r=e.values;return s[O]=i[O]*r[O]+i[G]*r[q]+i[z]*r[H]+i[V]*r[Q],s[G]=i[O]*r[G]+i[G]*r[D]+i[z]*r[j]+i[V]*r[$],s[z]=i[O]*r[z]+i[G]*r[_]+i[z]*r[U]+i[V]*r[ee],s[V]=i[O]*r[V]+i[G]*r[N]+i[z]*r[W]+i[V]*r[J],s[q]=i[q]*r[O]+i[D]*r[q]+i[_]*r[H]+i[N]*r[Q],s[D]=i[q]*r[G]+i[D]*r[D]+i[_]*r[j]+i[N]*r[$],s[_]=i[q]*r[z]+i[D]*r[_]+i[_]*r[U]+i[N]*r[ee],s[N]=i[q]*r[V]+i[D]*r[N]+i[_]*r[W]+i[N]*r[J],s[H]=i[H]*r[O]+i[j]*r[q]+i[U]*r[H]+i[W]*r[Q],s[j]=i[H]*r[G]+i[j]*r[D]+i[U]*r[j]+i[W]*r[$],s[U]=i[H]*r[z]+i[j]*r[_]+i[U]*r[U]+i[W]*r[ee],s[W]=i[H]*r[V]+i[j]*r[N]+i[U]*r[W]+i[W]*r[J],s[Q]=i[Q]*r[O]+i[$]*r[q]+i[ee]*r[H]+i[J]*r[Q],s[$]=i[Q]*r[G]+i[$]*r[D]+i[ee]*r[j]+i[J]*r[$],s[ee]=i[Q]*r[z]+i[$]*r[_]+i[ee]*r[U]+i[J]*r[ee],s[J]=i[Q]*r[V]+i[$]*r[N]+i[ee]*r[W]+i[J]*r[J],this.set(this.temp)}multiplyLeft(e){let s=this.temp,i=this.values,r=e.values;return s[O]=r[O]*i[O]+r[G]*i[q]+r[z]*i[H]+r[V]*i[Q],s[G]=r[O]*i[G]+r[G]*i[D]+r[z]*i[j]+r[V]*i[$],s[z]=r[O]*i[z]+r[G]*i[_]+r[z]*i[U]+r[V]*i[ee],s[V]=r[O]*i[V]+r[G]*i[N]+r[z]*i[W]+r[V]*i[J],s[q]=r[q]*i[O]+r[D]*i[q]+r[_]*i[H]+r[N]*i[Q],s[D]=r[q]*i[G]+r[D]*i[D]+r[_]*i[j]+r[N]*i[$],s[_]=r[q]*i[z]+r[D]*i[_]+r[_]*i[U]+r[N]*i[ee],s[N]=r[q]*i[V]+r[D]*i[N]+r[_]*i[W]+r[N]*i[J],s[H]=r[H]*i[O]+r[j]*i[q]+r[U]*i[H]+r[W]*i[Q],s[j]=r[H]*i[G]+r[j]*i[D]+r[U]*i[j]+r[W]*i[$],s[U]=r[H]*i[z]+r[j]*i[_]+r[U]*i[U]+r[W]*i[ee],s[W]=r[H]*i[V]+r[j]*i[N]+r[U]*i[W]+r[W]*i[J],s[Q]=r[Q]*i[O]+r[$]*i[q]+r[ee]*i[H]+r[J]*i[Q],s[$]=r[Q]*i[G]+r[$]*i[D]+r[ee]*i[j]+r[J]*i[$],s[ee]=r[Q]*i[z]+r[$]*i[_]+r[ee]*i[U]+r[J]*i[ee],s[J]=r[Q]*i[V]+r[$]*i[N]+r[ee]*i[W]+r[J]*i[J],this.set(this.temp)}lookAt(e,s,i){let r=Ye.xAxis,h=Ye.yAxis,l=Ye.zAxis;l.setFrom(s).normalize(),r.setFrom(s).normalize(),r.cross(i).normalize(),h.setFrom(r).cross(l).normalize(),this.identity();let n=this.values;return n[O]=r.x,n[G]=r.y,n[z]=r.z,n[q]=h.x,n[D]=h.y,n[_]=h.z,n[H]=-l.x,n[j]=-l.y,n[U]=-l.z,Ye.tmpMatrix.identity(),Ye.tmpMatrix.values[V]=-e.x,Ye.tmpMatrix.values[N]=-e.y,Ye.tmpMatrix.values[W]=-e.z,this.multiply(Ye.tmpMatrix),this}},Xi=class{position=new Se(0,0,0);direction=new Se(0,0,-1);up=new Se(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new lt;inverseProjectionView=new lt;projection=new lt;view=new lt;constructor(t,e){this.viewportWidth=t,this.viewportHeight=e,this.update()}update(){let t=this.projection,e=this.view,s=this.projectionView,i=this.inverseProjectionView,r=this.zoom,h=this.viewportWidth,l=this.viewportHeight;t.ortho(r*(-h/2),r*(h/2),r*(-l/2),r*(l/2),this.near,this.far),e.lookAt(this.position,this.direction,this.up),s.set(t.values),s.multiply(e),i.set(s.values).invert()}screenToWorld(t,e,s){let i=t.x,r=s-t.y-1;return t.x=2*i/e-1,t.y=2*r/s-1,t.z=2*t.z-1,t.project(this.inverseProjectionView),t}worldToScreen(t,e,s){return t.project(this.projectionView),t.x=e*(t.x+1)/2,t.y=s*(t.y+1)/2,t.z=(t.z+1)/2,t}setViewport(t,e){this.viewportWidth=t,this.viewportHeight=e}},Ds=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;autoPreventDefault;isTouch=!1;callbacks;constructor(t,e=!0){this.element=t,this.autoPreventDefault=e,this.callbacks=this.setupCallbacks(t)}setupCallbacks(t){const e=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,a)})}},s=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,a):c.moved&&c.moved(this.mouseX,this.mouseY,a)})}},i=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,a)})}},r=a=>{this.autoPreventDefault&&a.preventDefault();let o=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(o*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(o*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a.deltaY,a)})},h=a=>{if(this.isTouch=!0,!this.touch0||!this.touch1){var o=a.changedTouches;let c=o.item(0);if(!c)return;let d=t.getBoundingClientRect(),u=c.clientX-d.left,m=c.clientY-d.top,f=new Bi(c.identifier,u,m);if(this.mouseX=u,this.mouseY=m,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(g=>{g.down&&g.down(f.x,f.y,a)});else if(!this.touch1){this.touch1=f;let g=this.touch1.x-this.touch0.x,x=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(g*g+x*x),this.listeners.map(b=>{b.zoom&&b.zoom(this.initialPinchDistance,this.initialPinchDistance,a)})}}this.autoPreventDefault&&a.preventDefault()},l=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let u=t.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-u.left,f=d.clientY-u.top;this.touch0.identifier===d.identifier&&(this.touch0.x=this.mouseX=m,this.touch0.y=this.mouseY=f,this.listeners.map(g=>{g.dragged&&g.dragged(m,f,a)})),this.touch1&&this.touch1.identifier===d.identifier&&(this.touch1.x=this.mouseX=m,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let m=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,g=Math.sqrt(m*m+f*f);this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,g,a)})}}this.autoPreventDefault&&a.preventDefault()},n=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let u=t.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-u.left,f=d.clientY-u.top;if(this.touch0.identifier===d.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=f,this.listeners.map(g=>{g.up&&g.up(m,f,a)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(g=>{g.down&&g.down(this.touch0.x,this.touch0.y,a)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}this.autoPreventDefault&&a.preventDefault()};return t.addEventListener("mousedown",e,!0),t.addEventListener("mousemove",s,!0),t.addEventListener("mouseup",i,!0),t.addEventListener("wheel",r,!0),t.addEventListener("touchstart",h,{passive:!1,capture:!1}),t.addEventListener("touchmove",l,{passive:!1,capture:!1}),t.addEventListener("touchend",n,{passive:!1,capture:!1}),t.addEventListener("touchcancel",n),{mouseDown:e,mouseMove:s,mouseUp:i,mouseWheel:r,touchStart:h,touchMove:l,touchEnd:n}}dispose(){const t=this.element;t.removeEventListener("mousedown",this.callbacks.mouseDown,!0),t.removeEventListener("mousemove",this.callbacks.mouseMove,!0),t.removeEventListener("mouseup",this.callbacks.mouseUp,!0),t.removeEventListener("wheel",this.callbacks.mouseWheel,!0),t.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),t.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),t.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),t.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(t){this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},Bi=class{constructor(t,e,s){this.identifier=t,this.x=e,this.y=s}},Sn=class{constructor(t,e){this.canvas=t,this.camera=e;let s=0,i=0,r=0,h=0,l=0,n=0,a=0,o=0;new Ds(t).addListener({down:(c,d)=>{s=e.position.x,i=e.position.y,h=n=c,l=a=d,o=e.zoom},dragged:(c,d)=>{let u=c-h,m=d-l,f=e.screenToWorld(new Se(0,0),t.clientWidth,t.clientHeight),g=e.screenToWorld(new Se(u,m),t.clientWidth,t.clientHeight).sub(f);e.position.set(s-g.x,i-g.y,0),e.update(),n=c,a=d},wheel:c=>{let d=c/200*e.zoom,u=e.zoom+d;if(u>0){let m=0,f=0;if(c<0)m=n,f=a;else{let b=new Se(t.clientWidth/2+15,t.clientHeight/2),p=n-b.x,w=t.clientHeight-1-a-b.y;m=b.x-p,f=t.clientHeight-1-b.y+w}let g=e.screenToWorld(new Se(m,f),t.clientWidth,t.clientHeight);e.zoom=u,e.update();let x=e.screenToWorld(new Se(m,f),t.clientWidth,t.clientHeight);e.position.add(g.sub(x)),e.update()}},zoom:(c,d)=>{let u=c/d;e.zoom=o*u},up:(c,d)=>{n=c,a=d},moved:(c,d)=>{n=c,a=d}})}},Me=class ue{constructor(e,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=e instanceof xe?e:new xe(e),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let e=this.context.gl;try{if(this.vs=this.compileShader(e.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(e.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(s){throw this.dispose(),s}}compileShader(e,s){let i=this.context.gl,r=i.createShader(e);if(!r)throw new Error("Couldn't create shader.");if(i.shaderSource(r,s),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS)){let h="Couldn't compile shader: "+i.getShaderInfoLog(r);if(i.deleteShader(r),!i.isContextLost())throw new Error(h)}return r}compileProgram(e,s){let i=this.context.gl,r=i.createProgram();if(!r)throw new Error("Couldn't compile program.");if(i.attachShader(r,e),i.attachShader(r,s),i.linkProgram(r),!i.getProgramParameter(r,i.LINK_STATUS)){let h="Couldn't compile shader program: "+i.getProgramInfoLog(r);if(i.deleteProgram(r),!i.isContextLost())throw new Error(h)}return r}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,s){this.context.gl.uniform1i(this.getUniformLocation(e),s)}setUniformf(e,s){this.context.gl.uniform1f(this.getUniformLocation(e),s)}setUniform2f(e,s,i){this.context.gl.uniform2f(this.getUniformLocation(e),s,i)}setUniform3f(e,s,i,r){this.context.gl.uniform3f(this.getUniformLocation(e),s,i,r)}setUniform4f(e,s,i,r,h){this.context.gl.uniform4f(this.getUniformLocation(e),s,i,r,h)}setUniform2x2f(e,s){let i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,s){let i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,s){let i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getUniformLocation(this.program,e);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return i}getAttributeLocation(e){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getAttribLocation(this.program,e);if(i==-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return i}dispose(){this.context.removeRestorable(this);let e=this.context.gl;this.vs&&(e.deleteShader(this.vs),this.vs=null),this.fs&&(e.deleteShader(this.fs),this.fs=null),this.program&&(e.deleteProgram(this.program),this.program=null)}static newColoredTextured(e){let s=`
3
3
  attribute vec4 ${ue.POSITION};
4
4
  attribute vec4 ${ue.COLOR};
5
5
  attribute vec2 ${ue.TEXCOORDS};
@@ -81,4 +81,4 @@ varying LOWP vec4 v_color;
81
81
  void main () {
82
82
  gl_FragColor = v_color;
83
83
  }
84
- `;return new ue(e,s,i)}},Ns=class{constructor(t,e,s,i){this.attributes=e,this.context=t instanceof xe?t:new xe(t),this.elementsPerVertex=0;for(let r=0;r<e.length;r++)this.elementsPerVertex+=e[r].numElements;this.vertices=new Float32Array(s*this.elementsPerVertex),this.indices=new Uint16Array(i),this.context.addRestorable(this)}context;vertices;verticesBuffer=null;verticesLength=0;dirtyVertices=!1;indices;indicesBuffer=null;indicesLength=0;dirtyIndices=!1;elementsPerVertex=0;getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(t){this.dirtyVertices=!0,this.verticesLength=t}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(t){this.dirtyIndices=!0,this.indicesLength=t}getIndices(){return this.indices}getVertexSizeInFloats(){let t=0;for(var e=0;e<this.attributes.length;e++){let s=this.attributes[e];t+=s.numElements}return t}setVertices(t){if(this.dirtyVertices=!0,t.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(t,0),this.verticesLength=t.length}setIndices(t){if(this.dirtyIndices=!0,t.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(t,0),this.indicesLength=t.length}draw(t,e){this.drawWithOffset(t,e,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(t,e,s,i){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(t),this.indicesLength>0?r.drawElements(e,i,r.UNSIGNED_SHORT,s*2):r.drawArrays(e,s,i),this.unbind(t)}bind(t){let e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],h=t.getAttributeLocation(r.name);e.enableVertexAttribArray(h),e.vertexAttribPointer(h,r.numElements,e.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=r.numElements}this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(t){let e=this.context.gl;for(let s=0;s<this.attributes.length;s++){let i=this.attributes[s],r=t.getAttributeLocation(i.name);e.disableVertexAttribArray(r)}e.bindBuffer(e.ARRAY_BUFFER,null),this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}update(){let t=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),t.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=t.createBuffer()),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),t.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let t=this.context.gl;t.deleteBuffer(this.verticesBuffer),t.deleteBuffer(this.indicesBuffer)}},Ke=class{constructor(t,e,s){this.name=t,this.type=e,this.numElements=s}},yt=class extends Ke{constructor(){super(Me.POSITION,0,2)}},Tn=class extends Ke{constructor(){super(Me.POSITION,0,3)}},Us=class extends Ke{constructor(t=0){super(Me.TEXCOORDS+(t==0?"":t),0,2)}},At=class extends Ke{constructor(){super(Me.COLOR,0,4)}},Oi=class extends Ke{constructor(){super(Me.COLOR2,0,4)}},Vi=(t=>(t[t.Float=0]="Float",t))(Vi||{}),Xe=1,In=769,Di=770,Ni=771,Ui=774,Ws=class He{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(e,s=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=e instanceof xe?e:new xe(e);let r=s?[new yt,new At,new Us,new Oi]:[new yt,new At,new Us];this.mesh=new Ns(e,r,i,i*3);let h=this.context.gl;this.srcColorBlend=h.SRC_ALPHA,this.srcAlphaBlend=h.ONE,this.dstBlend=h.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=e,this.lastTexture=null,this.isDrawing=!0;let s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),He.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgb:Di,srcRgbPma:Xe,dstRgb:Ni,srcAlpha:Xe},{srcRgb:Di,srcRgbPma:Xe,dstRgb:Xe,srcAlpha:Xe},{srcRgb:Ui,srcRgbPma:Ui,dstRgb:Ni,srcAlpha:Xe},{srcRgb:Xe,srcRgbPma:Xe,dstRgb:In,srcAlpha:Xe}];setBlendMode(e,s){const i=He.blendModesGL[e],r=s?i.srcRgbPma:i.srcRgb,h=i.srcAlpha,l=i.dstRgb;if(this.srcColorBlend==r&&this.srcAlphaBlend==h&&this.dstBlend==l)return;this.srcColorBlend=r,this.srcAlphaBlend=h,this.dstBlend=l,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(r,l,h,l)}draw(e,s,i){e!=this.lastTexture?(this.flush(),this.lastTexture=e):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let r=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);let h=this.mesh.getIndices();for(let l=this.indicesLength,n=0;n<i.length;l++,n++)h[l]=i[n]+r;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,He.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let e=this.context.gl;e.disable(e.BLEND),He.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=He.globalDrawCalls;return He.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},Gs=class{context;isDrawing=!1;mesh;shapeType=4;color=new K(1,1,1,1);shader=null;vertexIndex=0;tmp=new Ue;srcColorBlend;srcAlphaBlend;dstBlend;constructor(t,e=10920){if(e>10920)throw new Error("Can't have more than 10920 triangles per batch: "+e);this.context=t instanceof xe?t:new xe(t),this.mesh=new Ns(t,[new yt,new At],e,0);let s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=t,this.vertexIndex=0,this.isDrawing=!0;let e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(t,e,s){this.srcColorBlend=t,this.srcAlphaBlend=e,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(t,s,e,s))}setColor(t){this.color.setFromColor(t)}setColorWith(t,e,s,i){this.color.set(t,e,s,i)}point(t,e,s){this.check(0,1),s||(s=this.color),this.vertex(t,e,s)}line(t,e,s,i,r){this.check(1,2);let h=this.mesh.getVertices(),l=this.vertexIndex;r||(r=this.color),this.vertex(t,e,r),this.vertex(s,i,r)}triangle(t,e,s,i,r,h,l,n,a,o){this.check(t?4:1,3);let c=this.mesh.getVertices(),d=this.vertexIndex;n||(n=this.color),a||(a=this.color),o||(o=this.color),t?(this.vertex(e,s,n),this.vertex(i,r,a),this.vertex(h,l,o)):(this.vertex(e,s,n),this.vertex(i,r,a),this.vertex(i,r,n),this.vertex(h,l,a),this.vertex(h,l,n),this.vertex(e,s,a))}quad(t,e,s,i,r,h,l,n,a,o,c,d,u){this.check(t?4:1,3);let m=this.mesh.getVertices(),f=this.vertexIndex;o||(o=this.color),c||(c=this.color),d||(d=this.color),u||(u=this.color),t?(this.vertex(e,s,o),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,u),this.vertex(e,s,o)):(this.vertex(e,s,o),this.vertex(i,r,c),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,u),this.vertex(n,a,u),this.vertex(e,s,o))}rect(t,e,s,i,r,h){this.quad(t,e,s,e+i,s,e+i,s+r,e,s+r,h,h,h,h)}rectLine(t,e,s,i,r,h,l){this.check(t?4:1,8),l||(l=this.color);let n=this.tmp.set(r-s,e-i);n.normalize(),h*=.5;let a=n.x*h,o=n.y*h;t?(this.vertex(e+a,s+o,l),this.vertex(e-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(e-a,s-o,l)):(this.vertex(e+a,s+o,l),this.vertex(e-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(e+a,s+o,l),this.vertex(i-a,r-o,l),this.vertex(e-a,s-o,l))}x(t,e,s){this.line(t-s,e-s,t+s,e+s),this.line(t-s,e+s,t+s,e-s)}polygon(t,e,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color);let r=this.mesh.getVertices(),h=this.vertexIndex;e<<=1,s<<=1;let l=t[e],n=t[e+1],a=e+s;for(let o=e,c=e+s-2;o<c;o+=2){let d=t[o],u=t[o+1],m=0,f=0;o+2>=a?(m=l,f=n):(m=t[o+2],f=t[o+3]),this.vertex(d,u,i),this.vertex(m,f,i)}}circle(t,e,s,i,r,h=0){if(h==0&&(h=Math.max(1,6*L.cbrt(i)|0)),h<=0)throw new Error("segments must be > 0.");r||(r=this.color);let l=2*L.PI/h,n=Math.cos(l),a=Math.sin(l),o=i,c=0;if(t){this.check(4,h*3+3),h--;for(let u=0;u<h;u++){this.vertex(e,s,r),this.vertex(e+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(e+o,s+c,r)}this.vertex(e,s,r),this.vertex(e+o,s+c,r)}else{this.check(1,h*2+2);for(let u=0;u<h;u++){this.vertex(e+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(e+o,s+c,r)}this.vertex(e+o,s+c,r)}let d=o;o=i,c=0,this.vertex(e+o,s+c,r)}curve(t,e,s,i,r,h,l,n,a,o){this.check(1,a*2+2),o||(o=this.color);let c=1/a,d=c*c,u=c*c*c,m=3*c,f=3*d,g=6*d,x=6*u,b=t-s*2+r,p=e-i*2+h,w=(s-r)*3-t+l,v=(i-h)*3-e+n,y=t,A=e,C=(s-t)*m+b*f+w*u,S=(i-e)*m+p*f+v*u,I=b*g+w*x,k=p*g+v*x,Y=w*x,F=v*x;for(;a-- >0;)this.vertex(y,A,o),y+=C,A+=S,C+=I,S+=k,I+=Y,k+=F,this.vertex(y,A,o);this.vertex(y,A,o),this.vertex(l,n,o)}vertex(t,e,s){let i=this.vertexIndex,r=this.mesh.getVertices();r[i++]=t,r[i++]=e,r[i++]=s.r,r[i++]=s.g,r[i++]=s.b,r[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let t=this.context.gl;t.disable(t.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(t,e){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==t)if(this.mesh.maxVertices()-this.mesh.numVertices()<e)this.flush();else return;else this.flush(),this.shapeType=t}dispose(){this.mesh.dispose()}},Wi=(t=>(t[t.Point=0]="Point",t[t.Line=1]="Line",t[t.Filled=4]="Filled",t))(Wi||{}),Gi=class ti{boneLineColor=new K(1,0,0,1);boneOriginColor=new K(0,1,0,1);attachmentLineColor=new K(0,0,1,.5);triangleLineColor=new K(1,.64,0,.5);pathColor=new K().setFromString("FF7F00");clipColor=new K(.8,0,0,2);aabbColor=new K(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;premultipliedAlpha=!1;scale=1;boneWidth=2;context;bounds=new Yi;temp=new Array;vertices=X.newFloatArray(2*1024);static LIGHT_GRAY=new K(192/255,192/255,192/255,1);static GREEN=new K(0,1,0,1);constructor(e){this.context=e instanceof xe?e:new xe(e)}draw(e,s,i){let r=s.x,h=s.y,l=this.context.gl,n=this.premultipliedAlpha?l.ONE:l.SRC_ALPHA;e.setBlendMode(n,l.ONE,l.ONE_MINUS_SRC_ALPHA);let a=s.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];if(i&&i.indexOf(d.data.name)>-1||!d.parent)continue;let u=d.data.length*d.a+d.worldX,m=d.data.length*d.c+d.worldY;e.rectLine(!0,d.worldX,d.worldY,u,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&e.x(r,h,4*this.scale)}if(this.drawRegionAttachments){e.setColor(this.attachmentLineColor);let o=s.slots;for(let c=0,d=o.length;c<d;c++){let u=o[c],m=u.getAttachment();if(m instanceof ce){let f=m,g=this.vertices;f.computeWorldVertices(u,g,0,2),e.line(g[0],g[1],g[2],g[3]),e.line(g[2],g[3],g[4],g[5]),e.line(g[4],g[5],g[6],g[7]),e.line(g[6],g[7],g[0],g[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let u=o[c];if(!u.bone.active)continue;let m=u.getAttachment();if(!(m instanceof Ge))continue;let f=m,g=this.vertices;f.computeWorldVertices(u,0,f.worldVerticesLength,g,0,2);let x=f.triangles,b=f.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let p=0,w=x.length;p<w;p+=3){let v=x[p]*2,y=x[p+1]*2,A=x[p+2]*2;e.triangle(!1,g[v],g[v+1],g[y],g[y+1],g[A],g[A+1])}}if(this.drawMeshHull&&b>0){e.setColor(this.attachmentLineColor),b=(b>>1)*2;let p=g[b-2],w=g[b-1];for(let v=0,y=b;v<y;v+=2){let A=g[v],C=g[v+1];e.line(A,C,p,w),p=A,w=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(s,!0),e.setColor(this.aabbColor),e.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let c=o.polygons,d=o.boundingBoxes;for(let u=0,m=c.length;u<m;u++){let f=c[u];e.setColor(d[u].color),e.polygon(f,0,f.length)}}if(this.drawPaths){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let u=o[c];if(!u.bone.active)continue;let m=u.getAttachment();if(!(m instanceof Ze))continue;let f=m,g=f.worldVerticesLength,x=this.temp=X.setArraySize(this.temp,g,0);f.computeWorldVertices(u,0,g,x,0,2);let b=this.pathColor,p=x[2],w=x[3],v=0,y=0;if(f.closed){e.setColor(b);let A=x[0],C=x[1],S=x[g-2],I=x[g-1];v=x[g-4],y=x[g-3],e.curve(p,w,A,C,S,I,v,y,32),e.setColor(ti.LIGHT_GRAY),e.line(p,w,A,C),e.line(v,y,S,I)}g-=4;for(let A=4;A<g;A+=6){let C=x[A],S=x[A+1],I=x[A+2],k=x[A+3];v=x[A+4],y=x[A+5],e.setColor(b),e.curve(p,w,C,S,I,k,v,y,32),e.setColor(ti.LIGHT_GRAY),e.line(p,w,C,S),e.line(v,y,I,k),p=v,w=y}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];i&&i.indexOf(d.data.name)>-1||e.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=s.slots;e.setColor(this.clipColor);for(let c=0,d=o.length;c<d;c++){let u=o[c];if(!u.bone.active)continue;let m=u.getAttachment();if(!(m instanceof rt))continue;let f=m,g=f.worldVerticesLength,x=this.temp=X.setArraySize(this.temp,g,0);f.computeWorldVertices(u,0,g,x,0,2);for(let b=0,p=x.length;b<p;b+=2){let w=x[b],v=x[b+1],y=x[(b+2)%x.length],A=x[(b+3)%x.length];e.line(w,v,y,A)}}}}dispose(){}},Mn=class{constructor(t,e,s){this.vertices=t,this.numVertices=e,this.numFloats=s}},zi=class Cr{static QUAD_TRIANGLES=[0,1,2,2,3,0];premultipliedAlpha=!1;tempColor=new K;tempColor2=new K;vertices;vertexSize=8;twoColorTint=!1;renderable=new Mn([],0,0);clipper=new vt;temp=new Ue;temp2=new Ue;temp3=new K;temp4=new K;constructor(e,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=X.newFloatArray(this.vertexSize*1024)}draw(e,s,i=-1,r=-1,h=null){let l=this.clipper,n=this.premultipliedAlpha,a=this.twoColorTint,o=null,c=this.renderable,d,u,m=s.drawOrder,f,g=s.color,x=a?12:8,b=!1;i==-1&&(b=!0);for(let p=0,w=m.length;p<w;p++){let v=l.isClipping()?2:x,y=m[p];if(!y.bone.active){l.clipEndWithSlot(y);continue}if(i>=0&&i==y.data.index&&(b=!0),!b){l.clipEndWithSlot(y);continue}r>=0&&r==y.data.index&&(b=!1);let A=y.getAttachment(),C;if(A instanceof ce){let S=A;c.vertices=this.vertices,c.numVertices=4,c.numFloats=v<<2,S.computeWorldVertices(y,c.vertices,0,v),u=Cr.QUAD_TRIANGLES,d=S.uvs,C=S.region.texture,f=S.color}else if(A instanceof Ge){let S=A;c.vertices=this.vertices,c.numVertices=S.worldVerticesLength>>1,c.numFloats=c.numVertices*v,c.numFloats>c.vertices.length&&(c.vertices=this.vertices=X.newFloatArray(c.numFloats)),S.computeWorldVertices(y,0,S.worldVerticesLength,c.vertices,0,v),u=S.triangles,C=S.region.texture,d=S.uvs,f=S.color}else if(A instanceof rt){let S=A;l.clipStart(y,S);continue}else{l.clipEndWithSlot(y);continue}if(C){let S=y.color,I=this.tempColor;I.r=g.r*S.r*f.r,I.g=g.g*S.g*f.g,I.b=g.b*S.b*f.b,I.a=g.a*S.a*f.a,n&&(I.r*=I.a,I.g*=I.a,I.b*=I.a);let k=this.tempColor2;y.darkColor?(n?(k.r=y.darkColor.r*I.a,k.g=y.darkColor.g*I.a,k.b=y.darkColor.b*I.a):k.setFromColor(y.darkColor),k.a=n?1:0):k.set(0,0,0,1);let Y=y.data.blendMode;if(Y!=o&&(o=Y,e.setBlendMode(o,n)),l.isClipping()){l.clipTriangles(c.vertices,u,u.length,d,I,k,a);let F=new Float32Array(l.clippedVertices),P=l.clippedTriangles;h&&h(F,F.length,x),e.draw(C,F,P)}else{let F=c.vertices;if(a)for(let M=2,R=0,B=c.numFloats;M<B;M+=x,R+=2)F[M]=I.r,F[M+1]=I.g,F[M+2]=I.b,F[M+3]=I.a,F[M+4]=d[R],F[M+5]=d[R+1],F[M+6]=k.r,F[M+7]=k.g,F[M+8]=k.b,F[M+9]=k.a;else for(let M=2,R=0,B=c.numFloats;M<B;M+=x,R+=2)F[M]=I.r,F[M+1]=I.g,F[M+2]=I.b,F[M+3]=I.a,F[M+4]=d[R],F[M+5]=d[R+1];let P=c.vertices.subarray(0,c.numFloats);h&&h(c.vertices,c.numFloats,x),e.draw(C,P,u)}}l.clipEndWithSlot(y)}l.clipEnd()}getSkeletonClipping(){return this.clipper}},T=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],Ct=[0,1,2,2,3,0],St=new K(1,1,1,1),zs=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;skeletonRenderer;skeletonDebugRenderer;constructor(t,e,s=!0){this.canvas=t,this.context=e instanceof xe?e:new xe(e),this.twoColorTint=s,this.camera=new Xi(t.width,t.height),this.batcherShader=s?Me.newTwoColoredTextured(this.context):Me.newColoredTextured(this.context),this.batcher=new Ws(this.context,s),this.shapesShader=Me.newColored(this.context),this.shapes=new Gs(this.context),this.skeletonRenderer=new zi(this.context,s),this.skeletonDebugRenderer=new Gi(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(t,e=!1,s=-1,i=-1,r=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=e,this.skeletonRenderer.draw(this.batcher,t,s,i,r)}drawSkeletonDebug(t,e=!1,s){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=e,this.skeletonDebugRenderer.draw(this.shapes,t,s)}drawTexture(t,e,s,i,r,h){this.enableRenderer(this.batcher),h||(h=St);var l=0;T[l++]=e,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t,T,Ct)}drawTextureUV(t,e,s,i,r,h,l,n,a,o){this.enableRenderer(this.batcher),o||(o=St);var c=0;T[c++]=e,T[c++]=s,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e+i,T[c++]=s,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e+i,T[c++]=s+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e,T[c++]=s+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c]=0),this.batcher.draw(t,T,Ct)}drawTextureRotated(t,e,s,i,r,h,l,n,a){this.enableRenderer(this.batcher),a||(a=St);let o=e+h,c=s+l,d=-h,u=-l,m=i-h,f=r-l,g=d,x=u,b=d,p=f,w=m,v=f,y=m,A=u,C=0,S=0,I=0,k=0,Y=0,F=0,P=0,M=0;if(n!=0){let B=L.cosDeg(n),se=L.sinDeg(n);C=B*g-se*x,S=se*g+B*x,P=B*b-se*p,M=se*b+B*p,Y=B*w-se*v,F=se*w+B*v,I=Y+(C-P),k=F+(S-M)}else C=g,S=x,P=b,M=p,Y=w,F=v,I=y,k=A;C+=o,S+=c,I+=o,k+=c,Y+=o,F+=c,P+=o,M+=c;var R=0;T[R++]=C,T[R++]=S,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=0,T[R++]=1,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=I,T[R++]=k,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=1,T[R++]=1,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=Y,T[R++]=F,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=1,T[R++]=0,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=P,T[R++]=M,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=0,T[R++]=0,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R]=0),this.batcher.draw(t,T,Ct)}drawRegion(t,e,s,i,r,h){this.enableRenderer(this.batcher),h||(h=St);var l=0;T[l++]=e,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u,T[l++]=t.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u2,T[l++]=t.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u2,T[l++]=t.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u,T[l++]=t.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t.page.texture,T,Ct)}line(t,e,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.line(t,e,s,i,r)}triangle(t,e,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.triangle(t,e,s,i,r,h,l,n,a,o)}quad(t,e,s,i,r,h,l,n,a,o,c,d,u){this.enableRenderer(this.shapes),this.shapes.quad(t,e,s,i,r,h,l,n,a,o,c,d,u)}rect(t,e,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.rect(t,e,s,i,r,h)}rectLine(t,e,s,i,r,h,l){this.enableRenderer(this.shapes),this.shapes.rectLine(t,e,s,i,r,h,l)}polygon(t,e,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(t,e,s,i)}circle(t,e,s,i,r,h=0){this.enableRenderer(this.shapes),this.shapes.circle(t,e,s,i,r,h)}curve(t,e,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.curve(t,e,s,i,r,h,l,n,a,o)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(t){let e=this.canvas;var s=window.devicePixelRatio||1,i=Math.round(e.clientWidth*s),r=Math.round(e.clientHeight*s);if((e.width!=i||e.height!=r)&&(e.width=i,e.height=r),this.context.gl.viewport(0,0,e.width,e.height),t===1)this.camera.setViewport(i,r);else if(t===2){let h=e.width,l=e.height,n=this.camera.viewportWidth,a=this.camera.viewportHeight,o=a/n,c=l/h,d=o<c?n/h:a/l;this.camera.setViewport(h*d,l*d)}this.camera.update()}enableRenderer(t){this.activeRenderer!==t&&(this.end(),t instanceof Ws?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Me.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):t instanceof Gs?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Me.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},qi=(t=>(t[t.Stretch=0]="Stretch",t[t.Expand=1]="Expand",t[t.Fit=2]="Fit",t))(qi||{}),Qe,qe,qs=0,En=1,_s=1,Tt=165,It=108,Ee=163,Rn=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Ot;backgroundColor=new K(.135,.135,.135,1);tempColor=new K;constructor(t){if(this.renderer=t,this.timeKeeper.maxDelta=9,!qe){let e=navigator.userAgent.indexOf("Safari")>-1,s=()=>qs++;qe=new Image,qe.src=Yn,e||(qe.crossOrigin="anonymous"),qe.onload=s,Qe=new Image,Qe.src=kn,e||(Qe.crossOrigin="anonymous"),Qe.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(t=!1){if(qs<2||t&&this.fadeOut>_s)return;this.timeKeeper.update();let e=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(e,5));let s=this.tempColor,i=this.renderer,r=i.canvas,h=i.context.gl;if(i.resize(1),i.camera.position.set(r.width/2,r.height/2,0),i.batcher.setBlendMode(0,!0),t){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>_s)return;s.setFromColor(this.backgroundColor),e=1-this.fadeOut/_s,e=1-(e-1)*(e-1),s.a*=e,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,r.width,0,r.width,r.height,0,r.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(h.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),h.clear(h.COLOR_BUFFER_BIT)),e=1;e*=Math.min(this.fadeIn/En,1),s.set(e,e,e,e),this.logo||(this.logo=new ze(i.context,qe),this.spinner=new ze(i.context,Qe)),i.camera.zoom=Math.max(1,Ee/r.height),i.begin(),i.drawTexture(this.logo,(r.width-Tt)/2,(r.height-It)/2,Tt,It,s),this.spinner&&i.drawTextureRotated(this.spinner,(r.width-Ee)/2,(r.height-Ee)/2,Ee,Ee,Ee/2,Ee/2,this.angle,s),i.end()}drawInCoordinates(t,e){if(qs<2)return;this.timeKeeper.update();let s=this.renderer;s.batcher.setBlendMode(0,!0),this.logo||(this.logo=new ze(s.context,qe),this.spinner=new ze(s.context,Qe));const i=t-Tt/2,r=e-It/2;s.drawTexture(this.logo,i,r,Tt,It),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,r-25,Ee,Ee,Ee/2,Ee/2,this.angle)}},kn="data:image/png;base64,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",Yn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAABsCAYAAAALzHKmAAAQ7klEQVR42u3da4xdVRUA4D0zd2Y6nZY59DVtZ1puS9+lzC0YAi2UQ8AAQczFpPgA9VIeIQbirRqJ0cBUBVGjDr/QCKSNRSMmpuODxAdxqhgwxkhFjf6Sxh/+UUNVNGJCzR7uTvas7LXX2q9zzp3em6y0gTN3Zu75utZe5+yztxC9V+/Ve5X9En1Vjd7J6SFbLNF7naPw+l2jh7YHMBWssqMHtlsRdim4qsLtIawaPiHEQOLoNrA9iIkQDnRrVA1qD2LZ8ISoxYqKo13sQAtBWBayQWZUAXGRQM9JjCngDVY0UqJNDbQrMcaGmArdUKpIjbYiQLsCZCyIMQBy8QwnilR4Q5AuCpxFYvRFmBLbEiwKwpsSaWycVQGZBKMrwBjA9BhxDe57u2L2hOoKNCbOrgAZitEVYUxoKSMErQvSxYIzCkguRg5EF4AUhqUlhy/YUKSxcRaKsioYOQhD4I0yYxkR3PcJBcuFysmgsXAWBTMJyBCMIQh9kGGxXIXvexCQXbHGAMrBWTbM2CCpMSMLIxehC77lSJwXGth7M0FzoVJIXXDWQnGmhOkL0ic7YhhtWdGGkAuPAjUWGoF4faCmwBkbZmyUqUCyMqMLRA4+E6IsdTjidUHKBYrh9CnpRcH0ypKxsyOGEYNIIeTCOz91OIJ1QYoB5eAMyZo+MFNnyVTZ0YiRC9EGEMOyAgshxErHsL2XK1gOUgwohtM1a5YNM7Rsu4K0ZkcbRm4mpPBRwFZ5hg9eCqkrUB+csWGGogzNkqEgrdnRhpGLkINudaLgwvVB6oqzCjCTZElb2Y4B0gUjBtEG0ARnDRLjjoG9DwcshtQGlIPTljVjwUySLWNkyRCQVHa0ZUUTRAwgF91a33BEy0VKAcVwwqwZC2bqbOlUurllOxQkJzNyINoAYqjWhYYjWg5SCiiG05Q1U8FMjTIoS8YE6YORi1BHtJ4KIcQEEtTXUWAxpK44YVlPBdO1jCdFWTZIE8bVGEYMIRPcZGBw4HKQcoBiOE1ZMzbMgVQwU6JMAdKEEcuIJogUvg1YCCE2gsCO42DlIIVAKZwpYJaSLVNnSU6XjYHUmxhTmXaFaMO3EYkLqMC+FsLlIoVAKZzMrEnBhJeLfLNlKMrYWRIDCbOkFSSVHbHM6AKRC6/ODUewNqQ+OLlZkxpjUmV8MBbMUJSxyzY3Q1IgTRgxiBRCHdem0KDAUkBh9sRwwjEnAXMMgTnKhFlUtiwkS5rGka4g9SaGgxFmRC7AzTCEEBcyA36dDSsXqAtOLkysjGMwY5XxVChjZ0kuSCo7YlkRQsQQYtDEFsegsLoCxUp7Kpgps2UslFGzJGccSYHUmxhOZqwzEZqAbfUMCisHKIZzgsCpl3MTzMwTpi1bYp2477gyFKUxS7qWbdjY2EBS2dGE0QQRA7gNCyHEdhjE8RhUDlBT9tzgmjWZMFNlSy+Urk1OzCyJlW0XkK4YOQh1cDtcgwBrQmoDWkdgboBZE8mYsJSHlnFbJ+5bwmOPJ7lZkirbC8aRsMvmgtTHjBhGE0QbwJ2egUE1ITVlUC5OmDVdYNrKuN70xM6WoShjlW4464dbtiFIWK6x7GjESEHUUe0iYncnbMdQSE0Z1ITTNOb0hRmjjLtmS9dmJ2rp1jtuKktyyrb6YLEMCUHq2dGG0QQRQ7f72kzc+cJecerne8Wvv7JNPHPvenEkz8Sh3UtFc92QyGt9Yko/HgOLAIUZlItTz5ouMF3KuE+2jFLCQ1D6lm6fLMkBacuOJowYRBUXyfjuHjF3NhdnsfjvAfH6E9vFt9XxKgikEKgJZyyYalzOLeMu2bLbULI6bh+QGwmQ+rgRlumdGEQAao+K56bEL2woVUwOiev0r8OAUjiJrMmFCbvykGxZRAmPitK1dHM7bohyMsuyi/I8f0+e57fJYIKEZXpXo9E4mOf5XTKyLLvCBLETF8uY2SKepkC+dpX4T02Ivepr4HvZcOZ5fmee54fyPL+DmTUhzAs6n4n8bN5dr9f3YdkSg8nsxG0lPBVKVpNjG0/aGhzfLDmRZdnumZmZp8+c+cdZPV555fSr7Xb7s0jJ3i5Pcue4MxKkPPkvvXTqz/B92u32l0wYOzG1fkhcd/py8Rcbyq/vFM/KY1WA95h/3zzP71bfU6JsNpsfgj+P/FlbrdaDGExYyuXvLz8H+DudODH700ajcSM3W6Yu4alQ1spCOTd38jcKocTZbh9+9NixY99XJ8AEUkcpo9W64yH197m5k7+bnZ19QT+J09NHntQhwji/Jg58qi6++ofLxJ8gSFneVw2Ka4QQDfh1Ok4dZavVmtZ/nrm5k7/Vf55O1tRhboUw5+ZOvqyOl5+R/FyOHj32PYVU/tloNG5IXcKrhJIzngwp3fNjomazea/64BuNxts646f50lWv169utw9/DmtqdJQyZFaSJVuV6nq9fqMEof5/vV6/CYBqgJDlee+yAbF/+4i4ZWqZeNfaIfHWzn+Hx0KcEuU9+s8jv3ej0bhVlXOZydX/k0iRMeb8P0D5e6tj8zy/Xb9UJIc56h/yqVOnXul8lmuZ2bJslKmbHG7XrbpCmCXFRLvdfqQD6jTS3Jiy5I4OykM6ADV+1Eu1DmV6evopBORexzDi1L+X/HnGxsb2w3Hm9PSRJ9QxWPOTZdmlKht2hi+w6dkox5bqffI8fye3hDteGqKaHVsHXihKl0tB+h0cY+lute54AGRKDCW89LNTRynHb7ChUWVVjetOnJh9EYBUyPZeNCoOtsbFQwdXi4/esELcd+tq8cCHJ8UXp+viy9efLz7AgamjlKXc1AA1m83DoIRDlFubzeb96hhZLVTlgJ24gttutx+ONa50bHZKRenaeTs1OfpAfnr6yOOdE7EZdNwmlKocntXLNkA5JTGq47Ds+Lf94lWsyfnXleLfnIwJUN4DOnNYwuUxh2A3Ln9XULrfK8t3J27Tu3BVwiOjXJqoAy8UZej1yclGo3GTLN+gu3w+z/P3YaWbQqk3Ne12e4ZC+c8rxWsYytcPiP9RpZxCqWDKnxOiBNlyAUpOnGsoh4tA2Rm8X9xqtT6md5wyZmYe+0YRKL+1S/wYQ3n8zctBl5SBUv5djivfjMOPduIzcizeiYfr9foVvUwZG+XCuzibZKnSceZ5/v4QlKp8y7ElhnJlTeTP7BI/kllRYfzrfvHqFy4UX1vaL/aVlSmROzwbwdS29T2UcEwZF+V8ozM2lu1VY812u/15akypGh3TmFJesJbHHD167IdUxz3YJy5bNySuX1mbvy55CbMLtzU6tjGlsdFptVqfUMc0Go23F4wy1l2dSnbfvpMwVPe9WWVLDsrOJaF9MFu2Wq1PqmNkGce67xiXhTjdNwdlvV6/BgxfbPfBfVCetxi6b9/rlCup65QzM48dl2OjLMv26CibzeZ96sTIzEFdpwQXz9U1yrtVlpR/Zll2Fec65Y6l4pbbx8XHH9kknvzJlPjlHy8Tp29eKT5ou0aJoIT3w3dBlLDzVpfAJEZ1XOdaJZxnOSlvPMjPzxFljIvng914RwebsjYO7uhMyHu46sOfnf3Oz2TXDW6vvYxdFoIXz3Wc8J5zs9n8iOn2IrxTc2BM3Glqdp7dI553uaOjxrhwcob+MyuUpjs6WZZdon8OcigjPx8V+u+GTWFTSWEx3WYcdJ225jNDSE4q0GHCzlueHOyujn6bUWYgeb9ZZUaQPe+GzQ+Gc8+oOGhC+c1d4gfI16n3XDAhQ7+9qE9l01E2Go132GYKyXE1NiFDTcpoNpv3LOYJGWXNErJNW9sEp63p2RKiVPMn1bS1DgxsyhoGdGpmizj+xtXiDYnx7/vFmce3iWdW1cTVGEY4hQ2ZW0nNq8Qm/M6XbXm3S100lwGedFybuvNOibLI+ZS2ceU4eAxiEuvCkfmU8ycToDxETe6FgCBQHeqyAbFvfEhcO7BwDuXFCEbTZF840XeHK0jYcbs2OIGle0mVJ/mmnClEPQqxyTY5I8/zFhif7fSZee4bnrPOU4AssnRXHaVTCTd14dRDY3UbTIiSeFhsN/aMjgnqthFx880rxX3yATL5p3y4LPXzOaBkUyBjZMlYpbtQlIOBD475ZEusjMNSvkXe6VEoJVDkeZ2dzIfIFsRzU+JF2OyM9M9fTC/6SUYOyFQPjQ2nWiUjxnPfw5EeHqMWIqAeIFsAU847lJM2JM6xsewt1OIDLs99P7ZFHNdB/upS8XtPiD7PfLuCXJNolYyyFiNI/Zit65ItrOVafFbHcFohY7hPTN21Tjz4uc3iqfsnxKdX1MTl1OoYRFaMsToGB6Trw2JFP/OdZC2hJZ7ZkrMoAbbSGmelDJ91hFKuJeS7jlBMkJnrAqqJlgMUZS/dArPlGHNdSg5M3xXXtvquuEatvIYtDRhpxbUJuIgqsU5lGWtUploK0KuEU9mSW8YpmFQ556xNuYW7NiW13B+FkMiKHIy+C6eGgBxJvMR0oSv5hi6+z4HJyZoU0M2RVvDlrOQbcxVfX5AhZbuqy0v7ZstYMLHlAVlLTF9ALLbvu9Y5Zylpn/XOsd0ibIvxr2KCLHpp6SCUIdnSZSF+WzfOhem6GD+1KwR3Z4jNjrtDpNoZwmWd8yrupZN6Hx3fbMmFSe0Swdq2ZIPjxk1112Duo8OBGLrBkw/IoncdK2XHsdC9dHz204m50xh3tzFq1zFqtzHXrfCw7OgDsqyNnZLszVijsmXgrmNcmGtS78lIoMX2aJz03fKO2sDJddPQSCDPiQ1DfWBycY6XtXstc2PQKuxgG2McmXTPb9/9vmuJYXKyJrWjbeg+3xPM4O73nWqvbyw7xgZZSJbEUBa157cNJjdr2vb+5iA1YV3HxYscj30PDCEHIgcjtfm8K8hSsmRotkwFk5s1TTghUAopB6xrjHMBBkI0YYTZ0dZlxwLpkiWDULpmy5gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Fn=class{constructor(t,e){this.config=e,e.pathPrefix||(e.pathPrefix=""),e.app||(e.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),e.webglConfig||(e.webglConfig={alpha:!0}),this.htmlCanvas=t,this.context=new xe(t,e.webglConfig),this.renderer=new zs(t,this.context),this.gl=this.context.gl,this.assetManager=new Li(this.context,e.pathPrefix),this.input=new Ds(t),e.app.loadAssets&&e.app.loadAssets(this);let s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),e.app.update&&e.app.update(this,this.time.delta),e.app.render&&e.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?e.app.error&&e.app.error(this,this.assetManager.getErrors()):(e.app.initialize&&e.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new Ot;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(t,e,s,i){this.gl.clearColor(t,e,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}},ye=Yr(Rr("Phaser"),1),Pn="esotericsoftware.spine.skeletonFile.cache",Ln="esotericsoftware.spine.atlas.cache",Xn="spineSkeletonData",Bn="spineAtlasData",Hs="spine",Ve=Phaser.GameObjects.Components,_i=Ve.ComputedSize,Hi=Ve.Depth,ji=Ve.Flip,Zi=Ve.ScrollFactor,Ji=Ve.Transform,Ki=Ve.Visible,Qi=Ve.Origin,$i=Ve.Alpha;function Be(...t){return e=>(Phaser.Class.mixin(e,t),e)}var er=Be(_i),tr=Be(Hi),sr=Be(ji),ir=Be(Zi),rr=Be(Ji),nr=Be(Ki),ar=Be(Qi),lr=Be($i),On=class extends Phaser.GameObjects.GameObject{constructor(t,e){super(t,e)}},Vn=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},or=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new Je(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(2);const s=e.getBoundsRect(this.clipping?new vt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Dn=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.animationState)return{x:0,y:0,width:0,height:0};const e=new gs(t.animationState.data),s=new Je(t.skeleton.data),i=this.clipping?new vt:void 0,r=s.data;if(this.skins.length>0){let l=new at("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&l.addSkin(a)}s.setSkin(l)}s.setToSetupPose();const h=this.animation!=null?r.findAnimation(this.animation):null;if(h==null){s.updateWorldTransform(2);const l=s.getBoundsRect(i);return l.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:l}else{let l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,h,!1);const c=Math.max(h.duration/this.timeStep,1);for(let u=0;u<c;u++){const m=u>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(i);l=Math.min(l,f.x),n=Math.min(n,f.y),a=Math.max(a,f.x+f.width),o=Math.max(o,f.y+f.height)}const d={x:l,y:n,width:a-l,height:o-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},js=class extends tr(ar(er(sr(ir(rr(nr(lr(On)))))))){constructor(t,e,s,i,r,h,l=new or){super(t,window.SPINE_GAME_OBJECT_TYPE?window.SPINE_GAME_OBJECT_TYPE:Hs),this.plugin=e,this.boundsProvider=l,this.setPosition(s,i),this.premultipliedAlpha=this.plugin.isAtlasPremultiplied(h),this.skeleton=this.plugin.createSkeleton(r,h),this.animationStateData=new pi(this.skeleton.data),this.animationState=new gs(this.animationStateData),this.skeleton.updateWorldTransform(2),this.updateSize()}blendMode=-1;skeleton;animationStateData;animationState;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};premultipliedAlpha=!1;offsetX=0;offsetY=0;updateSize(){if(!this.skeleton)return;let t=this.boundsProvider.calculateBounds(this);this.width=t.width,this.height=t.height,this.setDisplayOrigin(-t.x,-t.y),this.offsetX=-t.x,this.offsetY=-t.y}skeletonToPhaserWorldCoordinates(t){let e=this.getWorldTransformMatrix(),s=e.a,i=e.b,r=e.c,h=e.d,l=e.tx,n=e.ty,a=t.x,o=t.y;t.x=a*s+o*r+l,t.y=a*i+o*h+n}phaserWorldCoordinatesToSkeleton(t){let e=this.getWorldTransformMatrix();e=e.invert();let s=e.a,i=e.b,r=e.c,h=e.d,l=e.tx,n=e.ty,a=t.x,o=t.y;t.x=a*s+o*r+l,t.y=a*i+o*h+n}phaserWorldCoordinatesToBone(t,e){this.phaserWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}updatePose(t){this.animationState.update(t/1e3),this.animationState.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(t/1e3),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}preUpdate(t,e){!this.skeleton||!this.animationState||this.updatePose(e)}preDestroy(){}willRender(t){var e=15,s=!this.skeleton||!(e!==this.renderFlags||this.cameraFilter!==0&&this.cameraFilter&t.id);if(this.visible||(s=!1),!s&&this.parentContainer&&this.plugin.webGLRenderer){var i=this.plugin.webGLRenderer;this.plugin.gl&&this.plugin.phaserRenderer instanceof Phaser.Renderer.WebGL.WebGLRenderer&&i.batcher.isDrawing&&(i.end(),this.plugin.phaserRenderer.pipelines.rebind())}return s}renderWebGL(t,e,s,i){if(!this.skeleton||!this.animationState||!this.plugin.webGLRenderer)return;let r=this.plugin.webGLRenderer;t.newType&&(t.pipelines.clear(),r.begin()),s.addToRenderList(e);let h=Phaser.GameObjects.GetCalcMatrix(e,s,i).calc,l=h.a,n=h.b,a=h.c,o=h.d,c=h.tx,d=h.ty,u=e.offsetX-e.displayOriginX,m=e.offsetY-e.displayOriginY;r.drawSkeleton(e.skeleton,e.premultipliedAlpha,-1,-1,(f,g,x)=>{for(let b=0;b<g;b+=x){let p=f[b]+u,w=f[b+1]+m;f[b]=p*l+w*a+c,f[b+1]=p*n+w*o+d}}),t.nextTypeMatch||(r.end(),t.pipelines.rebind())}renderCanvas(t,e,s,i){if(!this.skeleton||!this.animationState||!this.plugin.canvasRenderer)return;let r=t.currentContext,h=this.plugin.canvasRenderer;h.ctx=r,s.addToRenderList(e);let l=Phaser.GameObjects.GetCalcMatrix(e,s,i).calc,n=this.skeleton;n.x=l.tx,n.y=l.ty,n.scaleX=l.scaleX,n.scaleY=l.scaleY;let a=n.getRootBone();a.rotation=-L.radiansToDegrees*l.rotationNormalized,this.skeleton.updateWorldTransform(2),r.save(),h.draw(n),r.restore()}};Je.yDown=!0;var Zs=class Xt extends ye.Plugins.ScenePlugin{game;isWebGL;gl;static gameWebGLRenderer=null;get webGLRenderer(){return Xt.gameWebGLRenderer}canvasRenderer;phaserRenderer;skeletonDataCache;atlasCache;constructor(e,s,i){super(e,s,i),this.game=s.game,this.isWebGL=this.game.config.renderType===2,this.gl=this.isWebGL?this.game.renderer.gl:null,this.phaserRenderer=this.game.renderer,this.canvasRenderer=null,this.skeletonDataCache=this.game.cache.addCustom(Pn),this.atlasCache=this.game.cache.addCustom(Ln);let r=function(o,c,d){let u=new hr(this,o,c,0,d);return this.addFile(u.files),this};s.registerFileType("spineJson",r,e);let h=function(o,c,d){let u=new hr(this,o,c,1,d);return this.addFile(u.files),this};s.registerFileType("spineBinary",h,e);let l=function(o,c,d,u){let m=new Nn(this,o,c,d,u);return this.addFile(m.files),this};s.registerFileType("spineAtlas",l,e);let n=function(o,c,d,u,m){this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.clear();const f=this.scene.sys[i];let g=new js(this.scene,f,o,c,d,u,m);return this.displayList.add(g),this.updateList.add(g),this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.rebind(),g},a=function(o,c=!1){this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.clear();let d=o.x?o.x:0,u=o.y?o.y:0,m=o.boundsProvider?o.boundsProvider:void 0;const f=this.scene.sys[i];let g=new js(this.scene,f,d,u,o.dataKey,o.atlasKey,m);return c!==void 0&&(o.add=c),this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.rebind(),ye.GameObjects.BuildGameObject(this.scene,g,o)};s.registerGameObject(window.SPINE_GAME_OBJECT_TYPE?window.SPINE_GAME_OBJECT_TYPE:Hs,n,a)}static rendererId=0;boot(){this.isWebGL&&this.gl?Xt.gameWebGLRenderer||=new zs(this.game.renderer.canvas,this.gl,!0):this.scene&&(this.canvasRenderer||=new Cn(this.scene.sys.context)),this.onResize(),this.systems&&(this.systems.events.once("destroy",this.destroy,this),this.systems.events.on("start",this.onStart,this),this.systems.events.on("shutdown",this.shutdown,this)),this.game.events.once("destroy",this.gameDestroy,this)}onResize(){const e=this.game.renderer,s=this.webGLRenderer;if(e&&s){const i=e.width,r=e.height;s.camera.position.x=i/2,s.camera.position.y=r/2,s.camera.up.y=-1,s.camera.direction.z=1,s.camera.setViewport(i,r)}}onStart(){this.game.scale.on(ye.Scale.Events.RESIZE,this.onResize,this)}shutdown(){this.isWebGL&&this.game.scale.off(ye.Scale.Events.RESIZE,this.onResize,this)}destroy(){this.shutdown(),this.systems?.events.off("start",this.onStart,this),this.systems?.events.off("shutdown",this.shutdown,this)}gameDestroy(){this.pluginManager.removeGameObject(window.SPINE_GAME_OBJECT_TYPE?window.SPINE_GAME_OBJECT_TYPE:Hs,!0,!0),this.webGLRenderer&&this.webGLRenderer.dispose(),Xt.gameWebGLRenderer=null}getAtlas(e){let s;if(this.atlasCache.exists(e))s=this.atlasCache.get(e);else{let i=this.game.cache.text.get(e);if(s=new wt(i.data),this.isWebGL){let r=this.gl;const h=r.getParameter(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL);h&&r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);for(let l of s.pages)l.setTexture(new ze(r,this.game.textures.get(e+"!"+l.name).getSourceImage(),!1));h&&r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}else for(let r of s.pages)r.setTexture(new yn(this.game.textures.get(e+"!"+r.name).getSourceImage()));this.atlasCache.add(e,s)}return s}isAtlasPremultiplied(e){let s=this.game.cache.text.get(e);return s?s.premultipliedAlpha:!1}getSkeletonData(e,s){const i=this.getAtlas(s),r=e+s;let h;if(this.skeletonDataCache.exists(r))h=this.skeletonDataCache.get(r);else{if(this.game.cache.json.exists(e)){let l=this.game.cache.json.get(e);h=new Pi(new ys(i)).readSkeletonData(l)}else{let l=this.game.cache.binary.get(e);h=new Ri(new ys(i)).readSkeletonData(new Uint8Array(l))}this.skeletonDataCache.add(r,h)}return h}createSkeleton(e,s){return new Je(this.getSkeletonData(e,s))}},hr=class extends ye.Loader.MultiFile{constructor(t,e,s,i,r){if(typeof e!="string"){const n=e;e=n.key,s=n.url,i=n.type==="spineJson"?0:1,r=n.xhrSettings}let h=null;i==0?h=new ye.Loader.FileTypes.JSONFile(t,{key:e,url:s,extension:"json",xhrSettings:r}):h=new ye.Loader.FileTypes.BinaryFile(t,{key:e,url:s,extension:"skel",xhrSettings:r}),super(t,Xn,e,[h]),this.fileType=i}onFileComplete(t){this.pending--}addToCache(){this.isReadyToProcess()&&this.files[0].addToCache()}},Nn=class extends ye.Loader.MultiFile{constructor(t,e,s,i,r){if(typeof e!="string"){const h=e;e=h.key,s=h.url,i=h.premultipliedAlpha,r=h.xhrSettings}super(t,Bn,e,[new ye.Loader.FileTypes.TextFile(t,{key:e,url:s,xhrSettings:r,extension:"atlas"})]),this.premultipliedAlpha=i}onFileComplete(t){if(this.files.indexOf(t)!=-1&&(this.pending--,t.type=="text")){var e=t.data.split(/\r\n|\r|\n/);let a=[];a.push(e[0]);for(var s=1;s<e.length;s++){var i=e[s];i.trim()===""&&s<e.length-1&&(i=e[s+1],a.push(i))}let o=(t.src.match(/^.*\//)??"").toString();this.loader.path&&this.loader.path.length>0&&o.startsWith(this.loader.path)&&(o=o.slice(this.loader.path.length));for(var r=0;r<a.length;r++){var h=o+a[r],l=t.key+"!"+a[r],n=new ye.Loader.FileTypes.ImageFile(this.loader,l,h);this.loader.keyExists(n)||(this.addToMultiFile(n),this.loader.addFile(n))}}}addToCache(){if(this.isReadyToProcess()){let t=this.loader.textureManager;for(let e of this.files)e.type=="image"?t.exists(e.key)||t.addImage(e.key,e.data):(this.premultipliedAlpha=this.premultipliedAlpha??(e.data.indexOf("pma: true")>=0||e.data.indexOf("pma:true")>=0),e.data={data:e.data,premultipliedAlpha:this.premultipliedAlpha},e.addToCache())}}};return window.spine={SpinePlugin:Zs},window["spine.SpinePlugin"]=Zs,Fr(ii)})();
84
+ `;return new ue(e,s,i)}},Ns=class{constructor(t,e,s,i){this.attributes=e,this.context=t instanceof xe?t:new xe(t),this.elementsPerVertex=0;for(let r=0;r<e.length;r++)this.elementsPerVertex+=e[r].numElements;this.vertices=new Float32Array(s*this.elementsPerVertex),this.indices=new Uint16Array(i),this.context.addRestorable(this)}context;vertices;verticesBuffer=null;verticesLength=0;dirtyVertices=!1;indices;indicesBuffer=null;indicesLength=0;dirtyIndices=!1;elementsPerVertex=0;getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(t){this.dirtyVertices=!0,this.verticesLength=t}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(t){this.dirtyIndices=!0,this.indicesLength=t}getIndices(){return this.indices}getVertexSizeInFloats(){let t=0;for(var e=0;e<this.attributes.length;e++){let s=this.attributes[e];t+=s.numElements}return t}setVertices(t){if(this.dirtyVertices=!0,t.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(t,0),this.verticesLength=t.length}setIndices(t){if(this.dirtyIndices=!0,t.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(t,0),this.indicesLength=t.length}draw(t,e){this.drawWithOffset(t,e,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(t,e,s,i){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(t),this.indicesLength>0?r.drawElements(e,i,r.UNSIGNED_SHORT,s*2):r.drawArrays(e,s,i),this.unbind(t)}bind(t){let e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],h=t.getAttributeLocation(r.name);e.enableVertexAttribArray(h),e.vertexAttribPointer(h,r.numElements,e.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=r.numElements}this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(t){let e=this.context.gl;for(let s=0;s<this.attributes.length;s++){let i=this.attributes[s],r=t.getAttributeLocation(i.name);e.disableVertexAttribArray(r)}e.bindBuffer(e.ARRAY_BUFFER,null),this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}update(){let t=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),t.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=t.createBuffer()),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),t.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let t=this.context.gl;t.deleteBuffer(this.verticesBuffer),t.deleteBuffer(this.indicesBuffer)}},Ke=class{constructor(t,e,s){this.name=t,this.type=e,this.numElements=s}},yt=class extends Ke{constructor(){super(Me.POSITION,0,2)}},Tn=class extends Ke{constructor(){super(Me.POSITION,0,3)}},Us=class extends Ke{constructor(t=0){super(Me.TEXCOORDS+(t==0?"":t),0,2)}},At=class extends Ke{constructor(){super(Me.COLOR,0,4)}},Oi=class extends Ke{constructor(){super(Me.COLOR2,0,4)}},Vi=(t=>(t[t.Float=0]="Float",t))(Vi||{}),Xe=1,In=769,Di=770,Ni=771,Ui=774,Ws=class He{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(e,s=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=e instanceof xe?e:new xe(e);let r=s?[new yt,new At,new Us,new Oi]:[new yt,new At,new Us];this.mesh=new Ns(e,r,i,i*3);let h=this.context.gl;this.srcColorBlend=h.SRC_ALPHA,this.srcAlphaBlend=h.ONE,this.dstBlend=h.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=e,this.lastTexture=null,this.isDrawing=!0;let s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),He.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgb:Di,srcRgbPma:Xe,dstRgb:Ni,srcAlpha:Xe},{srcRgb:Di,srcRgbPma:Xe,dstRgb:Xe,srcAlpha:Xe},{srcRgb:Ui,srcRgbPma:Ui,dstRgb:Ni,srcAlpha:Xe},{srcRgb:Xe,srcRgbPma:Xe,dstRgb:In,srcAlpha:Xe}];setBlendMode(e,s){const i=He.blendModesGL[e],r=s?i.srcRgbPma:i.srcRgb,h=i.srcAlpha,l=i.dstRgb;if(this.srcColorBlend==r&&this.srcAlphaBlend==h&&this.dstBlend==l)return;this.srcColorBlend=r,this.srcAlphaBlend=h,this.dstBlend=l,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(r,l,h,l)}draw(e,s,i){e!=this.lastTexture?(this.flush(),this.lastTexture=e):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let r=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);let h=this.mesh.getIndices();for(let l=this.indicesLength,n=0;n<i.length;l++,n++)h[l]=i[n]+r;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,He.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let e=this.context.gl;e.disable(e.BLEND),He.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=He.globalDrawCalls;return He.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},Gs=class{context;isDrawing=!1;mesh;shapeType=4;color=new K(1,1,1,1);shader=null;vertexIndex=0;tmp=new Ue;srcColorBlend;srcAlphaBlend;dstBlend;constructor(t,e=10920){if(e>10920)throw new Error("Can't have more than 10920 triangles per batch: "+e);this.context=t instanceof xe?t:new xe(t),this.mesh=new Ns(t,[new yt,new At],e,0);let s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=t,this.vertexIndex=0,this.isDrawing=!0;let e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(t,e,s){this.srcColorBlend=t,this.srcAlphaBlend=e,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(t,s,e,s))}setColor(t){this.color.setFromColor(t)}setColorWith(t,e,s,i){this.color.set(t,e,s,i)}point(t,e,s){this.check(0,1),s||(s=this.color),this.vertex(t,e,s)}line(t,e,s,i,r){this.check(1,2);let h=this.mesh.getVertices(),l=this.vertexIndex;r||(r=this.color),this.vertex(t,e,r),this.vertex(s,i,r)}triangle(t,e,s,i,r,h,l,n,a,o){this.check(t?4:1,3);let c=this.mesh.getVertices(),d=this.vertexIndex;n||(n=this.color),a||(a=this.color),o||(o=this.color),t?(this.vertex(e,s,n),this.vertex(i,r,a),this.vertex(h,l,o)):(this.vertex(e,s,n),this.vertex(i,r,a),this.vertex(i,r,n),this.vertex(h,l,a),this.vertex(h,l,n),this.vertex(e,s,a))}quad(t,e,s,i,r,h,l,n,a,o,c,d,u){this.check(t?4:1,3);let m=this.mesh.getVertices(),f=this.vertexIndex;o||(o=this.color),c||(c=this.color),d||(d=this.color),u||(u=this.color),t?(this.vertex(e,s,o),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,u),this.vertex(e,s,o)):(this.vertex(e,s,o),this.vertex(i,r,c),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,u),this.vertex(n,a,u),this.vertex(e,s,o))}rect(t,e,s,i,r,h){this.quad(t,e,s,e+i,s,e+i,s+r,e,s+r,h,h,h,h)}rectLine(t,e,s,i,r,h,l){this.check(t?4:1,8),l||(l=this.color);let n=this.tmp.set(r-s,e-i);n.normalize(),h*=.5;let a=n.x*h,o=n.y*h;t?(this.vertex(e+a,s+o,l),this.vertex(e-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(e-a,s-o,l)):(this.vertex(e+a,s+o,l),this.vertex(e-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(e+a,s+o,l),this.vertex(i-a,r-o,l),this.vertex(e-a,s-o,l))}x(t,e,s){this.line(t-s,e-s,t+s,e+s),this.line(t-s,e+s,t+s,e-s)}polygon(t,e,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color);let r=this.mesh.getVertices(),h=this.vertexIndex;e<<=1,s<<=1;let l=t[e],n=t[e+1],a=e+s;for(let o=e,c=e+s-2;o<c;o+=2){let d=t[o],u=t[o+1],m=0,f=0;o+2>=a?(m=l,f=n):(m=t[o+2],f=t[o+3]),this.vertex(d,u,i),this.vertex(m,f,i)}}circle(t,e,s,i,r,h=0){if(h==0&&(h=Math.max(1,6*L.cbrt(i)|0)),h<=0)throw new Error("segments must be > 0.");r||(r=this.color);let l=2*L.PI/h,n=Math.cos(l),a=Math.sin(l),o=i,c=0;if(t){this.check(4,h*3+3),h--;for(let u=0;u<h;u++){this.vertex(e,s,r),this.vertex(e+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(e+o,s+c,r)}this.vertex(e,s,r),this.vertex(e+o,s+c,r)}else{this.check(1,h*2+2);for(let u=0;u<h;u++){this.vertex(e+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(e+o,s+c,r)}this.vertex(e+o,s+c,r)}let d=o;o=i,c=0,this.vertex(e+o,s+c,r)}curve(t,e,s,i,r,h,l,n,a,o){this.check(1,a*2+2),o||(o=this.color);let c=1/a,d=c*c,u=c*c*c,m=3*c,f=3*d,g=6*d,x=6*u,b=t-s*2+r,p=e-i*2+h,w=(s-r)*3-t+l,v=(i-h)*3-e+n,y=t,A=e,C=(s-t)*m+b*f+w*u,S=(i-e)*m+p*f+v*u,I=b*g+w*x,k=p*g+v*x,Y=w*x,F=v*x;for(;a-- >0;)this.vertex(y,A,o),y+=C,A+=S,C+=I,S+=k,I+=Y,k+=F,this.vertex(y,A,o);this.vertex(y,A,o),this.vertex(l,n,o)}vertex(t,e,s){let i=this.vertexIndex,r=this.mesh.getVertices();r[i++]=t,r[i++]=e,r[i++]=s.r,r[i++]=s.g,r[i++]=s.b,r[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let t=this.context.gl;t.disable(t.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(t,e){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==t)if(this.mesh.maxVertices()-this.mesh.numVertices()<e)this.flush();else return;else this.flush(),this.shapeType=t}dispose(){this.mesh.dispose()}},Wi=(t=>(t[t.Point=0]="Point",t[t.Line=1]="Line",t[t.Filled=4]="Filled",t))(Wi||{}),Gi=class ti{boneLineColor=new K(1,0,0,1);boneOriginColor=new K(0,1,0,1);attachmentLineColor=new K(0,0,1,.5);triangleLineColor=new K(1,.64,0,.5);pathColor=new K().setFromString("FF7F00");clipColor=new K(.8,0,0,2);aabbColor=new K(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;premultipliedAlpha=!1;scale=1;boneWidth=2;context;bounds=new Yi;temp=new Array;vertices=X.newFloatArray(2*1024);static LIGHT_GRAY=new K(192/255,192/255,192/255,1);static GREEN=new K(0,1,0,1);constructor(e){this.context=e instanceof xe?e:new xe(e)}draw(e,s,i){let r=s.x,h=s.y,l=this.context.gl,n=this.premultipliedAlpha?l.ONE:l.SRC_ALPHA;e.setBlendMode(n,l.ONE,l.ONE_MINUS_SRC_ALPHA);let a=s.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];if(i&&i.indexOf(d.data.name)>-1||!d.parent)continue;let u=d.data.length*d.a+d.worldX,m=d.data.length*d.c+d.worldY;e.rectLine(!0,d.worldX,d.worldY,u,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&e.x(r,h,4*this.scale)}if(this.drawRegionAttachments){e.setColor(this.attachmentLineColor);let o=s.slots;for(let c=0,d=o.length;c<d;c++){let u=o[c],m=u.getAttachment();if(m instanceof ce){let f=m,g=this.vertices;f.computeWorldVertices(u,g,0,2),e.line(g[0],g[1],g[2],g[3]),e.line(g[2],g[3],g[4],g[5]),e.line(g[4],g[5],g[6],g[7]),e.line(g[6],g[7],g[0],g[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let u=o[c];if(!u.bone.active)continue;let m=u.getAttachment();if(!(m instanceof Ge))continue;let f=m,g=this.vertices;f.computeWorldVertices(u,0,f.worldVerticesLength,g,0,2);let x=f.triangles,b=f.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let p=0,w=x.length;p<w;p+=3){let v=x[p]*2,y=x[p+1]*2,A=x[p+2]*2;e.triangle(!1,g[v],g[v+1],g[y],g[y+1],g[A],g[A+1])}}if(this.drawMeshHull&&b>0){e.setColor(this.attachmentLineColor),b=(b>>1)*2;let p=g[b-2],w=g[b-1];for(let v=0,y=b;v<y;v+=2){let A=g[v],C=g[v+1];e.line(A,C,p,w),p=A,w=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(s,!0),e.setColor(this.aabbColor),e.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let c=o.polygons,d=o.boundingBoxes;for(let u=0,m=c.length;u<m;u++){let f=c[u];e.setColor(d[u].color),e.polygon(f,0,f.length)}}if(this.drawPaths){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let u=o[c];if(!u.bone.active)continue;let m=u.getAttachment();if(!(m instanceof Ze))continue;let f=m,g=f.worldVerticesLength,x=this.temp=X.setArraySize(this.temp,g,0);f.computeWorldVertices(u,0,g,x,0,2);let b=this.pathColor,p=x[2],w=x[3],v=0,y=0;if(f.closed){e.setColor(b);let A=x[0],C=x[1],S=x[g-2],I=x[g-1];v=x[g-4],y=x[g-3],e.curve(p,w,A,C,S,I,v,y,32),e.setColor(ti.LIGHT_GRAY),e.line(p,w,A,C),e.line(v,y,S,I)}g-=4;for(let A=4;A<g;A+=6){let C=x[A],S=x[A+1],I=x[A+2],k=x[A+3];v=x[A+4],y=x[A+5],e.setColor(b),e.curve(p,w,C,S,I,k,v,y,32),e.setColor(ti.LIGHT_GRAY),e.line(p,w,C,S),e.line(v,y,I,k),p=v,w=y}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];i&&i.indexOf(d.data.name)>-1||e.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=s.slots;e.setColor(this.clipColor);for(let c=0,d=o.length;c<d;c++){let u=o[c];if(!u.bone.active)continue;let m=u.getAttachment();if(!(m instanceof rt))continue;let f=m,g=f.worldVerticesLength,x=this.temp=X.setArraySize(this.temp,g,0);f.computeWorldVertices(u,0,g,x,0,2);for(let b=0,p=x.length;b<p;b+=2){let w=x[b],v=x[b+1],y=x[(b+2)%x.length],A=x[(b+3)%x.length];e.line(w,v,y,A)}}}}dispose(){}},Mn=class{constructor(t,e,s){this.vertices=t,this.numVertices=e,this.numFloats=s}},zi=class Cr{static QUAD_TRIANGLES=[0,1,2,2,3,0];premultipliedAlpha=!1;tempColor=new K;tempColor2=new K;vertices;vertexSize=8;twoColorTint=!1;renderable=new Mn([],0,0);clipper=new vt;temp=new Ue;temp2=new Ue;temp3=new K;temp4=new K;constructor(e,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=X.newFloatArray(this.vertexSize*1024)}draw(e,s,i=-1,r=-1,h=null){let l=this.clipper,n=this.premultipliedAlpha,a=this.twoColorTint,o=null,c=this.renderable,d,u,m=s.drawOrder,f,g=s.color,x=a?12:8,b=!1;i==-1&&(b=!0);for(let p=0,w=m.length;p<w;p++){let v=l.isClipping()?2:x,y=m[p];if(!y.bone.active){l.clipEndWithSlot(y);continue}if(i>=0&&i==y.data.index&&(b=!0),!b){l.clipEndWithSlot(y);continue}r>=0&&r==y.data.index&&(b=!1);let A=y.getAttachment(),C;if(A instanceof ce){let S=A;c.vertices=this.vertices,c.numVertices=4,c.numFloats=v<<2,S.computeWorldVertices(y,c.vertices,0,v),u=Cr.QUAD_TRIANGLES,d=S.uvs,C=S.region.texture,f=S.color}else if(A instanceof Ge){let S=A;c.vertices=this.vertices,c.numVertices=S.worldVerticesLength>>1,c.numFloats=c.numVertices*v,c.numFloats>c.vertices.length&&(c.vertices=this.vertices=X.newFloatArray(c.numFloats)),S.computeWorldVertices(y,0,S.worldVerticesLength,c.vertices,0,v),u=S.triangles,C=S.region.texture,d=S.uvs,f=S.color}else if(A instanceof rt){let S=A;l.clipStart(y,S);continue}else{l.clipEndWithSlot(y);continue}if(C){let S=y.color,I=this.tempColor;I.r=g.r*S.r*f.r,I.g=g.g*S.g*f.g,I.b=g.b*S.b*f.b,I.a=g.a*S.a*f.a,n&&(I.r*=I.a,I.g*=I.a,I.b*=I.a);let k=this.tempColor2;y.darkColor?(n?(k.r=y.darkColor.r*I.a,k.g=y.darkColor.g*I.a,k.b=y.darkColor.b*I.a):k.setFromColor(y.darkColor),k.a=n?1:0):k.set(0,0,0,1);let Y=y.data.blendMode;if(Y!=o&&(o=Y,e.setBlendMode(o,n)),l.isClipping()){l.clipTriangles(c.vertices,u,u.length,d,I,k,a);let F=new Float32Array(l.clippedVertices),P=l.clippedTriangles;h&&h(F,F.length,x),e.draw(C,F,P)}else{let F=c.vertices;if(a)for(let M=2,R=0,B=c.numFloats;M<B;M+=x,R+=2)F[M]=I.r,F[M+1]=I.g,F[M+2]=I.b,F[M+3]=I.a,F[M+4]=d[R],F[M+5]=d[R+1],F[M+6]=k.r,F[M+7]=k.g,F[M+8]=k.b,F[M+9]=k.a;else for(let M=2,R=0,B=c.numFloats;M<B;M+=x,R+=2)F[M]=I.r,F[M+1]=I.g,F[M+2]=I.b,F[M+3]=I.a,F[M+4]=d[R],F[M+5]=d[R+1];let P=c.vertices.subarray(0,c.numFloats);h&&h(c.vertices,c.numFloats,x),e.draw(C,P,u)}}l.clipEndWithSlot(y)}l.clipEnd()}getSkeletonClipping(){return this.clipper}},T=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],Ct=[0,1,2,2,3,0],St=new K(1,1,1,1),zs=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;skeletonRenderer;skeletonDebugRenderer;constructor(t,e,s=!0){this.canvas=t,this.context=e instanceof xe?e:new xe(e),this.twoColorTint=s,this.camera=new Xi(t.width,t.height),this.batcherShader=s?Me.newTwoColoredTextured(this.context):Me.newColoredTextured(this.context),this.batcher=new Ws(this.context,s),this.shapesShader=Me.newColored(this.context),this.shapes=new Gs(this.context),this.skeletonRenderer=new zi(this.context,s),this.skeletonDebugRenderer=new Gi(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(t,e=!1,s=-1,i=-1,r=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=e,this.skeletonRenderer.draw(this.batcher,t,s,i,r)}drawSkeletonDebug(t,e=!1,s){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=e,this.skeletonDebugRenderer.draw(this.shapes,t,s)}drawTexture(t,e,s,i,r,h){this.enableRenderer(this.batcher),h||(h=St);var l=0;T[l++]=e,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t,T,Ct)}drawTextureUV(t,e,s,i,r,h,l,n,a,o){this.enableRenderer(this.batcher),o||(o=St);var c=0;T[c++]=e,T[c++]=s,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e+i,T[c++]=s,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e+i,T[c++]=s+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e,T[c++]=s+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c]=0),this.batcher.draw(t,T,Ct)}drawTextureRotated(t,e,s,i,r,h,l,n,a){this.enableRenderer(this.batcher),a||(a=St);let o=e+h,c=s+l,d=-h,u=-l,m=i-h,f=r-l,g=d,x=u,b=d,p=f,w=m,v=f,y=m,A=u,C=0,S=0,I=0,k=0,Y=0,F=0,P=0,M=0;if(n!=0){let B=L.cosDeg(n),se=L.sinDeg(n);C=B*g-se*x,S=se*g+B*x,P=B*b-se*p,M=se*b+B*p,Y=B*w-se*v,F=se*w+B*v,I=Y+(C-P),k=F+(S-M)}else C=g,S=x,P=b,M=p,Y=w,F=v,I=y,k=A;C+=o,S+=c,I+=o,k+=c,Y+=o,F+=c,P+=o,M+=c;var R=0;T[R++]=C,T[R++]=S,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=0,T[R++]=1,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=I,T[R++]=k,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=1,T[R++]=1,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=Y,T[R++]=F,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=1,T[R++]=0,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=P,T[R++]=M,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=0,T[R++]=0,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R]=0),this.batcher.draw(t,T,Ct)}drawRegion(t,e,s,i,r,h){this.enableRenderer(this.batcher),h||(h=St);var l=0;T[l++]=e,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u,T[l++]=t.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u2,T[l++]=t.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u2,T[l++]=t.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u,T[l++]=t.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t.page.texture,T,Ct)}line(t,e,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.line(t,e,s,i,r)}triangle(t,e,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.triangle(t,e,s,i,r,h,l,n,a,o)}quad(t,e,s,i,r,h,l,n,a,o,c,d,u){this.enableRenderer(this.shapes),this.shapes.quad(t,e,s,i,r,h,l,n,a,o,c,d,u)}rect(t,e,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.rect(t,e,s,i,r,h)}rectLine(t,e,s,i,r,h,l){this.enableRenderer(this.shapes),this.shapes.rectLine(t,e,s,i,r,h,l)}polygon(t,e,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(t,e,s,i)}circle(t,e,s,i,r,h=0){this.enableRenderer(this.shapes),this.shapes.circle(t,e,s,i,r,h)}curve(t,e,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.curve(t,e,s,i,r,h,l,n,a,o)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(t){let e=this.canvas;var s=window.devicePixelRatio||1,i=Math.round(e.clientWidth*s),r=Math.round(e.clientHeight*s);if((e.width!=i||e.height!=r)&&(e.width=i,e.height=r),this.context.gl.viewport(0,0,e.width,e.height),t===1)this.camera.setViewport(i,r);else if(t===2){let h=e.width,l=e.height,n=this.camera.viewportWidth,a=this.camera.viewportHeight,o=a/n,c=l/h,d=o<c?n/h:a/l;this.camera.setViewport(h*d,l*d)}this.camera.update()}enableRenderer(t){this.activeRenderer!==t&&(this.end(),t instanceof Ws?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Me.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):t instanceof Gs?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Me.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},qi=(t=>(t[t.Stretch=0]="Stretch",t[t.Expand=1]="Expand",t[t.Fit=2]="Fit",t))(qi||{}),Qe,qe,qs=0,En=1,_s=1,Tt=165,It=108,Ee=163,Rn=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Ot;backgroundColor=new K(.135,.135,.135,1);tempColor=new K;constructor(t){if(this.renderer=t,this.timeKeeper.maxDelta=9,!qe){let e=navigator.userAgent.indexOf("Safari")>-1,s=()=>qs++;qe=new Image,qe.src=Yn,e||(qe.crossOrigin="anonymous"),qe.onload=s,Qe=new Image,Qe.src=kn,e||(Qe.crossOrigin="anonymous"),Qe.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(t=!1){if(qs<2||t&&this.fadeOut>_s)return;this.timeKeeper.update();let e=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(e,5));let s=this.tempColor,i=this.renderer,r=i.canvas,h=i.context.gl;if(i.resize(1),i.camera.position.set(r.width/2,r.height/2,0),i.batcher.setBlendMode(0,!0),t){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>_s)return;s.setFromColor(this.backgroundColor),e=1-this.fadeOut/_s,e=1-(e-1)*(e-1),s.a*=e,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,r.width,0,r.width,r.height,0,r.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(h.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),h.clear(h.COLOR_BUFFER_BIT)),e=1;e*=Math.min(this.fadeIn/En,1),s.set(e,e,e,e),this.logo||(this.logo=new ze(i.context,qe),this.spinner=new ze(i.context,Qe)),i.camera.zoom=Math.max(1,Ee/r.height),i.begin(),i.drawTexture(this.logo,(r.width-Tt)/2,(r.height-It)/2,Tt,It,s),this.spinner&&i.drawTextureRotated(this.spinner,(r.width-Ee)/2,(r.height-Ee)/2,Ee,Ee,Ee/2,Ee/2,this.angle,s),i.end()}drawInCoordinates(t,e){if(qs<2)return;this.timeKeeper.update();let s=this.renderer;s.batcher.setBlendMode(0,!0),this.logo||(this.logo=new ze(s.context,qe),this.spinner=new ze(s.context,Qe));const i=t-Tt/2,r=e-It/2;s.drawTexture(this.logo,i,r,Tt,It),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,r-25,Ee,Ee,Ee/2,Ee/2,this.angle)}},kn="data:image/png;base64,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",Yn="data:image/png;base64,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",Fn=class{constructor(t,e){this.config=e,e.pathPrefix||(e.pathPrefix=""),e.app||(e.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),e.webglConfig||(e.webglConfig={alpha:!0}),this.htmlCanvas=t,this.context=new xe(t,e.webglConfig),this.renderer=new zs(t,this.context),this.gl=this.context.gl,this.assetManager=new Li(this.context,e.pathPrefix),this.input=new Ds(t),e.app.loadAssets&&e.app.loadAssets(this);let s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),e.app.update&&e.app.update(this,this.time.delta),e.app.render&&e.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?e.app.error&&e.app.error(this,this.assetManager.getErrors()):(e.app.initialize&&e.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new Ot;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(t,e,s,i){this.gl.clearColor(t,e,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}},ye=Yr(Rr("Phaser"),1),Pn="esotericsoftware.spine.skeletonFile.cache",Ln="esotericsoftware.spine.atlas.cache",Xn="spineSkeletonData",Bn="spineAtlasData",Hs="spine",Ve=Phaser.GameObjects.Components,_i=Ve.ComputedSize,Hi=Ve.Depth,ji=Ve.Flip,Zi=Ve.ScrollFactor,Ji=Ve.Transform,Ki=Ve.Visible,Qi=Ve.Origin,$i=Ve.Alpha;function Be(...t){return e=>(Phaser.Class.mixin(e,t),e)}var er=Be(_i),tr=Be(Hi),sr=Be(ji),ir=Be(Zi),rr=Be(Ji),nr=Be(Ki),ar=Be(Qi),lr=Be($i),On=class extends Phaser.GameObjects.GameObject{constructor(t,e){super(t,e)}},Vn=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},or=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new Je(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(2);const s=e.getBoundsRect(this.clipping?new vt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Dn=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.animationState)return{x:0,y:0,width:0,height:0};const e=new gs(t.animationState.data),s=new Je(t.skeleton.data),i=this.clipping?new vt:void 0,r=s.data;if(this.skins.length>0){let l=new at("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&l.addSkin(a)}s.setSkin(l)}s.setToSetupPose();const h=this.animation!=null?r.findAnimation(this.animation):null;if(h==null){s.updateWorldTransform(2);const l=s.getBoundsRect(i);return l.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:l}else{let l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,h,!1);const c=Math.max(h.duration/this.timeStep,1);for(let u=0;u<c;u++){const m=u>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(2);const f=s.getBoundsRect(i);l=Math.min(l,f.x),n=Math.min(n,f.y),a=Math.max(a,f.x+f.width),o=Math.max(o,f.y+f.height)}const d={x:l,y:n,width:a-l,height:o-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},js=class extends tr(ar(er(sr(ir(rr(nr(lr(On)))))))){constructor(t,e,s,i,r,h,l=new or){super(t,window.SPINE_GAME_OBJECT_TYPE?window.SPINE_GAME_OBJECT_TYPE:Hs),this.plugin=e,this.boundsProvider=l,this.setPosition(s,i),this.premultipliedAlpha=this.plugin.isAtlasPremultiplied(h),this.skeleton=this.plugin.createSkeleton(r,h),this.animationStateData=new pi(this.skeleton.data),this.animationState=new gs(this.animationStateData),this.skeleton.updateWorldTransform(2),this.updateSize()}blendMode=-1;skeleton;animationStateData;animationState;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};premultipliedAlpha=!1;offsetX=0;offsetY=0;updateSize(){if(!this.skeleton)return;let t=this.boundsProvider.calculateBounds(this);this.width=t.width,this.height=t.height,this.setDisplayOrigin(-t.x,-t.y),this.offsetX=-t.x,this.offsetY=-t.y}skeletonToPhaserWorldCoordinates(t){let e=this.getWorldTransformMatrix(),s=e.a,i=e.b,r=e.c,h=e.d,l=e.tx,n=e.ty,a=t.x,o=t.y;t.x=a*s+o*r+l,t.y=a*i+o*h+n}phaserWorldCoordinatesToSkeleton(t){let e=this.getWorldTransformMatrix();e=e.invert();let s=e.a,i=e.b,r=e.c,h=e.d,l=e.tx,n=e.ty,a=t.x,o=t.y;t.x=a*s+o*r+l,t.y=a*i+o*h+n}phaserWorldCoordinatesToBone(t,e){this.phaserWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}updatePose(t){this.animationState.update(t/1e3),this.animationState.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(t/1e3),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}preUpdate(t,e){!this.skeleton||!this.animationState||this.updatePose(e)}preDestroy(){}willRender(t){var e=15,s=!this.skeleton||!(e!==this.renderFlags||this.cameraFilter!==0&&this.cameraFilter&t.id);if(this.visible||(s=!1),!s&&this.parentContainer&&this.plugin.webGLRenderer){var i=this.plugin.webGLRenderer;this.plugin.gl&&this.plugin.phaserRenderer instanceof Phaser.Renderer.WebGL.WebGLRenderer&&i.batcher.isDrawing&&(i.end(),this.plugin.phaserRenderer.pipelines.rebind())}return s}renderWebGL(t,e,s,i){if(!this.skeleton||!this.animationState||!this.plugin.webGLRenderer)return;let r=this.plugin.webGLRenderer;t.newType&&(t.pipelines.clear(),r.begin()),s.addToRenderList(e);let h=Phaser.GameObjects.GetCalcMatrix(e,s,i).calc,l=h.a,n=h.b,a=h.c,o=h.d,c=h.tx,d=h.ty,u=e.offsetX-e.displayOriginX,m=e.offsetY-e.displayOriginY;r.drawSkeleton(e.skeleton,e.premultipliedAlpha,-1,-1,(f,g,x)=>{for(let b=0;b<g;b+=x){let p=f[b]+u,w=f[b+1]+m;f[b]=p*l+w*a+c,f[b+1]=p*n+w*o+d}}),t.nextTypeMatch||(r.end(),t.pipelines.rebind())}renderCanvas(t,e,s,i){if(!this.skeleton||!this.animationState||!this.plugin.canvasRenderer)return;let r=t.currentContext,h=this.plugin.canvasRenderer;h.ctx=r,s.addToRenderList(e);let l=Phaser.GameObjects.GetCalcMatrix(e,s,i).calc,n=this.skeleton;n.x=l.tx,n.y=l.ty,n.scaleX=l.scaleX,n.scaleY=l.scaleY;let a=n.getRootBone();a.rotation=-L.radiansToDegrees*l.rotationNormalized,this.skeleton.updateWorldTransform(2),r.save(),h.draw(n),r.restore()}};Je.yDown=!0;var Zs=class Xt extends ye.Plugins.ScenePlugin{game;isWebGL;gl;static gameWebGLRenderer=null;get webGLRenderer(){return Xt.gameWebGLRenderer}canvasRenderer;phaserRenderer;skeletonDataCache;atlasCache;constructor(e,s,i){super(e,s,i),this.game=s.game,this.isWebGL=this.game.config.renderType===2,this.gl=this.isWebGL?this.game.renderer.gl:null,this.phaserRenderer=this.game.renderer,this.canvasRenderer=null,this.skeletonDataCache=this.game.cache.addCustom(Pn),this.atlasCache=this.game.cache.addCustom(Ln);let r=function(o,c,d){let u=new hr(this,o,c,0,d);return this.addFile(u.files),this};s.registerFileType("spineJson",r,e);let h=function(o,c,d){let u=new hr(this,o,c,1,d);return this.addFile(u.files),this};s.registerFileType("spineBinary",h,e);let l=function(o,c,d,u){let m=new Nn(this,o,c,d,u);return this.addFile(m.files),this};s.registerFileType("spineAtlas",l,e);let n=function(o,c,d,u,m){this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.clear();const f=this.scene.sys[i];let g=new js(this.scene,f,o,c,d,u,m);return this.displayList.add(g),this.updateList.add(g),this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.rebind(),g},a=function(o,c=!1){this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.clear();let d=o.x?o.x:0,u=o.y?o.y:0,m=o.boundsProvider?o.boundsProvider:void 0;const f=this.scene.sys[i];let g=new js(this.scene,f,d,u,o.dataKey,o.atlasKey,m);return c!==void 0&&(o.add=c),this.scene.sys.renderer instanceof ye.Renderer.WebGL.WebGLRenderer&&this.scene.sys.renderer.pipelines.rebind(),ye.GameObjects.BuildGameObject(this.scene,g,o)};s.registerGameObject(window.SPINE_GAME_OBJECT_TYPE?window.SPINE_GAME_OBJECT_TYPE:Hs,n,a)}static rendererId=0;boot(){this.isWebGL&&this.gl?Xt.gameWebGLRenderer||=new zs(this.game.renderer.canvas,this.gl,!0):this.scene&&(this.canvasRenderer||=new Cn(this.scene.sys.context)),this.onResize(),this.systems&&(this.systems.events.once("destroy",this.destroy,this),this.systems.events.on("start",this.onStart,this),this.systems.events.on("shutdown",this.shutdown,this)),this.game.events.once("destroy",this.gameDestroy,this)}onResize(){const e=this.game.renderer,s=this.webGLRenderer;if(e&&s){const i=e.width,r=e.height;s.camera.position.x=i/2,s.camera.position.y=r/2,s.camera.up.y=-1,s.camera.direction.z=1,s.camera.setViewport(i,r)}}onStart(){this.game.scale.on(ye.Scale.Events.RESIZE,this.onResize,this)}shutdown(){this.isWebGL&&this.game.scale.off(ye.Scale.Events.RESIZE,this.onResize,this)}destroy(){this.shutdown(),this.systems?.events.off("start",this.onStart,this),this.systems?.events.off("shutdown",this.shutdown,this)}gameDestroy(){this.pluginManager.removeGameObject(window.SPINE_GAME_OBJECT_TYPE?window.SPINE_GAME_OBJECT_TYPE:Hs,!0,!0),this.webGLRenderer&&this.webGLRenderer.dispose(),Xt.gameWebGLRenderer=null}getAtlas(e){let s;if(this.atlasCache.exists(e))s=this.atlasCache.get(e);else{let i=this.game.cache.text.get(e);if(s=new wt(i.data),this.isWebGL){let r=this.gl;const h=r.getParameter(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL);h&&r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);for(let l of s.pages)l.setTexture(new ze(r,this.game.textures.get(e+"!"+l.name).getSourceImage(),!1));h&&r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0)}else for(let r of s.pages)r.setTexture(new yn(this.game.textures.get(e+"!"+r.name).getSourceImage()));this.atlasCache.add(e,s)}return s}isAtlasPremultiplied(e){let s=this.game.cache.text.get(e);return s?s.premultipliedAlpha:!1}getSkeletonData(e,s){const i=this.getAtlas(s),r=e+s;let h;if(this.skeletonDataCache.exists(r))h=this.skeletonDataCache.get(r);else{if(this.game.cache.json.exists(e)){let l=this.game.cache.json.get(e);h=new Pi(new ys(i)).readSkeletonData(l)}else{let l=this.game.cache.binary.get(e);h=new Ri(new ys(i)).readSkeletonData(new Uint8Array(l))}this.skeletonDataCache.add(r,h)}return h}createSkeleton(e,s){return new Je(this.getSkeletonData(e,s))}},hr=class extends ye.Loader.MultiFile{constructor(t,e,s,i,r){if(typeof e!="string"){const n=e;e=n.key,s=n.url,i=n.type==="spineJson"?0:1,r=n.xhrSettings}let h=null;i==0?h=new ye.Loader.FileTypes.JSONFile(t,{key:e,url:s,extension:"json",xhrSettings:r}):h=new ye.Loader.FileTypes.BinaryFile(t,{key:e,url:s,extension:"skel",xhrSettings:r}),super(t,Xn,e,[h]),this.fileType=i}onFileComplete(t){this.pending--}addToCache(){this.isReadyToProcess()&&this.files[0].addToCache()}},Nn=class extends ye.Loader.MultiFile{constructor(t,e,s,i,r){if(typeof e!="string"){const h=e;e=h.key,s=h.url,i=h.premultipliedAlpha,r=h.xhrSettings}super(t,Bn,e,[new ye.Loader.FileTypes.TextFile(t,{key:e,url:s,xhrSettings:r,extension:"atlas"})]),this.premultipliedAlpha=i}onFileComplete(t){if(this.files.indexOf(t)!=-1&&(this.pending--,t.type=="text")){var e=t.data.split(/\r\n|\r|\n/);let a=[];a.push(e[0]);for(var s=1;s<e.length;s++){var i=e[s];i.trim()===""&&s<e.length-1&&(i=e[s+1],a.push(i))}let o=t.url;typeof o=="object"&&(o=t.src);let c=(o.match(/^.*\//)??"").toString();this.loader.path&&this.loader.path.length>0&&c.startsWith(this.loader.path)&&(c=c.slice(this.loader.path.length));for(var r=0;r<a.length;r++){var h=c+a[r],l=t.key+"!"+a[r],n=new ye.Loader.FileTypes.ImageFile(this.loader,l,h);this.loader.keyExists(n)||(this.addToMultiFile(n),this.loader.addFile(n))}}}addToCache(){if(this.isReadyToProcess()){let t=this.loader.textureManager;for(let e of this.files)e.type=="image"?t.exists(e.key)||t.addImage(e.key,e.data):(this.premultipliedAlpha=this.premultipliedAlpha??(e.data.indexOf("pma: true")>=0||e.data.indexOf("pma:true")>=0),e.data={data:e.data,premultipliedAlpha:this.premultipliedAlpha},e.addToCache())}}};return window.spine={SpinePlugin:Zs},window["spine.SpinePlugin"]=Zs,Fr(ii)})();