@esotericsoftware/spine-webgl 4.2.115 → 4.3.0

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,16 +1,16 @@
1
- "use strict";var spine=(()=>{var Ie=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,_i=Object.getOwnPropertyNames,ji=Object.prototype.hasOwnProperty,Zi=(e,t)=>{for(var s in t)Ie(e,s,{get:t[s],enumerable:!0})},Ki=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _i(t))!ji.call(e,r)&&r!==s&&Ie(e,r,{get:()=>t[r],enumerable:!(i=Hi(t,r))||i.enumerable});return e},Ji=e=>Ki(Ie({},"__esModule",{value:!0}),e),Ws={};Zi(Ws,{AlphaTimeline:()=>ze,Animation:()=>ne,AnimationState:()=>sr,AnimationStateAdapter:()=>ir,AnimationStateData:()=>rr,AssetCache:()=>li,AssetManager:()=>bi,AssetManagerBase:()=>ai,AtlasAttachmentLoader:()=>lr,Attachment:()=>Re,AttachmentTimeline:()=>Ot,BinaryInput:()=>gi,BlendMode:()=>Is,Bone:()=>ms,BoneData:()=>us,BoundingBoxAttachment:()=>hs,CURRENT:()=>ei,CameraController:()=>qr,ClippingAttachment:()=>$t,Color:()=>tt,Color2Attribute:()=>Ai,ColorAttribute:()=>me,ConstraintData:()=>ee,CurveTimeline:()=>Ct,CurveTimeline1:()=>yt,CurveTimeline2:()=>ae,DebugUtils:()=>tr,DeformTimeline:()=>Ge,Downloader:()=>gs,DrawOrderTimeline:()=>zt,Event:()=>xs,EventData:()=>ps,EventQueue:()=>Qs,EventTimeline:()=>le,EventType:()=>$s,FIRST:()=>as,FakeTexture:()=>nr,GLTexture:()=>Gt,HOLD_FIRST:()=>he,HOLD_MIX:()=>ti,HOLD_SUBSEQUENT:()=>ls,IkConstraint:()=>oi,IkConstraintData:()=>ws,IkConstraintTimeline:()=>He,Inherit:()=>de,InheritTimeline:()=>De,Input:()=>Ys,IntSet:()=>Qi,Interpolation:()=>qs,LoadingScreen:()=>Zr,M00:()=>V,M01:()=>W,M02:()=>q,M03:()=>O,M10:()=>G,M11:()=>D,M12:()=>H,M13:()=>N,M20:()=>_,M21:()=>j,M22:()=>U,M23:()=>z,M30:()=>J,M31:()=>Q,M32:()=>$,M33:()=>K,ManagedWebGLRenderingContext:()=>xt,MathUtils:()=>P,Matrix4:()=>se,Mesh:()=>ks,MeshAttachment:()=>Wt,MixBlend:()=>Zs,MixDirection:()=>Ks,OrthoCamera:()=>vi,PathAttachment:()=>qt,PathConstraint:()=>hi,PathConstraintData:()=>bs,PathConstraintMixTimeline:()=>Ke,PathConstraintPositionTimeline:()=>je,PathConstraintSpacingTimeline:()=>Ze,Physics:()=>ui,PhysicsConstraintDampingTimeline:()=>$e,PhysicsConstraintGravityTimeline:()=>ss,PhysicsConstraintInertiaTimeline:()=>Je,PhysicsConstraintMassTimeline:()=>ts,PhysicsConstraintMixTimeline:()=>is,PhysicsConstraintResetTimeline:()=>rs,PhysicsConstraintStrengthTimeline:()=>Qe,PhysicsConstraintTimeline:()=>Pt,PhysicsConstraintWindTimeline:()=>es,PointAttachment:()=>ni,PolygonBatcher:()=>Xs,Pool:()=>Jt,Position2Attribute:()=>ue,Position3Attribute:()=>Gr,PositionMode:()=>vs,Pow:()=>Gs,PowOut:()=>$i,RGB2Timeline:()=>qe,RGBA2Timeline:()=>We,RGBATimeline:()=>Ne,RGBTimeline:()=>Ue,RegionAttachment:()=>te,ResizeMode:()=>ki,RotateMode:()=>As,RotateTimeline:()=>Qt,SETUP:()=>os,SUBSEQUENT:()=>oe,ScaleTimeline:()=>Xe,ScaleXTimeline:()=>Pe,ScaleYTimeline:()=>Le,SceneRenderer:()=>Yi,SequenceTimeline:()=>ns,Shader:()=>Tt,ShapeRenderer:()=>Ps,ShapeType:()=>Mi,ShearTimeline:()=>Be,ShearXTimeline:()=>Ve,ShearYTimeline:()=>Oe,Skeleton:()=>fi,SkeletonBinary:()=>hr,SkeletonBounds:()=>xi,SkeletonClipping:()=>wi,SkeletonData:()=>Cs,SkeletonDebugRenderer:()=>Ei,SkeletonJson:()=>zr,SkeletonRenderer:()=>Ri,Skin:()=>fe,SkinEntry:()=>Ss,Slot:()=>ci,SlotData:()=>Ts,SpacingMode:()=>ys,SpineCanvas:()=>Qr,StringSet:()=>Me,TexCoordAttribute:()=>Fs,Texture:()=>cs,TextureAtlas:()=>ds,TextureAtlasPage:()=>ri,TextureAtlasRegion:()=>fs,TextureFilter:()=>ce,TextureRegion:()=>ii,TextureWrap:()=>si,TimeKeeper:()=>Ee,Timeline:()=>ft,Touch:()=>yi,TrackEntry:()=>Js,TransformConstraint:()=>di,TransformConstraintData:()=>Ms,TransformConstraintTimeline:()=>_e,TranslateTimeline:()=>Ye,TranslateXTimeline:()=>ke,TranslateYTimeline:()=>Fe,Triangulator:()=>pi,Utils:()=>L,Vector2:()=>Vt,Vector3:()=>At,VertexAttachment:()=>Yt,VertexAttribute:()=>Ht,VertexAttributeType:()=>Ci,WindowedMean:()=>er});var Qi=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Me=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},tt=class Nt{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new Nt(1,1,1,1);static RED=new Nt(1,0,0,1);static GREEN=new Nt(0,1,0,1);static BLUE=new Nt(0,0,1,1);static MAGENTA=new Nt(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,r){return this.r+=t,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(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new Nt){return s.setFromString(t)}},P=class Et{static PI=3.1415927;static PI2=Et.PI*2;static invPI2=1/Et.PI2;static radiansToDegrees=180/Et.PI;static radDeg=Et.radiansToDegrees;static degreesToRadians=Et.PI/180;static degRad=Et.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*Et.degRad)}static sinDeg(t){return Math.sin(t*Et.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*Et.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return Et.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),h=s-t;return r<=(i-t)/h?t+Math.sqrt(r*h*(i-t)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},qs=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},Gs=class extends qs{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},$i=class extends Gs{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},L=class Kt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,r,h){for(let l=s,n=r;l<s+h;l++,n++)i[n]=t[l]}static arrayFill(t,s,i,r){for(let h=s;h<i;h++)t[h]=r}static setArraySize(t,s,i=0){let r=t.length;if(r==s)return t;if(t.length=s,r<s)for(let h=r;h<s;h++)t[h]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:Kt.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r<t;r++)i[r]=s;return i}static newFloatArray(t){if(Kt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(Kt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return Kt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Kt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,i=!0){for(var r=0;r<t.length;r++)if(t[r]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},tr=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Jt=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Vt=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},Ee=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},er=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},Re=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Yt=class Bi extends Re{static nextID=0;id=Bi.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,i,r,h,l){i=h+(i>>1)*l;let n=t.bone.skeleton,a=t.deform,o=this.vertices,c=this.bones;if(!c){a.length>0&&(o=a);let u=t.bone,g=u.worldX,w=u.worldY,b=u.a,x=u.b,p=u.c,v=u.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*x+g,r[A+1]=C*p+S*v+w}return}let d=0,f=0;for(let u=0;u<s;u+=2){let g=c[d];d+=g+1,f+=g}let m=n.bones;if(a.length==0)for(let u=h,g=f*3;u<i;u+=l){let w=0,b=0,x=c[d++];for(x+=d;d<x;d++,g+=3){let p=m[c[d]],v=o[g],y=o[g+1],A=o[g+2];w+=(v*p.a+y*p.b+p.worldX)*A,b+=(v*p.c+y*p.d+p.worldY)*A}r[u]=w,r[u+1]=b}else{let u=a;for(let g=h,w=f*3,b=f<<1;g<i;g+=l){let x=0,p=0,v=c[d++];for(v+=d;d<v;d++,w+=3,b+=2){let y=m[c[d]],A=o[w]+u[b],C=o[w+1]+u[b+1],S=o[w+2];x+=(A*y.a+C*y.b+y.worldX)*S,p+=(A*y.c+C*y.d+y.worldY)*S}r[g]=x,r[g+1]=p}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),L.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=L.newFloatArray(this.vertices.length),L.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},Hs=class Ae{static _nextID=0;id=Ae.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Ae(this.regions.length);return L.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let i=t.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(t,s){let i=t,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return Ae._nextID++}},_s=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(_s||{}),js=[0,1,2,3,4,5,6],ne=class{name;timelines=[];timelineIds=new Me;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,r,h,l,n){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let o=0,c=a.length;o<c;o++)a[o].apply(e,t,s,r,h,l,n)}},Zs=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Zs||{}),Ks=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Ks||{}),it={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},ft=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=L.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}},Ct=class extends ft{curves;constructor(e,t,s){super(e,s),this.curves=L.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=L.newFloatArray(t);L.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,r,h,l,n,a,o,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+n)*.03,u=(r-l*2+a)*.03,g=((h-n)*3-i+o)*.006,w=((l-a)*3-r+c)*.006,b=m*2+g,x=u*2+w,p=(h-i)*.3+m+g*.16666667,v=(l-r)*.3+u+w*.16666667,y=i+p,A=r+v;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=A,p+=b,v+=x,b+=g,x+=w,y+=p,A+=v}getBezierValue(e,t,s,i){let r=this.curves;if(r[i]>e){let a=this.frames[t],o=this.frames[t+s];return o+(e-a)/(r[i]-a)*(r[i+1]-o)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=e){let a=r[i-2],o=r[i-1];return o+(e-a)/(r[i]-a)*(r[i+1]-o)}t+=this.getFrameEntries();let l=r[h-2],n=r[h-1];return n+(e-l)/(this.frames[t]-l)*(this.frames[t+s]-n)}},yt=class extends Ct{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],h=t[s+1];return h+(e-r)/(t[s+2]-r)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return r+h*t;case 1:case 2:h+=r-i}return i+h*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);return s==0?r+(h-r)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,r,h){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}return s==0?r+(h-r)*t:i+(h-i)*t}getScaleValue(e,t,s,i,r,h){const l=this.frames;if(e<l[0]){switch(s){case 0:return h;case 1:return r+(h-r)*t}return r}let n=this.getCurveValue(e)*h;if(t==1)return s==3?r+n-h:n;if(i==1)switch(s){case 0:return h+(Math.abs(n)*P.signum(h)-h)*t;case 1:case 2:return r+(Math.abs(n)*P.signum(r)-r)*t}else{let a=0;switch(s){case 0:return a=Math.abs(h)*P.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(r)*P.signum(n),a+(n-a)*t}}return r+(n-h)*t}},ae=class extends Ct{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Qt=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,h,n.rotation,n.data.rotation))}},Ye=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,it.x+"|"+s,it.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.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=ft.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*u,c+=(a[d+3+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+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}}},ke=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,h,n.x,n.data.x))}},Fe=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,h,n.y,n.data.y))}},Xe=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,it.scaleX+"|"+s,it.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.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=ft.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*u,c+=(a[d+3+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+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,u=0;if(l==1)switch(h){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(o)*P.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*P.signum(u)-u)*r;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(o)*P.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*P.signum(u)-u)*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)*P.signum(o),u=Math.abs(n.data.scaleY)*P.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*P.signum(o),u=Math.abs(n.scaleY)*P.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=u+(c-u)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Pe=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,h,l,n.scaleX,n.data.scaleX))}},Le=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,h,l,n.scaleY,n.data.scaleY))}},Be=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,it.shearX+"|"+s,it.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.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=ft.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*u,c+=(a[d+3+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+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}}},Ve=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,h,n.shearX,n.data.shearX))}},Oe=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,h,n.shearY,n.data.shearY))}},De=class extends ft{boneIndex=0;constructor(e,t){super(e,[it.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,r,h,l){let n=e.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[ft.search(a,s,2)+1]}},Ne=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s,it.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,r,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let w=n.data.color;switch(h){case 0:o.setFromColor(w);return;case 1:o.add((w.r-o.r)*r,(w.g-o.g)*r,(w.b-o.b)*r,(w.a-o.a)*r)}return}let c=0,d=0,f=0,m=0,u=ft.search(a,s,5),g=this.curves[u/5];switch(g){case 0:let w=a[u];c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];let b=(s-w)/(a[u+5]-w);c+=(a[u+5+1]-c)*b,d+=(a[u+5+2]-d)*b,f+=(a[u+5+3]-f)*b,m+=(a[u+5+4]-m)*b;break;case 1:c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];break;default:c=this.getBezierValue(s,u,1,g-2),d=this.getBezierValue(s,u,2,g+18-2),f=this.getBezierValue(s,u,3,g+18*2-2),m=this.getBezierValue(s,u,4,g+18*3-2)}r==1?o.set(c,d,f,m):(h==0&&o.setFromColor(n.data.color),o.add((c-o.r)*r,(d-o.g)*r,(f-o.b)*r,(m-o.a)*r))}},Ue=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r}apply(e,t,s,i,r,h,l){let n=e.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,f=0,m=ft.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let g=a[m];c=a[m+1],d=a[m+2],f=a[m+3];let w=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*w,d+=(a[m+4+2]-d)*w,f+=(a[m+4+3]-f)*w;break;case 1:c=a[m+1],d=a[m+2],f=a[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)o.r=c,o.g=d,o.b=f;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+=(f-o.b)*r}}},ze=class extends yt{slotIndex=0;constructor(e,t,s){super(e,t,it.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,h,l){let n=e.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)}},We=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s,it.alpha+"|"+s,it.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,r,h,l,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,i,r,h,l){let n=e.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,f=0,m=0,u=0,g=0,w=0,b=0,x=ft.search(a,s,8),p=this.curves[x>>3];switch(p){case 0:let v=a[x];d=a[x+1],f=a[x+2],m=a[x+3],u=a[x+4],g=a[x+5],w=a[x+6],b=a[x+7];let y=(s-v)/(a[x+8]-v);d+=(a[x+8+1]-d)*y,f+=(a[x+8+2]-f)*y,m+=(a[x+8+3]-m)*y,u+=(a[x+8+4]-u)*y,g+=(a[x+8+5]-g)*y,w+=(a[x+8+6]-w)*y,b+=(a[x+8+7]-b)*y;break;case 1:d=a[x+1],f=a[x+2],m=a[x+3],u=a[x+4],g=a[x+5],w=a[x+6],b=a[x+7];break;default:d=this.getBezierValue(s,x,1,p-2),f=this.getBezierValue(s,x,2,p+18-2),m=this.getBezierValue(s,x,3,p+18*2-2),u=this.getBezierValue(s,x,4,p+18*3-2),g=this.getBezierValue(s,x,5,p+18*4-2),w=this.getBezierValue(s,x,6,p+18*5-2),b=this.getBezierValue(s,x,7,p+18*6-2)}if(r==1)o.set(d,f,m,u),c.r=g,c.g=w,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,(f-o.g)*r,(m-o.b)*r,(u-o.a)*r),c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},qe=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s,it.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,l,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=n}apply(e,t,s,i,r,h,l){let n=e.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,f=0,m=0,u=0,g=0,w=0,b=0,x=ft.search(a,s,7),p=this.curves[x/7];switch(p){case 0:let v=a[x];d=a[x+1],f=a[x+2],m=a[x+3],g=a[x+4],w=a[x+5],b=a[x+6];let y=(s-v)/(a[x+7]-v);d+=(a[x+7+1]-d)*y,f+=(a[x+7+2]-f)*y,m+=(a[x+7+3]-m)*y,g+=(a[x+7+4]-g)*y,w+=(a[x+7+5]-w)*y,b+=(a[x+7+6]-b)*y;break;case 1:d=a[x+1],f=a[x+2],m=a[x+3],g=a[x+4],w=a[x+5],b=a[x+6];break;default:d=this.getBezierValue(s,x,1,p-2),f=this.getBezierValue(s,x,2,p+18-2),m=this.getBezierValue(s,x,3,p+18*2-2),g=this.getBezierValue(s,x,4,p+18*3-2),w=this.getBezierValue(s,x,5,p+18*4-2),b=this.getBezierValue(s,x,6,p+18*5-2)}if(r==1)o.r=d,o.g=f,o.b=m,c.r=g,c.g=w,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+=(f-o.g)*r,o.b+=(m-o.b)*r,c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},Ot=class extends ft{slotIndex=0;attachmentNames;constructor(e,t){super(e,[it.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(n.bone.active){if(l==1){h==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[ft.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Ge=class extends Ct{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[it.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,r,h,l,n,a,o,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+n)*.03,u=a*.03-l*.06,g=((h-n)*3-i+o)*.006,w=(l-a+.33333333)*.018,b=m*2+g,x=u*2+w,p=(h-i)*.3+m+g*.16666667,v=l*.3+u+w*.16666667,y=i+p,A=v;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=A,p+=b,v+=x,b+=g,x+=w,y+=p,A+=v}getCurvePercent(e,t){let s=this.curves,i=s[t];switch(i){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>e){let n=this.frames[t];return s[i+1]*(e-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=e){let n=s[i-2],a=s[i-1];return a+(e-n)/(s[i]-n)*(s[i+1]-a)}let h=s[r-2],l=s[r-1];return l+(1-l)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof Yt)||a.timelineAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(h){case 0:o.length=0;return;case 1:if(r==1){o.length=0;return}o.length=d;let x=a;if(x.bones){r=1-r;for(var m=0;m<d;m++)o[m]*=r}else{let p=x.vertices;for(var m=0;m<d;m++)o[m]+=(p[m]-o[m])*r}}return}if(o.length=d,s>=f[f.length-1]){let x=c[f.length-1];if(r==1)if(h==3){let p=a;if(p.bones)for(let v=0;v<d;v++)o[v]+=x[v];else{let v=p.vertices;for(let y=0;y<d;y++)o[y]+=x[y]-v[y]}}else L.arrayCopy(x,0,o,0,d);else switch(h){case 0:{let v=a;if(v.bones)for(let y=0;y<d;y++)o[y]=x[y]*r;else{let y=v.vertices;for(let A=0;A<d;A++){let C=y[A];o[A]=C+(x[A]-C)*r}}break}case 1:case 2:for(let v=0;v<d;v++)o[v]+=(x[v]-o[v])*r;break;case 3:let p=a;if(p.bones)for(let v=0;v<d;v++)o[v]+=x[v]*r;else{let v=p.vertices;for(let y=0;y<d;y++)o[y]+=(x[y]-v[y])*r}}return}let u=ft.search1(f,s),g=this.getCurvePercent(s,u),w=c[u],b=c[u+1];if(r==1)if(h==3){let x=a;if(x.bones)for(let p=0;p<d;p++){let v=w[p];o[p]+=v+(b[p]-v)*g}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];o[v]+=y+(b[v]-y)*g-p[v]}}}else for(let x=0;x<d;x++){let p=w[x];o[x]=p+(b[x]-p)*g}else switch(h){case 0:{let p=a;if(p.bones)for(let v=0;v<d;v++){let y=w[v];o[v]=(y+(b[v]-y)*g)*r}else{let v=p.vertices;for(let y=0;y<d;y++){let A=w[y],C=v[y];o[y]=C+(A+(b[y]-A)*g-C)*r}}break}case 1:case 2:for(let p=0;p<d;p++){let v=w[p];o[p]+=(v+(b[p]-v)*g-o[p])*r}break;case 3:let x=a;if(x.bones)for(let p=0;p<d;p++){let v=w[p];o[p]+=(v+(b[p]-v)*g)*r}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];o[v]+=(y+(b[v]-y)*g-p[v])*r}}}}},le=class Vi extends ft{static propertyIds=[""+it.event];events;constructor(t){super(t,Vi.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,r,h,l,n){if(!r)return;let a=this.frames,o=this.frames.length;if(s>i)this.apply(t,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=ft.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])}},zt=class Oi extends ft{static propertyIds=[""+it.drawOrder];drawOrders;constructor(t){super(t,Oi.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,h,l,n){if(n==1){l==0&&L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(l==0||l==1)&&L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=ft.search1(this.frames,i),o=this.drawOrders[a];if(!o)L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,d=t.slots;for(let f=0,m=o.length;f<m;f++)c[f]=d[o[f]]}}},He=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,[it.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,r,h,l){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h?1:0,this.frames[e+5]=l?1:0}apply(e,t,s,i,r,h,l){let n=e.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=ft.search(a,s,6),f=this.curves[d/6];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+6]-m);o+=(a[d+6+1]-o)*u,c+=(a[d+6+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+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))}},_e=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,[it.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,l,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=i,a[e+3]=r,a[e+4]=h,a[e+5]=l,a[e+6]=n}apply(e,t,s,i,r,h,l){let n=e.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,f,m,u,g=ft.search(a,s,7),w=this.curves[g/7];switch(w){case 0:let b=a[g];o=a[g+1],c=a[g+2],d=a[g+3],f=a[g+4],m=a[g+5],u=a[g+6];let x=(s-b)/(a[g+7]-b);o+=(a[g+7+1]-o)*x,c+=(a[g+7+2]-c)*x,d+=(a[g+7+3]-d)*x,f+=(a[g+7+4]-f)*x,m+=(a[g+7+5]-m)*x,u+=(a[g+7+6]-u)*x;break;case 1:o=a[g+1],c=a[g+2],d=a[g+3],f=a[g+4],m=a[g+5],u=a[g+6];break;default:o=this.getBezierValue(s,g,1,w-2),c=this.getBezierValue(s,g,2,w+18-2),d=this.getBezierValue(s,g,3,w+18*2-2),f=this.getBezierValue(s,g,4,w+18*3-2),m=this.getBezierValue(s,g,5,w+18*4-2),u=this.getBezierValue(s,g,6,w+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+(f-b.mixScaleX)*r,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*r,n.mixShearY=b.mixShearY+(u-b.mixShearY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(f-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(u-n.mixShearY)*r}},je=class extends yt{constraintIndex=0;constructor(e,t,s){super(e,t,it.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,l){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,h,n.position,n.data.position))}},Ze=class extends yt{constraintIndex=0;constructor(e,t,s){super(e,t,it.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,l){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,h,n.spacing,n.data.spacing))}},Ke=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,[it.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=r}apply(e,t,s,i,r,h,l){let n=e.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,f=ft.search(a,s,4),m=this.curves[f>>2];switch(m){case 0:let u=a[f];o=a[f+1],c=a[f+2],d=a[f+3];let g=(s-u)/(a[f+4]-u);o+=(a[f+4+1]-o)*g,c+=(a[f+4+2]-c)*g,d+=(a[f+4+3]-d)*g;break;case 1:o=a[f+1],c=a[f+2],d=a[f+3];break;default:o=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(h==0){let u=n.data;n.mixRotate=u.mixRotate+(o-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(d-u.mixY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Pt=class extends yt{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,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 e.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,r,h,this.get(o),this.setup(o),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,h,this.get(n),this.setup(n)))}},Je=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Qe=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},$e=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},ts=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},es=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},ss=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},is=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},rs=class Di extends ft{static propertyIds=[it.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Di.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,h,l,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const o=this.frames;if(s>i)this.apply(t,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[ft.search1(o,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},ns=class Lt extends ft{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[it.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Lt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,h){let l=this.frames;t*=Lt.ENTRIES,l[t]=s,l[t+Lt.MODE]=i|r<<4,l[t+Lt.DELAY]=h}apply(t,s,i,r,h,l,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let o=a.attachment,c=this.attachment;if(o!=c&&(!(o instanceof Yt)||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 f=ft.search(d,i,Lt.ENTRIES),m=d[f],u=d[f+Lt.MODE],g=d[f+Lt.DELAY];if(!this.attachment.sequence)return;let w=u>>4,b=this.attachment.sequence.regions.length,x=js[u&15];if(x!=0)switch(w+=(i-m)/g+1e-5|0,x){case 1:w=Math.min(b-1,w);break;case 2:w%=b;break;case 3:{let p=(b<<1)-2;w=p==0?0:w%p,w>=b&&(w=p-w);break}case 4:w=Math.max(b-1-w,0);break;case 5:w=b-1-w%b;break;case 6:{let p=(b<<1)-2;w=p==0?0:(w+b-1)%p,w>=b&&(w=p-w)}}a.sequenceIndex=w}},sr=class Ce{static _emptyAnimation=new ne("<empty>",[],0);static emptyAnimation(){return Ce._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Qs(this);propertyIDs=new Me;animationsChanged=!1;trackEntryPool=new Jt(()=>new Js);constructor(t){this.data=t}update(t){t*=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=t*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+t)*n.timeScale,h.trackTime+=l,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=t,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,t)){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(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;r=!0;let g=f==0?1:u.mixBlend,w=u.alpha;u.mixingFrom?w*=this.applyMixingFrom(u,t,g):u.trackTime>=u.trackEnd&&!u.next&&(w=0);let b=w>=u.alphaAttachmentThreshold,x=u.animationLast,p=u.getAnimationTime(),v=p,y=s;u.reverse&&(v=u.animation.duration-v,y=null);let A=u.animation.timelines,C=A.length;if(f==0&&w==1||g==3){f==0&&(b=!0);for(let S=0;S<C;S++){L.webkit602BugfixHelper(w,g);var h=A[S];h instanceof Ot?this.applyAttachmentTimeline(h,t,v,g,b):h.apply(t,x,v,y,w,g,0)}}else{let S=u.timelineMode,I=u.shortestRotation,Y=!I&&u.timelinesRotation.length!=C<<1;Y&&(u.timelinesRotation.length=C<<1);for(let k=0;k<C;k++){let F=A[k],X=S[k]==oe?g:0;!I&&F instanceof Qt?this.applyRotateTimeline(F,t,v,w,X,u.timelinesRotation,k<<1,Y):F instanceof Ot?this.applyAttachmentTimeline(F,t,v,g,b):(L.webkit602BugfixHelper(w,g),F.apply(t,x,v,y,w,X,0))}}this.queueEvents(u,p),s.length=0,u.nextAnimationLast=p,u.nextTrackLast=u.trackTime}for(var l=this.unkeyedState+os,n=t.slots,a=0,o=t.slots.length;a<o;a++){var c=n[a];if(c.attachmentState==l){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,s,i){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;t.mixDuration==0?(h=1,i==1&&(i=0)):(h=t.mixTime/t.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*t.interruptAlpha,d=c*(1-h),f=r.animationLast,m=r.getAnimationTime(),u=m,g=null;if(r.reverse?u=r.animation.duration-u:h<r.eventThreshold&&(g=this.events),i==3)for(let w=0;w<o;w++)a[w].apply(s,f,u,g,d,i,1);else{let w=r.timelineMode,b=r.timelineHoldMix,x=r.shortestRotation,p=!x&&r.timelinesRotation.length!=o<<1;p&&(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(w[v]){case oe:if(!n&&y instanceof zt)continue;C=i,S=d;break;case as:C=0,S=d;break;case ls:C=i,S=c;break;case he: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,!x&&y instanceof Qt?this.applyRotateTimeline(y,s,u,S,C,r.timelinesRotation,v<<1,p):y instanceof Ot?this.applyAttachmentTimeline(y,s,u,C,l&&S>=r.alphaAttachmentThreshold):(L.webkit602BugfixHelper(S,i),n&&y instanceof zt&&C==0&&(A=0),y.apply(s,f,u,g,S,C,A))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(t,s,i,r,h){var l=s.slots[t.slotIndex];l.bone.active&&(i<t.frames[0]?(r==0||r==1)&&this.setAttachment(s,l,l.data.attachmentName,h):this.setAttachment(s,l,t.attachmentNames[ft.search1(t.frames,i)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+os))}setAttachment(t,s,i,r){s.setAttachment(i?t.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+ei)}applyRotateTimeline(t,s,i,r,h,l,n,a){if(a&&(l[n]=0),r==1){t.apply(s,0,i,null,1,h,0);return}let o=s.bones[t.boneIndex];if(!o.active)return;let c=t.frames,d=0,f=0;if(i<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:d=o.rotation,f=o.data.rotation}else d=h==0?o.data.rotation:o.rotation,f=o.data.rotation+t.getCurveValue(i);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=l[n];else{let g=0,w=0;a?(g=0,w=u):(g=l[n],w=l[n+1]);let b=g-g%360;m=u+b;let x=u>=0,p=g>=0;Math.abs(w)<=90&&P.signum(w)!=P.signum(u)&&(Math.abs(g-b)>180?(m+=360*P.signum(g),p=x):b!=0?m-=360*P.signum(g):p=x),p!=x&&(m+=360*P.signum(g)),l[n]=m}l[n+1]=u,o.rotation=d+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,h=r-i,l=t.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(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=r&&t.animationLast<r;for(c&&this.queue.complete(t);a<o;a++){let d=n[a];d.time<i||this.queue.event(t,d)}}clearTracks(){let t=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=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];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(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=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(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let l=this.trackEntry(t,s,i,h);return this.setCurrent(t,l,r),this.queue.drain(),l}addAnimation(t,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,i,r)}addAnimationWith(t,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(t,s,i,h);return h?(h.next=l,l.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(t,l,!0),this.queue.drain(),r<0&&(r=0)),l.delay=r,l}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,Ce.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,Ce.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=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,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(L.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,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(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let s=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,h=t.timelineMode;h.length=r;let l=t.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())?he:ls;return}t:for(let a=0;a<r;a++){let o=i[a],c=o.getPropertyIds();if(!n.addAll(c))h[a]=oe;else if(!s||o instanceof Ot||o instanceof zt||o instanceof le||!s.animation.hasTimeline(c))h[a]=as;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(t.mixDuration>0){h[a]=ti,l[a]=d;continue t}break}h[a]=he}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Js=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Qs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t<e.length;t+=2){let s=e[t],i=e[t+1],r=this.animState.listeners.slice();switch(s){case 0:i.listener&&i.listener.start&&i.listener.start(i);for(let l=0;l<r.length;l++){let n=r[l];n.start&&n.start(i)}break;case 1:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let l=0;l<r.length;l++){let n=r[l];n.interrupt&&n.interrupt(i)}break;case 2:i.listener&&i.listener.end&&i.listener.end(i);for(let l=0;l<r.length;l++){let n=r[l];n.end&&n.end(i)}case 3:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let l=0;l<r.length;l++){let n=r[l];n.dispose&&n.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener&&i.listener.complete&&i.listener.complete(i);for(let l=0;l<r.length;l++){let n=r[l];n.complete&&n.complete(i)}break;case 5:let h=e[t+++2];i.listener&&i.listener.event&&i.listener.event(i,h);for(let l=0;l<r.length;l++){let n=r[l];n.event&&n.event(i,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},$s=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))($s||{}),ir=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},oe=0,as=1,ls=2,he=3,ti=4,os=1,ei=2,rr=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},hs=class Ni extends Yt{color=new tt(1,1,1,1);constructor(t){super(t)}copy(){let t=new Ni(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},$t=class Ui extends Yt{endSlot=null;color=new tt(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ui(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},cs=class{_image;constructor(e){this._image=e}getImage(){return this._image}},ce=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(ce||{}),si=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(si||{}),ii=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},nr=class extends cs{setFilters(e,t){}setWraps(e,t){}dispose(){}},ds=class{pages=new Array;regions=new Array;constructor(e){let t=new ar(e),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=L.enumValue(ce,s[1]),o.magFilter=L.enumValue(ce,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=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let l=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)l=null,h=t.readLine();else if(l){let o=new fs(l,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=r[s[0]];if(d)d(o);else{n||(n=[]),a||(a=[]),n.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));a.push(f)}}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 ri(h.trim());t.readEntry(s,h=t.readLine())!=0;){let o=i[s[0]];o&&o(l)}this.pages.push(l)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},ar=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=t.indexOf(",",r);if(h==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},ri=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},fs=class extends ii{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},Wt=class Ds extends Yt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new tt(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new tt(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=L.newFloatArray(t.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 fs){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 f=0;f<i;f+=2)s[f]=r+t[f+1]*l,s[f+1]=h+(1-t[f])*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 f=0;f<i;f+=2)s[f]=r+(1-t[f])*l,s[f+1]=h+(1-t[f+1])*n;return;case 270:r-=a.offsetY/c,h-=a.offsetX/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f+1])*l,s[f+1]=h+t[f]*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+t[a]*l,s[a+1]=h+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Ds(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),L.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?L.newFloatArray(this.uvs.length):new Array(this.uvs.length),L.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),L.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),L.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,i,r,h,l){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,h,l)}newLinkedMesh(){let t=new Ds(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},qt=class zi extends Yt{lengths=[];closed=!1;constantSpeed=!1;color=new tt(1,1,1,1);constructor(t){super(t)}copy(){let t=new zi(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),L.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},ni=class Wi extends Yt{x=0;y=0;rotation=0;color=new tt(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*P.degRad,i=Math.cos(s),r=Math.sin(s),h=i*t.a+r*t.b,l=i*t.c+r*t.d;return P.atan2Deg(l,h)}copy(){let t=new Wi(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},te=class qi extends Re{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new tt(1,1,1,1);path;region=null;sequence=null;offset=L.newFloatArray(8);uvs=L.newFloatArray(8);tempColor=new tt(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==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*P.degRad,c=Math.cos(o),d=Math.sin(o),f=this.x,m=this.y,u=h*c+f,g=h*d,w=l*c+m,b=l*d,x=n*c+f,p=n*d,v=a*c+m,y=a*d,A=this.offset;A[0]=u-b,A[1]=w+g,A[2]=u-y,A[3]=v+g,A[4]=x-y,A[5]=v+p,A[6]=x-b,A[7]=w+p,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,i,r){this.sequence!=null&&this.sequence.apply(t,this);let h=t.bone,l=this.offset,n=h.worldX,a=h.worldY,o=h.a,c=h.b,d=h.c,f=h.d,m=0,u=0;m=l[0],u=l[1],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=l[2],u=l[3],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=l[4],u=l[5],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=l[6],u=l[7],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a}copy(){let t=new qi(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,L.arrayCopy(this.uvs,0,t.uvs,0,8),L.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}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},lr=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let l=s.getPath(t,r),n=this.atlas.findRegion(l);if(n==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+e+")");i[r]=n}}newRegionAttachment(e,t,s,i){let r=new te(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=h}return r}newMeshAttachment(e,t,s,i){let r=new Wt(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=h}return r}newBoundingBoxAttachment(e,t){return new hs(t)}newPathAttachment(e,t){return new qt(t)}newPointAttachment(e,t){return new ni(t)}newClippingAttachment(e,t){return new $t(t)}},us=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 tt;icon;visible=!1;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},de=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(de||{}),ms=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,r,h,l){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l;let n=this.parent;if(!n){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,g=(s+h)*P.degRad,w=(s+90+l)*P.degRad;this.a=Math.cos(g)*i*m,this.b=Math.cos(w)*r*m,this.c=Math.sin(g)*i*u,this.d=Math.sin(w)*r*u,this.worldX=e*m+f.x,this.worldY=t*u+f.y;return}let a=n.a,o=n.b,c=n.c,d=n.d;switch(this.worldX=a*e+o*t+n.worldX,this.worldY=c*e+d*t+n.worldY,this.inherit){case 0:{const f=(s+h)*P.degRad,m=(s+90+l)*P.degRad,u=Math.cos(f)*i,g=Math.cos(m)*r,w=Math.sin(f)*i,b=Math.sin(m)*r;this.a=a*u+o*w,this.b=a*g+o*b,this.c=c*u+d*w,this.d=c*g+d*b;return}case 1:{const f=(s+h)*P.degRad,m=(s+90+l)*P.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;break}case 2:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=f,c*=m;let u=a*a+c*c,g=0;u>1e-4?(u=Math.abs(a*d*m-o*f*c)/u,o=c*u,d=a*u,g=Math.atan2(c,a)*P.radDeg):(a=0,c=0,g=90-Math.atan2(d,o)*P.radDeg);const w=(s+h-g)*P.degRad,b=(s+l-g+90)*P.degRad,x=Math.cos(w)*i,p=Math.cos(b)*r,v=Math.sin(w)*i,y=Math.sin(b)*r;this.a=a*x-o*v,this.b=a*p-o*y,this.c=c*x+d*v,this.d=c*p+d*y;break}case 3:case 4:{s*=P.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(a*f+o*m)/this.skeleton.scaleX,g=(c*f+d*m)/this.skeleton.scaleY,w=Math.sqrt(u*u+g*g);w>1e-5&&(w=1/w),u*=w,g*=w,w=Math.sqrt(u*u+g*g),this.inherit==3&&a*d-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(g,u);const b=Math.cos(s)*w,x=Math.sin(s)*w;h*=P.degRad,l=(90+l)*P.degRad;const p=Math.cos(h)*i,v=Math.cos(l)*r,y=Math.sin(h)*i,A=Math.sin(l)*r;this.a=u*p+b*y,this.b=u*v+b*A,this.c=g*p+x*y,this.d=g*v+x*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*P.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)*P.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,h=1/(t*r-s*i),l=r*h,n=s*h,a=i*h,o=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*l-d*n,this.ay=d*o-c*a;let f,m,u,g;if(this.inherit==1)f=this.a,m=this.b,u=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,r=t*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(t*r-s*i),l=r*h,n=s*h;break}case 3:case 4:let w=P.cosDeg(this.rotation),b=P.sinDeg(this.rotation);t=(t*w+s*b)/this.skeleton.scaleX,i=(i*w+r*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+i*i);x>1e-5&&(x=1/x),t*=x,i*=x,x=Math.sqrt(t*t+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let p=P.PI/2+Math.atan2(i,t);s=Math.cos(p)*x,r=Math.sin(p)*x,h=1/(t*r-s*i),l=r*h,n=s*h,a=i*h,o=t*h}f=l*this.a-n*this.c,m=l*this.b-n*this.d,u=o*this.c-a*this.a,g=o*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let w=f*g-m*u;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*g,w)*P.radDeg,this.arotation=Math.atan2(u,f)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*P.radDeg}rotateWorld(e){e*=P.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},ee=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ai=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new gs,i=new li){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),i(h)},(h,l)=>{const n=`Couldn't load binary ${e}: status ${h}, ${l}`;this.error(s,e,n),r(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),i(h)},(h,l)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${l}`;this.error(s,e,n),r(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[e],r=i!==void 0;return r&&(this.cache.assetsLoaded[e]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(t,e,h),h)).catch(h=>this.error(s,e,h))),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(e,n);this.success(t,e,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(e,n);this.success(t,e,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),h=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((l,n)=>{this.downloader.downloadText(e,a=>{try{const o=this.createTextureAtlas(e,a);let c=o.pages.length,d=!1;if(c===0){this.success(t,e,o),l(o);return}for(let f of o.pages)this.loadTexture(i?i[f.name]:h+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(t,e,o),l(o)))},(m,u)=>{if(!d){const g=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,g),n(g)}d=!0})}catch(o){const c=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,c),n(c)}},(a,o)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${o}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,h)=>{this.downloader.downloadText(e,l=>{try{const n=this.createTextureAtlas(e,l);this.success(t,e,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(l,n)=>{const a=`Couldn't load texture atlas ${e}: status ${l}, ${n}`;this.error(s,e,a),h(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(r))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?`
2
- `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof ds){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new ds(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&i()},s}},li=class Se{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=Se.AVAILABLE_CACHES.get(t);if(s)return s;const i=new Se;return Se.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},gs=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let h=()=>{this.finish(e,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let h=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let h=r.length-1,l=i.length;h<l;h+=2)i[h].apply(null,r)}},xs=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},ps=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},oi=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,h,l){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,o=n.b,c=n.c,d=n.d,f=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*P.signum(e.skeleton.scaleX),u=(s-e.worldY)*P.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(a*d-o*c)/Math.max(1e-4,a*a+c*c),x=a/e.skeleton.scaleX,p=c/e.skeleton.scaleY;o=-p*b*e.skeleton.scaleX,d=x*b*e.skeleton.scaleY,f+=Math.atan2(p,x)*P.radDeg;default:let v=t-n.worldX,y=s-n.worldY,A=a*d-o*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(v*d-y*o)/A-e.ax,u=(y*a-v*c)/A-e.ay)}f+=Math.atan2(u,m)*P.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,w=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const b=e.data.length*g;if(b>1e-4){const x=m*m+u*u;if(i&&x<b*b||r&&x>b*b){const p=(Math.sqrt(x)/b-1)*l+1;g*=p,h&&(w*=p)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*l,g,w,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,h,l,n,a){if(e.inherit!=0||t.inherit!=0)return;let o=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,u=f,g=t.ascaleX,w=0,b=0,x=0;d<0?(d=-d,w=180,x=-1):(w=0,x=1),f<0&&(f=-f,x=-x),g<0?(g=-g,b=180):b=0;let p=t.ax,v=0,y=0,A=0,C=e.a,S=e.b,I=e.c,Y=e.d,k=Math.abs(d-f)<=1e-4;!k||h?(v=0,y=C*p+e.worldX,A=I*p+e.worldY):(v=t.ay,y=C*p+S*v+e.worldX,A=I*p+Y*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,S=F.b,I=F.c,Y=F.d;let X=C*Y-S*I,E=y-F.worldX,R=A-F.worldY;X=Math.abs(X)<=1e-4?0:1/X;let B=(E*Y-R*S)*X-o,st=(R*C-E*I)*X-c,et=Math.sqrt(B*B+st*st),rt=t.data.length*g,ct,ot;if(et<1e-4){this.apply1(e,s,i,!1,h,!1,a),t.updateWorldTransformWith(p,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}E=s-F.worldX,R=i-F.worldY;let ut=(E*Y-R*S)*X-o,Z=(R*C-E*I)*X-c,nt=ut*ut+Z*Z;if(n!=0){n*=d*(g+1)*.5;let mt=Math.sqrt(nt),pt=mt-et-rt*d+n;if(pt>0){let wt=Math.min(1,pt/(n*2))-1;wt=(pt-n*(1-wt*wt))/mt,ut-=wt*ut,Z-=wt*Z,nt=ut*ut+Z*Z}}t:if(k){rt*=d;let mt=(nt-et*et-rt*rt)/(2*et*rt);mt<-1?(mt=-1,ot=Math.PI*r):mt>1?(mt=1,ot=0,h&&(C=(Math.sqrt(nt)/(et+rt)-1)*a+1,m*=C,l&&(u*=C))):ot=Math.acos(mt)*r,C=et+rt*mt,S=rt*Math.sin(ot),ct=Math.atan2(Z*C-ut*S,ut*C+Z*S)}else{C=d*rt,S=f*rt;let mt=C*C,pt=S*S,wt=Math.atan2(Z,ut);I=pt*et*et+mt*nt-mt*pt;let Mt=-2*pt*et,jt=pt-mt;if(Y=Mt*Mt-4*jt*I,Y>=0){let Zt=Math.sqrt(Y);Mt<0&&(Zt=-Zt),Zt=-(Mt+Zt)*.5;let re=Zt/jt,Li=I/Zt,ye=Math.abs(re)<Math.abs(Li)?re:Li;if(re=nt-ye*ye,re>=0){R=Math.sqrt(re)*r,ct=wt-Math.atan2(R,ye),ot=Math.atan2(R/f,(ye-et)/d);break t}}let ie=P.PI,be=et-C,Vs=be*be,Fi=0,Xi=0,ve=et+C,Os=ve*ve,Pi=0;I=-C*et/(mt-pt),I>=-1&&I<=1&&(I=Math.acos(I),E=C*Math.cos(I)+et,R=S*Math.sin(I),Y=E*E+R*R,Y<Vs&&(ie=I,Vs=Y,be=E,Fi=R),Y>Os&&(Xi=I,Os=Y,ve=E,Pi=R)),nt<=(Vs+Os)*.5?(ct=wt-Math.atan2(Fi*r,be),ot=ie*r):(ct=wt-Math.atan2(Pi*r,ve),ot=Xi*r)}let ht=Math.atan2(v,p)*x,bt=e.arotation;ct=(ct-ht)*P.radDeg+w-bt,ct>180?ct-=360:ct<-180&&(ct+=360),e.updateWorldTransformWith(o,c,bt+ct*a,m,u,0,0),bt=t.arotation,ot=((ot+ht)*P.radDeg-t.ashearX)*x+b-bt,ot>180?ot-=360:ot<-180&&(ot+=360),t.updateWorldTransformWith(p,v,bt+ot*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},ws=class extends ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},bs=class extends ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},vs=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(vs||{}),ys=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ys||{}),As=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(As||{}),hi=class Bt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0,h=t.bones.length;r<h;r++){let l=s.findBone(t.bones[r].name);if(!l)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(l)}let i=s.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof qt))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,f=L.setArraySize(this.spaces,d),m=a?this.lengths=L.setArraySize(this.lengths,c):[],u=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,Y=I*S.a,k=I*S.c;m[A]=Math.sqrt(Y*Y+k*k)}L.arrayFill(f,1,d,u);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<Bt.epsilon)a&&(m[A]=0),f[++A]=u;else{let Y=I*S.a,k=I*S.c,F=Math.sqrt(Y*Y+k*k);a&&(m[A]=F),f[++A]=F,v+=F}}if(v>0){v=d/v*u;for(let A=1;A<d;A++)f[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<Bt.epsilon)a&&(m[A]=0),f[++A]=u;else{let Y=I*S.a,k=I*S.c,F=Math.sqrt(Y*Y+k*k);a&&(m[A]=F),f[++A]=(y?I+u:u)*F/I}}}let g=this.computeWorldPositions(s,d,n),w=g[0],b=g[1],x=l.offsetRotation,p=!1;if(x==0)p=l.rotateMode==1;else{p=!1;let v=this.target.bone;x*=v.a*v.d-v.b*v.c>0?P.degRad:-P.degRad}for(let v=0,y=3;v<c;v++,y+=3){let A=o[v];A.worldX+=(w-A.worldX)*r,A.worldY+=(b-A.worldY)*h;let C=g[y],S=g[y+1],I=C-w,Y=S-b;if(a){let k=m[v];if(k!=0){let F=(Math.sqrt(I*I+Y*Y)/k-1)*i+1;A.a*=F,A.c*=F}}if(w=C,b=S,i>0){let k=A.a,F=A.b,X=A.c,E=A.d,R=0,B=0,st=0;if(n?R=g[y-1]:f[v+1]==0?R=g[y+2]:R=Math.atan2(Y,I),R-=Math.atan2(X,k),p){B=Math.cos(R),st=Math.sin(R);let et=A.data.length;w+=(et*(B*k-st*X)-I)*i,b+=(et*(st*k+B*X)-Y)*i}else R+=x;R>P.PI?R-=P.PI2:R<-P.PI&&(R+=P.PI2),R*=i,B=Math.cos(R),st=Math.sin(R),A.a=B*k-st*X,A.b=B*F-st*E,A.c=st*k+B*X,A.d=st*F+B*E}A.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,h=this.position,l=this.spaces,n=L.setArraySize(this.positions,s*3+2),a=this.world,o=t.closed,c=t.worldVerticesLength,d=c/6,f=Bt.NONE;if(!t.constantSpeed){let et=t.lengths;d-=o?1:2;let rt=et[d];this.data.positionMode==1&&(h*=rt);let ct;switch(this.data.spacingMode){case 2:ct=rt;break;case 3:ct=rt/s;break;default:ct=1}a=L.setArraySize(this.world,8);for(let ot=0,ut=0,Z=0;ot<s;ot++,ut+=3){let nt=l[ot]*ct;h+=nt;let ht=h;if(o)ht%=rt,ht<0&&(ht+=rt),Z=0;else if(ht<0){f!=Bt.BEFORE&&(f=Bt.BEFORE,t.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(ht,a,0,n,ut);continue}else if(ht>rt){f!=Bt.AFTER&&(f=Bt.AFTER,t.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(ht-rt,a,0,n,ut);continue}for(;;Z++){let bt=et[Z];if(!(ht>bt)){if(Z==0)ht/=bt;else{let mt=et[Z-1];ht=(ht-mt)/(bt-mt)}break}}Z!=f&&(f=Z,o&&Z==d?(t.computeWorldVertices(r,c-4,4,a,0,2),t.computeWorldVertices(r,0,4,a,4,2)):t.computeWorldVertices(r,Z*6+2,8,a,0,2)),this.addCurvePosition(ht,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,ut,i||ot>0&&nt==0)}return n}o?(c+=2,a=L.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,a,0,2),t.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=L.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,a,0,2));let m=L.setArraySize(this.curves,d),u=0,g=a[0],w=a[1],b=0,x=0,p=0,v=0,y=0,A=0,C=0,S=0,I=0,Y=0,k=0,F=0,X=0,E=0;for(let et=0,rt=2;et<d;et++,rt+=6)b=a[rt],x=a[rt+1],p=a[rt+2],v=a[rt+3],y=a[rt+4],A=a[rt+5],C=(g-b*2+p)*.1875,S=(w-x*2+v)*.1875,I=((b-p)*3-g+y)*.09375,Y=((x-v)*3-w+A)*.09375,k=C*2+I,F=S*2+Y,X=(b-g)*.75+C+I*.16666667,E=(x-w)*.75+S+Y*.16666667,u+=Math.sqrt(X*X+E*E),X+=k,E+=F,k+=I,F+=Y,u+=Math.sqrt(X*X+E*E),X+=k,E+=F,u+=Math.sqrt(X*X+E*E),X+=k+I,E+=F+Y,u+=Math.sqrt(X*X+E*E),m[et]=u,g=y,w=A;this.data.positionMode==1&&(h*=u);let R;switch(this.data.spacingMode){case 2:R=u;break;case 3:R=u/s;break;default:R=1}let B=this.segments,st=0;for(let et=0,rt=0,ct=0,ot=0;et<s;et++,rt+=3){let ut=l[et]*R;h+=ut;let Z=h;if(o)Z%=u,Z<0&&(Z+=u),ct=0;else if(Z<0){this.addBeforePosition(Z,a,0,n,rt);continue}else if(Z>u){this.addAfterPosition(Z-u,a,c-4,n,rt);continue}for(;;ct++){let nt=m[ct];if(!(Z>nt)){if(ct==0)Z/=nt;else{let ht=m[ct-1];Z=(Z-ht)/(nt-ht)}break}}if(ct!=f){f=ct;let nt=ct*6;for(g=a[nt],w=a[nt+1],b=a[nt+2],x=a[nt+3],p=a[nt+4],v=a[nt+5],y=a[nt+6],A=a[nt+7],C=(g-b*2+p)*.03,S=(w-x*2+v)*.03,I=((b-p)*3-g+y)*.006,Y=((x-v)*3-w+A)*.006,k=C*2+I,F=S*2+Y,X=(b-g)*.3+C+I*.16666667,E=(x-w)*.3+S+Y*.16666667,st=Math.sqrt(X*X+E*E),B[0]=st,nt=1;nt<8;nt++)X+=k,E+=F,k+=I,F+=Y,st+=Math.sqrt(X*X+E*E),B[nt]=st;X+=k,E+=F,st+=Math.sqrt(X*X+E*E),B[8]=st,X+=k+I,E+=F+Y,st+=Math.sqrt(X*X+E*E),B[9]=st,ot=0}for(Z*=st;;ot++){let nt=B[ot];if(!(Z>nt)){if(ot==0)Z/=nt;else{let ht=B[ot-1];Z=ot+(Z-ht)/(nt-ht)}break}}this.addCurvePosition(Z*.1,g,w,b,x,p,v,y,A,n,rt,i||et>0&&ut==0)}return n}addBeforePosition(t,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+t*Math.cos(c),r[h+1]=n+t*Math.sin(c),r[h+2]=c}addAfterPosition(t,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+t*Math.cos(c),r[h+1]=n+t*Math.sin(c),r[h+2]=c}addCurvePosition(t,s,i,r,h,l,n,a,o,c,d,f){if(t==0||isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=t*t,u=m*t,g=1-t,w=g*g,b=w*g,x=g*t,p=x*3,v=g*p,y=p*t,A=s*b+r*v+l*y+a*u,C=i*b+h*v+n*y+o*u;c[d]=A,c[d+1]=C,f&&(t<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(C-(i*w+h*x*2+n*m),A-(s*w+r*x*2+l*m)))}},or=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,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(e){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 f=this.remaining,m=this.inertia,u=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*o,x=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||i){if(s){const p=(this.ux-c)*m;this.xOffset+=p>b?b:p<-b?-b:p,this.ux=c}if(i){const p=(this.uy-d)*m;this.yOffset+=p>x?x:p<-x?-x:p,this.uy=d}if(f>=u){w=Math.pow(this.damping,60*u);const p=this.massInverse*u,v=this.strength,y=this.wind*g*a.scaleX,A=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*p,this.xOffset+=this.xVelocity*u,this.xVelocity*=w),i&&(this.yVelocity-=(A+this.yOffset*v)*p,this.yOffset+=this.yVelocity*u,this.yVelocity*=w),f-=u;while(f>=u)}s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(r||h){let p=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>x?S=x:S<-x&&(S=-x),r){A=(this.data.rotate+this.data.shearX)*t;let I=Math.atan2(S+this.ty,C+this.tx)-p-this.rotateOffset*A;this.rotateOffset+=(I-Math.ceil(I*P.invPI2-.5)*P.PI2)*m,I=this.rotateOffset*A+p,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(p),y=Math.sin(p);const I=n*l.getWorldScaleX();I>0&&(this.scaleOffset+=(C*v+S*y)*m/I)}if(f=this.remaining,f>=u){w==-1&&(w=Math.pow(this.damping,60*u));const I=this.massInverse*u,Y=this.strength,k=this.wind,F=fi.yDown?-this.gravity:this.gravity,X=n/g;for(;;)if(f-=u,h&&(this.scaleVelocity+=(k*v-F*y-this.scaleOffset*Y)*I,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=w),r){if(this.rotateVelocity-=((k*y+F*v)*X+this.rotateOffset*Y)*I,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=w,f<u)break;const E=this.rotateOffset*A+p;v=Math.cos(E),y=Math.sin(E)}else if(f<u)break}}this.remaining=f}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(r){let a=this.rotateOffset*t,o=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=a*this.data.rotate,o=Math.sin(f),c=Math.cos(f),d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d),f+=a*this.data.shearX,o=Math.sin(f),c=Math.cos(f),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*t*this.data.scaleX;l.a*=a,l.c*=a}e!=3&&(this.tx=n*l.a,this.ty=n*l.c),l.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*P.degRad,r=Math.cos(i),h=Math.sin(i),l=this.cx-e,n=this.cy-t;this.translate(l*r-n*h-l,l*h+n*r-n)}},ci=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new tt,this.darkColor=e.darkColor?new tt:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Yt)||!(this.attachment instanceof Yt)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},di=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Vt;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){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 e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,f=a*d-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,g=this.bones;for(let w=0,b=g.length;w<b;w++){let x=g[w];if(e!=0){let p=x.a,v=x.b,y=x.c,A=x.d,C=Math.atan2(c,a)-Math.atan2(y,p)+m;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let S=Math.cos(C),I=Math.sin(C);x.a=S*p-I*y,x.b=S*v-I*A,x.c=I*p+S*y,x.d=I*v+S*A}if(l){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(p.x-x.worldX)*t,x.worldY+=(p.y-x.worldY)*s}if(i!=0){let p=Math.sqrt(x.a*x.a+x.c*x.c);p!=0&&(p=(p+(Math.sqrt(a*a+c*c)-p+this.data.offsetScaleX)*i)/p),x.a*=p,x.c*=p}if(r!=0){let p=Math.sqrt(x.b*x.b+x.d*x.d);p!=0&&(p=(p+(Math.sqrt(o*o+d*d)-p+this.data.offsetScaleY)*r)/p),x.b*=p,x.d*=p}if(h>0){let p=x.b,v=x.d,y=Math.atan2(v,p),A=Math.atan2(d,o)-Math.atan2(c,a)-(y-Math.atan2(x.c,x.a));A>P.PI?A-=P.PI2:A<-P.PI&&(A+=P.PI2),A=y+(A+u)*h;let C=Math.sqrt(p*p+v*v);x.b=Math.cos(A)*C,x.d=Math.sin(A)*C}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,f=a*d-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,g=this.bones;for(let w=0,b=g.length;w<b;w++){let x=g[w];if(e!=0){let p=x.a,v=x.b,y=x.c,A=x.d,C=Math.atan2(c,a)+m;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let S=Math.cos(C),I=Math.sin(C);x.a=S*p-I*y,x.b=S*v-I*A,x.c=I*p+S*y,x.d=I*v+S*A}if(l){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=p.x*t,x.worldY+=p.y*s}if(i!=0){let p=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;x.a*=p,x.c*=p}if(r!=0){let p=(Math.sqrt(o*o+d*d)-1+this.data.offsetScaleY)*r+1;x.b*=p,x.d*=p}if(h>0){let p=Math.atan2(d,o)-Math.atan2(c,a);p>P.PI?p-=P.PI2:p<-P.PI&&(p+=P.PI2);let v=x.b,y=x.d;p=Math.atan2(y,v)+(p-P.PI/2+u)*h;let A=Math.sqrt(v*v+y*y);x.b=Math.cos(p)*A,x.d=Math.sin(p)*A}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=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;e!=0&&(d+=(l.arotation-d+this.data.offsetRotation)*e);let f=c.ax,m=c.ay;f+=(l.ax-f+this.data.offsetX)*t,m+=(l.ay-m+this.data.offsetY)*s;let u=c.ascaleX,g=c.ascaleY;i!=0&&u!=0&&(u=(u+(l.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*r)/g);let w=c.ashearY;h!=0&&(w+=(l.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(f,m,d,u,g,c.ashearX,w)}}applyRelativeLocal(){let e=this.mixRotate,t=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)*e,f=c.ax+(l.ax+this.data.offsetX)*t,m=c.ay+(l.ay+this.data.offsetY)*s,u=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*r+1),w=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,m,d,u,g,c.ashearX,w)}}},fi=class Ns{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 Ns.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=t.bones[s],r;if(!i.parent)r=new ms(i,this,null);else{let h=this.bones[i.parent.index];r=new ms(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let i=t.slots[s],r=this.bones[i.boneData.index],h=new ci(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let i=t.ikConstraints[s];this.ikConstraints.push(new oi(i,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let i=t.transformConstraints[s];this.transformConstraints.push(new di(i,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let i=t.pathConstraints[s];this.pathConstraints.push(new hi(i,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let i=t.physicsConstraints[s];this.physicsConstraints.push(new or(i,this))}this.color=new tt(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let f=0,m=s.length;f<m;f++){let u=s[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let g=this.bones[f[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;t:for(let f=0;f<d;f++){for(let m=0;m<n;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue t}}for(let m=0;m<a;m++){let u=r[m];if(u.data.order==f){this.sortTransformConstraint(u);continue t}}for(let m=0;m<o;m++){let u=h[m];if(u.data.order==f){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=l[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue t}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&L.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let i=t.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&L.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.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 qt&&this.sortPathConstraintAttachmentWith(h,r);let l=t.bones,n=l.length;for(let a=0;a<n;a++)this.sortBone(l[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(l[a].children);for(let a=0;a<n;a++)l[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&L.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,i=s.length;if(t.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(t);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(t,s,i){let r=t.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof qt))return;let i=t.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(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&L.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){let r=t[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){if(t==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(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let w=1,b=i.length;w<b;w++){let x=i[w];x.ax=x.x,x.ay=x.y,x.arotation=x.rotation,x.ascaleX=x.scaleX,x.ascaleY=x.scaleY,x.ashearX=x.shearX,x.ashearY=x.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,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)*P.degRad,c=(r.rotation+90+r.shearY)*P.degRad,d=Math.cos(o)*r.scaleX,f=Math.cos(c)*r.scaleY,m=Math.sin(o)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(h*d+l*m)*this.scaleX,r.b=(h*f+l*u)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*f+a*u)*this.scaleY;let g=this._updateCache;for(let w=0,b=g.length;w<b;w++){let x=g[w];x!=r&&x.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;L.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,i=t.length;s<i;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)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==t)return h}return null}findSlot(t){if(!t)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==t)return h}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.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=t.getAttachment(i,l);n&&h.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)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==t){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);l.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Vt,i=new Vt;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=null){if(!t)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 f=h[c];if(!f.bone.active)continue;let m=0,u=null,g=null,w=f.getAttachment();if(w instanceof te)m=8,u=L.setArraySize(i,m,0),w.computeWorldVertices(f,u,0,2),g=Ns.quadTriangles;else if(w instanceof Wt){let b=w;m=b.worldVerticesLength,u=L.setArraySize(i,m,0),b.computeWorldVertices(f,0,m,u,0,2),g=b.triangles}else if(w instanceof $t&&r!=null){r.clipStart(f,w);continue}if(u&&g){r!=null&&r.isClipping()&&(r.clipTriangles(u,g,g.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let b=0,x=u.length;b<x;b+=2){let p=u[b],v=u[b+1];l=Math.min(l,p),n=Math.min(n,v),a=Math.max(a,p),o=Math.max(o,v)}}r?.clipEndWithSlot(f)}r?.clipEnd(),t.set(l,n),s.set(a-l,o-n)}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(t,s)}physicsRotate(t,s,i){const r=this.physicsConstraints;for(let h=0,l=r.length;h<l;h++)r[h].rotate(t,s,i)}},ui=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ui||{}),mi=class extends ee{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Cs=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}},Ss=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},fe=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new tt(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let r=e.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<e.constraints.length;i++){let r=e.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 t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let r=e.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<e.constraints.length;i++){let r=e.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 t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof Wt?(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(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Ss(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Ss(e,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let r=e.slots[i],h=r.getAttachment();if(h&&s<t.attachments.length){let l=t.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++}}},Ts=class{index=0;name;boneData;color=new tt(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Is=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Is||{}),Ms=class extends ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},hr=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Cs;s.name="";let i=new gi(e),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()*t;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)],f=new us(o,c,d);f.rotation=i.readFloat(),f.x=i.readFloat()*t,f.y=i.readFloat()*t,f.scaleX=i.readFloat(),f.scaleY=i.readFloat(),f.shearX=i.readFloat(),f.shearY=i.readFloat(),f.length=i.readFloat()*t,f.inherit=i.readByte(),f.skinRequired=i.readBoolean(),l&&(tt.rgba8888ToColor(f.color,i.readInt32()),f.icon=i.readString()??void 0,f.visible=i.readBoolean()),s.bones.push(f)}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)],f=new Ts(o,c,d);tt.rgba8888ToColor(f.color,i.readInt32());let m=i.readInt32();m!=-1&&tt.rgb888ToColor(f.darkColor=new tt,m),f.attachmentName=i.readStringRef(),f.blendMode=i.readInt(!0),l&&(f.visible=i.readBoolean()),s.slots.push(f)}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 f=new ws(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(f.softness=i.readFloat()*t),s.ikConstraints.push(f)}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 f=new Ms(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=i.readFloat()),(m&16)!=0&&(f.offsetX=i.readFloat()*t),(m&32)!=0&&(f.offsetY=i.readFloat()*t),(m&64)!=0&&(f.offsetScaleX=i.readFloat()),(m&128)!=0&&(f.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(f.offsetShearY=i.readFloat()),(m&2)!=0&&(f.mixRotate=i.readFloat()),(m&4)!=0&&(f.mixX=i.readFloat()),(m&8)!=0&&(f.mixY=i.readFloat()),(m&16)!=0&&(f.mixScaleX=i.readFloat()),(m&32)!=0&&(f.mixScaleY=i.readFloat()),(m&64)!=0&&(f.mixShearY=i.readFloat()),s.transformConstraints.push(f)}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 f=new bs(d);f.order=i.readInt(!0),f.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.slots[i.readInt(!0)];const m=i.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=i.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}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 f=new mi(d);f.order=i.readInt(!0),f.bone=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=i.readFloat()),(m&4)!=0&&(f.y=i.readFloat()),(m&8)!=0&&(f.rotate=i.readFloat()),(m&16)!=0&&(f.scaleX=i.readFloat()),(m&32)!=0&&(f.shearX=i.readFloat()),f.limit=((m&64)!=0?i.readFloat():5e3)*t,f.step=1/i.readUnsignedByte(),f.inertia=i.readFloat(),f.strength=i.readFloat(),f.damping=i.readFloat(),f.massInverse=(m&128)!=0?i.readFloat():1,f.wind=i.readFloat(),f.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(f)}let a=this.readSkin(i,s,!0,l);a&&(s.defaultSkin=a,s.skins.push(a));{let o=s.skins.length;for(L.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 f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),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 ps(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(e,t,s,i){let r=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;r=new fe("default")}else{let l=e.readString();if(!l)throw new Error("Skin name must not be null.");r=new fe(l),i&&tt.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let l=0;l<h;l++){let n=e.readInt(!0);for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(e,t,s,i,r,h){let l=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let o=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null;let f=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),g=e.readFloat(),w=e.readFloat(),b=e.readFloat(),x=e.readFloat();o||(o=a);let p=this.attachmentLoader.newRegionAttachment(s,a,o,d);return p?(p.path=o,p.x=m*l,p.y=u*l,p.scaleX=g,p.scaleY=w,p.rotation=f,p.width=b*l,p.height=x*l,tt.rgba8888ToColor(p.color,c),p.sequence=d,d==null&&p.updateRegion(),p):null}case 1:{let o=this.readVertices(e,(n&16)!=0),c=h?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,h&&tt.rgba8888ToColor(d.color,c),d):null}case 2:{let o=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,f=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),g=this.readShortArray(e,(m.length-f-2)*3);let w=[],b=0,x=0;h&&(w=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),x=e.readFloat()),o||(o=a);let p=this.attachmentLoader.newMeshAttachment(s,a,o,d);return p?(p.path=o,tt.rgba8888ToColor(p.color,c),p.bones=m.bones,p.vertices=m.vertices,p.worldVerticesLength=m.length,p.triangles=g,p.regionUVs=u,d==null&&p.updateRegion(),p.hullLength=f<<1,p.sequence=d,h&&(p.edges=w,p.width=b*l,p.height=x*l),p):null}case 3:{const o=(n&16)!=0?e.readStringRef():a;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,f=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let g=0,w=0;h&&(g=e.readFloat(),w=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,o,d);return b?(b.path=o,tt.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*l,b.height=w*l),this.linkedMeshes.push(new cr(b,m,i,u,f)),b):null}case 4:{const o=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(e,(n&64)!=0),f=L.newArray(d.length/6,0);for(let g=0,w=f.length;g<w;g++)f[g]=e.readFloat()*l;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=o,u.constantSpeed=c,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,h&&tt.rgba8888ToColor(u.color,m),u):null}case 5:{const o=e.readFloat(),c=e.readFloat(),d=e.readFloat(),f=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*l,m.y=d*l,m.rotation=o,h&&tt.rgba8888ToColor(m.color,f),m):null}case 6:{const o=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let d=h?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,a);return f?(f.endSlot=t.slots[o],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,h&&tt.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new Hs(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),r=new dr;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let h=new Array,l=new Array;for(let n=0;n<i;n++){let a=e.readInt(!0);l.push(a);for(let o=0;o<a;o++)l.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return r.vertices=L.toFloatArray(h),r.bones=l,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,r=this.scale;for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0),g=u-1;switch(m){case Cr:{let w=new Ot(u,c);for(let b=0;b<u;b++)w.setFrame(b,e.readFloat(),e.readStringRef());i.push(w);break}case Sr:{let w=e.readInt(!0),b=new Ne(u,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,S=0;b.setFrame(C,x,p,v,y,A),C!=g;C++){let I=e.readFloat(),Y=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(C);break;case Ft:at(e,b,S++,C,0,x,I,p,Y,1),at(e,b,S++,C,1,x,I,v,k,1),at(e,b,S++,C,2,x,I,y,F,1),at(e,b,S++,C,3,x,I,A,X,1)}x=I,p=Y,v=k,y=F,A=X}i.push(b);break}case Tr:{let w=e.readInt(!0),b=new Ue(u,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,x,p,v,y),A!=g;A++){let S=e.readFloat(),I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(A);break;case Ft:at(e,b,C++,A,0,x,S,p,I,1),at(e,b,C++,A,1,x,S,v,Y,1),at(e,b,C++,A,2,x,S,y,k,1)}x=S,p=I,v=Y,y=k}i.push(b);break}case Ir:{let w=e.readInt(!0),b=new We(u,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let Y=0,k=0;b.setFrame(Y,x,p,v,y,A,C,S,I),Y!=g;Y++){let F=e.readFloat(),X=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,st=e.readUnsignedByte()/255,et=e.readUnsignedByte()/255,rt=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(Y);break;case Ft:at(e,b,k++,Y,0,x,F,p,X,1),at(e,b,k++,Y,1,x,F,v,E,1),at(e,b,k++,Y,2,x,F,y,R,1),at(e,b,k++,Y,3,x,F,A,B,1),at(e,b,k++,Y,4,x,F,C,st,1),at(e,b,k++,Y,5,x,F,S,et,1),at(e,b,k++,Y,6,x,F,I,rt,1)}x=F,p=X,v=E,y=R,A=B,C=st,S=et,I=rt}i.push(b);break}case Mr:{let w=e.readInt(!0),b=new qe(u,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let I=0,Y=0;b.setFrame(I,x,p,v,y,A,C,S),I!=g;I++){let k=e.readFloat(),F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,st=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(I);break;case Ft:at(e,b,Y++,I,0,x,k,p,F,1),at(e,b,Y++,I,1,x,k,v,X,1),at(e,b,Y++,I,2,x,k,y,E,1),at(e,b,Y++,I,3,x,k,A,R,1),at(e,b,Y++,I,4,x,k,C,B,1),at(e,b,Y++,I,5,x,k,S,st,1)}x=k,p=F,v=X,y=E,A=R,C=B,S=st}i.push(b);break}case Er:{let w=new ze(u,e.readInt(!0),c),b=e.readFloat(),x=e.readUnsignedByte()/255;for(let p=0,v=0;w.setFrame(p,b,x),p!=g;p++){let y=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case kt:w.setStepped(p);break;case Ft:at(e,w,v++,p,0,b,y,x,A,1)}b=y,x=A}i.push(w)}}}}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0);if(m==Ar){let w=new De(u,c);for(let b=0;b<u;b++)w.setFrame(b,e.readFloat(),e.readByte());i.push(w);continue}let g=e.readInt(!0);switch(m){case fr:i.push(gt(e,new Qt(u,g,c),1));break;case ur:i.push(Es(e,new Ye(u,g,c),r));break;case mr:i.push(gt(e,new ke(u,g,c),r));break;case gr:i.push(gt(e,new Fe(u,g,c),r));break;case xr:i.push(Es(e,new Xe(u,g,c),1));break;case pr:i.push(gt(e,new Pe(u,g,c),1));break;case wr:i.push(gt(e,new Le(u,g,c),1));break;case br:i.push(Es(e,new Be(u,g,c),1));break;case vr:i.push(gt(e,new Ve(u,g,c),1));break;case yr:i.push(gt(e,new Oe(u,g,c),1))}}}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new He(d,e.readInt(!0),c),u=e.readByte(),g=e.readFloat(),w=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,b=(u&4)!=0?e.readFloat()*r:0;for(let x=0,p=0;m.setFrame(x,g,w,b,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),x!=f;x++){u=e.readByte();const v=e.readFloat(),y=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,A=(u&4)!=0?e.readFloat()*r:0;(u&64)!=0?m.setStepped(x):(u&128)!=0&&(at(e,m,p++,x,0,g,v,w,y,1),at(e,m,p++,x,1,g,v,b,A,r)),g=v,w=y,b=A}i.push(m)}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new _e(d,e.readInt(!0),c),u=e.readFloat(),g=e.readFloat(),w=e.readFloat(),b=e.readFloat(),x=e.readFloat(),p=e.readFloat(),v=e.readFloat();for(let y=0,A=0;m.setFrame(y,u,g,w,b,x,p,v),y!=f;y++){let C=e.readFloat(),S=e.readFloat(),I=e.readFloat(),Y=e.readFloat(),k=e.readFloat(),F=e.readFloat(),X=e.readFloat();switch(e.readByte()){case kt:m.setStepped(y);break;case Ft:at(e,m,A++,y,0,u,C,g,S,1),at(e,m,A++,y,1,u,C,w,I,1),at(e,m,A++,y,2,u,C,b,Y,1),at(e,m,A++,y,3,u,C,x,k,1),at(e,m,A++,y,4,u,C,p,F,1),at(e,m,A++,y,5,u,C,v,X,1)}u=C,g=S,w=I,b=Y,x=k,p=F,v=X}i.push(m)}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=e.readInt(!0);f<m;f++){const u=e.readByte(),g=e.readInt(!0),w=e.readInt(!0);switch(u){case kr:i.push(gt(e,new je(g,w,c),d.positionMode==0?r:1));break;case Fr:i.push(gt(e,new Ze(g,w,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case Xr:let b=new Ke(g,w,c),x=e.readFloat(),p=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let A=0,C=0,S=b.getFrameCount()-1;b.setFrame(A,x,p,v,y),A!=S;A++){let I=e.readFloat(),Y=e.readFloat(),k=e.readFloat(),F=e.readFloat();switch(e.readByte()){case kt:b.setStepped(A);break;case Ft:at(e,b,C++,A,0,x,I,p,Y,1),at(e,b,C++,A,1,x,I,v,k,1),at(e,b,C++,A,2,x,I,y,F,1)}x=I,p=Y,v=k,y=F}i.push(b)}}}for(let a=0,o=e.readInt(!0);a<o;a++){const c=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),u=e.readInt(!0);if(m==Ur){const w=new rs(u,c);for(let b=0;b<u;b++)w.setFrame(b,e.readFloat());i.push(w);continue}const g=e.readInt(!0);switch(m){case Pr:i.push(gt(e,new Je(u,g,c),1));break;case Lr:i.push(gt(e,new Qe(u,g,c),1));break;case Br:i.push(gt(e,new $e(u,g,c),1));break;case Vr:i.push(gt(e,new ts(u,g,c),1));break;case Or:i.push(gt(e,new es(u,g,c),1));break;case Dr:i.push(gt(e,new ss(u,g,c),1));break;case Nr:i.push(gt(e,new is(u,g,c),1))}}}for(let a=0,o=e.readInt(!0);a<o;a++){let c=s.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readInt(!0);for(let u=0,g=e.readInt(!0);u<g;u++){let w=e.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,w),x=e.readByte(),p=e.readInt(!0),v=p-1;switch(x){case Rr:{let y=b,A=y.bones,C=y.vertices,S=A?C.length/3*2:C.length,I=e.readInt(!0),Y=new Ge(p,I,m,y),k=e.readFloat();for(let F=0,X=0;;F++){let E,R=e.readInt(!0);if(R==0)E=A?L.newFloatArray(S):C;else{E=L.newFloatArray(S);let st=e.readInt(!0);if(R+=st,r==1)for(let et=st;et<R;et++)E[et]=e.readFloat();else for(let et=st;et<R;et++)E[et]=e.readFloat()*r;if(!A)for(let et=0,rt=E.length;et<rt;et++)E[et]+=C[et]}if(Y.setFrame(F,k,E),F==v)break;let B=e.readFloat();switch(e.readByte()){case kt:Y.setStepped(F);break;case Ft:at(e,Y,X++,F,0,k,B,0,1,1)}k=B}i.push(Y);break}case Yr:{let y=new ns(p,m,b);for(let A=0;A<p;A++){let C=e.readFloat(),S=e.readInt32();y.setFrame(A,C,js[S&15],S>>4,e.readFloat())}i.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let a=new zt(h),o=s.slots.length;for(let c=0;c<h;c++){let d=e.readFloat(),f=e.readInt(!0),m=L.newArray(o,0);for(let b=o-1;b>=0;b--)m[b]=-1;let u=L.newArray(o-f,0),g=0,w=0;for(let b=0;b<f;b++){let x=e.readInt(!0);for(;g!=x;)u[w++]=g++;m[g+e.readInt(!0)]=g++}for(;g<o;)u[w++]=g++;for(let b=o-1;b>=0;b--)m[b]==-1&&(m[b]=u[--w]);a.setFrame(c,d,m)}i.push(a)}let l=e.readInt(!0);if(l>0){let a=new le(l);for(let o=0;o<l;o++){let c=e.readFloat(),d=s.events[e.readInt(!0)],f=new xs(c,d);f.intValue=e.readInt(!1),f.floatValue=e.readFloat(),f.stringValue=e.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=e.readFloat(),f.balance=e.readFloat()),a.setFrame(o,f)}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 ne(t,i,n)}},gi=class{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i<e;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},cr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},dr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function gt(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let h=0,l=0,n=t.getFrameCount()-1;t.setFrame(h,i,r),h!=n;h++){let a=e.readFloat(),o=e.readFloat()*s;switch(e.readByte()){case kt:t.setStepped(h);break;case Ft:at(e,t,l++,h,0,i,a,r,o,s)}i=a,r=o}return t}function Es(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,h=e.readFloat()*s;for(let l=0,n=0,a=t.getFrameCount()-1;t.setFrame(l,i,r,h),l!=a;l++){let o=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case kt:t.setStepped(l);break;case Ft:at(e,t,n++,l,0,i,o,r,c,s),at(e,t,n++,l,1,i,o,h,d,s)}i=o,r=c,h=d}return t}function at(e,t,s,i,r,h,l,n,a,o){t.setBezier(s,i,r,h,n,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,l,a)}var fr=0,ur=1,mr=2,gr=3,xr=4,pr=5,wr=6,br=7,vr=8,yr=9,Ar=10,Cr=0,Sr=1,Tr=2,Ir=3,Mr=4,Er=5,Rr=0,Yr=1,kr=0,Fr=1,Xr=2,Pr=0,Lr=1,Br=2,Vr=4,Or=5,Dr=6,Nr=7,Ur=8,kt=1,Ft=2,xi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Jt(()=>L.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=e.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 hs){let c=o;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=L.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=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],f=a[o+1];e=Math.min(e,d),t=Math.min(t,f),s=Math.max(s,d),i=Math.max(i,f)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,h=this.minY,l=this.maxX,n=this.maxY;if(e<=r&&s<=r||t<=h&&i<=h||e>=l&&s>=l||t>=n&&i>=n)return!1;let a=(i-t)/(s-e),o=a*(r-e)+t;if(o>h&&o<n||(o=a*(l-e)+t,o>h&&o<n))return!0;let c=(h-t)/a+e;return c>r&&c<l||(c=(n-t)/a+e,c>r&&c<l)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.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)<t&&(l=!l)}h=n}return l}intersectsSegment(e,t,s,i){let r=this.polygons;for(let h=0,l=r.length;h<l;h++)if(this.intersectsSegmentPolygon(r[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,r){let h=e,l=e.length,n=t-i,a=s-r,o=t*r-s*i,c=h[l-2],d=h[l-1];for(let f=0;f<l;f+=2){let m=h[f],u=h[f+1],g=c*u-d*m,w=c-m,b=d-u,x=n*b-a*w,p=(o*w-n*g)/x;if((p>=c&&p<=m||p>=m&&p<=c)&&(p>=t&&p<=i||p>=i&&p<=t)){let v=(o*b-a*g)/x;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=r||v>=r&&v<=s))return!0}c=m,d=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},pi=class vt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Jt(()=>new Array);polygonIndicesPool=new Jt(()=>new Array);triangulate(t){let s=t,i=t.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]=vt.isConcave(n,i,s,r);let l=this.triangles;for(l.length=0;i>3;){let n=i-1,a=0,o=1;for(;;){t:if(!h[a]){let f=r[n]<<1,m=r[a]<<1,u=r[o]<<1,g=s[f],w=s[f+1],b=s[m],x=s[m+1],p=s[u],v=s[u+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(vt.positiveArea(p,v,g,w,C,S)&&vt.positiveArea(g,w,b,x,C,S)&&vt.positiveArea(b,x,p,v,C,S))break t}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]=vt.isConcave(c,i,s,r),h[d]=vt.isConcave(d,i,s,r)}return i==3&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}decompose(t,s){let i=t,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 f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,g=i[f],w=i[f+1],b=i[m],x=i[m+1],p=i[u],v=i[u+1],y=!1;if(a==f){let A=n.length-4,C=vt.winding(n[A],n[A+1],n[A+2],n[A+3],p,v),S=vt.winding(p,v,n[0],n[1],n[2],n[3]);C==o&&S==o&&(n.push(p),n.push(v),l.push(u),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(w),n.push(b),n.push(x),n.push(p),n.push(v),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(f),l.push(m),l.push(u),o=vt.winding(g,w,b,x,p,v),a=f)}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 f=l[0],m=l[l.length-1];n=r[c];let u=n.length-4,g=n[u],w=n[u+1],b=n[u+2],x=n[u+3],p=n[0],v=n[1],y=n[2],A=n[3],C=vt.winding(g,w,b,x,p,v);for(let S=0;S<d;S++){if(S==c)continue;let I=h[S];if(I.length!=3)continue;let Y=I[0],k=I[1],F=I[2],X=r[S],E=X[X.length-2],R=X[X.length-1];if(Y!=f||k!=m)continue;let B=vt.winding(g,w,b,x,E,R),st=vt.winding(E,R,p,v,y,A);B==C&&st==C&&(X.length=0,I.length=0,n.push(E),n.push(R),l.push(F),g=b,w=x,b=E,x=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(t,s,i,r){let h=r[(s+t-1)%s]<<1,l=r[t]<<1,n=r[(t+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[l],i[l+1],i[n],i[n+1])}static positiveArea(t,s,i,r,h,l){return t*(l-r)+i*(s-l)+h*(r-s)>=0}static winding(t,s,i,r,h,l){let n=i-t,a=r-s;return h*a-l*n+n*s-t*a>=0?1:-1}},wi=class Us{triangulator=new pi;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=L.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let h=this.clippingPolygon;Us.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];Us.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.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(t,s,i,r,h,l,n,a){let o,c,d,f,m,u;typeof s=="number"?(o=i,c=r,d=h,f=l,m=n,u=a):(o=s,c=i,d=r,f=h,m=l,u=n),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,o,c,d,f,m,u):this.clipTrianglesNoRender(t,o,c)}clipTrianglesNoRender(t,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,f=t[d],m=t[d+1];d=s[c+1]<<1;let u=t[d],g=t[d+1];d=s[c+2]<<1;let w=t[d],b=t[d+1];for(let x=0;x<a;x++){let p=h.length;if(this.clip(f,m,u,g,w,b,n[x],r)){let v=r.length;if(v==0)continue;let y=v>>1,A=this.clipOutput,C=L.setArraySize(h,p+y*2);for(let I=0;I<v;I+=2,p+=2){let Y=A[I],k=A[I+1];C[p]=Y,C[p+1]=k}p=l.length;let S=L.setArraySize(l,p+3*(y-2));y--;for(let I=1;I<y;I++,p+=3)S[p]=o,S[p+1]=o+I,S[p+2]=o+I+1;o+=y+1}else{let v=L.setArraySize(h,p+6);v[p]=f,v[p+1]=m,v[p+2]=u,v[p+3]=g,v[p+4]=w,v[p+5]=b,p=l.length;let y=L.setArraySize(l,p+3);y[p]=o,y[p+1]=o+1,y[p+2]=o+2,o+=3;break}}}}clipTrianglesRender(t,s,i,r,h,l,n){let a=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=n?12:8,u=0;o.length=0,c.length=0;for(let g=0;g<i;g+=3){let w=s[g]<<1,b=t[w],x=t[w+1],p=r[w],v=r[w+1];w=s[g+1]<<1;let y=t[w],A=t[w+1],C=r[w],S=r[w+1];w=s[g+2]<<1;let I=t[w],Y=t[w+1],k=r[w],F=r[w+1];for(let X=0;X<f;X++){let E=o.length;if(this.clip(b,x,y,A,I,Y,d[X],a)){let R=a.length;if(R==0)continue;let B=A-Y,st=I-y,et=b-I,rt=Y-x,ct=1/(B*et+st*(x-Y)),ot=R>>1,ut=this.clipOutput,Z=L.setArraySize(o,E+ot*m);for(let ht=0;ht<R;ht+=2,E+=m){let bt=ut[ht],mt=ut[ht+1];Z[E]=bt,Z[E+1]=mt,Z[E+2]=h.r,Z[E+3]=h.g,Z[E+4]=h.b,Z[E+5]=h.a;let pt=bt-I,wt=mt-Y,Mt=(B*pt+st*wt)*ct,jt=(rt*pt+et*wt)*ct,ie=1-Mt-jt;Z[E+6]=p*Mt+C*jt+k*ie,Z[E+7]=v*Mt+S*jt+F*ie,n&&(Z[E+8]=l.r,Z[E+9]=l.g,Z[E+10]=l.b,Z[E+11]=l.a)}E=c.length;let nt=L.setArraySize(c,E+3*(ot-2));ot--;for(let ht=1;ht<ot;ht++,E+=3)nt[E]=u,nt[E+1]=u+ht,nt[E+2]=u+ht+1;u+=ot+1}else{let R=L.setArraySize(o,E+3*m);R[E]=b,R[E+1]=x,R[E+2]=h.r,R[E+3]=h.g,R[E+4]=h.b,R[E+5]=h.a,n?(R[E+6]=p,R[E+7]=v,R[E+8]=l.r,R[E+9]=l.g,R[E+10]=l.b,R[E+11]=l.a,R[E+12]=y,R[E+13]=A,R[E+14]=h.r,R[E+15]=h.g,R[E+16]=h.b,R[E+17]=h.a,R[E+18]=C,R[E+19]=S,R[E+20]=l.r,R[E+21]=l.g,R[E+22]=l.b,R[E+23]=l.a,R[E+24]=I,R[E+25]=Y,R[E+26]=h.r,R[E+27]=h.g,R[E+28]=h.b,R[E+29]=h.a,R[E+30]=k,R[E+31]=F,R[E+32]=l.r,R[E+33]=l.g,R[E+34]=l.b,R[E+35]=l.a):(R[E+6]=p,R[E+7]=v,R[E+8]=y,R[E+9]=A,R[E+10]=h.r,R[E+11]=h.g,R[E+12]=h.b,R[E+13]=h.a,R[E+14]=C,R[E+15]=S,R[E+16]=I,R[E+17]=Y,R[E+18]=h.r,R[E+19]=h.g,R[E+20]=h.b,R[E+21]=h.a,R[E+22]=k,R[E+23]=F),E=c.length;let B=L.setArraySize(c,E+3);B[E]=u,B[E+1]=u+1,B[E+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,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 f=0;f<i;f+=3){let m=s[f]<<1,u=t[m],g=t[m+1],w=r[m],b=r[m+1];m=s[f+1]<<1;let x=t[m],p=t[m+1],v=r[m],y=r[m+1];m=s[f+2]<<1;let A=t[m],C=t[m+1],S=r[m],I=r[m+1];for(let Y=0;Y<c;Y++){let k=l.length;if(this.clip(u,g,x,p,A,C,o[Y],h)){let F=h.length;if(F==0)continue;let X=p-C,E=A-x,R=u-A,B=C-g,st=1/(X*R+E*(g-C)),et=F>>1,rt=this.clipOutput,ct=L.setArraySize(l,k+et*2),ot=L.setArraySize(n,k+et*2);for(let Z=0;Z<F;Z+=2,k+=2){let nt=rt[Z],ht=rt[Z+1];ct[k]=nt,ct[k+1]=ht;let bt=nt-A,mt=ht-C,pt=(X*bt+E*mt)*st,wt=(B*bt+R*mt)*st,Mt=1-pt-wt;ot[k]=w*pt+v*wt+S*Mt,ot[k+1]=b*pt+y*wt+I*Mt}k=a.length;let ut=L.setArraySize(a,k+3*(et-2));et--;for(let Z=1;Z<et;Z++,k+=3)ut[k]=d,ut[k+1]=d+Z,ut[k+2]=d+Z+1;d+=et+1}else{let F=L.setArraySize(l,k+6);F[k]=u,F[k+1]=g,F[k+2]=x,F[k+3]=p,F[k+4]=A,F[k+5]=C;let X=L.setArraySize(n,k+3*2);X[k]=w,X[k+1]=b,X[k+2]=v,X[k+3]=y,X[k+4]=S,X[k+5]=I,k=a.length;let E=L.setArraySize(a,k+3);E[k]=d,E[k+1]=d+1,E[k+2]=d+2,d+=3;break}}}}clip(t,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(t),d.push(s),d.push(i),d.push(r),d.push(h),d.push(l),d.push(t),d.push(s),a.length=0;let f=n.length-4,m=n;for(let u=0;;u+=2){let g=m[u],w=m[u+1],b=g-m[u+2],x=w-m[u+3],p=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 Y=v[A],k=v[A+1],F=x*(g-Y)>b*(w-k),X=x*(g-S)-b*(w-I);if(X>0){if(F){a.push(Y),a.push(k);continue}let E=Y-S,R=k-I,B=X/(E*x-R*b);if(B>=0&&B<=1)a.push(S+E*B),a.push(I+R*B);else{a.push(Y),a.push(k);continue}}else if(F){let E=Y-S,R=k-I,B=X/(E*x-R*b);if(B>=0&&B<=1)a.push(S+E*B),a.push(I+R*B),a.push(Y),a.push(k);else{a.push(Y),a.push(k);continue}}c=!0}if(p==a.length)return o.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==f)break;let y=a;a=d,a.length=0,d=y}if(o!=a){o.length=0;for(let u=0,g=a.length-2;u<g;u++)o[u]=a[u]}else o.length=o.length-2;return c}static makeClockwise(t){let s=t,i=t.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 f=s[o],m=s[o+1],u=c-o;s[o]=s[u],s[o+1]=s[u+1],s[u]=f,s[u+1]=m}}},zr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Cs,i=typeof e=="string"?JSON.parse(e):e,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=M(r,"referenceScale",100)*t,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=M(l,"parent",null);a&&(n=s.findBone(a));let o=new us(s.bones.length,l.name,n);o.length=M(l,"length",0)*t,o.x=M(l,"x",0)*t,o.y=M(l,"y",0)*t,o.rotation=M(l,"rotation",0),o.scaleX=M(l,"scaleX",1),o.scaleY=M(l,"scaleY",1),o.shearX=M(l,"shearX",0),o.shearY=M(l,"shearY",0),o.inherit=L.enumValue(de,M(l,"inherit","Normal")),o.skinRequired=M(l,"skin",!1);let c=M(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 Ts(s.slots.length,n,a),c=M(l,"color",null);c&&o.color.setFromString(c);let d=M(l,"dark",null);d&&(o.darkColor=tt.fromString(d)),o.attachmentName=M(l,"attachment",null),o.blendMode=L.enumValue(Is,M(l,"blend","normal")),o.visible=M(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 ws(l.name);n.order=M(l,"order",0),n.skinRequired=M(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=M(l,"mix",1),n.softness=M(l,"softness",0)*t,n.bendDirection=M(l,"bendPositive",!0)?1:-1,n.compress=M(l,"compress",!1),n.stretch=M(l,"stretch",!1),n.uniform=M(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 Ms(l.name);n.order=M(l,"order",0),n.skinRequired=M(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);n.bones.push(f)}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=M(l,"local",!1),n.relative=M(l,"relative",!1),n.offsetRotation=M(l,"rotation",0),n.offsetX=M(l,"x",0)*t,n.offsetY=M(l,"y",0)*t,n.offsetScaleX=M(l,"scaleX",0),n.offsetScaleY=M(l,"scaleY",0),n.offsetShearY=M(l,"shearY",0),n.mixRotate=M(l,"mixRotate",1),n.mixX=M(l,"mixX",1),n.mixY=M(l,"mixY",n.mixX),n.mixScaleX=M(l,"mixScaleX",1),n.mixScaleY=M(l,"mixScaleY",n.mixScaleX),n.mixShearY=M(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 bs(l.name);n.order=M(l,"order",0),n.skinRequired=M(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);n.bones.push(f)}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=L.enumValue(vs,M(l,"positionMode","Percent")),n.spacingMode=L.enumValue(ys,M(l,"spacingMode","Length")),n.rotateMode=L.enumValue(As,M(l,"rotateMode","Tangent")),n.offsetRotation=M(l,"rotation",0),n.position=M(l,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=M(l,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=M(l,"mixRotate",1),n.mixX=M(l,"mixX",1),n.mixY=M(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 mi(l.name);n.order=M(l,"order",0),n.skinRequired=M(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=M(l,"x",0),n.y=M(l,"y",0),n.rotate=M(l,"rotate",0),n.scaleX=M(l,"scaleX",0),n.shearX=M(l,"shearX",0),n.limit=M(l,"limit",5e3)*t,n.step=1/M(l,"fps",60),n.inertia=M(l,"inertia",1),n.strength=M(l,"strength",100),n.damping=M(l,"damping",1),n.massInverse=1/M(l,"mass",1),n.wind=M(l,"wind",0),n.gravity=M(l,"gravity",0),n.mix=M(l,"mix",1),n.inertiaGlobal=M(l,"inertiaGlobal",!1),n.strengthGlobal=M(l,"strengthGlobal",!1),n.dampingGlobal=M(l,"dampingGlobal",!1),n.massGlobal=M(l,"massGlobal",!1),n.windGlobal=M(l,"windGlobal",!1),n.gravityGlobal=M(l,"gravityGlobal",!1),n.mixGlobal=M(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 fe(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 f=this.readAttachment(c[d],n,o.index,d,s);f&&n.setAttachment(o.index,d,f)}}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 ps(h);n.intValue=M(l,"int",0),n.floatValue=M(l,"float",0),n.stringValue=M(l,"string",""),n.audioPath=M(l,"audio",null),n.audioPath&&(n.volume=M(l,"volume",1),n.balance=M(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(e,t,s,i,r){let h=this.scale;switch(i=M(e,"name",i),M(e,"type","region")){case"region":{let l=M(e,"path",i),n=this.readSequence(M(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,i,l,n);if(!a)return null;a.path=l,a.x=M(e,"x",0)*h,a.y=M(e,"y",0)*h,a.scaleX=M(e,"scaleX",1),a.scaleY=M(e,"scaleY",1),a.rotation=M(e,"rotation",0),a.width=e.width*h,a.height=e.height*h,a.sequence=n;let o=M(e,"color",null);return o&&a.color.setFromString(o),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!l)return null;this.readVertices(e,l,e.vertexCount<<1);let n=M(e,"color",null);return n&&l.color.setFromString(n),l}case"mesh":case"linkedmesh":{let l=M(e,"path",i),n=this.readSequence(M(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,i,l,n);if(!a)return null;a.path=l;let o=M(e,"color",null);o&&a.color.setFromString(o),a.width=M(e,"width",0)*h,a.height=M(e,"height",0)*h,a.sequence=n;let c=M(e,"parent",null);if(c)return this.linkedMeshes.push(new Wr(a,M(e,"skin",null),s,c,M(e,"timelines",!0))),a;let d=e.uvs;return this.readVertices(e,a,d.length),a.triangles=e.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=M(e,"edges",null),a.hullLength=M(e,"hull",0)*2,a}case"path":{let l=this.attachmentLoader.newPathAttachment(t,i);if(!l)return null;l.closed=M(e,"closed",!1),l.constantSpeed=M(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,l,n<<1);let a=L.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*h;l.lengths=a;let o=M(e,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(t,i);if(!l)return null;l.x=M(e,"x",0)*h,l.y=M(e,"y",0)*h,l.rotation=M(e,"rotation",0);let n=M(e,"color",null);return n&&l.color.setFromString(n),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(t,i);if(!l)return null;let n=M(e,"end",null);n&&(l.endSlot=r.findSlot(n));let a=e.vertexCount;this.readVertices(e,l,a<<1);let o=M(e,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(e){if(e==null)return null;let t=new Hs(M(e,"count",0));return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let n=L.toFloatArray(r);if(i!=1)for(let a=0,o=r.length;a<o;a++)n[a]*=i;t.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])}t.bones=l,t.vertices=L.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let l in e.slots){let n=e.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 f=d.length;if(c=="attachment"){let m=new Ot(f,o);for(let u=0;u<f;u++){let g=d[u];m.setFrame(u,M(g,"time",0),M(g,"name",null))}r.push(m)}else if(c=="rgba"){let m=new Ne(f,f<<2,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.color);for(let b=0,x=0;;b++){m.setFrame(b,g,w.r,w.g,w.b,w.a);let p=d[b+1];if(!p){m.shrink(x);break}let v=M(p,"time",0),y=tt.fromString(p.color),A=u.curve;A&&(x=lt(A,m,x,b,0,g,v,w.r,y.r,1),x=lt(A,m,x,b,1,g,v,w.g,y.g,1),x=lt(A,m,x,b,2,g,v,w.b,y.b,1),x=lt(A,m,x,b,3,g,v,w.a,y.a,1)),g=v,w=y,u=p}r.push(m)}else if(c=="rgb"){let m=new Ue(f,f*3,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.color);for(let b=0,x=0;;b++){m.setFrame(b,g,w.r,w.g,w.b);let p=d[b+1];if(!p){m.shrink(x);break}let v=M(p,"time",0),y=tt.fromString(p.color),A=u.curve;A&&(x=lt(A,m,x,b,0,g,v,w.r,y.r,1),x=lt(A,m,x,b,1,g,v,w.g,y.g,1),x=lt(A,m,x,b,2,g,v,w.b,y.b,1)),g=v,w=y,u=p}r.push(m)}else if(c=="alpha")r.push(St(d,new ze(f,f,o),0,1));else if(c=="rgba2"){let m=new We(f,f*7,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.light),b=tt.fromString(u.dark);for(let x=0,p=0;;x++){m.setFrame(x,g,w.r,w.g,w.b,w.a,b.r,b.g,b.b);let v=d[x+1];if(!v){m.shrink(p);break}let y=M(v,"time",0),A=tt.fromString(v.light),C=tt.fromString(v.dark),S=u.curve;S&&(p=lt(S,m,p,x,0,g,y,w.r,A.r,1),p=lt(S,m,p,x,1,g,y,w.g,A.g,1),p=lt(S,m,p,x,2,g,y,w.b,A.b,1),p=lt(S,m,p,x,3,g,y,w.a,A.a,1),p=lt(S,m,p,x,4,g,y,b.r,C.r,1),p=lt(S,m,p,x,5,g,y,b.g,C.g,1),p=lt(S,m,p,x,6,g,y,b.b,C.b,1)),g=y,w=A,b=C,u=v}r.push(m)}else if(c=="rgb2"){let m=new qe(f,f*6,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.light),b=tt.fromString(u.dark);for(let x=0,p=0;;x++){m.setFrame(x,g,w.r,w.g,w.b,b.r,b.g,b.b);let v=d[x+1];if(!v){m.shrink(p);break}let y=M(v,"time",0),A=tt.fromString(v.light),C=tt.fromString(v.dark),S=u.curve;S&&(p=lt(S,m,p,x,0,g,y,w.r,A.r,1),p=lt(S,m,p,x,1,g,y,w.g,A.g,1),p=lt(S,m,p,x,2,g,y,w.b,A.b,1),p=lt(S,m,p,x,3,g,y,b.r,C.r,1),p=lt(S,m,p,x,4,g,y,b.g,C.g,1),p=lt(S,m,p,x,5,g,y,b.b,C.b,1)),g=y,w=A,b=C,u=v}r.push(m)}}}if(e.bones)for(let l in e.bones){let n=e.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],f=d.length;if(f!=0){if(c==="rotate")r.push(St(d,new Qt(f,f,o),0,1));else if(c==="translate"){let m=new Ye(f,f<<1,o);r.push(Rs(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new ke(f,f,o);r.push(St(d,m,0,i))}else if(c==="translatey"){let m=new Fe(f,f,o);r.push(St(d,m,0,i))}else if(c==="scale"){let m=new Xe(f,f<<1,o);r.push(Rs(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Pe(f,f,o);r.push(St(d,m,1,1))}else if(c==="scaley"){let m=new Le(f,f,o);r.push(St(d,m,1,1))}else if(c==="shear"){let m=new Be(f,f<<1,o);r.push(Rs(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Ve(f,f,o);r.push(St(d,m,0,1))}else if(c==="sheary"){let m=new Oe(f,f,o);r.push(St(d,m,0,1))}else if(c==="inherit"){let m=new De(f,a.index);for(let u=0;u<d.length;u++){let g=d[u];m.setFrame(u,M(g,"time",0),L.enumValue(de,M(g,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let l in e.ik){let n=e.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 He(n.length,n.length<<1,c),f=M(a,"time",0),m=M(a,"mix",1),u=M(a,"softness",0)*i;for(let g=0,w=0;;g++){d.setFrame(g,f,m,u,M(a,"bendPositive",!0)?1:-1,M(a,"compress",!1),M(a,"stretch",!1));let b=n[g+1];if(!b){d.shrink(w);break}let x=M(b,"time",0),p=M(b,"mix",1),v=M(b,"softness",0)*i,y=a.curve;y&&(w=lt(y,d,w,g,0,f,x,m,p,1),w=lt(y,d,w,g,1,f,x,u,v,i)),f=x,m=p,u=v,a=b}r.push(d)}if(e.transform)for(let l in e.transform){let n=e.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 _e(n.length,n.length*6,c),f=M(a,"time",0),m=M(a,"mixRotate",1),u=M(a,"mixX",1),g=M(a,"mixY",u),w=M(a,"mixScaleX",1),b=M(a,"mixScaleY",w),x=M(a,"mixShearY",1);for(let p=0,v=0;;p++){d.setFrame(p,f,m,u,g,w,b,x);let y=n[p+1];if(!y){d.shrink(v);break}let A=M(y,"time",0),C=M(y,"mixRotate",1),S=M(y,"mixX",1),I=M(y,"mixY",S),Y=M(y,"mixScaleX",1),k=M(y,"mixScaleY",Y),F=M(y,"mixShearY",1),X=a.curve;X&&(v=lt(X,d,v,p,0,f,A,m,C,1),v=lt(X,d,v,p,1,f,A,u,S,1),v=lt(X,d,v,p,2,f,A,g,I,1),v=lt(X,d,v,p,3,f,A,w,Y,1),v=lt(X,d,v,p,4,f,A,b,k,1),v=lt(X,d,v,p,5,f,A,x,F,1)),f=A,m=C,u=S,g=I,w=Y,b=k,w=Y,a=y}r.push(d)}if(e.path)for(let l in e.path){let n=e.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],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new je(m,m,o);r.push(St(d,u,0,a.positionMode==0?i:1))}else if(c==="spacing"){let u=new Ze(m,m,o);r.push(St(d,u,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let u=new Ke(m,m*3,o),g=M(f,"time",0),w=M(f,"mixRotate",1),b=M(f,"mixX",1),x=M(f,"mixY",b);for(let p=0,v=0;;p++){u.setFrame(p,g,w,b,x);let y=d[p+1];if(!y){u.shrink(v);break}let A=M(y,"time",0),C=M(y,"mixRotate",1),S=M(y,"mixX",1),I=M(y,"mixY",S),Y=f.curve;Y&&(v=lt(Y,u,v,p,0,g,A,w,C,1),v=lt(Y,u,v,p,1,g,A,b,S,1),v=lt(Y,u,v,p,2,g,A,x,I,1)),g=A,w=C,b=S,x=I,f=y}r.push(u)}}}if(e.physics)for(let l in e.physics){let n=e.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 f=c.length;if(o=="reset"){const u=new rs(f,a);for(let g=0;d!=null;d=c[g+1],g++)u.setFrame(g,M(d,"time",0));r.push(u);continue}let m;if(o=="inertia")m=new Je(f,f,a);else if(o=="strength")m=new Qe(f,f,a);else if(o=="damping")m=new $e(f,f,a);else if(o=="mass")m=new ts(f,f,a);else if(o=="wind")m=new es(f,f,a);else if(o=="gravity")m=new ss(f,f,a);else if(o=="mix")m=new is(f,f,a);else continue;r.push(St(c,m,0,1))}}if(e.attachments)for(let l in e.attachments){let n=e.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 f=d.index;for(let m in c){let u=c[m],g=a.getAttachment(f,m);for(let w in u){let b=u[w],x=b[0];if(x){if(w=="deform"){let p=g.bones,v=g.vertices,y=p?v.length/3*2:v.length,A=new Ge(b.length,b.length,f,g),C=M(x,"time",0);for(let S=0,I=0;;S++){let Y,k=M(x,"vertices",null);if(!k)Y=p?L.newFloatArray(y):v;else{Y=L.newFloatArray(y);let R=M(x,"offset",0);if(L.arrayCopy(k,0,Y,R,k.length),i!=1)for(let B=R,st=B+k.length;B<st;B++)Y[B]*=i;if(!p)for(let B=0;B<y;B++)Y[B]+=v[B]}A.setFrame(S,C,Y);let F=b[S+1];if(!F){A.shrink(I);break}let X=M(F,"time",0),E=x.curve;E&&(I=lt(E,A,I,S,0,C,X,0,1,1)),C=X,x=F}r.push(A)}else if(w=="sequence"){let p=new ns(b.length,f,g),v=0;for(let y=0;y<b.length;y++){let A=M(x,"delay",v),C=M(x,"time",0),S=_s[M(x,"mode","hold")],I=M(x,"index",0);p.setFrame(y,C,S,I,A),v=A,x=b[y+1]}r.push(p)}}}}}}if(e.drawOrder){let l=new zt(e.drawOrder.length),n=s.slots.length,a=0;for(let o=0;o<e.drawOrder.length;o++,a++){let c=e.drawOrder[o],d=null,f=M(c,"offsets",null);if(f){d=L.newArray(n,-1);let m=L.newArray(n-f.length,0),u=0,g=0;for(let w=0;w<f.length;w++){let b=f[w],x=s.findSlot(b.slot);if(!x)throw new Error("Slot not found: "+x);let p=x.index;for(;u!=p;)m[g++]=u++;d[u+b.offset]=u++}for(;u<n;)m[g++]=u++;for(let w=n-1;w>=0;w--)d[w]==-1&&(d[w]=m[--g])}l.setFrame(a,M(c,"time",0),d)}r.push(l)}if(e.events){let l=new le(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let o=e.events[a],c=s.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let d=new xs(L.toSinglePrecision(M(o,"time",0)),c);d.intValue=M(o,"int",c.intValue),d.floatValue=M(o,"float",c.floatValue),d.stringValue=M(o,"string",c.stringValue),d.data.audioPath&&(d.volume=M(o,"volume",1),d.balance=M(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 ne(t,r,h))}},Wr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function St(e,t,s,i){let r=e[0],h=M(r,"time",0),l=M(r,"value",s)*i,n=0;for(let a=0;;a++){t.setFrame(a,h,l);let o=e[a+1];if(!o)return t.shrink(n),t;let c=M(o,"time",0),d=M(o,"value",s)*i;r.curve&&(n=lt(r.curve,t,n,a,0,h,c,l,d,i)),h=c,l=d,r=o}}function Rs(e,t,s,i,r,h){let l=e[0],n=M(l,"time",0),a=M(l,s,r)*h,o=M(l,i,r)*h,c=0;for(let d=0;;d++){t.setFrame(d,n,a,o);let f=e[d+1];if(!f)return t.shrink(c),t;let m=M(f,"time",0),u=M(f,s,r)*h,g=M(f,i,r)*h,w=l.curve;w&&(c=lt(w,t,c,d,0,n,m,a,u,h),c=lt(w,t,c,d,1,n,m,o,g,h)),n=m,a=u,o=g,l=f}}function lt(e,t,s,i,r,h,l,n,a,o){if(e=="stepped")return t.setStepped(i),s;let c=r<<2,d=e[c],f=e[c+1]*o,m=e[c+2],u=e[c+3]*o;return t.setBezier(s,i,r,h,n,d,f,m,u,l,a),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var xt=class{canvas;gl;restorables=[];constructor(e,t={alpha:!0}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{const s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=e=>{e&&e.preventDefault()};contextRestoredHandler=()=>{for(let e=0,t=this.restorables.length;e<t;e++)this.restorables[e].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(e){this.restorables.push(e)}removeRestorable(e){const t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},Gt=class Te extends cs{context;texture=null;boundUnit=0;useMipMaps=!1;static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;constructor(t,s,i=!1){super(s),this.context=t instanceof xt?t:new xt(t),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(t,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Te.validateMagFilter(s)),this.useMipMaps=Te.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case 9987:case 9985:case 9986:case 9984:return 9729;default:return t}}static usesMipMaps(t){switch(t){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(t,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(t){let s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Te.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,t?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),t&&s.generateMipmap(s.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){let s=this.context.gl;this.boundUnit=t,s.activeTexture(s.TEXTURE0+t),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){let t=this.context.gl;t.activeTexture(t.TEXTURE0+this.boundUnit),t.bindTexture(t.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},bi=class extends ai{constructor(e,t="",s=new gs){super(i=>new Gt(e,i),t,s)}},At=class{x=0;y=0;z=0;constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,s){return this.x=e,this.y=t,this.z=s,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}normalize(){let e=this.length();return e==0?this:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this)}cross(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}multiply(e){let t=e.values;return this.set(this.x*t[V]+this.y*t[W]+this.z*t[q]+t[O],this.x*t[G]+this.y*t[D]+this.z*t[H]+t[N],this.x*t[_]+this.y*t[j]+this.z*t[U]+t[z])}project(e){let t=e.values,s=1/(this.x*t[J]+this.y*t[Q]+this.z*t[$]+t[K]);return this.set((this.x*t[V]+this.y*t[W]+this.z*t[q]+t[O])*s,(this.x*t[G]+this.y*t[D]+this.z*t[H]+t[N])*s,(this.x*t[_]+this.y*t[j]+this.z*t[U]+t[z])*s)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(e){let t=e.x-this.x,s=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+s*s+i*i)}},V=0,W=4,q=8,O=12,G=1,D=5,H=9,N=13,_=2,j=6,U=10,z=14,J=3,Q=7,$=11,K=15,se=class Rt{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new At;static yAxis=new At;static zAxis=new At;static tmpMatrix=new Rt;constructor(){let t=this.values;t[V]=1,t[D]=1,t[U]=1,t[K]=1}set(t){return this.values.set(t),this}transpose(){let t=this.temp,s=this.values;return t[V]=s[V],t[W]=s[G],t[q]=s[_],t[O]=s[J],t[G]=s[W],t[D]=s[D],t[H]=s[j],t[N]=s[Q],t[_]=s[q],t[j]=s[H],t[U]=s[U],t[z]=s[$],t[J]=s[O],t[Q]=s[N],t[$]=s[z],t[K]=s[K],this.set(t)}identity(){let t=this.values;return t[V]=1,t[W]=0,t[q]=0,t[O]=0,t[G]=0,t[D]=1,t[H]=0,t[N]=0,t[_]=0,t[j]=0,t[U]=1,t[z]=0,t[J]=0,t[Q]=0,t[$]=0,t[K]=1,this}invert(){let t=this.values,s=this.temp,i=t[J]*t[j]*t[H]*t[O]-t[_]*t[Q]*t[H]*t[O]-t[J]*t[D]*t[U]*t[O]+t[G]*t[Q]*t[U]*t[O]+t[_]*t[D]*t[$]*t[O]-t[G]*t[j]*t[$]*t[O]-t[J]*t[j]*t[q]*t[N]+t[_]*t[Q]*t[q]*t[N]+t[J]*t[W]*t[U]*t[N]-t[V]*t[Q]*t[U]*t[N]-t[_]*t[W]*t[$]*t[N]+t[V]*t[j]*t[$]*t[N]+t[J]*t[D]*t[q]*t[z]-t[G]*t[Q]*t[q]*t[z]-t[J]*t[W]*t[H]*t[z]+t[V]*t[Q]*t[H]*t[z]+t[G]*t[W]*t[$]*t[z]-t[V]*t[D]*t[$]*t[z]-t[_]*t[D]*t[q]*t[K]+t[G]*t[j]*t[q]*t[K]+t[_]*t[W]*t[H]*t[K]-t[V]*t[j]*t[H]*t[K]-t[G]*t[W]*t[U]*t[K]+t[V]*t[D]*t[U]*t[K];if(i==0)throw new Error("non-invertible matrix");let r=1/i;return s[V]=t[H]*t[z]*t[Q]-t[N]*t[U]*t[Q]+t[N]*t[j]*t[$]-t[D]*t[z]*t[$]-t[H]*t[j]*t[K]+t[D]*t[U]*t[K],s[W]=t[O]*t[U]*t[Q]-t[q]*t[z]*t[Q]-t[O]*t[j]*t[$]+t[W]*t[z]*t[$]+t[q]*t[j]*t[K]-t[W]*t[U]*t[K],s[q]=t[q]*t[N]*t[Q]-t[O]*t[H]*t[Q]+t[O]*t[D]*t[$]-t[W]*t[N]*t[$]-t[q]*t[D]*t[K]+t[W]*t[H]*t[K],s[O]=t[O]*t[H]*t[j]-t[q]*t[N]*t[j]-t[O]*t[D]*t[U]+t[W]*t[N]*t[U]+t[q]*t[D]*t[z]-t[W]*t[H]*t[z],s[G]=t[N]*t[U]*t[J]-t[H]*t[z]*t[J]-t[N]*t[_]*t[$]+t[G]*t[z]*t[$]+t[H]*t[_]*t[K]-t[G]*t[U]*t[K],s[D]=t[q]*t[z]*t[J]-t[O]*t[U]*t[J]+t[O]*t[_]*t[$]-t[V]*t[z]*t[$]-t[q]*t[_]*t[K]+t[V]*t[U]*t[K],s[H]=t[O]*t[H]*t[J]-t[q]*t[N]*t[J]-t[O]*t[G]*t[$]+t[V]*t[N]*t[$]+t[q]*t[G]*t[K]-t[V]*t[H]*t[K],s[N]=t[q]*t[N]*t[_]-t[O]*t[H]*t[_]+t[O]*t[G]*t[U]-t[V]*t[N]*t[U]-t[q]*t[G]*t[z]+t[V]*t[H]*t[z],s[_]=t[D]*t[z]*t[J]-t[N]*t[j]*t[J]+t[N]*t[_]*t[Q]-t[G]*t[z]*t[Q]-t[D]*t[_]*t[K]+t[G]*t[j]*t[K],s[j]=t[O]*t[j]*t[J]-t[W]*t[z]*t[J]-t[O]*t[_]*t[Q]+t[V]*t[z]*t[Q]+t[W]*t[_]*t[K]-t[V]*t[j]*t[K],s[U]=t[W]*t[N]*t[J]-t[O]*t[D]*t[J]+t[O]*t[G]*t[Q]-t[V]*t[N]*t[Q]-t[W]*t[G]*t[K]+t[V]*t[D]*t[K],s[z]=t[O]*t[D]*t[_]-t[W]*t[N]*t[_]-t[O]*t[G]*t[j]+t[V]*t[N]*t[j]+t[W]*t[G]*t[z]-t[V]*t[D]*t[z],s[J]=t[H]*t[j]*t[J]-t[D]*t[U]*t[J]-t[H]*t[_]*t[Q]+t[G]*t[U]*t[Q]+t[D]*t[_]*t[$]-t[G]*t[j]*t[$],s[Q]=t[W]*t[U]*t[J]-t[q]*t[j]*t[J]+t[q]*t[_]*t[Q]-t[V]*t[U]*t[Q]-t[W]*t[_]*t[$]+t[V]*t[j]*t[$],s[$]=t[q]*t[D]*t[J]-t[W]*t[H]*t[J]-t[q]*t[G]*t[Q]+t[V]*t[H]*t[Q]+t[W]*t[G]*t[$]-t[V]*t[D]*t[$],s[K]=t[W]*t[H]*t[_]-t[q]*t[D]*t[_]+t[q]*t[G]*t[j]-t[V]*t[H]*t[j]-t[W]*t[G]*t[U]+t[V]*t[D]*t[U],t[V]=s[V]*r,t[W]=s[W]*r,t[q]=s[q]*r,t[O]=s[O]*r,t[G]=s[G]*r,t[D]=s[D]*r,t[H]=s[H]*r,t[N]=s[N]*r,t[_]=s[_]*r,t[j]=s[j]*r,t[U]=s[U]*r,t[z]=s[z]*r,t[J]=s[J]*r,t[Q]=s[Q]*r,t[$]=s[$]*r,t[K]=s[K]*r,this}determinant(){let t=this.values;return t[J]*t[j]*t[H]*t[O]-t[_]*t[Q]*t[H]*t[O]-t[J]*t[D]*t[U]*t[O]+t[G]*t[Q]*t[U]*t[O]+t[_]*t[D]*t[$]*t[O]-t[G]*t[j]*t[$]*t[O]-t[J]*t[j]*t[q]*t[N]+t[_]*t[Q]*t[q]*t[N]+t[J]*t[W]*t[U]*t[N]-t[V]*t[Q]*t[U]*t[N]-t[_]*t[W]*t[$]*t[N]+t[V]*t[j]*t[$]*t[N]+t[J]*t[D]*t[q]*t[z]-t[G]*t[Q]*t[q]*t[z]-t[J]*t[W]*t[H]*t[z]+t[V]*t[Q]*t[H]*t[z]+t[G]*t[W]*t[$]*t[z]-t[V]*t[D]*t[$]*t[z]-t[_]*t[D]*t[q]*t[K]+t[G]*t[j]*t[q]*t[K]+t[_]*t[W]*t[H]*t[K]-t[V]*t[j]*t[H]*t[K]-t[G]*t[W]*t[U]*t[K]+t[V]*t[D]*t[U]*t[K]}translate(t,s,i){let r=this.values;return r[O]+=t,r[N]+=s,r[z]+=i,this}copy(){return new Rt().set(this.values)}projection(t,s,i,r){this.identity();let h=1/Math.tan(i*(Math.PI/180)/2),l=(s+t)/(t-s),n=2*s*t/(t-s),a=this.values;return a[V]=h/r,a[G]=0,a[_]=0,a[J]=0,a[W]=0,a[D]=h,a[j]=0,a[Q]=0,a[q]=0,a[H]=0,a[U]=l,a[$]=-1,a[O]=0,a[N]=0,a[z]=n,a[K]=0,this}ortho2d(t,s,i,r){return this.ortho(t,t+i,s,s+r,0,1)}ortho(t,s,i,r,h,l){this.identity();let n=2/(s-t),a=2/(r-i),o=-2/(l-h),c=-(s+t)/(s-t),d=-(r+i)/(r-i),f=-(l+h)/(l-h),m=this.values;return m[V]=n,m[G]=0,m[_]=0,m[J]=0,m[W]=0,m[D]=a,m[j]=0,m[Q]=0,m[q]=0,m[H]=0,m[U]=o,m[$]=0,m[O]=c,m[N]=d,m[z]=f,m[K]=1,this}multiply(t){let s=this.temp,i=this.values,r=t.values;return s[V]=i[V]*r[V]+i[W]*r[G]+i[q]*r[_]+i[O]*r[J],s[W]=i[V]*r[W]+i[W]*r[D]+i[q]*r[j]+i[O]*r[Q],s[q]=i[V]*r[q]+i[W]*r[H]+i[q]*r[U]+i[O]*r[$],s[O]=i[V]*r[O]+i[W]*r[N]+i[q]*r[z]+i[O]*r[K],s[G]=i[G]*r[V]+i[D]*r[G]+i[H]*r[_]+i[N]*r[J],s[D]=i[G]*r[W]+i[D]*r[D]+i[H]*r[j]+i[N]*r[Q],s[H]=i[G]*r[q]+i[D]*r[H]+i[H]*r[U]+i[N]*r[$],s[N]=i[G]*r[O]+i[D]*r[N]+i[H]*r[z]+i[N]*r[K],s[_]=i[_]*r[V]+i[j]*r[G]+i[U]*r[_]+i[z]*r[J],s[j]=i[_]*r[W]+i[j]*r[D]+i[U]*r[j]+i[z]*r[Q],s[U]=i[_]*r[q]+i[j]*r[H]+i[U]*r[U]+i[z]*r[$],s[z]=i[_]*r[O]+i[j]*r[N]+i[U]*r[z]+i[z]*r[K],s[J]=i[J]*r[V]+i[Q]*r[G]+i[$]*r[_]+i[K]*r[J],s[Q]=i[J]*r[W]+i[Q]*r[D]+i[$]*r[j]+i[K]*r[Q],s[$]=i[J]*r[q]+i[Q]*r[H]+i[$]*r[U]+i[K]*r[$],s[K]=i[J]*r[O]+i[Q]*r[N]+i[$]*r[z]+i[K]*r[K],this.set(this.temp)}multiplyLeft(t){let s=this.temp,i=this.values,r=t.values;return s[V]=r[V]*i[V]+r[W]*i[G]+r[q]*i[_]+r[O]*i[J],s[W]=r[V]*i[W]+r[W]*i[D]+r[q]*i[j]+r[O]*i[Q],s[q]=r[V]*i[q]+r[W]*i[H]+r[q]*i[U]+r[O]*i[$],s[O]=r[V]*i[O]+r[W]*i[N]+r[q]*i[z]+r[O]*i[K],s[G]=r[G]*i[V]+r[D]*i[G]+r[H]*i[_]+r[N]*i[J],s[D]=r[G]*i[W]+r[D]*i[D]+r[H]*i[j]+r[N]*i[Q],s[H]=r[G]*i[q]+r[D]*i[H]+r[H]*i[U]+r[N]*i[$],s[N]=r[G]*i[O]+r[D]*i[N]+r[H]*i[z]+r[N]*i[K],s[_]=r[_]*i[V]+r[j]*i[G]+r[U]*i[_]+r[z]*i[J],s[j]=r[_]*i[W]+r[j]*i[D]+r[U]*i[j]+r[z]*i[Q],s[U]=r[_]*i[q]+r[j]*i[H]+r[U]*i[U]+r[z]*i[$],s[z]=r[_]*i[O]+r[j]*i[N]+r[U]*i[z]+r[z]*i[K],s[J]=r[J]*i[V]+r[Q]*i[G]+r[$]*i[_]+r[K]*i[J],s[Q]=r[J]*i[W]+r[Q]*i[D]+r[$]*i[j]+r[K]*i[Q],s[$]=r[J]*i[q]+r[Q]*i[H]+r[$]*i[U]+r[K]*i[$],s[K]=r[J]*i[O]+r[Q]*i[N]+r[$]*i[z]+r[K]*i[K],this.set(this.temp)}lookAt(t,s,i){let r=Rt.xAxis,h=Rt.yAxis,l=Rt.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[V]=r.x,n[W]=r.y,n[q]=r.z,n[G]=h.x,n[D]=h.y,n[H]=h.z,n[_]=-l.x,n[j]=-l.y,n[U]=-l.z,Rt.tmpMatrix.identity(),Rt.tmpMatrix.values[O]=-t.x,Rt.tmpMatrix.values[N]=-t.y,Rt.tmpMatrix.values[z]=-t.z,this.multiply(Rt.tmpMatrix),this}},vi=class{position=new At(0,0,0);direction=new At(0,0,-1);up=new At(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new se;inverseProjectionView=new se;projection=new se;view=new se;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){let e=this.projection,t=this.view,s=this.projectionView,i=this.inverseProjectionView,r=this.zoom,h=this.viewportWidth,l=this.viewportHeight;e.ortho(r*(-h/2),r*(h/2),r*(-l/2),r*(l/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),s.set(e.values),s.multiply(t),i.set(s.values).invert()}screenToWorld(e,t,s){let i=e.x,r=s-e.y-1;return e.x=2*i/t-1,e.y=2*r/s-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,s){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=s*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},Ys=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;autoPreventDefault;isTouch=!1;callbacks;constructor(e,t=!0){this.element=e,this.autoPreventDefault=t,this.callbacks=this.setupCallbacks(e)}setupCallbacks(e){const t=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.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=e.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=e.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=e.getBoundingClientRect(),f=c.clientX-d.left,m=c.clientY-d.top,u=new yi(c.identifier,f,m);if(this.mouseX=f,this.mouseY=m,this.buttonDown=!0,!this.touch0)this.touch0=u,this.listeners.map(g=>{g.down&&g.down(u.x,u.y,a)});else if(!this.touch1){this.touch1=u;let g=this.touch1.x-this.touch0.x,w=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(g*g+w*w),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 f=e.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-f.left,u=d.clientY-f.top;this.touch0.identifier===d.identifier&&(this.touch0.x=this.mouseX=m,this.touch0.y=this.mouseY=u,this.listeners.map(g=>{g.dragged&&g.dragged(m,u,a)})),this.touch1&&this.touch1.identifier===d.identifier&&(this.touch1.x=this.mouseX=m,this.touch1.y=this.mouseY=u)}if(this.touch0&&this.touch1){let m=this.touch1.x-this.touch0.x,u=this.touch1.x-this.touch0.x,g=Math.sqrt(m*m+u*u);this.listeners.map(w=>{w.zoom&&w.zoom(this.initialPinchDistance,g,a)})}}this.autoPreventDefault&&a.preventDefault()},n=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let f=e.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-f.left,u=d.clientY-f.top;if(this.touch0.identifier===d.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=u,this.listeners.map(g=>{g.up&&g.up(m,u,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 e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",r,!0),e.addEventListener("touchstart",h,{passive:!1,capture:!1}),e.addEventListener("touchmove",l,{passive:!1,capture:!1}),e.addEventListener("touchend",n,{passive:!1,capture:!1}),e.addEventListener("touchcancel",n),{mouseDown:t,mouseMove:s,mouseUp:i,mouseWheel:r,touchStart:h,touchMove:l,touchEnd:n}}dispose(){const e=this.element;e.removeEventListener("mousedown",this.callbacks.mouseDown,!0),e.removeEventListener("mousemove",this.callbacks.mouseMove,!0),e.removeEventListener("mouseup",this.callbacks.mouseUp,!0),e.removeEventListener("wheel",this.callbacks.mouseWheel,!0),e.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),e.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),e.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),e.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},yi=class{constructor(e,t,s){this.identifier=e,this.x=t,this.y=s}},qr=class{constructor(e,t){this.canvas=e,this.camera=t;let s=0,i=0,r=0,h=0,l=0,n=0,a=0,o=0;new Ys(e).addListener({down:(c,d)=>{s=t.position.x,i=t.position.y,h=n=c,l=a=d,o=t.zoom},dragged:(c,d)=>{let f=c-h,m=d-l,u=t.screenToWorld(new At(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new At(f,m),e.clientWidth,e.clientHeight).sub(u);t.position.set(s-g.x,i-g.y,0),t.update(),n=c,a=d},wheel:c=>{let d=c/200*t.zoom,f=t.zoom+d;if(f>0){let m=0,u=0;if(c<0)m=n,u=a;else{let b=new At(e.clientWidth/2+15,e.clientHeight/2),x=n-b.x,p=e.clientHeight-1-a-b.y;m=b.x-x,u=e.clientHeight-1-b.y+p}let g=t.screenToWorld(new At(m,u),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let w=t.screenToWorld(new At(m,u),e.clientWidth,e.clientHeight);t.position.add(g.sub(w)),t.update()}},zoom:(c,d)=>{let f=c/d;t.zoom=o*f},up:(c,d)=>{n=c,a=d},moved:(c,d)=>{n=c,a=d}})}},Tt=class dt{constructor(t,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=t instanceof xt?t:new xt(t),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 t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.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(t,s){let i=this.context.gl,r=i.createShader(t);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(t,s){let i=this.context.gl,r=i.createProgram();if(!r)throw new Error("Couldn't compile program.");if(i.attachShader(r,t),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(t,s){this.context.gl.uniform1i(this.getUniformLocation(t),s)}setUniformf(t,s){this.context.gl.uniform1f(this.getUniformLocation(t),s)}setUniform2f(t,s,i){this.context.gl.uniform2f(this.getUniformLocation(t),s,i)}setUniform3f(t,s,i,r){this.context.gl.uniform3f(this.getUniformLocation(t),s,i,r)}setUniform4f(t,s,i,r,h){this.context.gl.uniform4f(this.getUniformLocation(t),s,i,r,h)}setUniform2x2f(t,s){let i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,s){let i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,s){let i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getUniformLocation(this.program,t);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getAttribLocation(this.program,t);if(i==-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);let t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){let s=`
3
- attribute vec4 ${dt.POSITION};
4
- attribute vec4 ${dt.COLOR};
5
- attribute vec2 ${dt.TEXCOORDS};
6
- uniform mat4 ${dt.MVP_MATRIX};
1
+ "use strict";var spine=(()=>{var os=Object.defineProperty,Vn=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertyNames,On=Object.prototype.hasOwnProperty,Dn=(e,t)=>{for(var s in t)os(e,s,{get:t[s],enumerable:!0})},Nn=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Bn(t))!On.call(e,n)&&n!==s&&os(e,n,{get:()=>t[n],enumerable:!(i=Vn(t,n))||i.enumerable});return e},Un=e=>Nn(os({},"__esModule",{value:!0}),e),Yi={};Dn(Yi,{AlphaTimeline:()=>Es,Animation:()=>Pe,AnimationState:()=>jn,AnimationStateAdapter:()=>Zn,AnimationStateData:()=>$n,AssetCache:()=>Gi,AssetManager:()=>cn,AssetManagerBase:()=>_i,AtlasAttachmentLoader:()=>Kn,Attachment:()=>us,AttachmentTimeline:()=>ne,BinaryInput:()=>sn,BlendMode:()=>hi,Bone:()=>Ve,BoneData:()=>Js,BonePose:()=>ke,BoneTimeline1:()=>_t,BoneTimeline2:()=>Re,BoundingBoxAttachment:()=>Ks,CameraController:()=>qr,ClippingAttachment:()=>$t,Color:()=>W,Color2Attribute:()=>fn,ColorAttribute:()=>Je,Constraint:()=>ae,ConstraintData:()=>oe,ConstraintTimeline1:()=>re,CurveTimeline:()=>Wt,CurveTimeline1:()=>pe,DebugUtils:()=>Wn,DeformTimeline:()=>Fs,Downloader:()=>$s,DrawOrder:()=>ji,DrawOrderFolderTimeline:()=>we,DrawOrderTimeline:()=>Zt,Event:()=>Be,EventData:()=>ei,EventQueue:()=>zi,EventTimeline:()=>Fe,EventType:()=>qi,FIRST:()=>ye,FakeTexture:()=>Gn,FromProperty:()=>Kt,FromRotate:()=>_e,FromScaleX:()=>je,FromScaleY:()=>Ze,FromShearY:()=>$e,FromX:()=>Ge,FromY:()=>He,GLTexture:()=>le,HOLD:()=>ve,HOLD_FIRST:()=>Wi,IkConstraint:()=>Zi,IkConstraintData:()=>Ae,IkConstraintPose:()=>Oe,IkConstraintTimeline:()=>Ls,Inherit:()=>Xe,InheritTimeline:()=>Cs,Input:()=>wi,IntSet:()=>zn,Interpolation:()=>ue,LoadingScreen:()=>Zr,M00:()=>_,M01:()=>K,M02:()=>J,M03:()=>G,M10:()=>Q,M11:()=>H,M12:()=>tt,M13:()=>j,M20:()=>et,M21:()=>st,M22:()=>Z,M23:()=>$,M30:()=>nt,M31:()=>rt,M32:()=>at,M33:()=>it,ManagedWebGLRenderingContext:()=>vt,MathUtils:()=>N,Matrix4:()=>Ie,Mesh:()=>yi,MeshAttachment:()=>Ot,OrthoCamera:()=>hn,PathAttachment:()=>Te,PathConstraint:()=>$i,PathConstraintData:()=>Se,PathConstraintMixTimeline:()=>Bs,PathConstraintPose:()=>De,PathConstraintPositionTimeline:()=>ks,PathConstraintSpacingTimeline:()=>Vs,Physics:()=>Ki,PhysicsConstraint:()=>ai,PhysicsConstraintDampingTimeline:()=>Ns,PhysicsConstraintData:()=>Ce,PhysicsConstraintGravityTimeline:()=>qs,PhysicsConstraintInertiaTimeline:()=>Os,PhysicsConstraintMassTimeline:()=>Us,PhysicsConstraintMixTimeline:()=>Ws,PhysicsConstraintPose:()=>Ne,PhysicsConstraintResetTimeline:()=>_s,PhysicsConstraintStrengthTimeline:()=>Ds,PhysicsConstraintTimeline:()=>Dt,PhysicsConstraintWindTimeline:()=>zs,PointAttachment:()=>Hi,PolygonBatcher:()=>Ti,Pool:()=>me,Posed:()=>Qs,PosedActive:()=>ti,PosedData:()=>Le,Position2Attribute:()=>Ke,Position3Attribute:()=>Wr,PositionMode:()=>ii,Pow:()=>Li,PowOut:()=>qn,Property:()=>Bi,RETAIN:()=>Zs,RGB2Timeline:()=>Rs,RGBA2Timeline:()=>Ps,RGBATimeline:()=>Is,RGBTimeline:()=>Ms,RegionAttachment:()=>qt,ResizeMode:()=>wn,RotateMode:()=>ri,RotateTimeline:()=>xe,SETUP:()=>js,SUBSEQUENT:()=>Ye,ScaleTimeline:()=>ws,ScaleXTimeline:()=>ys,ScaleYMode:()=>si,ScaleYTimeline:()=>vs,SceneRenderer:()=>bn,Sequence:()=>ge,SequenceMode:()=>ms,SequenceModeValues:()=>gs,SequenceTimeline:()=>Ys,Shader:()=>Pt,ShapeRenderer:()=>Ai,ShapeType:()=>gn,ShearTimeline:()=>Ts,ShearXTimeline:()=>As,ShearYTimeline:()=>Ss,Skeleton:()=>Qi,SkeletonBinary:()=>Jn,SkeletonBounds:()=>an,SkeletonClipping:()=>xi,SkeletonData:()=>oi,SkeletonDebugRenderer:()=>pn,SkeletonJson:()=>Dr,SkeletonRenderer:()=>xn,SkeletonRendererCore:()=>Ur,Skin:()=>qe,SkinEntry:()=>li,Slider:()=>tn,SliderData:()=>Gt,SliderMixTimeline:()=>Hs,SliderPose:()=>ze,SliderTimeline:()=>Gs,Slot:()=>Ji,SlotCurveTimeline:()=>be,SlotData:()=>ci,SlotPose:()=>Ue,SpacingMode:()=>ni,SpineCanvas:()=>Jr,StringSet:()=>ls,TexCoordAttribute:()=>vi,Texture:()=>hs,TextureAtlas:()=>ds,TextureAtlasPage:()=>Vi,TextureAtlasRegion:()=>fs,TextureFilter:()=>Ee,TextureRegion:()=>ki,TextureWrap:()=>Xi,TimeKeeper:()=>cs,Timeline:()=>gt,ToProperty:()=>Jt,ToRotate:()=>di,ToScaleX:()=>mi,ToScaleY:()=>gi,ToShearY:()=>pi,ToX:()=>fi,ToY:()=>ui,Touch:()=>dn,TrackEntry:()=>Ui,TransformConstraint:()=>en,TransformConstraintData:()=>ft,TransformConstraintPose:()=>We,TransformConstraintTimeline:()=>Xs,TranslateTimeline:()=>ps,TranslateXTimeline:()=>xs,TranslateYTimeline:()=>bs,Triangulator:()=>on,Utils:()=>B,Vector2:()=>ie,Vector3:()=>Et,VertexAttachment:()=>zt,VertexAttribute:()=>ce,VertexAttributeType:()=>un,WindowedMean:()=>_n,isBoneTimeline:()=>Di,isConstraintTimeline:()=>Ni,isSlotTimeline:()=>Oi});var zn=class{array=[];add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},ls=class{entries={};size=0;add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let s=0,i=e.length;s<i;s++)this.add(e[s]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},W=class te{constructor(t=0,s=0,i=0,n=0){this.r=t,this.g=s,this.b=i,this.a=n}static WHITE=new te(1,1,1,1);static RED=new te(1,0,0,1);static GREEN=new te(0,1,0,1);static BLUE=new te(0,0,1,1);static MAGENTA=new te(1,0,1,1);set(t,s,i,n){return this.r=t,this.g=s,this.b=i,this.a=n,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)==="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,n){return this.r+=t,this.g+=s,this.b+=i,this.a+=n,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(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,s=new te){return s.setFromString(t)}},N=class Lt{static PI=3.1415927;static PI2=Lt.PI*2;static invPI2=1/Lt.PI2;static radiansToDegrees=180/Lt.PI;static radDeg=Lt.radiansToDegrees;static degreesToRadians=Lt.PI/180;static degRad=Lt.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*Lt.degRad)}static sinDeg(t){return Math.sin(t*Lt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*Lt.radDeg}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return Lt.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){const n=Math.random(),r=s-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):s-Math.sqrt((1-n)*r*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},ue=class de{static linear=new class extends de{applyInternal(t){return t}};static smooth=new class extends de{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends de{applyInternal(t){return t*t}};static fastSlow=new class extends de{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends de{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,s,i){return s===void 0||i===void 0?this.applyInternal(t):t+(s-t)*this.applyInternal(i)}},Li=class extends ue{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2===0?-2:2)+1}},qn=class extends Li{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},B=class fe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,n,r){for(let o=s,h=n;o<s+r;o++,h++)i[h]=t[o]}static arrayFill(t,s,i,n){for(let r=s;r<i;r++)t[r]=n}static setArraySize(t,s,i=0){const n=t.length;if(n===s)return t;if(t.length=s,n<s)for(let r=n;r<s;r++)t[r]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:fe.setArraySize(t,s,i)}static newArray(t,s){const i=[];for(let n=0;n<t;n++)i[n]=s;return i}static newFloatArray(t){if(fe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{const s=[];for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(fe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{const s=[];for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return fe.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return fe.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,s,i=!0){for(let n=0;n<t.length;n++)if(t[n]===s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Wn=class{static logBones(e){for(let t=0;t<e.bones.length;t++){const s=e.bones[t].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},me=class{items=[];instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset?.(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},ie=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}},cs=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},_n=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},hs=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Ee=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Ee||{}),Xi=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Xi||{}),ki=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Gn=class extends hs{setFilters(e,t){}setWraps(e,t){}dispose(){}},ds=class{pages=[];regions=[];constructor(e){const t=new Hn(e),s=new Array(4),i={};i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.format=()=>{},i.filter=a=>{a.minFilter=B.enumValue(Ee,s[1]),a.magFilter=B.enumValue(Ee,s[2])},i.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},i.pma=a=>{a.pma=s[1]==="true"};var n={};n.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},n.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},n.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},n.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},n.rotate=a=>{const c=s[1];c==="true"?a.degrees=90:c!=="false"&&(a.degrees=parseInt(c))},n.index=a=>{a.index=parseInt(s[1])};let r=t.readLine();for(;r&&r.trim().length===0;)r=t.readLine();for(;!(!r||r.trim().length===0||t.readEntry(s,r)===0);)r=t.readLine();let o=null,h=null,l=null;for(;r!==null;)if(r.trim().length===0)o=null,r=t.readLine();else if(o){const a=new fs(o,r);for(;;){const c=t.readEntry(s,r=t.readLine());if(c===0)break;const d=n[s[0]];if(d)d(a);else{h||(h=[]),l||(l=[]),h.push(s[0]);const u=[];for(let f=0;f<c;f++)u.push(parseInt(s[f+1]));l.push(u)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),h&&h.length>0&&l&&l.length>0&&(a.names=h,a.values=l,h=null,l=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees===90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new Vi(r.trim());t.readEntry(s,r=t.readLine())!==0;){const a=i[s[0]];a&&a(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name===e)return this.regions[t];return null}setTextures(e,t=""){for(const s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Hn=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const s=t.indexOf(":");if(s===-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,n=s+1;;i++){const r=t.indexOf(",",n);if(r===-1)return e[i]=t.substr(n).trim(),i;if(e[i]=t.substr(n,r-n).trim(),n=r+1,i===4)return 4}}},Vi=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}},fs=class extends ki{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},us=class yn{static empty=[];name;timelineAttachment;timelineSlots=yn.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,s,i){let n=t[s];if(n.bone.isActive()){const r=(i?n.getAppliedPose():n.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,o=this.timelineSlots.length;r<o;r++){if(n=t[this.timelineSlots[r]],!n.bone.isActive())continue;const h=(i?n.getAppliedPose():n.getPose()).getAttachment();if(h!=null&&h.timelineAttachment===this)return!0}return!1}},zt=class vn extends us{static nextID=0;id=vn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,s,i,n,r,o,h){n=o+(n>>1)*h;const l=s.appliedPose.deform;let a=this.vertices;const c=this.bones;if(!c){l.length>0&&(a=l);const m=s.bone.appliedPose,p=m.worldX,g=m.worldY,x=m.a,b=m.b,w=m.c,v=m.d;for(let y=i,T=o;T<n;y+=2,T+=h){const A=a[y],S=a[y+1];r[T]=A*x+S*b+p,r[T+1]=A*w+S*v+g}return}let d=0,u=0;for(let m=0;m<i;m+=2){const p=c[d];d+=p+1,u+=p}const f=t.bones;if(l.length===0)for(let m=o,p=u*3;m<n;m+=h){let g=0,x=0,b=c[d++];for(b+=d;d<b;d++,p+=3){const w=f[c[d]].appliedPose,v=a[p],y=a[p+1],T=a[p+2];g+=(v*w.a+y*w.b+w.worldX)*T,x+=(v*w.c+y*w.d+w.worldY)*T}r[m]=g,r[m+1]=x}else{const m=l;for(let p=o,g=u*3,x=u<<1;p<n;p+=h){let b=0,w=0,v=c[d++];for(v+=d;d<v;d++,g+=3,x+=2){const y=f[c[d]].appliedPose,T=a[g]+m[x],A=a[g+1]+m[x+1],S=a[g+2];b+=(T*y.a+A*y.b+y.worldX)*S,w+=(T*y.c+A*y.d+y.worldY)*S}r[p]=b,r[p+1]=w}}}copyTo(t){this.bones?(t.bones=[],B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},Ot=class Ii extends zt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new W(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new W(0,0,0,0);constructor(t,s){super(t),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Ii(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new Ii(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,s,i){if(!t)throw new Error("Region not set.");const n=i.length;let r=t.u,o=t.v,h=0,l=0;if(t instanceof fs){const a=t.page,c=a.width,d=a.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/c,o-=(t.originalWidth-t.offsetX-t.width)/d,h=t.originalHeight/c,l=t.originalWidth/d;for(let u=0;u<n;u+=2)i[u]=r+s[u+1]*h,i[u+1]=o+(1-s[u])*l;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/c,o-=t.offsetY/d,h=t.originalWidth/c,l=t.originalHeight/d;for(let u=0;u<n;u+=2)i[u]=r+(1-s[u])*h,i[u+1]=o+(1-s[u+1])*l;return;case 270:r-=t.offsetY/c,o-=t.offsetX/d,h=t.originalHeight/c,l=t.originalWidth/d;for(let u=0;u<n;u+=2)i[u]=r+(1-s[u+1])*h,i[u+1]=o+s[u]*l;return;default:r-=t.offsetX/c,o-=(t.originalHeight-t.offsetY-t.height)/d,h=t.originalWidth/c,l=t.originalHeight/d}}else t?(h=t.u2-r,l=t.v2-o):(r=o=0,h=l=1);for(let a=0;a<n;a+=2)i[a]=r+s[a]*h,i[a+1]=o+s[a+1]*l}},qt=class Tn extends us{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new W(1,1,1,1);tempColor=new W(1,1,1,1);constructor(t,s){super(t),this.sequence=s}copy(){const t=new Tn(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,s,i,n,r){const o=t.bone.appliedPose,h=o.worldX,l=o.worldY,a=o.a,c=o.b,d=o.c,u=o.d;let f=s[0],m=s[1];i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l,n+=r,f=s[2],m=s[3],i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l,n+=r,f=s[4],m=s[5],i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l,n+=r,f=s[6],m=s[7],i[n]=f*a+m*c+h,i[n+1]=f*d+m*u+l}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,s,i,n,r,o,h,l,a,c){if(!t)throw new Error("Region not set.");const d=h/t.originalWidth*n,u=l/t.originalHeight*r,f=-h/2*n+t.offsetX*d,m=-l/2*r+t.offsetY*u,p=f+t.width*d,g=m+t.height*u,x=o*N.degRad,b=Math.cos(x),w=Math.sin(x),v=f*b+s,y=f*w,T=m*b+i,A=m*w,S=p*b+s,C=p*w,I=g*b+i,P=g*w;a[0]=v-A,a[1]=T+y,a[2]=v-P,a[3]=I+y,a[4]=S-P,a[5]=I+C,a[6]=S-A,a[7]=T+C,t==null?(c[0]=0,c[1]=0,c[2]=0,c[3]=1,c[4]=1,c[5]=1,c[6]=1,c[7]=0):(c[1]=t.v2,c[2]=t.u,c[5]=t.v,c[6]=t.u2,t.degrees===90?(c[0]=t.u2,c[3]=t.v2,c[4]=t.u,c[7]=t.v):(c[0]=t.u,c[3]=t.v,c[4]=t.u2,c[7]=t.v2))}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},ge=class ns{static _nextID=0;id=ns.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(t,s){this.regions=new Array(t),this.pathSuffix=s}copy(){const t=this.regions.length,s=new ns(t,this.pathSuffix);if(B.arrayCopy(this.regions,0,s.regions,0,t),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const i=this.uvs[0].length;s.uvs=[];for(let n=0;n<t;n++)s.uvs[n]=B.newFloatArray(i),B.arrayCopy(this.uvs[n],0,s.uvs[n],0,i)}if(this.offsets!=null){s.offsets=[];for(let i=0;i<t;i++)s.offsets[i]=[],B.arrayCopy(this.offsets[i],0,s.offsets[i],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof qt){this.uvs=[],this.offsets=[];for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(8),this.offsets[i]=[],qt.computeUVs(this.regions[i],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[i],this.uvs[i])}else if(t instanceof Ot){const i=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(i.length),Ot.computeUVs(this.regions[n],i,this.uvs[n])}}resolveIndex(t){let s=t.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,s){if(!this.pathSuffix)return t;let i=t;const n=(this.start+s).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return ns._nextID++}},ms=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(ms||{}),gs=[0,1,2,3,4,5,6],Pe=class{name;timelines=[];timelineIds;bones;color=new W(1,1,1,1);duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=s,this.timelineIds=new ls,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,i=e;for(let n=0;n<t;n++){const r=i[n];this.timelineIds.addAll(r.propertyIds),Di(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,n,r,o,h,l,a){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!==0&&(s%=this.duration,t>0&&(t%=this.duration));const c=this.timelines;for(let d=0,u=c.length;d<u;d++)c[d].apply(e,t,s,n,r,o,h,l,a)}},Bi=(e=>(e[e.rotate=0]="rotate",e[e.x=1]="x",e[e.y=2]="y",e[e.scaleX=3]="scaleX",e[e.scaleY=4]="scaleY",e[e.shearX=5]="shearX",e[e.shearY=6]="shearY",e[e.inherit=7]="inherit",e[e.rgb=8]="rgb",e[e.alpha=9]="alpha",e[e.rgb2=10]="rgb2",e[e.attachment=11]="attachment",e[e.deform=12]="deform",e[e.event=13]="event",e[e.drawOrder=14]="drawOrder",e[e.ikConstraint=15]="ikConstraint",e[e.transformConstraint=16]="transformConstraint",e[e.pathConstraintPosition=17]="pathConstraintPosition",e[e.pathConstraintSpacing=18]="pathConstraintSpacing",e[e.pathConstraintMix=19]="pathConstraintMix",e[e.physicsConstraintInertia=20]="physicsConstraintInertia",e[e.physicsConstraintStrength=21]="physicsConstraintStrength",e[e.physicsConstraintDamping=22]="physicsConstraintDamping",e[e.physicsConstraintMass=23]="physicsConstraintMass",e[e.physicsConstraintWind=24]="physicsConstraintWind",e[e.physicsConstraintGravity=25]="physicsConstraintGravity",e[e.physicsConstraintMix=26]="physicsConstraintMix",e[e.physicsConstraintReset=27]="physicsConstraintReset",e[e.sequence=28]="sequence",e[e.sliderTime=29]="sliderTime",e[e.sliderMix=30]="sliderMix",e))(Bi||{}),gt=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=B.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(e,t,s=1){const i=e.length;for(let n=s;n<i;n+=s)if(e[n]>t)return n-s;return i-s}};function Oi(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var Wt=class extends gt{curves;constructor(e,t,...s){super(e,...s),this.curves=B.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=B.newFloatArray(t);B.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,n,r,o,h,l,a,c){const d=this.curves;let u=this.getFrameCount()+e*18;s===0&&(d[t]=2+u);const f=(i-r*2+h)*.03,m=(n-o*2+l)*.03,p=((r-h)*3-i+a)*.006,g=((o-l)*3-n+c)*.006;let x=f*2+p,b=m*2+g,w=(r-i)*.3+f+p*.16666667,v=(o-n)*.3+m+g*.16666667,y=i+w,T=n+v;for(let A=u+18;u<A;u+=2)d[u]=y,d[u+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getBezierValue(e,t,s,i){const n=this.curves;if(n[i]>e){const l=this.frames[t],a=this.frames[t+s];return a+(e-l)/(n[i]-l)*(n[i+1]-a)}const r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=e){const l=n[i-2],a=n[i-1];return a+(e-l)/(n[i]-l)*(n[i+1]-a)}t+=this.getFrameEntries();const o=n[r-2],h=n[r-1];return h+(e-o)/(this.frames[t]-o)*(this.frames[t+s]-h)}},pe=class extends Wt{constructor(e,t,s){super(e,t,s)}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){const t=this.frames;let s=t.length-2;for(let n=2;n<=s;n+=2)if(t[n]>e){s=n-2;break}const i=this.curves[s>>1];switch(i){case 0:{const n=t[s],r=t[s+1];return r+(e-n)/(t[s+2]-n)*(t[s+2+1]-r)}case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,n,r){if(e<this.frames[0])return s?r:n;const o=this.getCurveValue(e);return s?r+o*t:n+(i?o:o+r-n)*t}getAbsoluteValue(e,t,s,i,n,r,o){return o===void 0?this.getAbsoluteValue1(e,t,s,i,n,r):this.getAbsoluteValue2(e,t,s,i,n,r,o)}getAbsoluteValue1(e,t,s,i,n,r){if(e<this.frames[0])return s?r:n;const o=this.getCurveValue(e);return s?r+(i?o:o-r)*t:n+(i?o:o-n)*t}getAbsoluteValue2(e,t,s,i,n,r,o){return e<this.frames[0]?s?r:n:s?r+(i?o:o-r)*t:n+(i?o:o-n)*t}getScaleValue(e,t,s,i,n,r,o){if(e<this.frames[0])return s?o:r;const h=this.getCurveValue(e)*o;if(t===1&&!i)return h;let l=s?o:r;return i?l+(h-o)*t:n?l+(Math.abs(h)*Math.sign(l)-l)*t:(l=Math.abs(l)*Math.sign(h),l+(h-l)*t)}};function Di(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var _t=class extends pe{boneIndex;constructor(e,t,s,i){super(e,t,`${i}|${s}`),this.boneIndex=s,this.additive=!0}apply(e,t,s,i,n,r,o,h,l){const a=e.bones[this.boneIndex];a.active&&this.apply1(l?a.appliedPose:a.pose,a.data.setupPose,s,n,r,o,h)}},Re=class extends Wt{boneIndex;constructor(e,t,s,i,n){super(e,t,`${i}|${s}`,`${n}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}apply(e,t,s,i,n,r,o,h,l){const a=e.bones[this.boneIndex];a.active&&this.apply1(l?a.appliedPose:a.pose,a.data.setupPose,s,n,r,o,h)}},xe=class extends _t{constructor(e,t,s){super(e,t,s,0)}apply1(e,t,s,i,n,r,o){e.rotation=this.getRelativeValue(s,i,n,r,e.rotation,t.rotation)}},ps=class extends Re{constructor(e,t,s){super(e,t,s,1,2)}apply1(e,t,s,i,n,r,o){const h=this.frames;if(s<h[0]){n&&(e.x=t.x,e.y=t.y);return}let l=0,a=0;const c=gt.search(h,s,3),d=this.curves[c/3];switch(d){case 0:{const u=h[c];l=h[c+1],a=h[c+2];const f=(s-u)/(h[c+3]-u);l+=(h[c+3+1]-l)*f,a+=(h[c+3+2]-a)*f;break}case 1:l=h[c+1],a=h[c+2];break;default:l=this.getBezierValue(s,c,1,d-2),a=this.getBezierValue(s,c,2,d+18-2)}n?(e.x=t.x+l*i,e.y=t.y+a*i):r?(e.x+=l*i,e.y+=a*i):(e.x+=(t.x+l-e.x)*i,e.y+=(t.y+a-e.y)*i)}},xs=class extends _t{constructor(e,t,s){super(e,t,s,1)}apply1(e,t,s,i,n,r,o){e.x=this.getRelativeValue(s,i,n,r,e.x,t.x)}},bs=class extends _t{constructor(e,t,s){super(e,t,s,2)}apply1(e,t,s,i,n,r,o){e.y=this.getRelativeValue(s,i,n,r,e.y,t.y)}},ws=class extends Re{constructor(e,t,s){super(e,t,s,3,4)}apply1(e,t,s,i,n,r,o){const h=this.frames;if(s<h[0]){n&&(e.scaleX=t.scaleX,e.scaleY=t.scaleY);return}let l,a;const c=gt.search(h,s,3),d=this.curves[c/3];switch(d){case 0:{const u=h[c];l=h[c+1],a=h[c+2];const f=(s-u)/(h[c+3]-u);l+=(h[c+3+1]-l)*f,a+=(h[c+3+2]-a)*f;break}case 1:l=h[c+1],a=h[c+2];break;default:l=this.getBezierValue(s,c,1,d-2),a=this.getBezierValue(s,c,2,d+18-2)}if(l*=t.scaleX,a*=t.scaleY,i===1&&!r)e.scaleX=l,e.scaleY=a;else{let u=0,f=0;n?(u=t.scaleX,f=t.scaleY):(u=e.scaleX,f=e.scaleY),r?(e.scaleX=u+(l-t.scaleX)*i,e.scaleY=f+(a-t.scaleY)*i):o?(e.scaleX=u+(Math.abs(l)*Math.sign(u)-u)*i,e.scaleY=f+(Math.abs(a)*Math.sign(f)-f)*i):(u=Math.abs(u)*Math.sign(l),f=Math.abs(f)*Math.sign(a),e.scaleX=u+(l-u)*i,e.scaleY=f+(a-f)*i)}}},ys=class extends _t{constructor(e,t,s){super(e,t,s,3)}apply1(e,t,s,i,n,r,o){e.scaleX=this.getScaleValue(s,i,n,r,o,e.scaleX,t.scaleX)}},vs=class extends _t{constructor(e,t,s){super(e,t,s,4)}apply1(e,t,s,i,n,r,o){e.scaleY=this.getScaleValue(s,i,n,r,o,e.scaleY,t.scaleY)}},Ts=class extends Re{constructor(e,t,s){super(e,t,s,5,6)}apply1(e,t,s,i,n,r,o){const h=this.frames;if(s<h[0]){n&&(e.shearX=t.shearX,e.shearY=t.shearY);return}let l=0,a=0;const c=gt.search(h,s,3),d=this.curves[c/3];switch(d){case 0:{const u=h[c];l=h[c+1],a=h[c+2];const f=(s-u)/(h[c+3]-u);l+=(h[c+3+1]-l)*f,a+=(h[c+3+2]-a)*f;break}case 1:l=h[c+1],a=h[c+2];break;default:l=this.getBezierValue(s,c,1,d-2),a=this.getBezierValue(s,c,2,d+18-2)}n?(e.shearX=t.shearX+l*i,e.shearY=t.shearY+a*i):r?(e.shearX+=l*i,e.shearY+=a*i):(e.shearX+=(t.shearX+l-e.shearX)*i,e.shearY+=(t.shearY+a-e.shearY)*i)}},As=class extends _t{constructor(e,t,s){super(e,t,s,5)}apply1(e,t,s,i,n,r,o){e.shearX=this.getRelativeValue(s,i,n,r,e.shearX,t.shearX)}},Ss=class extends _t{constructor(e,t,s){super(e,t,s,6)}apply1(e,t,s,i,n,r,o){e.shearY=this.getRelativeValue(s,i,n,r,e.shearY,t.shearY)}},Cs=class extends gt{boneIndex;constructor(e,t){super(e,`7|${t}`),this.boneIndex=t,this.instant=!0}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,n,r,o,h,l){const a=e.bones[this.boneIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose;if(h)r&&(c.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(c.inherit=a.data.setupPose.inherit):c.inherit=this.frames[gt.search(d,s,2)+1]}}},be=class extends Wt{slotIndex;constructor(e,t,s,...i){super(e,t,...i),this.slotIndex=s}apply(e,t,s,i,n,r,o,h,l){const a=e.slots[this.slotIndex];a.bone.active&&this.apply1(a,l?a.appliedPose:a.pose,s,n,r,o)}},Is=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(e,t,s,i,n,r){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r}apply1(e,t,s,i,n,r){const o=t.color,h=this.frames;if(s<h[0]){n&&o.setFromColor(e.data.setupPose.color);return}let l=0,a=0,c=0,d=0;const u=gt.search(h,s,5),f=this.curves[u/5];switch(f){case 0:{const m=h[u];l=h[u+1],a=h[u+2],c=h[u+3],d=h[u+4];const p=(s-m)/(h[u+5]-m);l+=(h[u+5+1]-l)*p,a+=(h[u+5+2]-a)*p,c+=(h[u+5+3]-c)*p,d+=(h[u+5+4]-d)*p;break}case 1:l=h[u+1],a=h[u+2],c=h[u+3],d=h[u+4];break;default:l=this.getBezierValue(s,u,1,f-2),a=this.getBezierValue(s,u,2,f+18-2),c=this.getBezierValue(s,u,3,f+18*2-2),d=this.getBezierValue(s,u,4,f+18*3-2)}if(i===1)o.set(l,a,c,d);else if(n){const m=e.data.setupPose.color;o.set(m.r+(l-m.r)*i,m.g+(a-m.g)*i,m.b+(c-m.b)*i,m.a+(d-m.a)*i)}else o.add((l-o.r)*i,(a-o.g)*i,(c-o.b)*i,(d-o.a)*i)}},Ms=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(e,t,s,i,n){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n}apply1(e,t,s,i,n,r){const o=t.color;let h=0,l=0,a=0;const c=this.frames;if(s<c[0]){if(n){const f=e.data.setupPose.color;o.r=f.r,o.g=f.g,o.b=f.b}return}const d=gt.search(c,s,4),u=this.curves[d>>2];switch(u){case 0:{const f=c[d];h=c[d+1],l=c[d+2],a=c[d+3];const m=(s-f)/(c[d+4]-f);h+=(c[d+4+1]-h)*m,l+=(c[d+4+2]-l)*m,a+=(c[d+4+3]-a)*m;break}case 1:h=c[d+1],l=c[d+2],a=c[d+3];break;default:h=this.getBezierValue(s,d,1,u-2),l=this.getBezierValue(s,d,2,u+18-2),a=this.getBezierValue(s,d,3,u+18*2-2)}if(i!==1)if(n){const f=e.data.setupPose.color;h=f.r+(h-f.r)*i,l=f.g+(l-f.g)*i,a=f.b+(a-f.b)*i}else h=o.r+(h-o.r)*i,l=o.g+(l-o.g)*i,a=o.b+(a-o.b)*i;o.r=h<0?0:h>1?1:h,o.g=l<0?0:l>1?1:l,o.b=a<0?0:a>1?1:a}},Es=class extends pe{slotIndex=0;constructor(e,t,s){super(e,t,`9|${s}`),this.slotIndex=s}apply(e,t,s,i,n,r,o,h,l){const a=e.slots[this.slotIndex];if(!a.bone.active)return;const c=(l?a.appliedPose:a.pose).color;let d=0;const u=this.frames;if(s<u[0]){r&&(c.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),n!==1)if(r){const f=a.data.setupPose.color;d=f.a+(d-f.a)*n}else d=c.a+(d-c.a)*n;c.a=d<0?0:d>1?1:d}},Ps=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,i,n,r,o,h,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r,this.frames[e+5]=o,this.frames[e+6]=h,this.frames[e+7]=l}apply1(e,t,s,i,n,r){const o=t.color,h=t.darkColor;let l=0,a=0,c=0;const d=this.frames;if(s<d[0]){if(n){const b=e.data.setupPose;o.setFromColor(b.color);const w=b.darkColor;h.r=w.r,h.g=w.g,h.b=w.b}return}let u=0,f=0,m=0,p=0;const g=gt.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];u=d[g+1],f=d[g+2],m=d[g+3],p=d[g+4],l=d[g+5],a=d[g+6],c=d[g+7];const w=(s-b)/(d[g+8]-b);u+=(d[g+8+1]-u)*w,f+=(d[g+8+2]-f)*w,m+=(d[g+8+3]-m)*w,p+=(d[g+8+4]-p)*w,l+=(d[g+8+5]-l)*w,a+=(d[g+8+6]-a)*w,c+=(d[g+8+7]-c)*w;break}case 1:u=d[g+1],f=d[g+2],m=d[g+3],p=d[g+4],l=d[g+5],a=d[g+6],c=d[g+7];break;default:u=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),l=this.getBezierValue(s,g,5,x+18*4-2),a=this.getBezierValue(s,g,6,x+18*5-2),c=this.getBezierValue(s,g,7,x+18*6-2)}if(i===1)o.set(u,f,m,p);else if(n){const b=e.data.setupPose;let w=b.color;o.set(w.r+(u-w.r)*i,w.g+(f-w.g)*i,w.b+(m-w.b)*i,w.a+(p-w.a)*i),w=b.darkColor,l=w.r+(l-w.r)*i,a=w.g+(a-w.g)*i,c=w.b+(c-w.b)*i}else o.add((u-o.r)*i,(f-o.g)*i,(m-o.b)*i,(p-o.a)*i),l=h.r+(l-h.r)*i,a=h.g+(a-h.g)*i,c=h.b+(c-h.b)*i;h.r=l<0?0:l>1?1:l,h.g=a<0?0:a>1?1:a,h.b=c<0?0:c>1?1:c}},Rs=class extends be{constructor(e,t,s){super(e,t,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,i,n,r,o,h){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r,this.frames[e+5]=o,this.frames[e+6]=h}apply1(e,t,s,i,n,r){const o=t.color,h=t.darkColor;let l=0,a=0,c=0,d=0,u=0,f=0;const m=this.frames;if(s<m[0]){if(n){const x=e.data.setupPose,b=x.color,w=x.darkColor;o.r=b.r,o.g=b.g,o.b=b.b,h.r=w.r,h.g=w.g,h.b=w.b}return}const p=gt.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];l=m[p+1],a=m[p+2],c=m[p+3],d=m[p+4],u=m[p+5],f=m[p+6];const b=(s-x)/(m[p+7]-x);l+=(m[p+7+1]-l)*b,a+=(m[p+7+2]-a)*b,c+=(m[p+7+3]-c)*b,d+=(m[p+7+4]-d)*b,u+=(m[p+7+5]-u)*b,f+=(m[p+7+6]-f)*b;break}case 1:l=m[p+1],a=m[p+2],c=m[p+3],d=m[p+4],u=m[p+5],f=m[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),c=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),u=this.getBezierValue(s,p,5,g+18*4-2),f=this.getBezierValue(s,p,6,g+18*5-2)}if(i!==1)if(n){const x=e.data.setupPose;let b=x.color;l=b.r+(l-b.r)*i,a=b.g+(a-b.g)*i,c=b.b+(c-b.b)*i,b=x.darkColor,d=b.r+(d-b.r)*i,u=b.g+(u-b.g)*i,f=b.b+(f-b.b)*i}else l=o.r+(l-o.r)*i,a=o.g+(a-o.g)*i,c=o.b+(c-o.b)*i,d=h.r+(d-h.r)*i,u=h.g+(u-h.g)*i,f=h.b+(f-h.b)*i;o.r=l<0?0:l>1?1:l,o.g=a<0?0:a>1?1:a,o.b=c<0?0:c>1?1:c,h.r=d<0?0:d>1?1:d,h.g=u<0?0:u>1?1:u,h.b=f<0?0:f>1?1:f}},ne=class extends gt{slotIndex=0;attachmentNames;constructor(e,t){super(e,`11|${t}`),this.slotIndex=t,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,n,r,o,h,l){const a=e.slots[this.slotIndex];if(!a.bone.active)return;const c=l?a.appliedPose:a.pose;h||s<this.frames[0]?r&&this.setAttachment(e,c,a.data.attachmentName):this.setAttachment(e,c,this.attachmentNames[gt.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},Fs=class extends Wt{slotIndex;attachment;vertices;constructor(e,t,s,i){super(e,t,`12|${s}|${i.id}`),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,n,r,o,h,l,a,c){const d=this.curves;let u=this.getFrameCount()+e*18;s===0&&(d[t]=2+u);const f=(i-r*2+h)*.03,m=l*.03-o*.06,p=((r-h)*3-i+a)*.006,g=(o-l+.33333333)*.018;let x=f*2+p,b=m*2+g,w=(r-i)*.3+f+p*.16666667,v=o*.3+m+g*.16666667,y=i+w,T=v;for(let A=u+18;u<A;u+=2)d[u]=y,d[u+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getCurvePercent(e,t){const s=this.curves;let i=s[t];switch(i){case 0:{const h=this.frames[t];return(e-h)/(this.frames[t+this.getFrameEntries()]-h)}case 1:return 0}if(i-=2,s[i]>e){const h=this.frames[t];return s[i+1]*(e-h)/(s[i]-h)}const n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=e){const h=s[i-2],l=s[i-1];return l+(e-h)/(s[i]-h)*(s[i+1]-l)}const r=s[n-2],o=s[n-1];return o+(1-o)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,i,n,r,o,h,l){const a=e.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,l))return;const c=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],l,r);for(const g of c)this.applyBeforeFirst(a[g],l,r);return}let u,f,m;if(s>=d[d.length-1])m=0,u=this.vertices[d.length-1],f=null;else{const g=gt.search(d,s);m=this.getCurvePercent(s,g),u=this.vertices[g],f=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],l,u,f,m,p,n,r,o);for(const g of c)this.applyToSlot(a[g],l,u,f,m,p,n,r,o)}applyToSlot(e,t,s,i,n,r,o,h,l){if(!e.bone.active)return;const a=t?e.appliedPose:e.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const c=a.attachment,d=a.deform;if(d.length===0&&(h=!0),d.length=r,i===null)if(o===1)if(l&&!h)if(c.bones)for(let u=0;u<r;u++)d[u]+=s[u];else{const u=c.vertices;for(let f=0;f<r;f++)d[f]+=s[f]-u[f]}else B.arrayCopy(s,0,d,0,r);else if(h)if(c.bones)for(let u=0;u<r;u++)d[u]=s[u]*o;else{const u=c.vertices;for(let f=0;f<r;f++){const m=u[f];d[f]=m+(s[f]-m)*o}}else if(l)if(c.bones)for(let u=0;u<r;u++)d[u]+=s[u]*o;else{const u=c.vertices;for(let f=0;f<r;f++)d[f]+=(s[f]-u[f])*o}else for(let u=0;u<r;u++)d[u]+=(s[u]-d[u])*o;else if(o===1)if(l&&!h)if(c.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=f+(i[u]-f)*n}else{const u=c.vertices;for(let f=0;f<r;f++){const m=s[f];d[f]+=m+(i[f]-m)*n-u[f]}}else if(n===0)B.arrayCopy(s,0,d,0,r);else for(let u=0;u<r;u++){const f=s[u];d[u]=f+(i[u]-f)*n}else if(h)if(c.bones)for(let u=0;u<r;u++){const f=s[u];d[u]=(f+(i[u]-f)*n)*o}else{const u=c.vertices;for(let f=0;f<r;f++){const m=s[f],p=u[f];d[f]=p+(m+(i[f]-m)*n-p)*o}}else if(l)if(c.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(i[u]-f)*n)*o}else{const u=c.vertices;for(let f=0;f<r;f++){const m=s[f];d[f]+=(m+(i[f]-m)*n-u[f])*o}}else for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(i[u]-f)*n-d[u])*o}}applyBeforeFirst(e,t,s){if(!e.bone.active)return;const i=t?e.appliedPose:e.pose;i.attachment==null||i.attachment.timelineAttachment!==this.attachment||(i.deform.length===0&&(s=!0),s&&(i.deform.length=0))}},Ys=class jt extends gt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,`28|${s}|${i.sequence.id}`),this.slotIndex=s,this.attachment=i,this.instant=!0}getFrameEntries(){return jt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,n,r){const o=this.frames;t*=jt.ENTRIES,o[t]=s,o[t+jt.MODE]=i|n<<4,o[t+jt.DELAY]=r}apply(t,s,i,n,r,o,h,l,a){const c=t.slots;if(!this.attachment.isTimelineActive(c,this.slotIndex,a))return;const d=this.attachment.timelineSlots,u=this.frames;if(l||i<u[0]){if(o){this.setupPose(c[this.slotIndex],a);for(const x of d)this.setupPose(c[x],a)}return}const f=gt.search(u,i,jt.ENTRIES),m=u[f],p=u[f+jt.MODE],g=u[f+jt.DELAY];this.applyToSlot(c[this.slotIndex],a,i,m,p,g);for(const x of d)this.applyToSlot(c[x],a,i,m,p,g)}setupPose(t,s){if(!t.bone.active)return;const i=s?t.appliedPose:t.pose;i.attachment===null||i.attachment.timelineAttachment!==this.attachment||(i.sequenceIndex=-1)}applyToSlot(t,s,i,n,r,o){if(!t.bone.active)return;const h=s?t.appliedPose:t.pose;if(h.attachment===null||h.attachment.timelineAttachment!==this.attachment)return;let l=r>>4,a=h.attachment.sequence.regions.length;const c=gs[r&15];if(c!==0)switch(l+=(i-n)/o+1e-5|0,c){case 1:l=Math.min(a-1,l);break;case 2:l%=a;break;case 3:{const d=(a<<1)-2;l=d===0?0:l%d,l>=a&&(l=d-l);break}case 4:l=Math.max(a-1-l,0);break;case 5:l=a-1-l%a;break;case 6:{const d=(a<<1)-2;l=d===0?0:(l+a-1)%d,l>=a&&(l=d-l)}}h.sequenceIndex=l}},Fe=class An extends gt{static propertyIds=["13"];events;constructor(t){super(t,...An.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,n,r,o,h,l,a){if(!n)return;const c=this.frames,d=this.frames.length;if(s>i)this.apply(null,s,Number.MAX_VALUE,n,0,!1,!1,!1,!1),s=-1;else if(s>=c[d-1])return;if(i<c[0])return;let u=0;if(s<c[0])u=0;else{u=gt.search(c,s)+1;const f=c[u];for(;u>0&&c[u-1]===f;)u--}for(;u<d&&i>=c[u];u++)n.push(this.events[u])}},Zt=class Mi extends gt{static propertyID="14";static propertyIds=[Mi.propertyID];drawOrders;constructor(t){super(t,...Mi.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,n,r,o,h,l,a){const c=a?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||i<this.frames[0]){o&&B.arrayCopy(d,0,c,0,t.slots.length);return}const u=this.drawOrders[gt.search(this.frames,i)];if(!u)B.arrayCopy(d,0,c,0,t.slots.length);else for(let f=0,m=u.length;f<m;f++)c[f]=d[u[f]]}},we=class Sn extends gt{slots;inFolder;drawOrders;constructor(t,s,i){super(t,...Sn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(t),this.inFolder=new Array(i);for(const n of s)this.inFolder[n]=!0;this.instant=!0}static propertyIds(t){const s=t.length,i=new Array(s);for(let n=0;n<s;n++)i[n]=`d${t[n]}`;return i}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,n,r,o,h,l,a){const c=a?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||i<this.frames[0])o&&this.setup(c,d);else{const u=this.drawOrders[gt.search(this.frames,i)];if(!u)this.setup(c,d);else{const f=this.inFolder,m=this.slots;for(let p=0,g=0,x=m.length;!(f[c[p].data.index]&&(c[p]=d[m[u[g]]],++g===x));p++);}}}setup(t,s){const{inFolder:i,slots:n}=this;for(let r=0,o=0,h=n.length;!(i[t[r].data.index]&&(t[r]=s[n[o]],++o===h));r++);}};function Ni(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var Ls=class extends Wt{constraintIndex=0;constructor(e,t,s){super(e,t,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,n,r,o){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=n,this.frames[e+4]=r?1:0,this.frames[e+5]=o?1:0}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.data.setupPose;c.mix=x.mix,c.softness=x.softness,c.bendDirection=x.bendDirection,c.compress=x.compress,c.stretch=x.stretch}return}let u=0,f=0;const m=gt.search(d,s,6),p=this.curves[m/6];switch(p){case 0:{const x=d[m];u=d[m+1],f=d[m+2];const b=(s-x)/(d[m+6]-x);u+=(d[m+6+1]-u)*b,f+=(d[m+6+2]-f)*b;break}case 1:u=d[m+1],f=d[m+2];break;default:u=this.getBezierValue(s,m,1,p-2),f=this.getBezierValue(s,m,2,p+18-2)}const g=r?a.data.setupPose:c;c.mix=g.mix+(u-g.mix)*n,c.softness=g.softness+(f-g.softness)*n,h?r&&(c.bendDirection=g.bendDirection,c.compress=g.compress,c.stretch=g.stretch):(c.bendDirection=d[m+3],c.compress=d[m+4]!==0,c.stretch=d[m+5]!==0)}},Xs=class extends Wt{constraintIndex=0;constructor(e,t,s){super(e,t,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(e,t,s,i,n,r,o,h){const l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=i,l[e+3]=n,l[e+4]=r,l[e+5]=o,l[e+6]=h}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.data.setupPose;c.mixRotate=y.mixRotate,c.mixX=y.mixX,c.mixY=y.mixY,c.mixScaleX=y.mixScaleX,c.mixScaleY=y.mixScaleY,c.mixShearY=y.mixShearY}return}let u,f,m,p,g,x;const b=gt.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];u=d[b+1],f=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const T=(s-y)/(d[b+7]-y);u+=(d[b+7+1]-u)*T,f+=(d[b+7+2]-f)*T,m+=(d[b+7+3]-m)*T,p+=(d[b+7+4]-p)*T,g+=(d[b+7+5]-g)*T,x+=(d[b+7+6]-x)*T;break}case 1:u=d[b+1],f=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:u=this.getBezierValue(s,b,1,w-2),f=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+18*2-2),p=this.getBezierValue(s,b,4,w+18*3-2),g=this.getBezierValue(s,b,5,w+18*4-2),x=this.getBezierValue(s,b,6,w+18*5-2)}const v=r?a.data.setupPose:c;o?(c.mixRotate=v.mixRotate+u*n,c.mixX=v.mixX+f*n,c.mixY=v.mixY+m*n,c.mixScaleX=v.mixScaleX+p*n,c.mixScaleY=v.mixScaleY+g*n,c.mixShearY=v.mixShearY+x*n):(c.mixRotate=v.mixRotate+(u-v.mixRotate)*n,c.mixX=v.mixX+(f-v.mixX)*n,c.mixY=v.mixY+(m-v.mixY)*n,c.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*n,c.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*n,c.mixShearY=v.mixShearY+(x-v.mixShearY)*n)}},re=class extends pe{constraintIndex;constructor(e,t,s,i){super(e,t,`${i}|${s}`),this.constraintIndex=s}},ks=class extends re{constructor(e,t,s){super(e,t,s,17),this.additive=!0}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.position=this.getAbsoluteValue(s,n,r,o,c.position,a.data.setupPose.position)}}},Vs=class extends re{constructor(e,t,s){super(e,t,s,18)}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.spacing=this.getAbsoluteValue(s,n,r,!1,c.spacing,a.data.setupPose.spacing)}}},Bs=class extends Wt{constraintIndex;constructor(e,t,s){super(e,t,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,n){const r=this.frames;e<<=2,r[e]=t,r[e+1]=s,r[e+2]=i,r[e+3]=n}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(!a.active)return;const c=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;c.mixRotate=b.mixRotate,c.mixX=b.mixX,c.mixY=b.mixY}return}let u,f,m;const p=gt.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];u=d[p+1],f=d[p+2],m=d[p+3];const w=(s-b)/(d[p+4]-b);u+=(d[p+4+1]-u)*w,f+=(d[p+4+2]-f)*w,m+=(d[p+4+3]-m)*w;break}case 1:u=d[p+1],f=d[p+2],m=d[p+3];break;default:u=this.getBezierValue(s,p,1,g-2),f=this.getBezierValue(s,p,2,g+18-2),m=this.getBezierValue(s,p,3,g+18*2-2)}const x=r?a.data.setupPose:c;o?(c.mixRotate=x.mixRotate+u*n,c.mixX=x.mixX+f*n,c.mixY=x.mixY+m*n):(c.mixRotate=x.mixRotate+(u-x.mixRotate)*n,c.mixX=x.mixX+(f-x.mixX)*n,c.mixY=x.mixY+(m-x.mixY)*n)}},Dt=class extends re{constructor(e,t,s,i){super(e,t,s,i)}apply(e,t,s,i,n,r,o,h,l){if(o&&!this.additive&&(o=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,c=e.physics;for(const d of c)if(d.active&&this.global(d.data)){const u=l?d.appliedPose:d.pose;this.set(u,this.getAbsoluteValue(s,n,r,o,this.get(u),this.get(d.data.setupPose),a))}}else{const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;this.set(c,this.getAbsoluteValue(s,n,r,o,this.get(c),this.get(a.data.setupPose)))}}}},Os=class extends Dt{constructor(e,t,s){super(e,t,s,20)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Ds=class extends Dt{constructor(e,t,s){super(e,t,s,21)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ns=class extends Dt{constructor(e,t,s){super(e,t,s,22)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Us=class extends Dt{constructor(e,t,s){super(e,t,s,23)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},zs=class extends Dt{constructor(e,t,s){super(e,t,s,24),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},qs=class extends Dt{constructor(e,t,s){super(e,t,s,25),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Ws=class extends Dt{constructor(e,t,s){super(e,t,s,26)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},_s=class Cn extends gt{static propertyIds=["27"];constraintIndex;constructor(t,s){super(t,...Cn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,n,r,o,h,l,a){let c;if(this.constraintIndex!==-1&&(c=t.constraints[this.constraintIndex],!c.active))return;const d=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],r,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(i<d[0])&&(s<d[0]||i>=d[gt.search(d,s)+1]))if(c!=null)c.reset(t);else for(const u of t.physics)u.active&&u.reset(t)}},Gs=class extends re{constructor(e,t,s){super(e,t,s,29)}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.time=this.getAbsoluteValue(s,n,r,o,c.time,a.data.setupPose.time)}}},Hs=class extends re{constructor(e,t,s){super(e,t,s,30),this.additive=!0}apply(e,t,s,i,n,r,o,h,l){const a=e.constraints[this.constraintIndex];if(a.active){const c=l?a.appliedPose:a.pose;c.mix=this.getAbsoluteValue(s,n,r,o,c.mix,a.data.setupPose.mix)}}},jn=class Ei{static emptyAnimation=new Pe("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new zi(this);propertyIds=new ls;animationsChanged=!1;trackEntryPool=new me(()=>new Ui);constructor(t){this.data=t}update(t){t*=this.timeScale;const s=this.tracks;for(let i=0,n=s.length;i<n;i++){const r=s[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=t*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let h=r.next;if(h){const l=r.trackLast-h.delay;if(l>=0){for(h.delay=0,h.trackTime+=r.timeScale===0?0:(l/r.timeScale+t)*h.timeScale,r.trackTime+=o,this.setTrack(i,h,!0);h.mixingFrom;)h.mixTime+=t,h=h.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[i]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let l=r.mixingFrom;for(r.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(t,s){const i=t.mixingFrom;if(!i)return!0;const n=this.updateMixingFrom(i,s);if(i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(i.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),i.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(i)}return n}return i.trackTime+=s*i.timeScale,t.mixTime+=s,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,i=this.tracks;let n=!1;for(let h=0,l=i.length;h<l;h++){const a=i[h];if(!a||a.delay>0)continue;n=!0;let c=a.alpha;a.mixingFrom?c*=this.applyMixingFrom(a,t):a.trackTime>=a.trackEnd&&!a.next&&(c=0);let d=a.animationLast,u=a.getAnimationTime(),f=u,m=s;a.reverse&&(f=a.animation.duration-f,m=null);const p=a.animation.timelines,g=p.length;if(h===0&&c===1)for(let x=0;x<g;x++){B.webkit602BugfixHelper(c);const b=p[x];b instanceof ne?this.applyAttachmentTimeline(b,t,f,!0,!0):b.apply(t,d,f,m,c,!0,!1,!1,!1)}else{const x=a.timelineMode,b=c>=a.alphaAttachmentThreshold,w=a.additive,v=w||a.shortestRotation,y=!v&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const A=p[T],S=(x[T]&ye)!==0;!v&&A instanceof xe?this.applyRotateTimeline(A,t,f,c,S,a.timelinesRotation,T<<1,y):A instanceof ne?this.applyAttachmentTimeline(A,t,f,S,b):(B.webkit602BugfixHelper(c),A.apply(t,d,f,m,c,S,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,u),this.queueEvents(a,u),s.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+js,o=t.slots;for(let h=0,l=t.slots.length;h<l;h++){const a=o[h];if(a.attachmentState===r){const c=a.data.attachmentName;a.pose.setAttachment(c?t.getAttachment(a.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(t,s){const i=t.mixingFrom,n=i.mixingFrom!==null?this.applyMixingFrom(i,s):1,r=t.mix(),o=i.alpha*n,h=1-r*t.alpha,l=o*(1-r),a=h>0?l/h:o,c=i.animation.timelines,d=c.length,u=i.timelineMode,f=i.timelineHoldMix,m=r<i.mixAttachmentThreshold,p=r<i.mixDrawOrderThreshold,g=i.additive,x=g||i.shortestRotation,b=!x&&i.timelinesRotation.length!==d<<1;b&&(i.timelinesRotation.length=d<<1);const w=i.timelinesRotation;let v=i.animationLast,y=i.getAnimationTime(),T=y,A=null;i.reverse?T=i.animation.duration-T:r<i.eventThreshold&&(A=this.events),i.totalAlpha=0;for(let S=0;S<d;S++){const C=c[S],I=u[S];let P=0;if((I&ve)!==0){const k=f[S];P=k==null?a:a*(1-k.mix())}else{if(!p&&C instanceof Zt)continue;P=l}i.totalAlpha+=P;const F=(I&ye)!==0;if(!x&&C instanceof xe)this.applyRotateTimeline(C,s,T,P,F,w,S<<1,b);else if(C instanceof ne)this.applyAttachmentTimeline(C,s,T,F,m&&P>=i.alphaAttachmentThreshold);else{const k=!p||!(C instanceof Zt)||!F;C.apply(s,v,T,A,P,F,g,k,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,v,y),t.mixDuration>0&&this.queueEvents(i,y),this.events.length=0,i.nextAnimationLast=y,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(t,s,i,n,r){const o=s.slots[t.slotIndex];if(!o.bone.active||!r&&o.attachmentState===this.unkeyedState+Zs)return;let h=i<t.frames[0],l=null;if(h||(l=t.attachmentNames[gt.search(t.frames,i)],h=!r&&l==null),h){if(!n)return;l=o.data.attachmentName}o.pose.setAttachment(l==null?null:s.getAttachment(o.data.index,l)),r?o.attachmentState=this.unkeyedState+Zs:h||(o.attachmentState=this.unkeyedState+js)}applyRotateTimeline(t,s,i,n,r,o,h,l){if(l&&(o[h]=0),n===1){t.apply(s,0,i,null,1,r,!1,!1,!1);return}const a=s.bones[t.boneIndex];if(!a.active)return;const c=a.pose,d=a.data.setupPose,u=t.frames;if(i<u[0]){r&&(c.rotation=d.rotation);return}const f=r?d.rotation:c.rotation,m=d.rotation+t.getCurveValue(i);let p=0,g=m-f;if(g-=Math.ceil(g/360-.5)*360,g===0)p=o[h];else{let x=0,b=0;l?(x=0,b=g):(x=o[h],b=o[h+1]);const w=x-x%360;p=g+w;let v=g>=0,y=x>=0;Math.abs(b)<=90&&N.signum(b)!==N.signum(g)&&(Math.abs(x-w)>180?(p+=360*N.signum(x),y=v):w!==0?p-=360*N.signum(x):y=v),y!==v&&(p+=360*N.signum(x)),o[h]=p}o[h+1]=g,c.rotation=f+p*n}queueEvents(t,s){const i=t.animationStart,n=t.animationEnd,r=n-i,o=t.reverse;let h=t.trackLast%r;o&&(h=r-h);const l=this.events;let a=0,c=l.length;for(;a<c;a++){const u=l[a];if(u.time<h!==o)break;u.time>=i&&u.time<=n&&this.queue.event(t,u)}let d=!1;if(t.loop)if(r===0)d=!0;else{const u=Math.floor(t.trackTime/r);d=u>0&&u>Math.floor(t.trackLast/r)}else d=s>=n&&t.animationLast<n;for(d&&this.queue.complete(t);a<c;a++){const u=l[a];u.time>=i&&u.time<=n&&this.queue.event(t,u)}}eventsReverse(t,s,i){const n=t.animation.duration,r=n-s,o=n-i,h=t.animation.timelines;for(let l=0,a=t.animation.timelines.length;l<a;l++){const c=h[l];if(!(c instanceof Fe))continue;const d=c.events,u=c.frames,f=u.length;if(r>=o){for(let m=0;m<f;m++)if(!(u[m]<o)){if(u[m]>=r)break;this.events.push(d[m])}}else{for(let p=0;p<f&&!(u[p]>=r);p++)this.events.push(d[p]);let m=0;for(;m<f&&!(u[m]>=o);m++);for(;m<f;m++)this.events.push(d[m])}}}clearTracks(){const t=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=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;const s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){const n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(t,s,i){const n=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,n&&(n.next=null,i&&this.queue.interrupt(n),s.mixingFrom=n,n.mixingTo=s,s.mixTime=0,n.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){return typeof s=="string"?this.setAnimation1(t,s,i):this.setAnimation2(t,s,i)}setAnimation1(t,s,i=!1){const n=this.data.skeletonData.findAnimation(s);if(!n)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(t,n,i)}setAnimation2(t,s,i=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));const o=this.trackEntry(t,s,i,r);return this.setTrack(t,o,n),this.queue.drain(),o}addAnimation(t,s,i=!1,n=0){return typeof s=="string"?this.addAnimation1(t,s,i,n):this.addAnimation2(t,s,i,n)}addAnimation1(t,s,i=!1,n=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(t,r,i,n)}addAnimation2(t,s,i=!1,n=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const o=this.trackEntry(t,s,i,r);return r?(r.next=o,o.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-o.mixDuration,0))):(this.setTrack(t,o,!0),this.queue.drain(),n<0&&(n=0)),o.delay=n,o}setEmptyAnimation(t,s=0){const i=this.setAnimation(t,Ei.emptyAnimation,!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){const n=this.addAnimation(t,Ei.emptyAnimation,!1,i);return i<=0&&(n.delay=Math.max(n.delay+n.mixDuration-s,0)),n.mixDuration=s,n.trackEnd=s,n}setEmptyAnimations(t=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,n=this.tracks.length;i<n;i++){const r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(B.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,n){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=s,r.loop=i,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;const t=this.tracks;for(let s=0,i=t.length;s<i;s++){let n=t[s];if(n){for(;n.mixingFrom;)n=n.mixingFrom;do this.computeHold(n),n=n.mixingTo;while(n)}}this.propertyIds.clear()}computeHold(t){const s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;const r=t.timelineHoldMix;r.length=0;const o=this.propertyIds,h=t.additive,l=t.keepHold,a=t.mixingTo;t:for(let c=0;c<i;c++){const d=s[c],u=d.propertyIds,f=o.addAll(u)&&!(d instanceof we&&o.contains(Zt.propertyID));if(h&&d.additive){n[c]=f?ye:Ye;continue}for(let p=t.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(u)){n[c]=Ye;continue t}let m;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(u))m=f?ye:Ye;else{m=f?Wi:ve;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(u)){p.mixDuration>0&&(r[c]=p);break}}l&&(m=m&~ve|n[c]&ve),n[c]=m}}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ui=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=ue.linear;setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===ue.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=ue.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const e=this.animationEnd-this.animationStart;if(e!==0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},zi=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let e=0;e<this.objects.length;e+=2){const t=this.objects,s=t[e],i=t[e+1],n=this.animState.listeners.slice();switch(s){case 0:i.listener?.start&&i.listener.start(i);for(let r=0;r<n.length;r++){const o=n[r];o.start&&o.start(i)}break;case 1:i.listener?.interrupt&&i.listener.interrupt(i);for(let r=0;r<n.length;r++){const o=n[r];o.interrupt&&o.interrupt(i)}break;case 2:i.listener?.end&&i.listener.end(i);for(let r=0;r<n.length;r++){const o=n[r];o.end&&o.end(i)}case 3:i.listener?.dispose&&i.listener.dispose(i);for(let r=0;r<n.length;r++){const o=n[r];o.dispose&&o.dispose(i)}this.animState.trackEntryPool.free(i);break;case 4:i.listener?.complete&&i.listener.complete(i);for(let r=0;r<n.length;r++){const o=n[r];o.complete&&o.complete(i)}break;case 5:{const r=t[e+++2];i.listener?.event&&i.listener.event(i,r);for(let o=0;o<n.length;o++){const h=n[o];h.event&&h.event(i,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},qi=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(qi||{}),Zn=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Ye=0,ye=1,ve=2,Wi=3,js=1,Zs=2,$n=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){return typeof e=="string"?this.setMix1(e,t,s):this.setMix2(e,t,s)}setMix1(e,t,s){const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);this.setMix2(i,n,s)}setMix2(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");const i=`${e.name}.${t.name}`;this.animationToMixTime[i]=s}getMix(e,t){const s=`${e.name}.${t.name}`,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},_i=class{constructor(e,t="",s=new $s,i=new Gi){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{const i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,n)=>{this.downloader.downloadBinary(e,r=>{this.success(t,e,r),i(r)},(r,o)=>{const h=`Couldn't load binary ${e}: status ${r}, ${o}`;this.error(s,e,h),n(h)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,n)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${n}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,n)=>{this.downloader.downloadJson(e,r=>{this.success(t,e,r),i(r)},(r,o)=>{const h=`Couldn't load JSON ${e}: status ${r}, ${o}`;this.error(s,e,h),n(h)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.getAsset(e),n=i!==void 0;return n&&(this.cache.assetsLoaded[e]=i.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(t,e,r),r)).catch(r=>{this.error(s,e,r)})),n}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),this.reuseAssets(e,t,s))return;const i=this.texturePmaInfo[e];this.cache.assetsLoaded[e]=new Promise((n,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(l=>{if(l.ok)return l.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(l=>l?createImageBitmap(l,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(l=>{if(l){const a=this.createTexture(e,i,l);this.success(t,e,a),n(a)}});else{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{const a=this.createTexture(e,i,l);this.success(t,e,a),n(a)},l.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),l.src=e}})}loadTextureAtlas(e,t=()=>{},s=()=>{},i){const n=e.lastIndexOf("/"),r=n>=0?e.substring(0,n+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((o,h)=>{this.downloader.downloadText(e,l=>{try{const a=this.createTextureAtlas(l,r,e,i);let c=a.pages.length,d=!1;if(c===0){this.success(t,e,a),o(a);return}for(const u of a.pages)this.loadTexture(this.texturePath(r,u.name,i),(f,m)=>{d||(u.setTexture(m),--c===0&&(this.success(t,e,a),o(a)))},(f,m)=>{if(!d){const p=`Couldn't load texture ${e} page image: ${f}`;this.error(s,e,p),h(p)}d=!0})}catch(a){const c=`Couldn't parse texture atlas ${e}: ${a.message}`;this.error(s,e,c),h(c)}},(l,a)=>{const c=`Couldn't load texture atlas ${e}: status ${l}, ${a}`;this.error(s,e,c),h(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{}){const i=e.lastIndexOf("/"),n=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,o)=>{this.downloader.downloadText(e,h=>{try{const l=this.createTextureAtlas(h,n,e);this.success(t,e,l),r(l)}catch(l){const a=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,a),o(a)}},(h,l)=>{const a=`Couldn't load texture atlas ${e}: status ${h}, ${l}`;this.error(s,e,a),o(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,n)=>t(n),(i,n)=>s(n))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,n)=>t(n),(i,n)=>s(n))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;const t=this.cache.assets[e];if(t)return t;const s=this.errors[e];throw Error(`Asset not found: ${e}${s?`
2
+ ${s}`:""}`)}remove(e){e=this.pathPrefix+e;const t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(const e in this.cache.assets){const t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof ds){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t,s,i){const n=new ds(e);n.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of n.pages)r.texture?.dispose()}};for(const r of n.pages){const o=this.texturePath(t,r.name,i);this.texturePmaInfo[this.pathPrefix+o]=r.pma}return n}createTexture(e,t,s){const i=this.textureLoader(s,t),n=i.dispose.bind(i);return i.dispose=()=>{this.disposeAssetInternal(e)&&n()},i}texturePath(e,t,s){return s?s[t]:e+t}},Gi=class rs{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=rs.AVAILABLE_CACHES.get(t);if(s)return s;const i=new rs;return rs.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){return this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=s,s}getAsset(t){return this.assetsLoaded[t]}},$s=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!==-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){var t=window.atob(e),s=t.length,i=new Uint8Array(s);for(let n=0;n<s;n++)i[n]=t.charCodeAt(n);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t===-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}const n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",i||e,!0);const r=()=>{this.finish(e,n.status,n.responseText)};n.onload=r,n.onerror=r,n.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(o){this.finish(e,400,JSON.stringify(o))}return}const n=new XMLHttpRequest;n.open("GET",i||e,!0),n.responseType="arraybuffer";const r=()=>{this.finish(e,n.status,n.response)};n.onload=()=>{n.status===200||n.status===0?this.finish(e,200,new Uint8Array(n.response)):r()},n.onerror=r,n.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){const i=this.callbacks[e];if(delete this.callbacks[e],t===200||t===0)for(let n=0,r=i.length;n<r;n+=2)i[n](s);else for(let n=1,r=i.length;n<r;n+=2)i[n](t,s)}},Ks=class In extends zt{color=new W(1,1,1,1);constructor(t){super(t)}copy(){const t=new In(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},$t=class Mn extends zt{endSlot=null;convex=!1;inverse=!1;color=new W(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){const t=new Mn(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}},Te=class En extends zt{lengths=[];closed=!1;constantSpeed=!1;color=new W(1,1,1,1);constructor(t){super(t)}copy(){const t=new En(this.name);return this.copyTo(t),t.lengths=[],B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Hi=class Pn extends zt{x=0;y=0;rotation=0;color=new W(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*N.degRad,i=Math.cos(s),n=Math.sin(s),r=i*t.a+n*t.b,o=i*t.c+n*t.d;return N.atan2Deg(o,r)}copy(){const t=new Pn(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Kn=class{atlas;allowMissingRegions;constructor(e,t=!1){this.atlas=e,this.allowMissingRegions=t}findRegions(e,t,s){const i=s.regions;for(let n=0,r=i.length;n<r;n++)i[n]=this.findRegion(e,s.getPath(t,n))}findRegion(e,t){const s=this.atlas.findRegion(t);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${t} (attachment: ${e})`);return s}newRegionAttachment(e,t,s,i,n){return this.findRegions(s,i,n),new qt(s,n)}newMeshAttachment(e,t,s,i,n){return this.findRegions(s,i,n),new Ot(s,n)}newBoundingBoxAttachment(e,t,s){return new Ks(s)}newPathAttachment(e,t,s){return new Te(s)}newPointAttachment(e,t,s){return new Hi(s)}newClippingAttachment(e,t,s){return new $t(s)}},Le=class{name;setupPose;skinRequired=!1;constructor(e,t){if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}},Js=class Rn extends Le{index=0;parent=null;length=0;color=new W;icon;iconSize=1;iconRotation=0;visible=!1;constructor(t,s,i){if(super(s,new ke),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=t,this.parent=i}copy(t){const s=new Rn(this.index,this.name,t);return s.length=this.length,s.setupPose.set(this.setupPose),s}},Xe=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(Xe||{}),ke=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(e){if(e==null)throw new Error("pose cannot be null.");this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,s=this.scaleX,i=this.scaleY,n=this.shearX,r=this.shearY;if(!this.bone.parent){const d=e.scaleX,u=e.scaleY,f=(t+n)*N.degRad,m=(t+90+r)*N.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(m)*i*d,this.c=Math.sin(f)*s*u,this.d=Math.sin(m)*i*u,this.worldX=this.x*d+e.x,this.worldY=this.y*u+e.y;return}const o=this.bone.parent.appliedPose;let h=o.a,l=o.b,a=o.c,c=o.d;switch(this.worldX=h*this.x+l*this.y+o.worldX,this.worldY=a*this.x+c*this.y+o.worldY,this.inherit){case 0:{const d=(t+n)*N.degRad,u=(t+90+r)*N.degRad,f=Math.cos(d)*s,m=Math.cos(u)*i,p=Math.sin(d)*s,g=Math.sin(u)*i;this.a=h*f+l*p,this.b=h*m+l*g,this.c=a*f+c*p,this.d=a*m+c*g;return}case 1:{const d=(t+n)*N.degRad,u=(t+90+r)*N.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(u)*i,this.c=Math.sin(d)*s,this.d=Math.sin(u)*i;break}case 2:{const d=1/e.scaleX,u=1/e.scaleY;h*=d,a*=u;let f=h*h+a*a,m=0;f>1e-4?(f=Math.abs(h*c*u-l*d*a)/f,l=a*f,c=h*f,m=N.atan2Deg(a,h)):(h=0,a=0,m=90-N.atan2Deg(c,l));const p=(t+n-m)*N.degRad,g=(t+r-m+90)*N.degRad,x=Math.cos(p)*s,b=Math.cos(g)*i,w=Math.sin(p)*s,v=Math.sin(g)*i;this.a=h*x-l*w,this.b=h*b-l*v,this.c=a*x+c*w,this.d=a*b+c*v;break}case 3:case 4:{let d=t*N.degRad,u=Math.cos(d),f=Math.sin(d),m=(h*u+l*f)/e.scaleX,p=(a*u+c*f)/e.scaleY,g=Math.sqrt(m*m+p*p);g>1e-5&&(g=1/g),m*=g,p*=g,g=Math.sqrt(m*m+p*p),this.inherit===3&&h*c-l*a<0!=(e.scaleX<0!=e.scaleY<0)&&(g=-g),d=Math.PI/2+Math.atan2(p,m);const x=Math.cos(d)*g,b=Math.sin(d)*g,w=n*N.degRad,v=(90+r)*N.degRad,y=Math.cos(w)*s,T=Math.cos(v)*i,A=Math.sin(w)*s,S=Math.sin(v)*i;this.a=m*y+x*A,this.b=m*T+x*S,this.c=p*y+b*A,this.d=p*T+b*S;break}}this.a*=e.scaleX,this.b*=e.scaleX,this.c*=e.scaleY,this.d*=e.scaleY}updateLocalTransform(e){if(this.local=0,this.world=e._update,!this.bone.parent){this.x=this.worldX-e.x,this.y=this.worldY-e.y;const x=this.a,b=this.b,w=this.c,v=this.d;this.rotation=N.atan2Deg(w,x),this.scaleX=Math.sqrt(x*x+w*w),this.scaleY=Math.sqrt(b*b+v*v),this.shearX=0,this.shearY=N.atan2Deg(x*b+w*v,x*v-b*w);return}const t=this.bone.parent.appliedPose;let s=t.a,i=t.b,n=t.c,r=t.d,o=1/(s*r-i*n),h=r*o,l=i*o,a=n*o,c=s*o;const d=this.worldX-t.worldX,u=this.worldY-t.worldY;this.x=d*h-u*l,this.y=u*c-d*a;let f,m,p,g;if(this.inherit===1)f=this.a,m=this.b,p=this.c,g=this.d;else{switch(this.inherit){case 2:{const x=Math.abs(s*r-i*n)/(s*s+n*n);i=-n*e.scaleX*x/e.scaleY,r=s*e.scaleY*x/e.scaleX,o=1/(s*r-i*n),h=r*o,l=i*o;break}case 3:case 4:{let x=this.rotation*N.degRad,b=Math.cos(x),w=Math.sin(x);s=(s*b+i*w)/e.scaleX,n=(n*b+r*w)/e.scaleY;let v=Math.sqrt(s*s+n*n);v>1e-5&&(v=1/v),s*=v,n*=v,v=Math.sqrt(s*s+n*n),this.inherit===3&&o<0!=(e.scaleX<0!=e.scaleY<0)&&(v=-v),x=N.PI/2+Math.atan2(n,s),i=Math.cos(x)*v,r=Math.sin(x)*v,o=1/(s*r-i*n),h=r*o,l=i*o,a=n*o,c=s*o}}f=h*this.a-l*this.c,m=h*this.b-l*this.d,p=c*this.c-a*this.a,g=c*this.d-a*this.b}if(this.shearX=0,this.scaleX=Math.sqrt(f*f+p*p),this.scaleX>1e-4){const x=f*g-m*p;this.scaleY=x/this.scaleX,this.shearY=-N.atan2Deg(f*m+p*g,x),this.rotation=N.atan2Deg(p,f)}else this.scaleX=0,this.scaleY=Math.sqrt(m*m+g*g),this.shearY=0,this.rotation=90-N.atan2Deg(g,m)}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e._update)}modifyWorld(e){this.local=e,this.world=e,this.resetWorld(e)}resetWorld(e){const t=this.bone.children;for(let s=0,i=t.length;s<i;s++){const n=t[s].appliedPose;n.world===e&&(n.world=0,n.local=0,n.resetWorld(e))}}getWorldRotationX(){return N.atan2Deg(this.c,this.a)}getWorldRotationY(){return N.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,s=e.x-this.worldX,i=e.y-this.worldY;return e.x=(s*this.d-i*this.b)/t,e.y=(i*this.a-s*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=N.degRad;const t=Math.sin(e),s=Math.cos(e);return N.atan2Deg(this.a*t-this.c*s,this.d*s-this.b*t)+this.rotation-this.shearX}localToWorldRotation(e){e=(e-this.rotation-this.shearX)*N.degRad;const t=Math.sin(e),s=Math.cos(e);return N.atan2Deg(s*this.c+t*this.d,s*this.a+t*this.b)}rotateWorld(e){e*=N.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,n=this.b;this.a=s*i-t*this.c,this.b=s*n-t*this.d,this.c=t*i+s*this.c,this.d=t*n+s*this.d}},Qs=class{data;pose;constrainedPose;appliedPose;constructor(e,t,s){if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=s,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},ti=class extends Qs{active=!1;constructor(e,t,s){super(e,t,s),this.setupPose()}isActive(){return this.active}},Ve=class Fn extends ti{parent=null;children=[];sorted=!1;constructor(t,s){super(t,new ke,new ke),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const s=new Fn(this.data,t);return s.pose.set(this.pose),s}},ae=class extends ti{constructor(e,t,s){super(e,t,s)}isSourceActive(){return!0}},ji=class{_setupPose;pose;constrainedPose;appliedPose;constructor(e){this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,B.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,B.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},oe=class extends Le{constructor(e,t){super(e,t)}},Be=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},ei=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}setupPose=new Be(-1,this);constructor(e){this.name=e}},Oe=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}},Ae=class extends oe{bones=[];_target=null;set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(e){super(e,new Oe)}create(e){return new Zi(this,e)}},si=(e=>(e[e.None=0]="None",e[e.Uniform=1]="Uniform",e[e.Volume=2]="Volume",e))(si||{}),Zi=class ee extends ae{bones;target;constructor(t,s){if(super(t,new Oe,new Oe),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of t.bones)this.bones.push(s.bones[i.index].constrainedPose);this.target=s.bones[t.target.index]}copy(t){var s=new ee(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mix===0)return;const n=this.target.appliedPose,r=this.bones;switch(r.length){case 1:ee.apply(t,r[0],n.worldX,n.worldY,i.compress,i.stretch,this.data.scaleYMode,i.mix);break;case 2:ee.apply(t,r[0],r[1],n.worldX,n.worldY,i.bendDirection,i.stretch,this.data.scaleYMode,i.softness,i.mix);break}}sort(t){t.sortBone(this.target);const s=this.bones[0].bone;t.sortBone(s),t._updateCache.push(this),s.sorted=!1,t.sortReset(s.children),t.constrained(s),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,s,i,n,r,o,h,l,a,c){typeof i=="number"?ee.apply1(t,s,i,n,r,o,h,l):ee.apply2(t,s,i,n,r,o,h,l,a,c)}static apply1(t,s,i,n,r,o,h,l){s.modifyLocal(t);const a=s.bone.parent.appliedPose;let c=a.a,d=a.b,u=a.c,f=a.d,m=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(i-s.worldX)*N.signum(t.scaleX),g=(n-s.worldY)*N.signum(t.scaleY);break;case 2:{const x=Math.abs(c*f-d*u)/Math.max(1e-4,c*c+u*u),b=c/t.scaleX,w=u/t.scaleY;d=-w*x*t.scaleX,f=b*x*t.scaleY,m+=N.atan2Deg(w,b)}default:{const x=i-a.worldX,b=n-a.worldY,w=c*f-d*u;Math.abs(w)<=1e-4?(p=0,g=0):(p=(x*f-b*d)/w-s.x,g=(b*c-x*u)/w-s.y)}}if(m+=N.atan2Deg(g,p),s.scaleX<0&&(m+=180),m>180?m-=360:m<-180&&(m+=360),s.rotation+=m*l,r||o){switch(s.inherit){case 3:case 4:p=i-s.worldX,g=n-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>1e-4){const b=p*p+g*g;if(r&&b<x*x||o&&b>x*x){const w=(Math.sqrt(b)/x-1)*l+1;switch(s.scaleX*=w,h){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w}}}}}static apply2(t,s,i,n,r,o,h,l,a,c){if(s.inherit!==0||i.inherit!==0)return;s.modifyLocal(t),i.modifyLocal(t);let d=s.x,u=s.y,f=s.scaleX,m=s.scaleY,p=i.scaleX,g=0,x=0,b=0;f<0?(f=-f,g=180,b=-1):(g=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,x=180):x=0;let w=0,v=0,y=s.a,T=s.b,A=s.c,S=s.d;const C=Math.abs(f-m)<=1e-4;!C||h?(i.y=0,w=y*i.x+s.worldX,v=A*i.x+s.worldY):(w=y*i.x+T*i.y+s.worldX,v=A*i.x+S*i.y+s.worldY);const I=s.bone.parent.appliedPose;y=I.a,T=I.b,A=I.c,S=I.d;let P=y*S-T*A,F=w-I.worldX,k=v-I.worldY;P=Math.abs(P)<=1e-4?0:1/P;const X=(F*S-k*T)*P-d,R=(k*y-F*A)*P-u;let V=Math.sqrt(X*X+R*R),ot=i.bone.data.length*p,D,L;if(V<1e-4){ee.apply(t,s,n,r,!1,h,0,c),i.rotation=0;return}F=n-I.worldX,k=r-I.worldY;let Y=(F*S-k*T)*P-d,z=(k*y-F*A)*P-u,U=Y*Y+z*z;if(a!==0){a*=f*(p+1)*.5;const O=Math.sqrt(U),lt=O-V-ot*f+a;if(lt>0){let q=Math.min(1,lt/(a*2))-1;q=(lt-a*(1-q*q))/O,Y-=q*Y,z-=q*z,U=Y*Y+z*z}}t:if(C){ot*=f;let O=(U-V*V-ot*ot)/(2*V*ot);if(O<-1)O=-1,L=Math.PI*o;else if(O>1){if(O=1,L=0,h)switch(y=(Math.sqrt(U)/(V+ot)-1)*c+1,s.scaleX*=y,l){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y}}else L=Math.acos(O)*o;y=V+ot*O,T=ot*Math.sin(L),D=Math.atan2(z*y-Y*T,Y*y+z*T)}else{y=f*ot,T=m*ot;const O=y*y,lt=T*T,q=Math.atan2(z,Y);A=lt*V*V+O*U-O*lt;const ut=-2*lt*V,bt=lt-O;if(S=ut*ut-4*bt*A,S>=0){let Bt=Math.sqrt(S);ut<0&&(Bt=-Bt),Bt=-(ut+Bt)*.5;let Nt=Bt/bt,Me=A/Bt;const is=Math.abs(Nt)<Math.abs(Me)?Nt:Me;if(Nt=U-is*is,Nt>=0){k=Math.sqrt(Nt)*o,D=q-Math.atan2(k,is),L=Math.atan2(k/m,(is-V)/f);break t}}let mt=N.PI,wt=V-y,Tt=wt*wt,yt=0,Ft=0,At=V+y,St=At*At,Yt=0;A=-y*V/(O-lt),A>=-1&&A<=1&&(A=Math.acos(A),F=y*Math.cos(A)+V,k=T*Math.sin(A),S=F*F+k*k,S<Tt&&(mt=A,Tt=S,wt=F,yt=k),S>St&&(Ft=A,St=S,At=F,Yt=k)),U<=(Tt+St)*.5?(D=q-Math.atan2(yt*o,wt),L=mt*o):(D=q-Math.atan2(Yt*o,At),L=Ft*o)}const ct=Math.atan2(i.y,i.x)*b;D=(D-ct)*N.radDeg+g-s.rotation,D>180?D-=360:D<-180&&(D+=360),s.rotation+=D*c,L=((L+ct)*N.radDeg-i.shearX)*b+x-i.rotation,L>180?L-=360:L<-180&&(L+=360),i.rotation+=L*c}},De=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}},Se=class extends oe{bones=[];set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(e){super(e,new De)}create(e){return new $i(this,e)}},ii=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(ii||{}),ni=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ni||{}),ri=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(ri||{}),$i=class Ut extends ae{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,s){if(super(t,new De,new De),!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const i of this.data.bones)this.bones.push(s.bones[i.index].constrainedPose);this.slot=s.slots[t.slot.index]}copy(t){var s=new Ut(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.slot.appliedPose.attachment;if(!(i instanceof Te))return;const n=this.appliedPose,r=n.mixRotate,o=n.mixX,h=n.mixY;if(r===0&&o===0&&h===0)return;const l=this.data,a=l.rotateMode===0,c=l.rotateMode===2,d=this.bones,u=d.length,f=a?u:u+1,m=B.setArraySize(this.spaces,f),p=c?this.lengths=B.setArraySize(this.lengths,u):[],g=n.spacing;switch(l.spacingMode){case 2:if(c)for(let T=0,A=f-1;T<A;T++){const S=d[T],C=S.bone.data.length,I=C*S.a,P=C*S.c;p[T]=Math.sqrt(I*I+P*P)}B.arrayFill(m,1,f,g);break;case 3:{let T=0;for(let A=0,S=f-1;A<S;){const C=d[A],I=C.bone.data.length;if(I<Ut.epsilon)c&&(p[A]=0),m[++A]=g;else{const P=I*C.a,F=I*C.c,k=Math.sqrt(P*P+F*F);c&&(p[A]=k),m[++A]=k,T+=k}}if(T>0){T=f/T*g;for(let A=1;A<f;A++)m[A]*=T}break}default:{const T=l.spacingMode===0;for(let A=0,S=f-1;A<S;){const C=d[A],I=C.bone.data.length;if(I<Ut.epsilon)c&&(p[A]=0),m[++A]=g;else{const P=I*C.a,F=I*C.c,k=Math.sqrt(P*P+F*F);c&&(p[A]=k),m[++A]=(T?Math.max(0,I+g):g)*k/I}}}}const x=this.computeWorldPositions(t,i,f,a);let b=x[0],w=x[1],v=l.offsetRotation,y=!1;if(v===0)y=l.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?N.degRad:-N.degRad}for(let T=0,A=3,S=t._update;T<u;T++,A+=3){const C=d[T];C.worldX+=(b-C.worldX)*o,C.worldY+=(w-C.worldY)*h;const I=x[A],P=x[A+1],F=I-b,k=P-w;if(c){const X=p[T];if(X!==0){const R=(Math.sqrt(F*F+k*k)/X-1)*r+1;C.a*=R,C.c*=R}}if(b=I,w=P,r>0){let X=C.a,R=C.b,V=C.c,ot=C.d,D=0,L=0,Y=0;if(a?D=x[A-1]:m[T+1]===0?D=x[A+2]:D=Math.atan2(k,F),D-=Math.atan2(V,X),y){L=Math.cos(D),Y=Math.sin(D);const z=C.bone.data.length;b+=(z*(L*X-Y*V)-F)*r,w+=(z*(Y*X+L*V)-k)*r}else D+=v;D>N.PI?D-=N.PI2:D<-N.PI&&(D+=N.PI2),D*=r,L=Math.cos(D),Y=Math.sin(D),C.a=L*X-Y*V,C.b=L*R-Y*ot,C.c=Y*X+L*V,C.d=Y*R+L*ot}C.modifyWorld(S)}}computeWorldPositions(t,s,i,n){const r=this.slot;let o=this.appliedPose.position,h=this.spaces,l=B.setArraySize(this.positions,i*3+2),a=this.world;const c=s.closed;let d=s.worldVerticesLength,u=d/6,f=Ut.NONE;if(!s.constantSpeed){const L=s.lengths;u-=c?1:2;const Y=L[u];this.data.positionMode===1&&(o*=Y);let z;switch(this.data.spacingMode){case 2:z=Y;break;case 3:z=Y/i;break;default:z=1}a=B.setArraySize(this.world,8);for(let U=0,ct=0,O=0;U<i;U++,ct+=3){const lt=h[U]*z;o+=lt;let q=o;if(c)q%=Y,q<0&&(q+=Y),O=0;else if(q<0){f!==Ut.BEFORE&&(f=Ut.BEFORE,s.computeWorldVertices(t,r,2,4,a,0,2)),this.addBeforePosition(q,a,0,l,ct);continue}else if(q>Y){f!==Ut.AFTER&&(f=Ut.AFTER,s.computeWorldVertices(t,r,d-6,4,a,0,2)),this.addAfterPosition(q-Y,a,0,l,ct);continue}for(;;O++){const ut=L[O];if(!(q>ut)){if(O===0)q/=ut;else{const bt=L[O-1];q=(q-bt)/(ut-bt)}break}}O!==f&&(f=O,c&&O===u?(s.computeWorldVertices(t,r,d-4,4,a,0,2),s.computeWorldVertices(t,r,0,4,a,4,2)):s.computeWorldVertices(t,r,O*6+2,8,a,0,2)),this.addCurvePosition(q,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],l,ct,n||U>0&&lt===0)}return l}c?(d+=2,a=B.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d-4,a,0,2),s.computeWorldVertices(t,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(u--,d-=4,a=B.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d,a,0,2));const m=B.setArraySize(this.curves,u);let p=0,g=a[0],x=a[1],b=0,w=0,v=0,y=0,T=0,A=0,S=0,C=0,I=0,P=0,F=0,k=0,X=0,R=0;for(let L=0,Y=2;L<u;L++,Y+=6)b=a[Y],w=a[Y+1],v=a[Y+2],y=a[Y+3],T=a[Y+4],A=a[Y+5],S=(g-b*2+v)*.1875,C=(x-w*2+y)*.1875,I=((b-v)*3-g+T)*.09375,P=((w-y)*3-x+A)*.09375,F=S*2+I,k=C*2+P,X=(b-g)*.75+S+I*.16666667,R=(w-x)*.75+C+P*.16666667,p+=Math.sqrt(X*X+R*R),X+=F,R+=k,F+=I,k+=P,p+=Math.sqrt(X*X+R*R),X+=F,R+=k,p+=Math.sqrt(X*X+R*R),X+=F+I,R+=k+P,p+=Math.sqrt(X*X+R*R),m[L]=p,g=T,x=A;this.data.positionMode===1&&(o*=p);let V;switch(this.data.spacingMode){case 2:V=p;break;case 3:V=p/i;break;default:V=1}const ot=this.segments;let D=0;for(let L=0,Y=0,z=0,U=0;L<i;L++,Y+=3){const ct=h[L]*V;o+=ct;let O=o;if(c)O%=p,O<0&&(O+=p),z=0,U=0;else if(O<0){this.addBeforePosition(O,a,0,l,Y);continue}else if(O>p){this.addAfterPosition(O-p,a,d-4,l,Y);continue}for(;;z++){const lt=m[z];if(!(O>lt)){if(z===0)O/=lt;else{const q=m[z-1];O=(O-q)/(lt-q)}break}}if(z!==f){f=z;let lt=z*6;for(g=a[lt],x=a[lt+1],b=a[lt+2],w=a[lt+3],v=a[lt+4],y=a[lt+5],T=a[lt+6],A=a[lt+7],S=(g-b*2+v)*.03,C=(x-w*2+y)*.03,I=((b-v)*3-g+T)*.006,P=((w-y)*3-x+A)*.006,F=S*2+I,k=C*2+P,X=(b-g)*.3+S+I*.16666667,R=(w-x)*.3+C+P*.16666667,D=Math.sqrt(X*X+R*R),ot[0]=D,lt=1;lt<8;lt++)X+=F,R+=k,F+=I,k+=P,D+=Math.sqrt(X*X+R*R),ot[lt]=D;X+=F,R+=k,D+=Math.sqrt(X*X+R*R),ot[8]=D,X+=F+I,R+=k+P,D+=Math.sqrt(X*X+R*R),ot[9]=D,U=0}for(O*=D;;U++){const lt=ot[U];if(!(O>lt)){if(U===0)O/=lt;else{const q=ot[U-1];O=U+(O-q)/(lt-q)}break}}this.addCurvePosition(O*.1,g,x,b,w,v,y,T,A,l,Y,n||L>0&&ct===0)}return l}addBeforePosition(t,s,i,n,r){const o=s[i],h=s[i+1],l=s[i+2]-o,a=s[i+3]-h,c=Math.atan2(a,l);n[r]=o+t*Math.cos(c),n[r+1]=h+t*Math.sin(c),n[r+2]=c}addAfterPosition(t,s,i,n,r){const o=s[i+2],h=s[i+3],l=o-s[i],a=h-s[i+1],c=Math.atan2(a,l);n[r]=o+t*Math.cos(c),n[r+1]=h+t*Math.sin(c),n[r+2]=c}addCurvePosition(t,s,i,n,r,o,h,l,a,c,d,u){if(t===0||Number.isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(r-i,n-s);return}const f=t*t,m=f*t,p=1-t,g=p*p,x=g*p,b=p*t,w=b*3,v=p*w,y=w*t,T=s*x+n*v+o*y+l*m,A=i*x+r*v+h*y+a*m;c[d]=T,c[d+1]=A,u&&(t<.001?c[d+2]=Math.atan2(r-i,n-s):c[d+2]=Math.atan2(A-(i*g+r*b*2+h*f),T-(s*g+n*b*2+o*f)))}sort(t){const s=this.slot.data.index,i=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,s,i),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,s,i),this.sortPath(t,this.slot.pose.attachment,i);const n=this.bones,r=this.bones.length;for(let o=0;o<r;o++){const h=n[o].bone;t.sortBone(h),t.constrained(h)}t._updateCache.push(this);for(let o=0;o<r;o++)t.sortReset(n[o].bone.children);for(let o=0;o<r;o++)n[o].bone.sorted=!0}sortPathSlot(t,s,i,n){const r=s.getAttachments();for(let o=0,h=r.length;o<h;o++){const l=r[o];l.slotIndex===i&&this.sortPath(t,l.attachment,n)}}sortPath(t,s,i){if(!(s instanceof Te))return;const n=s.bones;if(n==null)t.sortBone(i);else{const r=t.bones;for(let o=0,h=n.length;o<h;){let l=n[o++];for(l+=o;o<l;)t.sortBone(r[n[o++]])}}}isSourceActive(){return this.slot.bone.active}},Ki=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Ki||{}),Ne=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(e){this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}},Ue=class{color=new W(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof zt)||!(this.attachment instanceof zt)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}},Ji=class Yn extends Qs{skeleton;bone;attachmentState=0;constructor(t,s){if(super(t,new Ue,new Ue),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new W,this.constrainedPose.darkColor=new W),this.setupPose()}copy(t,s,i){const n=new Yn(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(n.pose.darkColor=new W,n.constrainedPose.darkColor=new W),n.pose.set(t.pose),n}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},Qi=class as{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return as.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*as.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n;if(!i.parent)n=new Ve(i,null);else{const r=this.bones[i.parent.index];n=new Ve(i,r),r.children.push(n)}this.bones.push(n)}this.slots=[];for(const s of this.data.slots)this.slots.push(new Ji(s,this));this.drawOrder=new ji(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const i=s.create(this);i instanceof ai&&this.physics.push(i),this.constraints.push(i)}this.color=new W(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const t=this.slots;for(let o=0,h=t.length;o<h;o++)t[o].unconstrained();const s=this.bones,i=s.length;for(let o=0,h=i;o<h;o++){const l=s[o];l.sorted=l.data.skinRequired,l.active=!l.sorted,l.unconstrained()}if(this.skin){const o=this.skin.bones;for(let h=0,l=this.skin.bones.length;h<l;h++){let a=this.bones[o[h].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const n=this.constraints;let r=this.constraints.length;for(let o=0;o<r;o++)n[o].unconstrained();for(let o=0;o<r;o++){const h=n[o];h.active=h.isSourceActive()&&(!h.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(h.data)),h.active&&h.sort(this)}for(let o=0;o<i;o++)this.sortBone(s[o]);r=this._updateCache.length;for(let o=0;o<r;o++){const h=this._updateCache[o];h instanceof Ve&&(this._updateCache[o]=h.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;const s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){const n=t[s];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let n=0,r=this.resetCache.length;n<r;n++)s[n].resetConstrained();const i=this._updateCache;for(let n=0,r=this._updateCache.length;n<r;n++)i[n].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const t=this.bones;for(let i=0,n=t.length;i<n;i++)t[i].setupPose();const s=this.constraints;for(let i=0,n=s.length;i<n;i++)s[i].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const t=this.slots;for(let s=0,i=t.length;s<i;s++)t[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");const s=this.bones;for(let i=0,n=s.length;i<n;i++)if(s[i].data.name===t)return s[i];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const s=this.slots;for(let i=0,n=s.length;i<n;i++)if(s[i].data.name===t)return s[i];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){const s=this.data.findSkin(t);if(!s)throw new Error(`Skin not found: ${t}`);this.setSkin(s)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{const s=this.slots;for(let i=0,n=s.length;i<n;i++){const r=s[i],o=r.data.attachmentName;if(o){const h=t.getAttachment(i,o);h&&r.pose.setAttachment(h)}}}this.skin=t,this.updateCache()}}getAttachment(t,s){return typeof t=="string"?this.getAttachmentByName(t,s):this.getAttachmentByIndex(t,s)}getAttachmentByName(t,s){const i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachmentByIndex(t,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");const i=this.findSlot(t);if(!i)throw new Error(`Slot not found: ${t}`);let n=null;if(s&&(n=this.getAttachment(i.data.index,s),!n))throw new Error(`Attachment not found: ${s}, for slot: ${t}`);i.pose.setAttachment(n)}findConstraint(t,s){if(t==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=i.length;n<r;n++){const o=i[n];if(o instanceof s&&o.data.name===t)return o}return null}getBoundsRect(t){const s=new ie,i=new ie;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),n=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,o=r;let h=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let d=0,u=r.length;d<u;d++){const f=o[d];if(!f.bone.active)continue;let m=0,p=null,g=null;const x=f.appliedPose.attachment;if(x){if(x instanceof qt)m=8,p=B.setArraySize(i,m,0),x.computeWorldVertices(f,x.getOffsets(f.appliedPose),p,0,2),g=as.quadTriangles;else if(x instanceof Ot)m=x.worldVerticesLength,p=B.setArraySize(i,m,0),x.computeWorldVertices(this,f,0,m,p,0,2),g=x.triangles;else if(x instanceof $t&&n){n.clipEnd(f),n.clipStart(this,f,x);continue}if(p&&g){n?.isClipping()&&n.clipTriangles(p,g,g.length)&&(p=n.clippedVertices,m=n.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const v=p[b],y=p[b+1];h=Math.min(h,v),l=Math.min(l,y),a=Math.max(a,v),c=Math.max(c,y)}}}n&&n.clipEnd(f)}n&&n.clipEnd(),t.set(h,l),s.set(a-h,c-l)}setScale(t,s){this.scaleX=t,this.scaleY=s}setPosition(t,s){this.x=t,this.y=s}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physics;for(let n=0,r=i.length;n<r;n++)i[n].translate(t,s)}physicsRotate(t,s,i){const n=this.physics;for(let r=0,o=n.length;r<o;r++)n[r].rotate(t,s,i)}},ai=class Ln extends ae{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(t,s){if(super(t,new Ne,new Ne),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[t.bone.index].constrainedPose}copy(t){var s=new Ln(this.data,t);return s.pose.set(this.pose),s}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,s){this.ux-=t,this.uy-=s,this.cx-=t,this.cy-=s}rotate(t,s,i){const n=i*N.degRad,r=Math.cos(n),o=Math.sin(n),h=this.cx-t,l=this.cy-s;this.translate(h*r-l*o-h,h*o+l*r-l)}update(t,s){const i=this.appliedPose,n=i.mix;if(n===0)return;const r=this.data.x>0,o=this.data.y>0,h=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,a=this.bone;let c=a.bone.data.length,d=this.data.step,u=0;switch(s){case 0:return;case 1:this.reset(t);case 2:{const f=Math.max(t.time-this.lastTime,0),m=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,b=i.inertia,w=t.data.referenceScale,v=-1,y=0,T=0,A=this.data.limit*f,S=A*Math.abs(t.scaleY);if(A*=Math.abs(t.scaleX),r||o){if(r){const C=(this.ux-p)*b;this.xOffset+=C>A?A:C<-A?-A:C,this.ux=p}if(o){const C=(this.uy-g)*b;this.yOffset+=C>S?S:C<-S?-S:C,this.uy=g}if(x>=d){const C=this.xOffset,I=this.yOffset;v=i.damping**(60*d),y=d*i.massInverse,T=i.strength;const P=w*i.wind,F=w*i.gravity,k=(P*t.windX+F*t.gravityX)*t.scaleX,X=(P*t.windY+F*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(k-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),o&&(this.yVelocity-=(X+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),x-=d;while(x>=d);this.xLag=this.xOffset-C,this.yLag=this.yOffset-I}u=Math.max(0,1-x/d),r&&(a.worldX+=(this.xOffset-this.xLag*u)*n*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*u)*n*this.data.y)}if(h||l){let C=Math.atan2(a.c,a.a),I=0,P=0,F=0,k=this.cx-a.worldX,X=this.cy-a.worldY;if(k>A?k=A:k<-A&&(k=-A),X>S?X=S:X<-S&&(X=-S),x=this.remaining,h){F=(this.data.rotate+this.data.shearX)*n,u=this.rotateLag*Math.max(0,1-m/d);let R=Math.atan2(X+this.ty,k+this.tx)-C-(this.rotateOffset-u)*F;this.rotateOffset+=(R-Math.ceil(R*N.invPI2-.5)*N.PI2)*b,R=(this.rotateOffset-u)*F+C,I=Math.cos(R),P=Math.sin(R),l&&(R=c*a.getWorldScaleX(),R>0&&(this.scaleOffset+=(k*I+X*P)*b/R))}else{I=Math.cos(C),P=Math.sin(C);const R=c*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);R>0&&(this.scaleOffset+=(k*I+X*P)*b/R)}if(x>=d){v===-1&&(v=i.damping**(60*d),y=d*i.massInverse,T=i.strength);const R=i.wind*t.windX+i.gravity*t.gravityX,V=(i.wind*t.windY+i.gravity*t.gravityY)*Qi.yDir,ot=this.rotateOffset,D=this.scaleOffset,L=c/w;for(;;)if(x-=d,l&&(this.scaleVelocity+=(R*I-V*P-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),h){if(this.rotateVelocity-=((R*P+V*I)*L+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,x<d)break;const Y=this.rotateOffset*F+C;I=Math.cos(Y),P=Math.sin(Y)}else if(x<d)break;this.rotateLag=this.rotateOffset-ot,this.scaleLag=this.scaleOffset-D}u=Math.max(0,1-x/d)}this.remaining=x}this.cx=a.worldX,this.cy=a.worldY;break}case 3:u=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*u)*n*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*u)*n*this.data.y)}if(h){let f=(this.rotateOffset-this.rotateLag*u)*n,m=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=f*this.data.rotate,m=Math.sin(x),p=Math.cos(x),g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d),x+=f*this.data.shearX,m=Math.sin(x),p=Math.cos(x),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c}else f*=this.data.rotate,m=Math.sin(f),p=Math.cos(f),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c,g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d}if(l){const f=1+(this.scaleOffset-this.scaleLag*u)*n*this.data.scaleX;a.a*=f,a.c*=f}s!==3&&(this.tx=c*a.a,this.ty=c*a.c),a.modifyWorld(t._update)}sort(t){const s=this.bone.bone;t.sortBone(s),t._updateCache.push(this),t.sortReset(s.children),t.constrained(s)}isSourceActive(){return this.bone.bone.active}},Ce=class extends oe{set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,new Ne)}create(e){return new ai(this,e)}};typeof Math.fround>"u"&&(Math.fround=(e=>t=>(e[0]=t,e[0]))(new Float32Array(1)));var ze=class{time=0;mix=0;set(e){this.time=e.time,this.mix=e.mix}},tn=class Pi extends ae{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,s){if(super(t,new ze,new ze),!s)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=s.bones[t.bone.index])}copy(t){var s=new Pi(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mix===0)return;const n=this.data,r=n.animation,o=this.bone;if(o!==null){if(!o.active)return;n.local&&o.appliedPose.validateLocalTransform(t),i.time=n.offset+(n.property.value(t,o.appliedPose,n.local,Pi.offsets)-n.property.offset)*n.scale,n.loop?i.time=r.duration+i.time%r.duration:i.time=Math.max(0,i.time)}const h=t.bones,l=r.bones;for(let a=0,c=r.bones.length;a<c;a++)h[l[a]].appliedPose.modifyLocal(t);r.apply(t,i.time,i.time,n.loop,null,i.mix,!1,n.additive,!1,!0)}sort(t){const s=this.bone,i=this.data;s&&!i.local&&t.sortBone(s),t._updateCache.push(this);const n=t.bones,r=i.animation.bones;for(let d=0,u=i.animation.bones.length;d<u;d++){const f=n[r[d]];f.sorted=!1,t.sortReset(f.children),t.constrained(f)}const o=i.animation.timelines,h=t.slots,l=t.constraints,a=t.physics,c=t.physics.length;for(let d=0,u=i.animation.timelines.length;d<u;d++){const f=o[d];if(Oi(f))t.constrained(h[f.slotIndex]);else if(f instanceof Zt||f instanceof we)t.drawOrder.constrained();else if(f instanceof Dt)if(f.constraintIndex===-1)for(let m=0;m<c;m++)t.constrained(a[m]);else t.constrained(l[f.constraintIndex]);else if(Ni(f)){const m=f.constraintIndex;m!==-1&&t.constrained(l[m])}}}},Gt=class extends oe{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(e){super(e,new ze)}create(e){return new tn(this,e)}},oi=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findSliderAnimations(e){const t=this.constraints;for(let s=0,i=this.constraints.length;s<i;s++){const n=t[s];n instanceof Gt&&n.animation!=null&&e.push(n.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let s=0,i=t.length;s<i;s++)if(t[s].name===e)return t[s];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const s=this.constraints;for(let i=0,n=this.constraints.length;i<n;i++){const r=s[i];if(r instanceof t&&r.name===e)return r}return null}},li=class{slotIndex=0;placeholder;attachment;constructor(e=0,t,s){this.slotIndex=e,this.placeholder=t,this.attachment=s}},qe=class{name;attachments=[];bones=[];constraints=[];color=new W(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");const i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let s=0;s<e.bones.length;s++){const i=e.bones[s];let n=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<e.constraints.length;s++){const i=e.constraints[s];let n=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===i){n=!0;break}n||this.constraints.push(i)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const i=t[s];this.setAttachment(i.slotIndex,i.placeholder,i.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){const i=e.bones[s];let n=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<e.constraints.length;s++){const i=e.constraints[s];let n=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===i){n=!0;break}n||this.constraints.push(i)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const i=t[s];i.attachment&&(i.attachment instanceof Ot?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.placeholder,i.attachment)))}}getAttachment(e,t){const s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){const s=this.attachments[e];s&&delete s[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new li(t,i,n))}}return e}getAttachmentsForSlot(e,t){const s=this.attachments[e];if(s)for(const i in s){const n=s[i];n&&t.push(new li(e,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){const n=e.slots[i],r=n.pose.getAttachment();if(r&&s<t.attachments.length){const o=t.attachments[s];for(const h in o){const l=o[h];if(r===l){const a=this.getAttachment(s,h);a&&n.pose.setAttachment(a);break}}}s++}}},ci=class extends Le{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(super(t,new Ue),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.boneData=s}},hi=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(hi||{}),We=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}},en=class Xn extends ae{bones;source;constructor(t,s){if(super(t,new We,new We),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(s.bones[n.index].constrainedPose);const i=s.bones[t.source.index];if(i==null)throw new Error("source cannot be null.");this.source=i}copy(t){var s=new Xn(this.data,t);return s.pose.set(this.pose),s}update(t,s){const i=this.appliedPose;if(i.mixRotate===0&&i.mixX===0&&i.mixY===0&&i.mixScaleX===0&&i.mixScaleY===0&&i.mixShearY===0)return;const n=this.data,r=n.localSource,o=n.localTarget,h=n.additive,l=n.clamp,a=n.offsets,c=this.source.appliedPose;r&&c.validateLocalTransform(t);const d=n.properties,u=n.properties.length,f=t._update,m=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=m[p];o?x.modifyLocal(t):x.modifyWorld(f);for(let b=0;b<u;b++){const w=d[b],v=w.value(t,c,r,a)-w.offset,y=w.to;for(let T=0,A=w.to.length;T<A;T++){const S=y[T];if(S.mix(i)!==0){let C=S.offset+v*S.scale;l&&(S.offset<S.max?C=N.clamp(C,S.offset,S.max):C=N.clamp(C,S.max,S.offset)),S.apply(t,i,x,C,o,h)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const s=this.bones,i=this.bones.length,n=!this.data.localTarget;if(n)for(let r=0;r<i;r++)t.sortBone(s[r].bone);t._updateCache.push(this);for(let r=0;r<i;r++){const o=s[r].bone;t.sortReset(o.children),t.constrained(o)}for(let r=0;r<i;r++)s[r].bone.sorted=n}isSourceActive(){return this.source.active}},ft=class Mt extends oe{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(t){super(t,new We)}create(t){return new en(this,t)}getOffsetRotation(){return this.offsets[Mt.ROTATION]}setOffsetRotation(t){this.offsets[Mt.ROTATION]=t}getOffsetX(){return this.offsets[Mt.X]}setOffsetX(t){this.offsets[Mt.X]=t}getOffsetY(){return this.offsets[Mt.Y]}setOffsetY(t){this.offsets[Mt.Y]=t}getOffsetScaleX(){return this.offsets[Mt.SCALEX]}setOffsetScaleX(t){this.offsets[Mt.SCALEX]=t}getOffsetScaleY(){return this.offsets[Mt.SCALEY]}setOffsetScaleY(t){this.offsets[Mt.SCALEY]=t}getOffsetShearY(){return this.offsets[Mt.SHEARY]}setOffsetShearY(t){this.offsets[Mt.SHEARY]=t}},Kt=class{offset=0;to=[]},Jt=class{offset=0;max=0;scale=0},_e=class extends Kt{value(e,t,s,i){if(s)return t.rotation+i[ft.ROTATION];const n=e.scaleX,r=e.scaleY;let o=Math.atan2(t.c/r,t.a/n)*N.radDeg+((t.a*t.d-t.b*t.c)*n*r>0?i[ft.ROTATION]:-i[ft.ROTATION]);return o<0&&(o+=360),o}},di=class extends Jt{mix(e){return e.mixRotate}apply(e,t,s,i,n,r){if(n)s.rotation+=(r?i:i-s.rotation)*t.mixRotate;else{const o=e.scaleX,h=e.scaleY,l=1/o,a=1/h,c=s.a*l,d=s.b*l,u=s.c*a,f=s.d*a;i*=N.degRad,r||(i-=Math.atan2(u,c)),i>N.PI?i-=N.PI2:i<-N.PI&&(i+=N.PI2),i*=t.mixRotate;const m=Math.cos(i),p=Math.sin(i);s.a=(m*c-p*u)*o,s.b=(m*d-p*f)*o,s.c=(p*c+m*u)*h,s.d=(p*d+m*f)*h}}},Ge=class extends Kt{value(e,t,s,i){return s?t.x+i[ft.X]:(i[ft.X]*t.a+i[ft.Y]*t.b+t.worldX)/e.scaleX}},fi=class extends Jt{mix(e){return e.mixX}apply(e,t,s,i,n,r){n?s.x+=(r?i:i-s.x)*t.mixX:(r||(i-=s.worldX/e.scaleX),s.worldX+=i*t.mixX*e.scaleX)}},He=class extends Kt{value(e,t,s,i){return s?t.y+i[ft.Y]:(i[ft.X]*t.c+i[ft.Y]*t.d+t.worldY)/e.scaleY}},ui=class extends Jt{mix(e){return e.mixY}apply(e,t,s,i,n,r){n?s.y+=(r?i:i-s.y)*t.mixY:(r||(i-=s.worldY/e.scaleY),s.worldY+=i*t.mixY*e.scaleY)}},je=class extends Kt{value(e,t,s,i){if(s)return t.scaleX+i[ft.SCALEX];const n=t.a/e.scaleX,r=t.c/e.scaleY;return Math.sqrt(n*n+r*r)+i[ft.SCALEX]}},mi=class extends Jt{mix(e){return e.mixScaleX}apply(e,t,s,i,n,r){if(n)r?s.scaleX*=1+(i-1)*t.mixScaleX:s.scaleX!==0&&(s.scaleX+=(i-s.scaleX)*t.mixScaleX);else if(r){const o=1+(i-1)*t.mixScaleX;s.a*=o,s.c*=o}else{let o=s.a/e.scaleX,h=s.c/e.scaleY,l=Math.sqrt(o*o+h*h);l!==0&&(l=1+(i-l)*t.mixScaleX/l,s.a*=l,s.c*=l)}}},Ze=class extends Kt{value(e,t,s,i){if(s)return t.scaleY+i[ft.SCALEY];const n=t.b/e.scaleX,r=t.d/e.scaleY;return Math.sqrt(n*n+r*r)+i[ft.SCALEY]}},gi=class extends Jt{mix(e){return e.mixScaleY}apply(e,t,s,i,n,r){if(n)r?s.scaleY*=1+(i-1)*t.mixScaleY:s.scaleY!==0&&(s.scaleY+=(i-s.scaleY)*t.mixScaleY);else if(r){const o=1+(i-1)*t.mixScaleY;s.b*=o,s.d*=o}else{let o=s.b/e.scaleX,h=s.d/e.scaleY,l=Math.sqrt(o*o+h*h);l!==0&&(l=1+(i-l)*t.mixScaleY/l,s.b*=l,s.d*=l)}}},$e=class extends Kt{value(e,t,s,i){if(s)return t.shearY+i[ft.SHEARY];const n=1/e.scaleX,r=1/e.scaleY;return(Math.atan2(t.d*r,t.b*n)-Math.atan2(t.c*r,t.a*n))*N.radDeg-90+i[ft.SHEARY]}},pi=class extends Jt{mix(e){return e.mixShearY}apply(e,t,s,i,n,r){if(n)r||(i-=s.shearY),s.shearY+=i*t.mixShearY;else{const o=e.scaleX,h=e.scaleY,l=s.b/o,a=s.d/h,c=Math.atan2(a,l);i=(i+90)*N.degRad,r?i-=N.PI/2:(i-=c-Math.atan2(s.c/o,s.a/h),i>N.PI?i-=N.PI2:i<-N.PI&&(i+=N.PI2)),i=c+i*t.mixShearY;const d=Math.sqrt(l*l+a*a);s.b=Math.cos(i)*d*h,s.d=Math.sin(i)*d*o}}},Jn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new oi;s.name="";const i=new sn(e),n=i.readInt32(),r=i.readInt32();s.hash=r===0&&n===0?null:r.toString(16)+n.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()*t;const o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let h=0;h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("String in string table must not be null.");i.strings.push(m)}const l=s.bones;h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Bone name must not be null.");const p=f===0?null:l[i.readInt(!0)],g=new Js(f,m,p),x=g.setupPose;x.rotation=i.readFloat(),x.x=i.readFloat()*t,x.y=i.readFloat()*t,x.scaleX=i.readFloat(),x.scaleY=i.readFloat(),x.shearX=i.readFloat(),x.shearY=i.readFloat(),x.inherit=i.readByte(),g.length=i.readFloat()*t,g.skinRequired=i.readBoolean(),o&&(W.rgba8888ToColor(g.color,i.readInt32()),g.icon=i.readString()??void 0,g.iconSize=i.readFloat(),g.iconRotation=i.readFloat(),g.visible=i.readBoolean()),l.push(g)}h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Slot name must not be null.");const p=l[i.readInt(!0)],g=new ci(f,m,p);W.rgba8888ToColor(g.setupPose.color,i.readInt32());const x=i.readInt32();x!==-1&&W.rgb888ToColor(g.setupPose.darkColor=new W,x),g.attachmentName=i.readStringRef(),g.blendMode=i.readInt(!0),o&&(g.visible=i.readBoolean()),s.slots.push(g)}const a=s.constraints,c=i.readInt(!0);for(let f=0;f<c;f++){const m=i.readString();if(!m)throw new Error("Constraint data name must not be null.");let p;switch(i.readByte()){case wr:{const g=new Ae(m);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[i.readInt(!0)]);g.target=l[i.readInt(!0)];const x=i.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=i.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?i.readFloat():1),(x&128)!==0&&(b.softness=i.readFloat()*t),a.push(g);break}case vr:{const g=new ft(m);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[i.readInt(!0)]);g.source=l[i.readInt(!0)];let x=i.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,v;w<p;w++){let y=1,T;switch(i.readByte()){case 0:T=new _e;break;case 1:{y=t,T=new Ge;break}case 2:{y=t,T=new He;break}case 3:T=new je;break;case 4:T=new Ze;break;case 5:T=new $e;break;default:T=null}if(T){T.offset=i.readFloat()*y,v=i.readByte();for(let A=0;A<v;A++){let S=1,C;switch(i.readByte()){case 0:C=new di;break;case 1:{S=t,C=new fi;break}case 2:{S=t,C=new ui;break}case 3:C=new mi;break;case 4:C=new gi;break;case 5:C=new pi;break;default:C=null}C&&(C.offset=i.readFloat()*S,C.max=i.readFloat()*S,C.scale=i.readFloat()*S/y,T.to[A]=C)}g.properties[w]=T}}x=i.readByte(),(x&1)!==0&&(g.offsets[ft.ROTATION]=i.readFloat()),(x&2)!==0&&(g.offsets[ft.X]=i.readFloat()*t),(x&4)!==0&&(g.offsets[ft.Y]=i.readFloat()*t),(x&8)!==0&&(g.offsets[ft.SCALEX]=i.readFloat()),(x&16)!==0&&(g.offsets[ft.SCALEY]=i.readFloat()),(x&32)!==0&&(g.offsets[ft.SHEARY]=i.readFloat()),x=i.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=i.readFloat()),(x&2)!==0&&(b.mixX=i.readFloat()),(x&4)!==0&&(b.mixY=i.readFloat()),(x&8)!==0&&(b.mixScaleX=i.readFloat()),(x&16)!==0&&(b.mixScaleY=i.readFloat()),(x&32)!==0&&(b.mixShearY=i.readFloat()),a.push(g);break}case yr:{const g=new Se(m);p=i.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[i.readInt(!0)]);g.slot=s.slots[i.readInt(!0)];const x=i.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=i.readFloat());const b=g.setupPose;b.position=i.readFloat(),g.positionMode===0&&(b.position*=t),b.spacing=i.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=t),b.mixRotate=i.readFloat(),b.mixX=i.readFloat(),b.mixY=i.readFloat(),a.push(g);break}case Tr:{const g=new Ce(m);g.bone=l[i.readInt(!0)];let x=i.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=i.readFloat()),(x&4)!==0&&(g.y=i.readFloat()),(x&8)!==0&&(g.rotate=i.readFloat()),(x&16)!==0&&(g.scaleX=i.readFloat()),(x&32)!==0&&(g.shearX=i.readFloat()),g.limit=((x&64)!==0?i.readFloat():5e3)*t,g.step=1/i.readUnsignedByte();const b=g.setupPose;b.inertia=i.readFloat(),b.strength=i.readFloat(),b.damping=i.readFloat(),b.massInverse=(x&128)!==0?i.readFloat():1,b.wind=i.readFloat(),b.gravity=i.readFloat(),x=i.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?i.readFloat():1,a.push(g);break}case Ar:{const g=new Gt(m),x=i.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0&&(g.setupPose.time=i.readFloat()),(x&16)!==0&&(g.setupPose.mix=(x&32)!==0?i.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=l[i.readInt(!0)];const b=i.readFloat();let w=1;switch(i.readByte()){case 0:g.property=new _e;break;case 1:{w=t,g.property=new Ge;break}case 2:{w=t,g.property=new He;break}case 3:g.property=new je;break;case 4:g.property=new Ze;break;case 5:g.property=new $e;break;default:continue}g.property.offset=b*w,g.offset=i.readFloat(),g.scale=i.readFloat()/w}a.push(g);break}}}const d=this.readSkin(i,s,!0,o);d&&(s.defaultSkin=d,s.skins.push(d));{let f=s.skins.length;for(B.setArraySize(s.skins,h=f+i.readInt(!0));f<h;f++){const m=this.readSkin(i,s,!1,o);if(!m)throw new Error("readSkin() should not have returned null.");s.skins[f]=m}}h=this.linkedMeshes.length;for(let f=0;f<h;f++){const m=this.linkedMeshes[f],p=s.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(m.sourceIndex,m.source);if(!g)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?g:m.mesh,m.mesh.setSourceMesh(g),m.mesh.updateSequence()}this.linkedMeshes.length=0,h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Event data name must not be null");const p=new ei(m),g=p.setupPose;g.intValue=i.readInt(!1),g.floatValue=i.readFloat(),g.stringValue=i.readString(),p._audioPath=i.readString(),p.audioPath&&(g.volume=i.readFloat(),g.balance=i.readFloat()),s.events.push(p)}const u=s.animations;h=i.readInt(!0);for(let f=0;f<h;f++){const m=i.readString();if(!m)throw new Error("Animation name must not be null.");u.push(this.readAnimation(i,m,s,o))}for(let f=0;f<c;f++){const m=a[f];m instanceof Gt&&(m.animation=u[i.readInt(!0)])}return s}readSkin(e,t,s,i){let n=null,r=0;if(s){if(r=e.readInt(!0),r===0)return null;n=new qe("default")}else{const o=e.readString();if(!o)throw new Error("Skin name must not be null.");n=new qe(o),i&&W.rgba8888ToColor(n.color,e.readInt32());let h=e.readInt(!0),l=t.bones,a=n.bones;for(let c=0;c<h;c++)a[c]=l[e.readInt(!0)];h=e.readInt(!0),l=t.constraints,a=n.constraints;for(let c=0;c<h;c++)a[c]=l[e.readInt(!0)];r=e.readInt(!0)}for(let o=0;o<r;o++){const h=e.readInt(!0);for(let l=0,a=e.readInt(!0);l<a;l++){const c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,n,h,c,i);d&&n.setAttachment(h,c,d)}}return n}readAttachment(e,t,s,i,n,r){const o=this.scale,h=e.readByte(),l=(h&8)!==0?e.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(h&7){case 0:{let a=(h&16)!==0?e.readStringRef():null;const c=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),u=(h&128)!==0?e.readFloat():0,f=e.readFloat(),m=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),b=e.readFloat();a||(a=l);const w=this.attachmentLoader.newRegionAttachment(s,n,l,a,d);return w?(w.path=a,w.x=f*o,w.y=m*o,w.scaleX=p,w.scaleY=g,w.rotation=u,w.width=x*o,w.height=b*o,W.rgba8888ToColor(w.color,c),w.updateSequence(),w):null}case 1:{const a=this.readVertices(e,(h&16)!==0),c=r?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,n,l);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&W.rgba8888ToColor(d.color,c),d):null}case 2:{let a=(h&16)!==0?e.readStringRef():l;const c=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),u=e.readInt(!0),f=this.readVertices(e,(h&128)!==0),m=this.readFloatArray(e,f.length,1),p=this.readShortArray(e,(f.length-u-2)*3),g=e.readInt(!0);let x=null;if(g>0){x=[];for(let T=0;T<g;T++)x[T]=e.readInt(!0)}let b=[],w=0,v=0;r&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),v=e.readFloat()),a||(a=l);const y=this.attachmentLoader.newMeshAttachment(s,n,l,a,d);return y?(y.path=a,W.rgba8888ToColor(y.color,c),y.hullLength=u<<1,y.bones=f.bones,y.vertices=f.vertices,y.worldVerticesLength=f.length,y.regionUVs=m,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*o,y.height=v*o),y.updateSequence(),y):null}case 3:{const a=(h&16)!==0?e.readStringRef():l;if(a==null)throw new Error("Path of linked mesh must not be null");const c=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),u=(h&128)!==0,f=e.readInt(!0),m=e.readInt(!0),p=e.readStringRef();let g=0,x=0;r&&(g=e.readFloat(),x=e.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,n,l,a,d);return b?(b.path=a,W.rgba8888ToColor(b.color,c),r&&(b.width=g*o,b.height=x*o),this.linkedMeshes.push(new Qn(b,m,i,f,p,u)),b):null}case 4:{const a=(h&16)!==0,c=(h&32)!==0,d=this.readVertices(e,(h&64)!==0),u=this.readFloatArray(e,d.length/6,o),f=r?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,n,l);return m?(m.closed=a,m.constantSpeed=c,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=u,r&&W.rgba8888ToColor(m.color,f),m):null}case 5:{const a=e.readFloat(),c=e.readFloat(),d=e.readFloat(),u=r?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,n,l);return f?(f.x=c*o,f.y=d*o,f.rotation=a,r&&W.rgba8888ToColor(f.color,u),f):null}case 6:{const a=e.readInt(!0),c=this.readVertices(e,(h&16)!==0),d=r?e.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,n,l);return u?(u.endSlot=t.slots[a],u.convex=(h&32)!==0,u.inverse=(h&64)!==0,u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,r&&W.rgba8888ToColor(u.color,d),u):null}}}readSequence(e,t){if(!t)return new ge(1,!1);const s=new ge(e.readInt(!0),!0);return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,t){const s=this.scale,n=e.readInt(!0)<<1;if(!t)return new nn(null,this.readFloatArray(e,n,s),n);const r=e.readInt(!0),o=[],h=[];for(let l=0,a=0;l<r;){const c=e.readInt(!0);o[l++]=c;for(let d=0;d<c;d++,a+=3)o[l++]=e.readInt(!0),h[a]=e.readFloat()*s,h[a+1]=e.readFloat()*s,h[a+2]=e.readFloat()}return new nn(o,B.toFloatArray(h),n)}readFloatArray(e,t,s){const i=[];if(s===1)for(let n=0;n<t;n++)i[n]=e.readFloat();else for(let n=0;n<t;n++)i[n]=e.readFloat()*s;return i}readShortArray(e,t){const s=[];for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s,i){e.readInt(!0);const n=[],r=this.scale;for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=b-1;switch(x){case ur:{const v=new ne(b,m);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readStringRef());n.push(v);break}case mr:{const v=e.readInt(!0),y=new Is(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let P=0,F=0;y.setFrame(P,T,A,S,C,I),P!==w;P++){const k=e.readFloat(),X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,ot=e.readUnsignedByte()/255;switch(e.readByte()){case kt:y.setStepped(P);break;case Vt:ht(e,y,F++,P,0,T,k,A,X,1),ht(e,y,F++,P,1,T,k,S,R,1),ht(e,y,F++,P,2,T,k,C,V,1),ht(e,y,F++,P,3,T,k,I,ot,1)}T=k,A=X,S=R,C=V,I=ot}n.push(y);break}case gr:{const v=e.readInt(!0),y=new Ms(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let I=0,P=0;y.setFrame(I,T,A,S,C),I!==w;I++){const F=e.readFloat(),k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case kt:y.setStepped(I);break;case Vt:ht(e,y,P++,I,0,T,F,A,k,1),ht(e,y,P++,I,1,T,F,S,X,1),ht(e,y,P++,I,2,T,F,C,R,1)}T=F,A=k,S=X,C=R}n.push(y);break}case pr:{const v=e.readInt(!0),y=new Ps(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let X=0,R=0;y.setFrame(X,T,A,S,C,I,P,F,k),X!==w;X++){const V=e.readFloat(),ot=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,ct=e.readUnsignedByte()/255;switch(e.readByte()){case kt:y.setStepped(X);break;case Vt:ht(e,y,R++,X,0,T,V,A,ot,1),ht(e,y,R++,X,1,T,V,S,D,1),ht(e,y,R++,X,2,T,V,C,L,1),ht(e,y,R++,X,3,T,V,I,Y,1),ht(e,y,R++,X,4,T,V,P,z,1),ht(e,y,R++,X,5,T,V,F,U,1),ht(e,y,R++,X,6,T,V,k,ct,1)}T=V,A=ot,S=D,C=L,I=Y,P=z,F=U,k=ct}n.push(y);break}case xr:{const v=e.readInt(!0),y=new Rs(b,v,m);let T=e.readFloat(),A=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let k=0,X=0;y.setFrame(k,T,A,S,C,I,P,F),k!==w;k++){const R=e.readFloat(),V=e.readUnsignedByte()/255,ot=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255;switch(e.readByte()){case kt:y.setStepped(k);break;case Vt:ht(e,y,X++,k,0,T,R,A,V,1),ht(e,y,X++,k,1,T,R,S,ot,1),ht(e,y,X++,k,2,T,R,C,D,1),ht(e,y,X++,k,3,T,R,I,L,1),ht(e,y,X++,k,4,T,R,P,Y,1),ht(e,y,X++,k,5,T,R,F,z,1)}T=R,A=V,S=ot,C=D,I=L,P=Y,F=z}n.push(y);break}case br:{const v=new Es(b,e.readInt(!0),m);let y=e.readFloat(),T=e.readUnsignedByte()/255;for(let A=0,S=0;v.setFrame(A,y,T),A!==w;A++){const C=e.readFloat(),I=e.readUnsignedByte()/255;switch(e.readByte()){case kt:v.setStepped(A);break;case Vt:ht(e,v,S++,A,0,y,C,T,I,1)}y=C,T=I}n.push(v)}}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===fr){const v=new Cs(b,m);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readByte());n.push(v);continue}const w=e.readInt(!0);switch(x){case sr:xt(e,n,new xe(b,w,m),1);break;case ir:xt(e,n,new ps(b,w,m),r);break;case nr:xt(e,n,new xs(b,w,m),r);break;case rr:xt(e,n,new bs(b,w,m),r);break;case ar:xt(e,n,new ws(b,w,m),1);break;case or:xt(e,n,new ys(b,w,m),1);break;case lr:xt(e,n,new vs(b,w,m),1);break;case cr:xt(e,n,new Ts(b,w,m),1);break;case hr:xt(e,n,new As(b,w,m),1);break;case dr:xt(e,n,new Ss(b,w,m),1);break}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new Ls(p,e.readInt(!0),m);let b=e.readByte(),w=e.readFloat(),v=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,y=(b&4)!==0?e.readFloat()*r:0;for(let T=0,A=0;x.setFrame(T,w,v,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),T!==g;T++){b=e.readByte();const S=e.readFloat(),C=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,I=(b&4)!==0?e.readFloat()*r:0;(b&64)!==0?x.setStepped(T):(b&128)!==0&&(ht(e,x,A++,T,0,w,S,v,C,1),ht(e,x,A++,T,1,w,S,y,I,r)),w=S,v=C,y=I}n.push(x)}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new Xs(p,e.readInt(!0),m);let b=e.readFloat(),w=e.readFloat(),v=e.readFloat(),y=e.readFloat(),T=e.readFloat(),A=e.readFloat(),S=e.readFloat();for(let C=0,I=0;x.setFrame(C,b,w,v,y,T,A,S),C!==g;C++){const P=e.readFloat(),F=e.readFloat(),k=e.readFloat(),X=e.readFloat(),R=e.readFloat(),V=e.readFloat(),ot=e.readFloat();switch(e.readByte()){case kt:x.setStepped(C);break;case Vt:ht(e,x,I++,C,0,b,P,w,F,1),ht(e,x,I++,C,1,b,P,v,k,1),ht(e,x,I++,C,2,b,P,y,X,1),ht(e,x,I++,C,3,b,P,T,R,1),ht(e,x,I++,C,4,b,P,A,V,1),ht(e,x,I++,C,5,b,P,S,ot,1)}b=P,w=F,v=k,y=X,T=R,A=V,S=ot}n.push(x)}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0),p=s.constraints[m];for(let g=0,x=e.readInt(!0);g<x;g++){const b=e.readByte(),w=e.readInt(!0),v=e.readInt(!0);switch(b){case Ir:xt(e,n,new ks(w,v,m),p.positionMode===0?r:1);break;case Mr:xt(e,n,new Vs(w,v,m),p.spacingMode===0||p.spacingMode===1?r:1);break;case Er:{const y=new Bs(w,v,m);let T=e.readFloat(),A=e.readFloat(),S=e.readFloat(),C=e.readFloat();for(let I=0,P=0,F=y.getFrameCount()-1;y.setFrame(I,T,A,S,C),I!==F;I++){const k=e.readFloat(),X=e.readFloat(),R=e.readFloat(),V=e.readFloat();switch(e.readByte()){case kt:y.setStepped(I);break;case Vt:ht(e,y,P++,I,0,T,k,A,X,1),ht(e,y,P++,I,1,T,k,S,R,1),ht(e,y,P++,I,2,T,k,C,V,1)}T=k,A=X,S=R,C=V}n.push(y)}}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0)-1;for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===Vr){const v=new _s(b,m);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat());n.push(v);continue}const w=e.readInt(!0);switch(x){case Pr:xt(e,n,new Os(b,w,m),1);break;case Rr:xt(e,n,new Ds(b,w,m),1);break;case Fr:xt(e,n,new Ns(b,w,m),1);break;case Yr:xt(e,n,new Us(b,w,m),1);break;case Lr:xt(e,n,new zs(b,w,m),1);break;case Xr:xt(e,n,new qs(b,w,m),1);break;case kr:xt(e,n,new Ws(b,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=e.readInt(!0);switch(x){case Br:xt(e,n,new Gs(b,w,m),1);break;case Or:xt(e,n,new Hs(b,w,m),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let u=0,f=e.readInt(!0);u<f;u++){const m=s.skins[e.readInt(!0)];for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readInt(!0);for(let b=0,w=e.readInt(!0);b<w;b++){const v=e.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=m.getAttachment(x,v),T=e.readByte(),A=e.readInt(!0),S=A-1;switch(T){case Sr:{const C=y,I=C.bones,P=C.vertices,F=I?P.length/3*2:P.length,k=e.readInt(!0),X=new Fs(A,k,x,C);let R=e.readFloat();for(let V=0,ot=0;;V++){let D,L=e.readInt(!0);if(L===0)D=I?B.newFloatArray(F):P;else{D=B.newFloatArray(F);const z=e.readInt(!0);if(L+=z,r===1)for(let U=z;U<L;U++)D[U]=e.readFloat();else for(let U=z;U<L;U++)D[U]=e.readFloat()*r;if(!I)for(let U=0,ct=D.length;U<ct;U++)D[U]+=P[U]}if(X.setFrame(V,R,D),V===S)break;const Y=e.readFloat();switch(e.readByte()){case kt:X.setStepped(V);break;case Vt:ht(e,X,ot++,V,0,R,Y,0,1,1)}R=Y}n.push(X);break}case Cr:{const C=new Ys(A,x,y);for(let I=0;I<A;I++){const P=e.readFloat(),F=e.readInt32();C.setFrame(I,P,gs[F&15],F>>4,e.readFloat())}n.push(C);break}}}}}const o=s.slots.length,h=e.readInt(!0);if(h>0){const u=new Zt(h);for(let f=0;f<h;f++)u.setFrame(f,e.readFloat(),rn(e,o));n.push(u)}const l=e.readInt(!0);for(let u=0;u<l;u++){const f=e.readInt(!0),m=new Array(f);for(let x=0;x<f;x++)m[x]=e.readInt(!0);const p=e.readInt(!0),g=new we(p,m,o);for(let x=0;x<p;x++)g.setFrame(x,e.readFloat(),rn(e,f));n.push(g)}const a=e.readInt(!0);if(a>0){const u=new Fe(a);for(let f=0;f<a;f++){const m=e.readFloat(),p=s.events[e.readInt(!0)],g=new Be(m,p);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),u.setFrame(f,g)}n.push(u)}let c=0;for(let u=0,f=n.length;u<f;u++)c=Math.max(c,n[u].getDuration());const d=new Pe(t,n,c);return i&&W.rgba8888ToColor(d.color,e.readInt32()),d}},sn=class{constructor(e,t=[],s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){const e=this.readInt(!0);return e===0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s<e;){const i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(i),s++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}},Qn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,i,n,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.sourceIndex=i,this.source=n,this.inheritTimelines=r}},nn=class{constructor(e=null,t,s=0){this.bones=e,this.vertices=t,this.length=s}};function xt(e,t,s,i){s instanceof pe?tr(e,t,s,i):er(e,t,s,i)}function tr(e,t,s,i){let n=e.readFloat(),r=e.readFloat()*i;for(let o=0,h=0,l=s.getFrameCount()-1;s.setFrame(o,n,r),o!==l;o++){const a=e.readFloat(),c=e.readFloat()*i;switch(e.readByte()){case kt:s.setStepped(o);break;case Vt:ht(e,s,h++,o,0,n,a,r,c,i)}n=a,r=c}t.push(s)}function er(e,t,s,i){let n=e.readFloat(),r=e.readFloat()*i,o=e.readFloat()*i;for(let h=0,l=0,a=s.getFrameCount()-1;s.setFrame(h,n,r,o),h!==a;h++){const c=e.readFloat(),d=e.readFloat()*i,u=e.readFloat()*i;switch(e.readByte()){case kt:s.setStepped(h);break;case Vt:ht(e,s,l++,h,0,n,c,r,d,i),ht(e,s,l++,h,1,n,c,o,u,i)}n=c,r=d,o=u}t.push(s)}function rn(e,t){const s=e.readInt(!0);if(s===0)return null;const i=new Array(t).fill(-1),n=new Array(t-s);let r=0,o=0;for(let h=0;h<s;h++){const l=e.readInt(!0);for(;r!==l;)n[o++]=r++;i[r+e.readInt(!0)]=r++}for(;r<t;)n[o++]=r++;for(let h=t-1;h>=0;h--)i[h]===-1&&(i[h]=n[--o]);return i}function ht(e,t,s,i,n,r,o,h,l,a){t.setBezier(s,i,n,r,h,e.readFloat(),e.readFloat()*a,e.readFloat(),e.readFloat()*a,o,l)}var sr=0,ir=1,nr=2,rr=3,ar=4,or=5,lr=6,cr=7,hr=8,dr=9,fr=10,ur=0,mr=1,gr=2,pr=3,xr=4,br=5,wr=0,yr=1,vr=2,Tr=3,Ar=4,Sr=0,Cr=1,Ir=0,Mr=1,Er=2,Pr=0,Rr=1,Fr=2,Yr=4,Lr=5,Xr=6,kr=7,Vr=8,Br=0,Or=1,kt=1,Vt=2,an=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new me(()=>B.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=e.slots,o=r.length;s.length=0,n.freeAll(i),i.length=0;for(let h=0;h<o;h++){const l=r[h];if(!l.bone.active)continue;const a=l.appliedPose.attachment;if(a instanceof Ks){s.push(a);let c=n.obtain();c.length!==a.worldVerticesLength&&(c=B.newFloatArray(a.worldVerticesLength)),i.push(c),a.computeWorldVertices(e,l,0,a.worldVerticesLength,c,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const n=this.polygons;for(let r=0,o=n.length;r<o;r++){const h=n[r],l=h;for(let a=0,c=h.length;a<c;a+=2){const d=l[a],u=l[a+1];e=Math.min(e,d),t=Math.min(t,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){const n=this.minX,r=this.minY,o=this.maxX,h=this.maxY;if(e<=n&&s<=n||t<=r&&i<=r||e>=o&&s>=o||t>=h&&i>=h)return!1;const l=(i-t)/(s-e);let a=l*(n-e)+t;if(a>r&&a<h||(a=l*(o-e)+t,a>r&&a<h))return!0;let c=(r-t)/l+e;return c>n&&c<o||(c=(h-t)/l+e,c>n&&c<o)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){const s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){const i=e,n=e.length;let r=n-2,o=!1;for(let h=0;h<n;h+=2){const l=i[h+1],a=i[r+1];if(l<s&&a>=s||a<s&&l>=s){const c=i[h];c+(s-l)/(a-l)*(i[r]-c)<t&&(o=!o)}r=h}return o}intersectsSegment(e,t,s,i){const n=this.polygons;for(let r=0,o=n.length;r<o;r++)if(this.intersectsSegmentPolygon(n[r],e,t,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(e,t,s,i,n){const r=e,o=e.length,h=t-i,l=s-n,a=t*n-s*i;let c=r[o-2],d=r[o-1];for(let u=0;u<o;u+=2){const f=r[u],m=r[u+1],p=c*m-d*f,g=c-f,x=d-m,b=h*x-l*g,w=(a*g-h*p)/b;if((w>=c&&w<=f||w>=f&&w<=c)&&(w>=t&&w<=i||w>=i&&w<=t)){const v=(a*x-l*p)/b;if((v>=d&&v<=m||v>=m&&v<=d)&&(v>=s&&v<=n||v>=n&&v<=s))return!0}c=f,d=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");const t=this.boundingBoxes.indexOf(e);return t===-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},on=class Ct{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new me(()=>[]);polygonIndicesPool=new me(()=>[]);triangulate(t){const s=t;let i=t.length>>1;const n=this.indicesArray;n.length=0;for(let h=0;h<i;h++)n[h]=h;const r=this.isConcaveArray;r.length=0;for(let h=0;h<i;h++)r[h]=Ct.isConcave(h,i,s,n);const o=this.triangles;for(o.length=0;i>3;){let h=i-1,l=0,a=1;for(;;){t:if(!r[l]){const u=n[h]<<1,f=n[l]<<1,m=n[a]<<1,p=s[u],g=s[u+1],x=s[f],b=s[f+1],w=s[m],v=s[m+1];for(let y=a+1<i?a+1:0;y!==h;){if(r[y]){const T=n[y]<<1,A=s[T],S=s[T+1];if(Ct.positiveArea(w,v,p,g,A,S)&&Ct.positiveArea(p,g,x,b,A,S)&&Ct.positiveArea(x,b,w,v,A,S))break t}++y===i&&(y=0)}break}if(a===0){do{if(!r[l])break;l--}while(l>0);h=l>0?l-1:i-1,a=l+1<i?l+1:0;break}h=l,l=a,++a===i&&(a=0)}o.push(n[h],n[l],n[a]),n.splice(l,1),r.splice(l,1),i--;const c=l>0?l-1:i-1,d=l<i?l:0;r[c]=Ct.isConcave(c,i,s,n),r[d]=Ct.isConcave(d,i,s,n)}return i===3&&o.push(n[2],n[0],n[1]),o}decompose(t,s){const i=t,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let h=this.polygonPool.obtain();h.length=0;let l=-1,a=0;for(let c=0,d=s.length;c<d;c+=3){const u=s[c]<<1,f=s[c+1]<<1,m=s[c+2]<<1,p=i[u],g=i[u+1],x=i[f],b=i[f+1],w=i[m],v=i[m+1];if(l===u){const y=h.length-4;if(Ct.winding(h[y],h[y+1],h[y+2],h[y+3],w,v)===a&&Ct.winding(w,v,h[0],h[1],h[2],h[3])===a){h.push(w,v),o.push(m);continue}}h.length>0&&(n.push(h),r.push(o),h=this.polygonPool.obtain(),o=this.polygonIndicesPool.obtain()),h.length=0,h.push(p,g,x,b),h.push(w,v),o.length=0,o.push(u,f,m),a=Ct.winding(p,g,x,b,w,v),l=u}h.length>0&&(n.push(h),r.push(o));for(let c=0,d=n.length;c<d;c++){if(o=r[c],o.length===0)continue;const u=o[0];let f=o[o.length-1];h=n[c];const m=h.length-4;let p=h[m],g=h[m+1],x=h[m+2],b=h[m+3];const w=h[0],v=h[1],y=h[2],T=h[3],A=Ct.winding(p,g,x,b,w,v);for(let S=0;S<d;S++){if(S===c)continue;const C=r[S];if(C.length!==3)continue;const I=C[0],P=C[1],F=C[2],k=n[S],X=k[k.length-2],R=k[k.length-1];I!==u||P!==f||Ct.winding(p,g,x,b,X,R)===A&&Ct.winding(X,R,w,v,y,T)===A&&(k.length=0,C.length=0,h.push(X,R),o.push(F),f=F,p=x,g=b,x=X,b=R,S=-1)}}for(let c=n.length-1;c>=0;c--)h=n[c],h.length===0?(n.splice(c,1),this.polygonPool.free(h),o=r[c],r.splice(c,1),this.polygonIndicesPool.free(o)):h.push(h[0],h[1]);return n}static isConcave(t,s,i,n){const r=n[t>0?t-1:s-1]<<1,o=n[t]<<1,h=n[t+1<s?t+1:0]<<1;return!Ct.positiveArea(i[r],i[r+1],i[o],i[o+1],i[h],i[h+1])}static positiveArea(t,s,i,n,r,o){return t*(o-n)+i*(s-o)+r*(n-s)>=0}static winding(t,s,i,n,r,o){return t*(o-n)+i*(s-o)+r*(n-s)>=0?1:-1}},xi=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(e,t,s){if(this.clipAttachment)return;const i=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const n=B.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,t,0,i,n,0,2);const r=this.clippingPolygon,o=this.makeClockwise(r);o||this.inverse||s.convex?(o||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new on),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(e){this.clipAttachment&&(e&&this.clipAttachment.endSlot!==e.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,n,r,o,h){return i&&n&&r&&typeof o=="boolean"&&typeof h=="number"?this.clipTrianglesRender(e,t,s,i,n,r,o,h):this.clipTrianglesNoRender(e,t,s)}clipTrianglesNoRender(e,t,s){const i=this.clippedVertices;i.length=0;const n=this.clippedTriangles;n.length=0;let r=0;if(this.inverse){const c=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let u=t[d]<<1;const f=e[u],m=e[u+1];u=t[d+1]<<1;const p=e[u],g=e[u+1];u=t[d+2]<<1;const x=e[u],b=e[u+1];this.clipInverse(f,m,p,g,x,b,c);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=w[v++];let A=T>>1,S=i.length;const C=B.setArraySize(i,S+T);B.arrayCopy(w,v,C,S,T),S=n.length;const I=B.setArraySize(n,S+3*(A-2));for(let P=1;P<A-1;P++,S+=3)I[S]=r,I[S+1]=r+P,I[S+2]=r+P+1;r+=A,v+=T}}return!0}const o=this.clipOutput,h=this.clippingPolygons,l=h.length;let a=null;for(let c=0;c<s;c+=3){let d=t[c]<<1;const u=e[d],f=e[d+1];d=t[c+1]<<1;const m=e[d],p=e[d+1];d=t[c+2]<<1;const g=e[d],x=e[d+1];for(let b=0;b<l;b++){let w=i.length;if(this.clip(u,f,m,p,g,x,h[b])){a=this.clipOutput;const v=o.length;if(v===0)continue;let y=v>>1;const T=B.setArraySize(i,w+v);B.arrayCopy(a,0,T,w,v),w=n.length;const A=B.setArraySize(n,w+3*(y-2));y--;for(let S=1;S<y;S++,w+=3)A[w]=r,A[w+1]=r+S,A[w+2]=r+S+1;r+=y}else{const v=B.setArraySize(i,w+6);v[w]=u,v[w+1]=f,v[w+2]=m,v[w+3]=p,v[w+4]=g,v[w+5]=x,w=n.length;const y=B.setArraySize(n,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(e,t,s,i,n,r,o,h){const l=this.clippedVertices;l.length=0;const a=this.clippedTriangles;a.length=0;let c=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=t[g],b=t[g+1],w=t[g+2];const v=e[x*h],y=e[x*h+1],T=e[b*h],A=e[b*h+1],S=e[w*h],C=e[w*h+1];this.clipInverse(v,y,T,A,S,C,p);const I=this.inverseVertices.length;if(I===0)continue;const P=i[x<<=1],F=i[x+1],k=i[b<<=1],X=i[b+1],R=i[w<<=1],V=i[w+1],ot=A-C,D=S-T,L=v-S,Y=C-y,z=1/(ot*L+D*(y-C)),U=this.inverseVertices;for(let ct=0;ct<I;){const O=U[ct++],lt=O>>1;let q=l.length;const ut=B.setArraySize(l,q+lt*h);for(let mt=0;mt<O;mt+=2,q+=h){const wt=U[ct+mt],Tt=U[ct+mt+1];ut[q]=wt,ut[q+1]=Tt,ut[q+2]=n.r,ut[q+3]=n.g,ut[q+4]=n.b,ut[q+5]=n.a;const yt=wt-S,Ft=Tt-C,At=(ot*yt+D*Ft)*z,St=(Y*yt+L*Ft)*z,Yt=1-At-St;ut[q+6]=P*At+k*St+R*Yt,ut[q+7]=F*At+X*St+V*Yt,o&&(ut[q+8]=r.r,ut[q+9]=r.g,ut[q+10]=r.b,ut[q+11]=r.a)}q=a.length;const bt=B.setArraySize(a,q+3*(lt-2));for(let mt=1;mt<lt-1;mt++,q+=3)bt[q]=c,bt[q+1]=c+mt,bt[q+2]=c+mt+1;c+=lt,ct+=O}}return!0}const d=this.clipOutput,u=this.clippingPolygons,f=this.clippingPolygons.length;let m=null;for(let p=0;p<s;p+=3){let g=t[p];const x=e[g*h],b=e[g*h+1],w=i[g<<1],v=i[(g<<1)+1];g=t[p+1];const y=e[g*h],T=e[g*h+1],A=i[g<<1],S=i[(g<<1)+1];g=t[p+2];const C=e[g*h],I=e[g*h+1],P=i[g<<1],F=i[(g<<1)+1],k=T-I,X=C-y,R=x-C,V=I-b,ot=1/(k*R+X*(b-I));for(let D=0;D<f;D++){let L=l.length;if(this.clip(x,b,y,T,C,I,u[D])){m=this.clipOutput;const Y=d.length;if(Y===0)continue;let z=Y>>1;const U=B.setArraySize(l,L+z*h);for(let O=0;O<Y;O+=2,L+=h){const lt=m[O],q=m[O+1];U[L]=lt,U[L+1]=q,U[L+2]=n.r,U[L+3]=n.g,U[L+4]=n.b,U[L+5]=n.a;const ut=lt-C,bt=q-I,mt=(k*ut+X*bt)*ot,wt=(V*ut+R*bt)*ot,Tt=1-mt-wt;U[L+6]=w*mt+A*wt+P*Tt,U[L+7]=v*mt+S*wt+F*Tt,o&&(U[L+8]=r.r,U[L+9]=r.g,U[L+10]=r.b,U[L+11]=r.a)}L=a.length;const ct=B.setArraySize(a,L+3*(z-2));z--;for(let O=1;O<z;O++,L+=3)ct[L]=c,ct[L+1]=c+O,ct[L+2]=c+O+1;c+=z+1}else{const Y=B.setArraySize(l,L+3*h);Y[L]=x,Y[L+1]=b,Y[L+2]=n.r,Y[L+3]=n.g,Y[L+4]=n.b,Y[L+5]=n.a,o?(Y[L+6]=w,Y[L+7]=v,Y[L+8]=r.r,Y[L+9]=r.g,Y[L+10]=r.b,Y[L+11]=r.a,Y[L+12]=y,Y[L+13]=T,Y[L+14]=n.r,Y[L+15]=n.g,Y[L+16]=n.b,Y[L+17]=n.a,Y[L+18]=A,Y[L+19]=S,Y[L+20]=r.r,Y[L+21]=r.g,Y[L+22]=r.b,Y[L+23]=r.a,Y[L+24]=C,Y[L+25]=I,Y[L+26]=n.r,Y[L+27]=n.g,Y[L+28]=n.b,Y[L+29]=n.a,Y[L+30]=P,Y[L+31]=F,Y[L+32]=r.r,Y[L+33]=r.g,Y[L+34]=r.b,Y[L+35]=r.a):(Y[L+6]=w,Y[L+7]=v,Y[L+8]=y,Y[L+9]=T,Y[L+10]=n.r,Y[L+11]=n.g,Y[L+12]=n.b,Y[L+13]=n.a,Y[L+14]=A,Y[L+15]=S,Y[L+16]=C,Y[L+17]=I,Y[L+18]=n.r,Y[L+19]=n.g,Y[L+20]=n.b,Y[L+21]=n.a,Y[L+22]=P,Y[L+23]=F),L=a.length;const z=B.setArraySize(a,L+3);z[L]=c,z[L+1]=c+1,z[L+2]=c+2,c+=3;break}}}return m!=null}clipTrianglesUnpacked(e,t,s,i,n,r=2){let o=this._clippedVerticesTyped,h=this._clippedUVsTyped,l=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const m=this.clippingPolygons[0];for(let p=0;p<i;p+=3){let g=s[p]*r;const x=e[t+g],b=e[t+g+1];let w=s[p]<<1;const v=n[w],y=n[w+1];g=s[p+1]*r;const T=e[t+g],A=e[t+g+1];w=s[p+1]<<1;const S=n[w],C=n[w+1];g=s[p+2]*r;const I=e[t+g],P=e[t+g+1];w=s[p+2]<<1;const F=n[w],k=n[w+1];this.clipInverse(x,b,T,A,I,P,m);const X=this.inverseVertices.length;if(X===0)continue;const R=A-P,V=I-T,ot=x-I,D=P-b,L=1/(R*ot+V*(b-P)),Y=this.inverseVertices;for(let z=0;z<X;){const U=Y[z++],ct=U>>1;let O=this.clippedVerticesLength;const lt=O+ct*r,q=this.clippedUVsLength+ct*2;o.length<lt&&(this._clippedVerticesTyped=new Float32Array(lt*2),this._clippedVerticesTyped.set(o.subarray(0,O)),o=this._clippedVerticesTyped),h.length<q&&(this._clippedUVsTyped=new Float32Array(q*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped),this.clippedVerticesLength=lt,this.clippedUVsLength=q;const ut=this._clippedVerticesTyped,bt=this._clippedUVsTyped;let mt=q-ct*2;for(let yt=0;yt<U;yt+=2,O+=r,mt+=2){const Ft=Y[z+yt],At=Y[z+yt+1];ut[O]=Ft,ut[O+1]=At;const St=Ft-I,Yt=At-P,Bt=(R*St+V*Yt)*L,Nt=(D*St+ot*Yt)*L,Me=1-Bt-Nt;bt[mt]=v*Bt+S*Nt+F*Me,bt[mt+1]=y*Bt+C*Nt+k*Me}O=this.clippedTrianglesLength;const wt=O+3*(ct-2);l.length<wt&&(this._clippedTrianglesTyped=new Uint16Array(wt*2),this._clippedTrianglesTyped.set(l.subarray(0,O)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=wt;const Tt=l;for(let yt=1;yt<ct-1;yt++,O+=3)Tt[O]=a,Tt[O+1]=a+yt,Tt[O+2]=a+yt+1;a+=ct,z+=U}}return!0}const c=this.clipOutput,d=this.clippingPolygons,u=this.clippingPolygons.length;let f=null;for(let m=0;m<i;m+=3){let p=s[m],g=p*r;const x=e[t+g],b=e[t+g+1];let w=p<<1;const v=n[w],y=n[w+1];p=s[m+1],g=p*r;const T=e[t+g],A=e[t+g+1];w=p<<1;const S=n[w],C=n[w+1];p=s[m+2],g=p*r;const I=e[t+g],P=e[t+g+1];w=p<<1;const F=n[w],k=n[w+1],X=A-P,R=I-T,V=x-I,ot=P-b,D=1/(X*V+R*(b-P));for(let L=0;L<u;L++){let Y=this.clippedVerticesLength;if(this.clip(x,b,T,A,I,P,d[L])){f=c;const z=c.length;if(z===0)continue;let U=z>>1;const ct=Y+U*r;o.length<ct&&(this._clippedVerticesTyped=new Float32Array(ct*2),this._clippedVerticesTyped.set(o.subarray(0,Y)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+U*2)*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),o=this._clippedVerticesTyped,h=this._clippedUVsTyped);const O=o,lt=h;this.clippedVerticesLength=ct;let q=this.clippedUVsLength;this.clippedUVsLength=q+U*2;for(let mt=0;mt<z;mt+=2,Y+=r,q+=2){const wt=f[mt],Tt=f[mt+1];O[Y]=wt,O[Y+1]=Tt;const yt=wt-I,Ft=Tt-P,At=(X*yt+R*Ft)*D,St=(ot*yt+V*Ft)*D,Yt=1-At-St;lt[q]=v*At+S*St+F*Yt,lt[q+1]=y*At+C*St+k*Yt}Y=this.clippedTrianglesLength;const ut=Y+3*(U-2);l.length<ut&&(this._clippedTrianglesTyped=new Uint16Array(ut*2),this._clippedTrianglesTyped.set(l.subarray(0,Y)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=ut;const bt=l;U--;for(let mt=1;mt<U;mt++,Y+=3)bt[Y]=a,bt[Y+1]=a+mt,bt[Y+2]=a+mt+1;a+=U+1}else{let z=Y+3*r;o.length<z&&(this._clippedVerticesTyped=new Float32Array(z*2),this._clippedVerticesTyped.set(o.subarray(0,Y)),o=this._clippedVerticesTyped),o[Y]=x,o[Y+1]=b,o[Y+r]=T,o[Y+r+1]=A,o[Y+r*2]=I,o[Y+r*2+1]=P;const U=this.clippedUVsLength+3*2;h.length<U&&(this._clippedUVsTyped=new Float32Array(U*2),this._clippedUVsTyped.set(h.subarray(0,this.clippedUVsLength)),h=this._clippedUVsTyped);const ct=this.clippedUVsLength;h[ct]=v,h[ct+1]=y,h[ct+2]=S,h[ct+3]=C,h[ct+4]=F,h[ct+5]=k,this.clippedVerticesLength=z,this.clippedUVsLength=U,Y=this.clippedTrianglesLength,z=Y+3,l.length<z&&(this._clippedTrianglesTyped=new Uint16Array(z*2),this._clippedTrianglesTyped.set(l.subarray(0,Y)),l=this._clippedTrianglesTyped);const O=l;O[Y]=a,O[Y+1]=a+1,O[Y+2]=a+2,a+=3,this.clippedTrianglesLength=z;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),f!==null}clip(e,t,s,i,n,r,o){const h=this.clipOutput;let l=!1,a,c;o.length%4>=2?(a=this.clipOutput,c=this.scratch):(a=this.scratch,c=this.clipOutput);const d=o;a.length=8;const u=a;u[0]=e,u[1]=t,u[2]=s,u[3]=i,u[4]=n,u[5]=r,u[6]=e,u[7]=t,c.length=0;const f=o.length-4;for(let m=0;;m+=2){const p=d[m],g=d[m+1],x=p-d[m+2],b=g-d[m+3],w=c.length,v=a;for(let T=0,A=a.length-2;T<A;){e=v[T],t=v[T+1],T+=2,s=v[T],i=v[T+1];const S=b*(p-s)>x*(g-i),C=b*(p-e)-x*(g-t);if(C>0)if(S)c.push(s,i);else{const I=s-e,P=i-t,F=C/(I*b-P*x);F>=0&&F<=1?(c.push(e+I*F,t+P*F),l=!0):c.push(s,i)}else if(S){const I=s-e,P=i-t,F=C/(I*b-P*x);F>=0&&F<=1?(c.push(e+I*F,t+P*F,s,i),l=!0):c.push(s,i)}else l=!0}if(w===c.length)return h.length=0,!0;if(c.push(c[0],c[1]),m===f)break;const y=c;c=a,c.length=0,a=y}if(h!==c){h.length=0;for(let m=0,p=c.length-2;m<p;m++)h[m]=c[m]}else h.length=h.length-2;return l}clipInverse(e,t,s,i,n,r,o){this.inverseVertices.length=0;const h=o.length-4;let l,a;o.length%4>=2?(l=this.clipOutput,a=this.scratch):(l=this.scratch,a=this.clipOutput),l.length=8;let c=o,d=l;d[0]=e,d[1]=t,d[2]=s,d[3]=i,d[4]=n,d[5]=r,d[6]=e,d[7]=t,a.length=0;for(let u=0;;u+=2){const f=c[u],m=c[u+1],p=f-c[u+2],g=m-c[u+3],x=a.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=l;for(let y=0,T=l.length-2;y<T;){e=d[y],t=d[y+1],y+=2,s=d[y],i=d[y+1];const A=g*(f-s)>p*(m-i),S=g*(f-e)-p*(m-t);if(S>0)if(A)a.push(s,i);else{const C=s-e,I=i-t,P=S/(C*g-I*p);if(P>=0&&P<=1){const F=e+C*P,k=t+I*P;a.push(F,k),this.inverseVertices.push(F,k,s,i)}else a.push(s,i)}else if(A){const C=s-e,I=i-t,P=S/(C*g-I*p);if(P>=0&&P<=1){const F=e+C*P,k=t+I*P;this.inverseVertices.push(F,k),a.push(F,k,s,i)}else a.push(s,i)}else this.inverseVertices.push(s,i)}const w=this.inverseVertices.length-b-1;if(w>=6?this.inverseVertices[b]=w:this.inverseVertices.length=b,x===a.length||(a.push(a[0],a[1]),u===h))break;const v=a;a=l,a.length=0,l=v}}makeClockwise(e){const t=e,s=e.length;let i=!0,n=!0,r=0,o=t[s-2],h=t[s-1],l=t[0],a=t[1];for(let d=2;d<s;d+=2){const u=t[d],f=t[d+1];r+=l*f-u*a;const m=(l-o)*(f-a)-(a-h)*(u-l);n=n&&m<=0,i=i&&m>=0,o=l,h=a,l=u,a=f}r+=l*t[1]-t[0]*a;const c=(l-o)*(t[1]-a)-(a-h)*(t[0]-l);if(n=n&&c<=0,i=i&&c>=0,r>=0){for(let d=0,u=s-2,f=s>>1;d<f;d+=2){const m=t[d],p=t[d+1],g=u-d;t[d]=t[g],t[d+1]=t[g+1],t[g]=m,t[g+1]=p}return i}return n}makeConvex(e){const t=e.length,s=e;this.clipOutput.length=t;const i=this.clipOutput;i[0]=s[0],i[1]=s[1];for(let o=2;o<t;o+=2){const h=s[o],l=s[o+1];let a=o-2;for(;a>=0&&(i[a]>h||i[a]===h&&i[a+1]>l);a-=2)i[a+2]=i[a],i[a+3]=i[a+1];i[a+2]=h,i[a+3]=l}s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3];let n=4;for(let o=4;o<t;o+=2,n+=2){const h=i[o],l=i[o+1];for(;(s[n-2]-s[n-4])*(l-s[n-3])-(s[n-1]-s[n-3])*(h-s[n-4])>=0&&(n-=2,n!==2););s[n]=h,s[n+1]=l}s[n]=i[t-4],s[n+1]=i[t-3];const r=n;n+=2;for(let o=t-6;o>=0;o-=2,n+=2){const h=i[o],l=i[o+1];for(;(s[n-2]-s[n-4])*(l-s[n-3])-(s[n-1]-s[n-3])*(h-s[n-4])>=0&&(n-=2,n!==r););s[n]=h,s[n+1]=l}e.length=n-2}},Dr=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new oi,i=typeof e=="string"?JSON.parse(e):e,n=i.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=E(n,"referenceScale",100)*t,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let r=0;r<i.bones.length;r++){const o=i.bones[r];let h=null;const l=E(o,"parent",null);l&&(h=s.findBone(l));const a=new Js(s.bones.length,o.name,h);a.length=E(o,"length",0)*t;const c=a.setupPose;c.x=E(o,"x",0)*t,c.y=E(o,"y",0)*t,c.rotation=E(o,"rotation",0),c.scaleX=E(o,"scaleX",1),c.scaleY=E(o,"scaleY",1),c.shearX=E(o,"shearX",0),c.shearY=E(o,"shearY",0),c.inherit=B.enumValue(Xe,E(o,"inherit","Normal")),a.skinRequired=E(o,"skin",!1);const d=E(o,"color",null);d&&a.color.setFromString(d),a.icon=E(o,"icon",void 0),a.iconSize=E(o,"iconSize",1),a.iconRotation=E(o,"iconRotation",0),s.bones.push(a)}if(i.slots)for(let r=0;r<i.slots.length;r++){const o=i.slots[r],h=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${h}`);const a=new ci(s.slots.length,h,l),c=E(o,"color",null);c&&a.setupPose.color.setFromString(c);const d=E(o,"dark",null);d&&(a.setupPose.darkColor=W.fromString(d)),a.attachmentName=E(o,"attachment",null),a.blendMode=B.enumValue(hi,E(o,"blend","normal")),a.visible=E(o,"visible",!0),s.slots.push(a)}if(i.constraints)for(const r of i.constraints){const o=r.name,h=E(r,"skin",!1);switch(E(r,"type",!1)){case"ik":{const l=new Ae(o);l.skinRequired=h;for(let f=0;f<r.bones.length;f++){const m=s.findBone(r.bones[f]);if(!m)throw new Error(`Couldn't find bone ${r.bones[f]} for IK constraint ${o}.`);l.bones.push(m)}const a=r.target,c=s.findBone(a);if(!c)throw new Error(`Couldn't find target bone ${a} for IK constraint ${o}.`);l.target=c;const d=E(r,"scaleY",null);d!=null&&(l.scaleYMode=B.enumValue(si,d));const u=l.setupPose;u.mix=E(r,"mix",1),u.softness=E(r,"softness",0)*t,u.bendDirection=E(r,"bendPositive",!0)?1:-1,u.compress=E(r,"compress",!1),u.stretch=E(r,"stretch",!1),s.constraints.push(l);break}case"transform":{const l=new ft(o);l.skinRequired=h;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);l.bones.push(y)}const a=r.source,c=s.findBone(a);if(!c)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);l.source=c,l.localSource=E(r,"localSource",!1),l.localTarget=E(r,"localTarget",!1),l.additive=E(r,"additive",!1),l.clamp=E(r,"clamp",!1);let d=!1,u=!1,f=!1,m=!1,p=!1,g=!1;const x=Object.entries(E(r,"properties",{}));for(const[w,v]of x){const y=this.fromProperty(w),T=this.propertyScale(w,t);y.offset=E(v,"offset",0)*T;const A=Object.entries(E(v,"to",{}));for(const[S,C]of A){let I=1,P;switch(S){case"rotate":{d=!0,P=new di;break}case"x":{u=!0,P=new fi,I=t;break}case"y":{f=!0,P=new ui,I=t;break}case"scaleX":{m=!0,P=new mi;break}case"scaleY":{p=!0,P=new gi;break}case"shearY":{g=!0,P=new pi;break}default:throw new Error(`Invalid transform constraint to property: ${S}`)}P.offset=E(C,"offset",0)*I,P.max=E(C,"max",1)*I,P.scale=E(C,"scale",1)*I/T,y.to.push(P)}y.to.length>0&&l.properties.push(y)}l.offsets[ft.ROTATION]=E(r,"rotation",0),l.offsets[ft.X]=E(r,"x",0)*t,l.offsets[ft.Y]=E(r,"y",0)*t,l.offsets[ft.SCALEX]=E(r,"scaleX",0),l.offsets[ft.SCALEY]=E(r,"scaleY",0),l.offsets[ft.SHEARY]=E(r,"shearY",0);const b=l.setupPose;d&&(b.mixRotate=E(r,"mixRotate",1)),u&&(b.mixX=E(r,"mixX",1)),f&&(b.mixY=E(r,"mixY",b.mixX)),m&&(b.mixScaleX=E(r,"mixScaleX",1)),p&&(b.mixScaleY=E(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=E(r,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new Se(o);l.skinRequired=h;for(let u=0;u<r.bones.length;u++){const f=r.bones[u],m=s.findBone(f);if(!m)throw new Error(`Couldn't find bone ${f} for path constraint ${r.name}.`);l.bones.push(m)}const a=r.slot,c=s.findSlot(a);if(!c)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);l.slot=c,l.positionMode=B.enumValue(ii,E(r,"positionMode","Percent")),l.spacingMode=B.enumValue(ni,E(r,"spacingMode","Length")),l.rotateMode=B.enumValue(ri,E(r,"rotateMode","Tangent")),l.offsetRotation=E(r,"rotation",0);const d=l.setupPose;d.position=E(r,"position",0),l.positionMode===0&&(d.position*=t),d.spacing=E(r,"spacing",0),(l.spacingMode===0||l.spacingMode===1)&&(d.spacing*=t),d.mixRotate=E(r,"mixRotate",1),d.mixX=E(r,"mixX",1),d.mixY=E(r,"mixY",d.mixX),s.constraints.push(l);break}case"physics":{const l=new Ce(o);l.skinRequired=h;const a=r.bone,c=s.findBone(a);if(c==null)throw new Error(`Physics bone not found: ${a}`);l.bone=c,l.x=E(r,"x",0),l.y=E(r,"y",0),l.rotate=E(r,"rotate",0),l.scaleX=E(r,"scaleX",0),l.shearX=E(r,"shearX",0),l.limit=E(r,"limit",5e3)*t,l.step=1/E(r,"fps",60);const d=l.setupPose;d.inertia=E(r,"inertia",.5),d.strength=E(r,"strength",100),d.damping=E(r,"damping",.85),d.massInverse=1/E(r,"mass",1),d.wind=E(r,"wind",0),d.gravity=E(r,"gravity",0),d.mix=E(r,"mix",1),l.inertiaGlobal=E(r,"inertiaGlobal",!1),l.strengthGlobal=E(r,"strengthGlobal",!1),l.dampingGlobal=E(r,"dampingGlobal",!1),l.massGlobal=E(r,"massGlobal",!1),l.windGlobal=E(r,"windGlobal",!1),l.gravityGlobal=E(r,"gravityGlobal",!1),l.mixGlobal=E(r,"mixGlobal",!1),s.constraints.push(l);break}case"slider":{const l=new Gt(o);l.skinRequired=h,l.additive=E(r,"additive",!1),l.loop=E(r,"loop",!1),l.setupPose.time=E(r,"time",0),l.setupPose.mix=E(r,"mix",1);const a=r.bone;if(a){if(l.bone=s.findBone(a),!l.bone)throw new Error(`Slider bone not found: ${a}`);const c=r.property;l.property=this.fromProperty(c);const d=this.propertyScale(c,t);l.property.offset=E(r,"from",0)*d,l.offset=E(r,"to",0),l.scale=E(r,"scale",1)/d,l.local=E(r,"local",!1)}s.constraints.push(l);break}}}if(i.skins)for(let r=0;r<i.skins.length;r++){const o=i.skins[r],h=new qe(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){const a=o.bones[l],c=s.findBone(a);if(!c)throw new Error(`Couldn't find bone ${a} for skin ${o.name}.`);h.bones.push(c)}if(o.ik)for(let l=0;l<o.ik.length;l++){const a=o.ik[l],c=s.findConstraint(a,Ae);if(!c)throw new Error(`Couldn't find IK constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.transform)for(let l=0;l<o.transform.length;l++){const a=o.transform[l],c=s.findConstraint(a,ft);if(!c)throw new Error(`Couldn't find transform constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.path)for(let l=0;l<o.path.length;l++){const a=o.path[l],c=s.findConstraint(a,Se);if(!c)throw new Error(`Couldn't find path constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.physics)for(let l=0;l<o.physics.length;l++){const a=o.physics[l],c=s.findConstraint(a,Ce);if(!c)throw new Error(`Couldn't find physics constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}if(o.slider)for(let l=0;l<o.slider.length;l++){const a=o.slider[l],c=s.findConstraint(a,Gt);if(!c)throw new Error(`Couldn't find slider constraint ${a} for skin ${o.name}.`);h.constraints.push(c)}for(const l in o.attachments){const a=s.findSlot(l);if(!a)throw new Error(`Couldn't find skin slot ${l} for skin ${o.name}.`);const c=o.attachments[l];for(const d in c){const u=this.readAttachment(c[d],h,a.index,d,s);u&&h.setAttachment(a.index,d,u)}}s.skins.push(h),h.name==="default"&&(s.defaultSkin=h)}for(let r=0,o=this.linkedMeshes.length;r<o;r++){const h=this.linkedMeshes[r],l=h.skin?s.findSkin(h.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);const a=l.getAttachment(h.sourceIndex,h.source);if(!a)throw new Error(`Source mesh not found: ${h.source}`);h.mesh.timelineAttachment=h.inheritTimelines?a:h.mesh,h.mesh.setSourceMesh(a),h.mesh.updateSequence();t:if(h.inheritTimelines&&h.slotIndex!==h.sourceIndex){const c=a.timelineSlots;for(const u of c)if(u===h.slotIndex)break t;const d=[...c];d[c.length]=h.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,i.events)for(const r in i.events){const o=i.events[r],h=new ei(r),l=h.setupPose;l.intValue=E(o,"int",0),l.floatValue=E(o,"float",0),l.stringValue=E(o,"string",""),h._audioPath=E(o,"audio",null),h.audioPath&&(l.volume=E(o,"volume",l.volume),l.balance=E(o,"balance",l.balance)),s.events.push(h)}if(i.animations)for(const r in i.animations){const o=i.animations[r];this.readAnimation(o,r,s)}if(i.constraints)for(const r in i.constraints){const o=i.constraints[r];if(o.type==="slider"){const h=s.findConstraint(o.name,Gt),l=o.animation,a=s.findAnimation(l);if(!a)throw new Error(`Slider animation not found: ${l}`);h.animation=a}}return s}fromProperty(e){let t;switch(e){case"rotate":t=new _e;break;case"x":t=new Ge;break;case"y":t=new He;break;case"scaleX":t=new je;break;case"scaleY":t=new Ze;break;case"shearY":t=new $e;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,s,i,n){const r=this.scale,o=E(e,"name",i);switch(E(e,"type","region")){case"region":{const h=E(e,"path",o),l=this.readSequence(E(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,i,o,h,l);if(!a)return null;a.path=h,a.x=E(e,"x",0)*r,a.y=E(e,"y",0)*r,a.scaleX=E(e,"scaleX",1),a.scaleY=E(e,"scaleY",1),a.rotation=E(e,"rotation",0),a.width=e.width*r,a.height=e.height*r;const c=E(e,"color",null);return c&&a.color.setFromString(c),a.updateSequence(),a}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(t,i,o);if(!h)return null;this.readVertices(e,h,e.vertexCount<<1);const l=E(e,"color",null);return l&&h.color.setFromString(l),h}case"mesh":case"linkedmesh":{const h=E(e,"path",o),l=this.readSequence(E(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,i,o,h,l);if(!a)return null;a.path=h;const c=E(e,"color",null);c&&a.color.setFromString(c),a.width=E(e,"width",0)*r,a.height=E(e,"height",0)*r;const d=E(e,"source",null);if(d){let f=s;const m=E(e,"slot",null);if(m){const p=n.findSlot(m);if(!p)throw new Error(`Source mesh slot not found: ${m}`);f=p.index}return this.linkedMeshes.push(new Nr(a,E(e,"skin",null),s,f,d,E(e,"timelines",!0))),a}const u=e.uvs;return this.readVertices(e,a,u.length),a.triangles=e.triangles,a.regionUVs=u,a.edges=E(e,"edges",null),a.hullLength=E(e,"hull",0)*2,a.updateSequence(),a}case"path":{const h=this.attachmentLoader.newPathAttachment(t,i,o);if(!h)return null;h.closed=E(e,"closed",!1),h.constantSpeed=E(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,h,l<<1);const a=B.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)a[d]=e.lengths[d]*r;h.lengths=a;const c=E(e,"color",null);return c&&h.color.setFromString(c),h}case"point":{const h=this.attachmentLoader.newPointAttachment(t,i,o);if(!h)return null;h.x=E(e,"x",0)*r,h.y=E(e,"y",0)*r,h.rotation=E(e,"rotation",0);const l=E(e,"color",null);return l&&h.color.setFromString(l),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(t,i,o);if(!h)return null;const l=E(e,"end",null);l&&(h.endSlot=n.findSlot(l)),h.convex=E(e,"convex",!1),h.inverse=E(e,"inverse",!1);const a=e.vertexCount;this.readVertices(e,h,a<<1);const c=E(e,"color",null);return c&&h.color.setFromString(c),h}}return null}readSequence(e){if(e==null)return new ge(1,!1);const t=new ge(E(e,"count",0),!0);return t.start=E(e,"start",1),t.digits=E(e,"digits",0),t.setupIndex=E(e,"setup",0),t}readVertices(e,t,s){const i=this.scale;t.worldVerticesLength=s;const n=e.vertices;if(s===n.length){const h=B.toFloatArray(n);if(i!==1)for(let l=0,a=n.length;l<a;l++)h[l]*=i;t.vertices=h;return}const r=[],o=[];for(let h=0,l=n.length;h<l;){const a=n[h++];o.push(a);for(let c=h+a*4;h<c;h+=4)o.push(n[h]),r.push(n[h+1]*i),r.push(n[h+2]*i),r.push(n[h+3])}t.bones=o,t.vertices=B.toFloatArray(r)}readAnimation(e,t,s){const i=this.scale,n=[];if(e.slots)for(const l in e.slots){const a=e.slots[l],c=s.findSlot(l);if(!c)throw new Error(`Slot not found: ${l}`);const d=c.index;for(const u in a){const f=a[u];if(!f)continue;const m=f.length;switch(u){case"attachment":{const p=new ne(m,d);for(let g=0;g<m;g++){const x=f[g];p.setFrame(g,E(x,"time",0),E(x,"name",null))}n.push(p);break}case"rgba":{const p=new Is(m,m<<2,d);let g=f[0],x=E(g,"time",0),b=W.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=f[w+1];if(!y){p.shrink(v);break}const T=E(y,"time",0),A=W.fromString(y.color),S=g.curve;S&&(v=dt(S,p,v,w,0,x,T,b.r,A.r,1),v=dt(S,p,v,w,1,x,T,b.g,A.g,1),v=dt(S,p,v,w,2,x,T,b.b,A.b,1),v=dt(S,p,v,w,3,x,T,b.a,A.a,1)),x=T,b=A,g=y}n.push(p);break}case"rgb":{const p=new Ms(m,m*3,d);let g=f[0],x=E(g,"time",0),b=W.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=f[w+1];if(!y){p.shrink(v);break}const T=E(y,"time",0),A=W.fromString(y.color),S=g.curve;S&&(v=dt(S,p,v,w,0,x,T,b.r,A.r,1),v=dt(S,p,v,w,1,x,T,b.g,A.g,1),v=dt(S,p,v,w,2,x,T,b.b,A.b,1)),x=T,b=A,g=y}n.push(p);break}case"alpha":{It(n,f,new Es(m,m,d),0,1);break}case"rgba2":{const p=new Ps(m,m*7,d);let g=f[0],x=E(g,"time",0),b=W.fromString(g.light),w=W.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const A=E(T,"time",0),S=W.fromString(T.light),C=W.fromString(T.dark),I=g.curve;I&&(y=dt(I,p,y,v,0,x,A,b.r,S.r,1),y=dt(I,p,y,v,1,x,A,b.g,S.g,1),y=dt(I,p,y,v,2,x,A,b.b,S.b,1),y=dt(I,p,y,v,3,x,A,b.a,S.a,1),y=dt(I,p,y,v,4,x,A,w.r,C.r,1),y=dt(I,p,y,v,5,x,A,w.g,C.g,1),y=dt(I,p,y,v,6,x,A,w.b,C.b,1)),x=A,b=S,w=C,g=T}n.push(p);break}case"rgb2":{const p=new Rs(m,m*6,d);let g=f[0],x=E(g,"time",0),b=W.fromString(g.light),w=W.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const A=E(T,"time",0),S=W.fromString(T.light),C=W.fromString(T.dark),I=g.curve;I&&(y=dt(I,p,y,v,0,x,A,b.r,S.r,1),y=dt(I,p,y,v,1,x,A,b.g,S.g,1),y=dt(I,p,y,v,2,x,A,b.b,S.b,1),y=dt(I,p,y,v,3,x,A,w.r,C.r,1),y=dt(I,p,y,v,4,x,A,w.g,C.g,1),y=dt(I,p,y,v,5,x,A,w.b,C.b,1)),x=A,b=S,w=C,g=T}n.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${f.name} (${a.name})`)}}}if(e.bones)for(const l in e.bones){const a=e.bones[l],c=s.findBone(l);if(!c)throw new Error(`Bone not found: ${l}`);const d=c.index;for(const u in a){const f=a[u],m=f.length;if(m!==0)switch(u){case"rotate":It(n,f,new xe(m,m,d),0,1);break;case"translate":bi(n,f,new ps(m,m<<1,d),"x","y",0,i);break;case"translatex":It(n,f,new xs(m,m,d),0,i);break;case"translatey":It(n,f,new bs(m,m,d),0,i);break;case"scale":bi(n,f,new ws(m,m<<1,d),"x","y",1,1);break;case"scalex":It(n,f,new ys(m,m,d),1,1);break;case"scaley":It(n,f,new vs(m,m,d),1,1);break;case"shear":bi(n,f,new Ts(m,m<<1,d),"x","y",0,1);break;case"shearx":It(n,f,new As(m,m,d),0,1);break;case"sheary":It(n,f,new Ss(m,m,d),0,1);break;case"inherit":{const p=new Cs(m,c.index);for(let g=0;g<f.length;g++){const x=f[g];p.setFrame(g,E(x,"time",0),B.enumValue(Xe,E(x,"inherit","Normal")))}n.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${f.name} (${a.name})`)}}}if(e.ik)for(const l in e.ik){const a=e.ik[l];let c=a[0];if(!c)continue;const d=s.findConstraint(l,Ae);if(!d)throw new Error(`IK Constraint not found: ${l}`);const u=new Ls(a.length,a.length<<1,s.constraints.indexOf(d));let f=E(c,"time",0),m=E(c,"mix",1),p=E(c,"softness",0)*i;for(let g=0,x=0;;g++){u.setFrame(g,f,m,p,E(c,"bendPositive",!0)?1:-1,E(c,"compress",!1),E(c,"stretch",!1));const b=a[g+1];if(!b){u.shrink(x);break}const w=E(b,"time",0),v=E(b,"mix",1),y=E(b,"softness",0)*i,T=c.curve;T&&(x=dt(T,u,x,g,0,f,w,m,v,1),x=dt(T,u,x,g,1,f,w,p,y,i)),f=w,m=v,p=y,c=b}n.push(u)}if(e.transform)for(const l in e.transform){const a=e.transform[l];let c=a[0];if(!c)continue;const d=s.findConstraint(l,ft);if(!d)throw new Error(`Transform constraint not found: ${l}`);const u=new Xs(a.length,a.length*6,s.constraints.indexOf(d));let f=E(c,"time",0),m=E(c,"mixRotate",1),p=E(c,"mixX",1),g=E(c,"mixY",p),x=E(c,"mixScaleX",1),b=E(c,"mixScaleY",1);const w=E(c,"mixShearY",1);for(let v=0,y=0;;v++){u.setFrame(v,f,m,p,g,x,b,w);const T=a[v+1];if(!T){u.shrink(y);break}const A=E(T,"time",0),S=E(T,"mixRotate",1),C=E(T,"mixX",1),I=E(T,"mixY",C),P=E(T,"mixScaleX",1),F=E(T,"mixScaleY",1),k=E(T,"mixShearY",1),X=c.curve;X&&(y=dt(X,u,y,v,0,f,A,m,S,1),y=dt(X,u,y,v,1,f,A,p,C,1),y=dt(X,u,y,v,2,f,A,g,I,1),y=dt(X,u,y,v,3,f,A,x,P,1),y=dt(X,u,y,v,4,f,A,b,F,1),y=dt(X,u,y,v,5,f,A,w,k,1)),f=A,m=S,p=C,g=I,x=P,b=F,x=P,c=T}n.push(u)}if(e.path)for(const l in e.path){const a=e.path[l],c=s.findConstraint(l,Se);if(!c)throw new Error(`Path constraint not found: ${l}`);const d=s.constraints.indexOf(c);for(const u in a){const f=a[u];let m=f[0];if(!m)continue;const p=f.length;switch(u){case"position":{const g=new ks(p,p,d);It(n,f,g,0,c.positionMode===0?i:1);break}case"spacing":{const g=new Vs(p,p,d);It(n,f,g,0,c.spacingMode===0||c.spacingMode===1?i:1);break}case"mix":{const g=new Bs(p,p*3,d);let x=E(m,"time",0),b=E(m,"mixRotate",1),w=E(m,"mixX",1),v=E(m,"mixY",w);for(let y=0,T=0;;y++){g.setFrame(y,x,b,w,v);const A=f[y+1];if(!A){g.shrink(T);break}const S=E(A,"time",0),C=E(A,"mixRotate",1),I=E(A,"mixX",1),P=E(A,"mixY",I),F=m.curve;F&&(T=dt(F,g,T,y,0,x,S,b,C,1),T=dt(F,g,T,y,1,x,S,w,I,1),T=dt(F,g,T,y,2,x,S,v,P,1)),x=S,b=C,w=I,v=P,m=A}n.push(g);break}}}}if(e.physics)for(const l in e.physics){const a=e.physics[l];let c=-1;if(l.length>0){const d=s.findConstraint(l,Ce);if(!d)throw new Error(`Physics constraint not found: ${l}`);c=s.constraints.indexOf(d)}for(const d in a){const u=a[d];let f=u[0];if(!f)continue;const m=u.length;let p,g=0;if(d==="reset"){const x=new _s(m,c);for(let b=0;f!=null;f=u[b+1],b++)x.setFrame(b,E(f,"time",0));n.push(x);continue}switch(d){case"inertia":p=new Os(m,m,c);break;case"strength":p=new Ds(m,m,c);break;case"damping":p=new Ns(m,m,c);break;case"mass":p=new Us(m,m,c);break;case"wind":p=new zs(m,m,c);break;case"gravity":p=new qs(m,m,c);break;case"mix":{g=1,p=new Ws(m,m,c);break}default:continue}It(n,u,p,g,1)}}if(e.slider)for(const l in e.slider){const a=e.slider[l],c=s.findConstraint(l,Gt);if(!c)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(c);for(const u in a){const f=a[u];if(!f[0])continue;const p=f.length;switch(u){case"time":It(n,f,new Gs(p,p,d),1,1);break;case"mix":It(n,f,new Hs(p,p,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const a=e.attachments[l],c=s.findSkin(l);if(!c)throw new Error(`Skin not found: ${l}`);for(const d in a){const u=a[d],f=s.findSlot(d);if(!f)throw new Error(`Attachment slot not found: ${d}`);const m=f.index;for(const p in u){const g=u[p],x=c.getAttachment(m,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let v=w[0];if(v){if(b==="deform"){const y=x.bones,T=x.vertices,A=y?T.length/3*2:T.length,S=new Fs(w.length,w.length,m,x);let C=E(v,"time",0);for(let I=0,P=0;;I++){let F;const k=E(v,"vertices",null);if(!k)F=y?B.newFloatArray(A):T;else{F=B.newFloatArray(A);const ot=E(v,"offset",0);if(B.arrayCopy(k,0,F,ot,k.length),i!==1)for(let D=ot,L=D+k.length;D<L;D++)F[D]*=i;if(!y)for(let D=0;D<A;D++)F[D]+=T[D]}S.setFrame(I,C,F);const X=w[I+1];if(!X){S.shrink(P);break}const R=E(X,"time",0),V=v.curve;V&&(P=dt(V,S,P,I,0,C,R,0,1,1)),C=R,v=X}n.push(S)}else if(b==="sequence"){const y=new Ys(w.length,m,x);let T=0;for(let A=0;A<w.length;A++){const S=E(v,"delay",T),C=E(v,"time",0),I=ms[E(v,"mode","hold")],P=E(v,"index",0);y.setFrame(A,C,I,P,S),T=S,v=w[A+1]}n.push(y)}}}}}}if(e.drawOrder){const l=new Zt(e.drawOrder.length),a=s.slots.length;let c=0;for(const d of e.drawOrder)l.setFrame(c++,E(d,"time",0),ln(s,d,a,null));n.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const a=E(l,"slots",[]),c=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);c[d++]=g.index}const u=E(l,"keys",[]),f=new we(u.length,c,s.slots.length);let m=0;for(const p of u)f.setFrame(m++,E(p,"time",0),ln(s,p,c.length,c));n.push(f)}if(e.events){const l=new Fe(e.events.length);let a=0;for(let c=0;c<e.events.length;c++,a++){const d=e.events[c],u=s.findEvent(d.name);if(!u)throw new Error(`Event not found: ${d.name}`);const f=u.setupPose,m=new Be(B.toSinglePrecision(E(d,"time",0)),u);m.intValue=E(d,"int",f.intValue),m.floatValue=E(d,"float",f.floatValue),m.stringValue=E(d,"string",f.stringValue),m.data.audioPath&&(m.volume=E(d,"volume",f.volume),m.balance=E(d,"balance",f.volume)),l.setFrame(a,m)}n.push(l)}let r=0;for(let l=0,a=n.length;l<a;l++)r=Math.max(r,n[l].getDuration());const o=new Pe(t,n,r),h=E(e,"color",null);h!==null&&o.color.setFromString(h),s.animations.push(o)}},Nr=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,i,n,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.sourceIndex=i,this.source=n,this.inheritTimelines=r}};function It(e,t,s,i,n){let r=t[0],o=r.time??0,h=(r.value??i)*n,l=0;for(let a=0;;a++){s.setFrame(a,o,h);const c=t[a+1];if(!c){s.shrink(l),e.push(s);return}const d=c.time??0,u=(c.value??i)*n;r.curve&&(l=dt(r.curve,s,l,a,0,o,d,h,u,n)),o=d,h=u,r=c}}function bi(e,t,s,i,n,r,o){let h=t[0],l=h.time??0,a=(h[i]??r)*o,c=(h[n]??r)*o,d=0;for(let u=0;;u++){s.setFrame(u,l,a,c);const f=t[u+1];if(!f){s.shrink(d),e.push(s);return}const m=f.time??0,p=(f[i]??r)*o,g=(f[n]??r)*o,x=h.curve;x&&(d=dt(x,s,d,u,0,l,m,a,p,o),d=dt(x,s,d,u,1,l,m,c,g,o)),l=m,a=p,c=g,h=f}}function ln(e,t,s,i){const n=t.offsets;if(!n)return null;const r=new Array(s).fill(-1),o=new Array(s-n.length);let h=0,l=0;for(const a of n){const c=e.findSlot(a.slot);if(c==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!i)d=c.index;else{d=-1;for(let u=0;u<s;u++)if(i[u]===c.index){d=u;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;h!==d;)o[l++]=h++;r[h+a.offset]=h++}for(;h<s;)o[l++]=h++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=o[--l]);return r}function dt(e,t,s,i,n,r,o,h,l,a){if(e==="stepped")return t.setStepped(i),s;const c=n<<2,d=e[c],u=e[c+1]*a,f=e[c+2],m=e[c+3]*a;return t.setBezier(s,i,n,r,h,d,u,f,m,o,l),s+1}function E(e,t,s){return e[t]!==void 0?e[t]:s}var Ur=class{commandPool=new zr;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new xi;renderCommands=[];render(e,t=!1,s,i=2){this.commandPool.reset(),this.renderCommands.length=0;const n=this.clipping,r=e.drawOrder.appliedPose;for(let o=0;o<e.slots.length;o++){const h=r[o],l=h.appliedPose.attachment;if(!l){n.clipEnd(h);continue}const a=h.appliedPose,c=a.color;if((c.a===0||!h.bone.active)&&!(l instanceof $t)){n.clipEnd(h);continue}let u,f,m,p,g,x,b;if(l instanceof qt){if(x=l.color,x.a===0){n.clipEnd(h);continue}const A=l.sequence,S=A.resolveIndex(a);l.computeWorldVertices(h,l.getOffsets(a),this.worldVertices,0,i),u=this.worldVertices,f=4,m=A.getUVs(S),p=this.quadIndices,g=6,b=A.regions[S]?.texture}else if(l instanceof Ot){if(x=l.color,x.a===0){n.clipEnd(h);continue}this.worldVertices.length<l.worldVerticesLength&&(this.worldVertices=new Float32Array(l.worldVerticesLength)),l.computeWorldVertices(e,h,0,l.worldVerticesLength,this.worldVertices,0,i),u=this.worldVertices,f=l.worldVerticesLength>>1;const A=l.sequence,S=A.resolveIndex(a);m=A.getUVs(S),p=l.triangles,g=p.length,b=A.regions[S]?.texture}else if(l instanceof $t){n.clipStart(e,h,l);continue}else continue;const w=e.color;let v,y;if(t){let A;if(s){A=Math.floor(s[3]*w.a*c.a*x.a*255);const S=Math.floor(A*s[0]*w.r*c.r*x.r),C=Math.floor(A*s[1]*w.g*c.g*x.g),I=Math.floor(A*s[2]*w.b*c.b*x.b);v=A<<24|S<<16|C<<8|I}else{A=Math.floor(w.a*c.a*x.a*255);const S=Math.floor(A*w.r*c.r*x.r),C=Math.floor(A*w.g*c.g*x.g),I=Math.floor(A*w.b*c.b*x.b);v=A<<24|S<<16|C<<8|I}if(y=4278190080,a.darkColor){const{r:S,g:C,b:I}=a.darkColor;y=4278190080|Math.floor(S*A)<<16|Math.floor(C*A)<<8|Math.floor(I*A)}}else{if(s){const A=Math.floor(s[3]*w.a*c.a*x.a*255),S=Math.floor(s[0]*w.r*c.r*x.r*255),C=Math.floor(s[1]*w.g*c.g*x.g*255),I=Math.floor(s[2]*w.b*c.b*x.b*255);v=A<<24|S<<16|C<<8|I}else{const A=Math.floor(w.a*c.a*x.a*255),S=Math.floor(w.r*c.r*x.r*255),C=Math.floor(w.g*c.g*x.g*255),I=Math.floor(w.b*c.b*x.b*255);v=A<<24|S<<16|C<<8|I}if(y=0,a.darkColor){const{r:A,g:S,b:C}=a.darkColor;y=Math.floor(A*255)<<16|Math.floor(S*255)<<8|Math.floor(C*255)}}n.isClipping()&&(n.clipTrianglesUnpacked(u,0,p,g,m,i),u=n.clippedVerticesTyped,f=n.clippedVerticesLength/i,m=n.clippedUVsTyped,p=n.clippedTrianglesTyped,g=n.clippedTrianglesLength);const T=this.commandPool.getCommand(f,g,i);T.blendMode=h.data.blendMode,T.texture=b,T.positions.set(u.subarray(0,f*i)),T.uvs.set(m.subarray(0,f<<1));for(let A=0;A<f;A++)T.colors[A]=v,T.darkColors[A]=y;p instanceof Uint16Array?T.indices.set(p.subarray(0,g)):T.indices.set(p.slice(0,g)),this.renderCommands.push(T),n.clipEnd(h)}return n.clipEnd(),this.batchCommands(i)}batchSubCommands(e,t,s,i,n,r){const o=e[t],h=this.commandPool.getCommand(i,n,r);h.blendMode=o.blendMode,h.texture=o.texture;let l=0,a=0,c=0,d=0,u=0;for(let f=t;f<=s;f++){const m=e[f];h.positions.set(m.positions,l),l+=m.numVertices*r,h.uvs.set(m.uvs,a),a+=m.numVertices<<1,h.colors.set(m.colors,c),h.darkColors.set(m.darkColors,c),c+=m.numVertices;for(let p=0;p<m.numIndices;p++)h.indices[d+p]=m.indices[p]+u;d+=m.numIndices,u+=m.numVertices}return h}batchCommands(e){if(this.renderCommands.length===0)return;let t,s,i=this.renderCommands[0],n=0,r=1,o=i.numVertices,h=i.numIndices;for(;r<=this.renderCommands.length;){const l=r<this.renderCommands.length?this.renderCommands[r]:null;if(l&&l.numVertices===0&&l.numIndices===0){r++;continue}if(l!==null&&l.texture===i.texture&&l.blendMode===i.blendMode&&l.colors[0]===i.colors[0]&&l.darkColors[0]===i.darkColors[0]&&h+l.numIndices<65535)o+=l.numVertices,h+=l.numIndices;else{const c=this.batchSubCommands(this.renderCommands,n,r-1,o,h,e);if(s?(s.next=c,s=c):t=s=c,r===this.renderCommands.length)break;i=this.renderCommands[r],n=r,o=i.numVertices,h=i.numIndices}r++}return t}},zr=class{pool=[];inUse=[];getCommand(e,t,s){let i;for(const n of this.pool)if(n._positions.length>=e*s&&n._indices.length>=t){i=n;break}if(i)this.pool.splice(this.pool.indexOf(i),1),i.next=void 0,i.numVertices=e,i.numIndices=t,i.positions=i._positions.subarray(0,e*s),i.uvs=i._uvs.subarray(0,e<<1),i.colors=i._colors.subarray(0,e),i.darkColors=i._darkColors.subarray(0,e),i.indices=i._indices.subarray(0,t);else{const n=new Float32Array(e*s),r=new Float32Array(e<<1),o=new Uint32Array(e),h=new Uint32Array(e),l=new Uint16Array(t);i={positions:n,uvs:r,colors:o,darkColors:h,indices:l,_positions:n,_uvs:r,_colors:o,_darkColors:h,_indices:l,numVertices:e,numIndices:t,blendMode:0,texture:null}}return this.inUse.push(i),i}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},vt=class{canvas;gl;restorables=[];constructor(e,t={alpha:!0}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{const s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=e=>{e&&e.preventDefault()};contextRestoredHandler=()=>{for(let e=0,t=this.restorables.length;e<t;e++)this.restorables[e].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(e){this.restorables.push(e)}removeRestorable(e){const t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},le=class Ri extends hs{context;texture=null;boundUnit=0;pma;useMipMaps;constructor(t,s,i,n=!1){super(s),this.context=t instanceof vt?t:new vt(t),this.pma=i,this.useMipMaps=n,this.restore(),this.context.addRestorable(this)}setFilters(t,s){const i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Ri.validateMagFilter(s)),this.useMipMaps=Ri.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case 9987:case 9985:case 9986:case 9984:return 9729;default:return t}}static usesMipMaps(t){switch(t){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(t,s){const i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(t){const s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind();const i=s.getParameter(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!this.pma),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,t?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),t&&s.generateMipmap(s.TEXTURE_2D),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){const s=this.context.gl;this.boundUnit=t,s.activeTexture(s.TEXTURE0+t),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){const t=this.context.gl;t.activeTexture(t.TEXTURE0+this.boundUnit),t.bindTexture(t.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},cn=class extends _i{constructor(e,t="",s=new $s){super((i,n=!1)=>new le(e,i,n),t,s)}},Et=class{x=0;y=0;z=0;constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,s){return this.x=e,this.y=t,this.z=s,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}normalize(){let e=this.length();return e===0?this:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this)}cross(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}multiply(e){const t=e.values;return this.set(this.x*t[_]+this.y*t[K]+this.z*t[J]+t[G],this.x*t[Q]+this.y*t[H]+this.z*t[tt]+t[j],this.x*t[et]+this.y*t[st]+this.z*t[Z]+t[$])}project(e){const t=e.values,s=1/(this.x*t[nt]+this.y*t[rt]+this.z*t[at]+t[it]);return this.set((this.x*t[_]+this.y*t[K]+this.z*t[J]+t[G])*s,(this.x*t[Q]+this.y*t[H]+this.z*t[tt]+t[j])*s,(this.x*t[et]+this.y*t[st]+this.z*t[Z]+t[$])*s)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(e){const t=e.x-this.x,s=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+s*s+i*i)}},_=0,K=4,J=8,G=12,Q=1,H=5,tt=9,j=13,et=2,st=6,Z=10,$=14,nt=3,rt=7,at=11,it=15,Ie=class Xt{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new Et;static yAxis=new Et;static zAxis=new Et;static tmpMatrix=new Xt;constructor(){const t=this.values;t[_]=1,t[H]=1,t[Z]=1,t[it]=1}set(t){return this.values.set(t),this}transpose(){const t=this.temp,s=this.values;return t[_]=s[_],t[K]=s[Q],t[J]=s[et],t[G]=s[nt],t[Q]=s[K],t[H]=s[H],t[tt]=s[st],t[j]=s[rt],t[et]=s[J],t[st]=s[tt],t[Z]=s[Z],t[$]=s[at],t[nt]=s[G],t[rt]=s[j],t[at]=s[$],t[it]=s[it],this.set(t)}identity(){const t=this.values;return t[_]=1,t[K]=0,t[J]=0,t[G]=0,t[Q]=0,t[H]=1,t[tt]=0,t[j]=0,t[et]=0,t[st]=0,t[Z]=1,t[$]=0,t[nt]=0,t[rt]=0,t[at]=0,t[it]=1,this}invert(){const t=this.values,s=this.temp,i=t[nt]*t[st]*t[tt]*t[G]-t[et]*t[rt]*t[tt]*t[G]-t[nt]*t[H]*t[Z]*t[G]+t[Q]*t[rt]*t[Z]*t[G]+t[et]*t[H]*t[at]*t[G]-t[Q]*t[st]*t[at]*t[G]-t[nt]*t[st]*t[J]*t[j]+t[et]*t[rt]*t[J]*t[j]+t[nt]*t[K]*t[Z]*t[j]-t[_]*t[rt]*t[Z]*t[j]-t[et]*t[K]*t[at]*t[j]+t[_]*t[st]*t[at]*t[j]+t[nt]*t[H]*t[J]*t[$]-t[Q]*t[rt]*t[J]*t[$]-t[nt]*t[K]*t[tt]*t[$]+t[_]*t[rt]*t[tt]*t[$]+t[Q]*t[K]*t[at]*t[$]-t[_]*t[H]*t[at]*t[$]-t[et]*t[H]*t[J]*t[it]+t[Q]*t[st]*t[J]*t[it]+t[et]*t[K]*t[tt]*t[it]-t[_]*t[st]*t[tt]*t[it]-t[Q]*t[K]*t[Z]*t[it]+t[_]*t[H]*t[Z]*t[it];if(i===0)throw new Error("non-invertible matrix");const n=1/i;return s[_]=t[tt]*t[$]*t[rt]-t[j]*t[Z]*t[rt]+t[j]*t[st]*t[at]-t[H]*t[$]*t[at]-t[tt]*t[st]*t[it]+t[H]*t[Z]*t[it],s[K]=t[G]*t[Z]*t[rt]-t[J]*t[$]*t[rt]-t[G]*t[st]*t[at]+t[K]*t[$]*t[at]+t[J]*t[st]*t[it]-t[K]*t[Z]*t[it],s[J]=t[J]*t[j]*t[rt]-t[G]*t[tt]*t[rt]+t[G]*t[H]*t[at]-t[K]*t[j]*t[at]-t[J]*t[H]*t[it]+t[K]*t[tt]*t[it],s[G]=t[G]*t[tt]*t[st]-t[J]*t[j]*t[st]-t[G]*t[H]*t[Z]+t[K]*t[j]*t[Z]+t[J]*t[H]*t[$]-t[K]*t[tt]*t[$],s[Q]=t[j]*t[Z]*t[nt]-t[tt]*t[$]*t[nt]-t[j]*t[et]*t[at]+t[Q]*t[$]*t[at]+t[tt]*t[et]*t[it]-t[Q]*t[Z]*t[it],s[H]=t[J]*t[$]*t[nt]-t[G]*t[Z]*t[nt]+t[G]*t[et]*t[at]-t[_]*t[$]*t[at]-t[J]*t[et]*t[it]+t[_]*t[Z]*t[it],s[tt]=t[G]*t[tt]*t[nt]-t[J]*t[j]*t[nt]-t[G]*t[Q]*t[at]+t[_]*t[j]*t[at]+t[J]*t[Q]*t[it]-t[_]*t[tt]*t[it],s[j]=t[J]*t[j]*t[et]-t[G]*t[tt]*t[et]+t[G]*t[Q]*t[Z]-t[_]*t[j]*t[Z]-t[J]*t[Q]*t[$]+t[_]*t[tt]*t[$],s[et]=t[H]*t[$]*t[nt]-t[j]*t[st]*t[nt]+t[j]*t[et]*t[rt]-t[Q]*t[$]*t[rt]-t[H]*t[et]*t[it]+t[Q]*t[st]*t[it],s[st]=t[G]*t[st]*t[nt]-t[K]*t[$]*t[nt]-t[G]*t[et]*t[rt]+t[_]*t[$]*t[rt]+t[K]*t[et]*t[it]-t[_]*t[st]*t[it],s[Z]=t[K]*t[j]*t[nt]-t[G]*t[H]*t[nt]+t[G]*t[Q]*t[rt]-t[_]*t[j]*t[rt]-t[K]*t[Q]*t[it]+t[_]*t[H]*t[it],s[$]=t[G]*t[H]*t[et]-t[K]*t[j]*t[et]-t[G]*t[Q]*t[st]+t[_]*t[j]*t[st]+t[K]*t[Q]*t[$]-t[_]*t[H]*t[$],s[nt]=t[tt]*t[st]*t[nt]-t[H]*t[Z]*t[nt]-t[tt]*t[et]*t[rt]+t[Q]*t[Z]*t[rt]+t[H]*t[et]*t[at]-t[Q]*t[st]*t[at],s[rt]=t[K]*t[Z]*t[nt]-t[J]*t[st]*t[nt]+t[J]*t[et]*t[rt]-t[_]*t[Z]*t[rt]-t[K]*t[et]*t[at]+t[_]*t[st]*t[at],s[at]=t[J]*t[H]*t[nt]-t[K]*t[tt]*t[nt]-t[J]*t[Q]*t[rt]+t[_]*t[tt]*t[rt]+t[K]*t[Q]*t[at]-t[_]*t[H]*t[at],s[it]=t[K]*t[tt]*t[et]-t[J]*t[H]*t[et]+t[J]*t[Q]*t[st]-t[_]*t[tt]*t[st]-t[K]*t[Q]*t[Z]+t[_]*t[H]*t[Z],t[_]=s[_]*n,t[K]=s[K]*n,t[J]=s[J]*n,t[G]=s[G]*n,t[Q]=s[Q]*n,t[H]=s[H]*n,t[tt]=s[tt]*n,t[j]=s[j]*n,t[et]=s[et]*n,t[st]=s[st]*n,t[Z]=s[Z]*n,t[$]=s[$]*n,t[nt]=s[nt]*n,t[rt]=s[rt]*n,t[at]=s[at]*n,t[it]=s[it]*n,this}determinant(){const t=this.values;return t[nt]*t[st]*t[tt]*t[G]-t[et]*t[rt]*t[tt]*t[G]-t[nt]*t[H]*t[Z]*t[G]+t[Q]*t[rt]*t[Z]*t[G]+t[et]*t[H]*t[at]*t[G]-t[Q]*t[st]*t[at]*t[G]-t[nt]*t[st]*t[J]*t[j]+t[et]*t[rt]*t[J]*t[j]+t[nt]*t[K]*t[Z]*t[j]-t[_]*t[rt]*t[Z]*t[j]-t[et]*t[K]*t[at]*t[j]+t[_]*t[st]*t[at]*t[j]+t[nt]*t[H]*t[J]*t[$]-t[Q]*t[rt]*t[J]*t[$]-t[nt]*t[K]*t[tt]*t[$]+t[_]*t[rt]*t[tt]*t[$]+t[Q]*t[K]*t[at]*t[$]-t[_]*t[H]*t[at]*t[$]-t[et]*t[H]*t[J]*t[it]+t[Q]*t[st]*t[J]*t[it]+t[et]*t[K]*t[tt]*t[it]-t[_]*t[st]*t[tt]*t[it]-t[Q]*t[K]*t[Z]*t[it]+t[_]*t[H]*t[Z]*t[it]}translate(t,s,i){const n=this.values;return n[G]+=t,n[j]+=s,n[$]+=i,this}copy(){return new Xt().set(this.values)}projection(t,s,i,n){this.identity();const r=1/Math.tan(i*(Math.PI/180)/2),o=(s+t)/(t-s),h=2*s*t/(t-s),l=this.values;return l[_]=r/n,l[Q]=0,l[et]=0,l[nt]=0,l[K]=0,l[H]=r,l[st]=0,l[rt]=0,l[J]=0,l[tt]=0,l[Z]=o,l[at]=-1,l[G]=0,l[j]=0,l[$]=h,l[it]=0,this}ortho2d(t,s,i,n){return this.ortho(t,t+i,s,s+n,0,1)}ortho(t,s,i,n,r,o){this.identity();const h=2/(s-t),l=2/(n-i),a=-2/(o-r),c=-(s+t)/(s-t),d=-(n+i)/(n-i),u=-(o+r)/(o-r),f=this.values;return f[_]=h,f[Q]=0,f[et]=0,f[nt]=0,f[K]=0,f[H]=l,f[st]=0,f[rt]=0,f[J]=0,f[tt]=0,f[Z]=a,f[at]=0,f[G]=c,f[j]=d,f[$]=u,f[it]=1,this}multiply(t){const s=this.temp,i=this.values,n=t.values;return s[_]=i[_]*n[_]+i[K]*n[Q]+i[J]*n[et]+i[G]*n[nt],s[K]=i[_]*n[K]+i[K]*n[H]+i[J]*n[st]+i[G]*n[rt],s[J]=i[_]*n[J]+i[K]*n[tt]+i[J]*n[Z]+i[G]*n[at],s[G]=i[_]*n[G]+i[K]*n[j]+i[J]*n[$]+i[G]*n[it],s[Q]=i[Q]*n[_]+i[H]*n[Q]+i[tt]*n[et]+i[j]*n[nt],s[H]=i[Q]*n[K]+i[H]*n[H]+i[tt]*n[st]+i[j]*n[rt],s[tt]=i[Q]*n[J]+i[H]*n[tt]+i[tt]*n[Z]+i[j]*n[at],s[j]=i[Q]*n[G]+i[H]*n[j]+i[tt]*n[$]+i[j]*n[it],s[et]=i[et]*n[_]+i[st]*n[Q]+i[Z]*n[et]+i[$]*n[nt],s[st]=i[et]*n[K]+i[st]*n[H]+i[Z]*n[st]+i[$]*n[rt],s[Z]=i[et]*n[J]+i[st]*n[tt]+i[Z]*n[Z]+i[$]*n[at],s[$]=i[et]*n[G]+i[st]*n[j]+i[Z]*n[$]+i[$]*n[it],s[nt]=i[nt]*n[_]+i[rt]*n[Q]+i[at]*n[et]+i[it]*n[nt],s[rt]=i[nt]*n[K]+i[rt]*n[H]+i[at]*n[st]+i[it]*n[rt],s[at]=i[nt]*n[J]+i[rt]*n[tt]+i[at]*n[Z]+i[it]*n[at],s[it]=i[nt]*n[G]+i[rt]*n[j]+i[at]*n[$]+i[it]*n[it],this.set(this.temp)}multiplyLeft(t){const s=this.temp,i=this.values,n=t.values;return s[_]=n[_]*i[_]+n[K]*i[Q]+n[J]*i[et]+n[G]*i[nt],s[K]=n[_]*i[K]+n[K]*i[H]+n[J]*i[st]+n[G]*i[rt],s[J]=n[_]*i[J]+n[K]*i[tt]+n[J]*i[Z]+n[G]*i[at],s[G]=n[_]*i[G]+n[K]*i[j]+n[J]*i[$]+n[G]*i[it],s[Q]=n[Q]*i[_]+n[H]*i[Q]+n[tt]*i[et]+n[j]*i[nt],s[H]=n[Q]*i[K]+n[H]*i[H]+n[tt]*i[st]+n[j]*i[rt],s[tt]=n[Q]*i[J]+n[H]*i[tt]+n[tt]*i[Z]+n[j]*i[at],s[j]=n[Q]*i[G]+n[H]*i[j]+n[tt]*i[$]+n[j]*i[it],s[et]=n[et]*i[_]+n[st]*i[Q]+n[Z]*i[et]+n[$]*i[nt],s[st]=n[et]*i[K]+n[st]*i[H]+n[Z]*i[st]+n[$]*i[rt],s[Z]=n[et]*i[J]+n[st]*i[tt]+n[Z]*i[Z]+n[$]*i[at],s[$]=n[et]*i[G]+n[st]*i[j]+n[Z]*i[$]+n[$]*i[it],s[nt]=n[nt]*i[_]+n[rt]*i[Q]+n[at]*i[et]+n[it]*i[nt],s[rt]=n[nt]*i[K]+n[rt]*i[H]+n[at]*i[st]+n[it]*i[rt],s[at]=n[nt]*i[J]+n[rt]*i[tt]+n[at]*i[Z]+n[it]*i[at],s[it]=n[nt]*i[G]+n[rt]*i[j]+n[at]*i[$]+n[it]*i[it],this.set(this.temp)}lookAt(t,s,i){const n=Xt.xAxis,r=Xt.yAxis,o=Xt.zAxis;o.setFrom(s).normalize(),n.setFrom(s).normalize(),n.cross(i).normalize(),r.setFrom(n).cross(o).normalize(),this.identity();const h=this.values;return h[_]=n.x,h[K]=n.y,h[J]=n.z,h[Q]=r.x,h[H]=r.y,h[tt]=r.z,h[et]=-o.x,h[st]=-o.y,h[Z]=-o.z,Xt.tmpMatrix.identity(),Xt.tmpMatrix.values[G]=-t.x,Xt.tmpMatrix.values[j]=-t.y,Xt.tmpMatrix.values[$]=-t.z,this.multiply(Xt.tmpMatrix),this}},hn=class{position=new Et(0,0,0);direction=new Et(0,0,-1);up=new Et(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Ie;inverseProjectionView=new Ie;projection=new Ie;view=new Ie;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){const e=this.projection,t=this.view,s=this.projectionView,i=this.inverseProjectionView,n=this.zoom,r=this.viewportWidth,o=this.viewportHeight;e.ortho(n*(-r/2),n*(r/2),n*(-o/2),n*(o/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),s.set(e.values),s.multiply(t),i.set(s.values).invert()}screenToWorld(e,t,s){const i=e.x,n=s-e.y-1;return e.x=2*i/t-1,e.y=2*n/s-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,s){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=s*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},wi=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=[];autoPreventDefault;isTouch=!1;callbacks;constructor(e,t=!0){this.element=e,this.autoPreventDefault=t,this.callbacks=this.setupCallbacks(e)}setupCallbacks(e){const t=l=>{if(l instanceof MouseEvent&&!this.isTouch){const a=e.getBoundingClientRect();this.mouseX=l.clientX-a.left,this.mouseY=l.clientY-a.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,l)})}},s=l=>{if(l instanceof MouseEvent&&!this.isTouch){const a=e.getBoundingClientRect();this.mouseX=l.clientX-a.left,this.mouseY=l.clientY-a.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,l):c.moved&&c.moved(this.mouseX,this.mouseY,l)})}},i=l=>{if(l instanceof MouseEvent&&!this.isTouch){const a=e.getBoundingClientRect();this.mouseX=l.clientX-a.left,this.mouseY=l.clientY-a.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,l)})}},n=l=>{this.autoPreventDefault&&l.preventDefault();let a=l.deltaY;l.deltaMode===WheelEvent.DOM_DELTA_LINE&&(a*=8),l.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a,l)})},r=l=>{if(this.isTouch=!0,!this.touch0||!this.touch1){const c=l.changedTouches.item(0);if(!c)return;const d=e.getBoundingClientRect(),u=c.clientX-d.left,f=c.clientY-d.top,m=new dn(c.identifier,u,f);if(this.mouseX=u,this.mouseY=f,this.buttonDown=!0,!this.touch0)this.touch0=m,this.listeners.map(p=>{p.down&&p.down(m.x,m.y,l)});else if(!this.touch1){this.touch1=m;const p=this.touch1.x-this.touch0.x,g=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(p*p+g*g),this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,this.initialPinchDistance,l)})}}this.autoPreventDefault&&l.preventDefault()},o=l=>{if(this.isTouch=!0,this.touch0){const a=l.changedTouches,c=e.getBoundingClientRect();for(let d=0;d<a.length;d++){const u=a[d],f=u.clientX-c.left,m=u.clientY-c.top;this.touch0.identifier===u.identifier&&(this.touch0.x=this.mouseX=f,this.touch0.y=this.mouseY=m,this.listeners.map(p=>{p.dragged&&p.dragged(f,m,l)})),this.touch1&&this.touch1.identifier===u.identifier&&(this.touch1.x=this.mouseX=f,this.touch1.y=this.mouseY=m)}if(this.touch0&&this.touch1){const d=this.touch1.x-this.touch0.x,u=this.touch1.x-this.touch0.x,f=Math.sqrt(d*d+u*u);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,f,l)})}}this.autoPreventDefault&&l.preventDefault()},h=l=>{this.isTouch=!0;const a=this.touch0;if(a){const c=l.changedTouches,d=e.getBoundingClientRect();for(let u=0;u<c.length;u++){const f=c[u],m=f.clientX-d.left,p=f.clientY-d.top;if(a.identifier===f.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=p,this.listeners.map(g=>{g.up&&g.up(m,p,l)}),this.touch1){const g=this.touch0=this.touch1;this.touch1=null,this.mouseX=g.x,this.mouseY=g.y,this.buttonDown=!0,this.listeners.map(x=>{x.down&&x.down(g.x,g.y,l)})}else{this.buttonDown=!1;break}this.touch1?.identifier&&(this.touch1=null)}}this.autoPreventDefault&&l.preventDefault()};return e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",r,{passive:!1,capture:!1}),e.addEventListener("touchmove",o,{passive:!1,capture:!1}),e.addEventListener("touchend",h,{passive:!1,capture:!1}),e.addEventListener("touchcancel",h),{mouseDown:t,mouseMove:s,mouseUp:i,mouseWheel:n,touchStart:r,touchMove:o,touchEnd:h}}dispose(){const e=this.element;e.removeEventListener("mousedown",this.callbacks.mouseDown,!0),e.removeEventListener("mousemove",this.callbacks.mouseMove,!0),e.removeEventListener("mouseup",this.callbacks.mouseUp,!0),e.removeEventListener("wheel",this.callbacks.mouseWheel,!0),e.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),e.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),e.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),e.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(e){this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},dn=class{constructor(e,t,s){this.identifier=e,this.x=t,this.y=s}},qr=class{constructor(e,t){this.canvas=e,this.camera=t;let s=0,i=0,n=0,r=0,o=0,h=0,l=0;new wi(e).addListener({down:(a,c)=>{s=t.position.x,i=t.position.y,n=o=a,r=h=c,l=t.zoom},dragged:(a,c)=>{const d=a-n,u=c-r,f=t.screenToWorld(new Et(0,0),e.clientWidth,e.clientHeight),m=t.screenToWorld(new Et(d,u),e.clientWidth,e.clientHeight).sub(f);t.position.set(s-m.x,i-m.y,0),t.update(),o=a,h=c},wheel:a=>{const c=a/200*t.zoom,d=t.zoom+c;if(d>0){let u=0,f=0;if(a<0)u=o,f=h;else{const g=new Et(e.clientWidth/2+15,e.clientHeight/2),x=o-g.x,b=e.clientHeight-1-h-g.y;u=g.x-x,f=e.clientHeight-1-g.y+b}const m=t.screenToWorld(new Et(u,f),e.clientWidth,e.clientHeight);t.zoom=d,t.update();const p=t.screenToWorld(new Et(u,f),e.clientWidth,e.clientHeight);t.position.add(m.sub(p)),t.update()}},zoom:(a,c)=>{const d=a/c;t.zoom=l*d},up:(a,c)=>{o=a,h=c},moved:(a,c)=>{o=a,h=c}})}},Pt=class pt{constructor(t,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=t instanceof vt?t:new vt(t),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(){const t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.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(t,s){const i=this.context.gl,n=i.createShader(t);if(!n)throw new Error("Couldn't create shader.");if(i.shaderSource(n,s),i.compileShader(n),!i.getShaderParameter(n,i.COMPILE_STATUS)){const r=`Couldn't compile shader: ${i.getShaderInfoLog(n)}`;if(i.deleteShader(n),!i.isContextLost())throw new Error(r)}return n}compileProgram(t,s){const i=this.context.gl,n=i.createProgram();if(!n)throw new Error("Couldn't compile program.");if(i.attachShader(n,t),i.attachShader(n,s),i.linkProgram(n),!i.getProgramParameter(n,i.LINK_STATUS)){const r=`Couldn't compile shader program: ${i.getProgramInfoLog(n)}`;if(i.deleteProgram(n),!i.isContextLost())throw new Error(r)}return n}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,s){this.context.gl.uniform1i(this.getUniformLocation(t),s)}setUniformf(t,s){this.context.gl.uniform1f(this.getUniformLocation(t),s)}setUniform2f(t,s,i){this.context.gl.uniform2f(this.getUniformLocation(t),s,i)}setUniform3f(t,s,i,n){this.context.gl.uniform3f(this.getUniformLocation(t),s,i,n)}setUniform4f(t,s,i,n,r){this.context.gl.uniform4f(this.getUniformLocation(t),s,i,n,r)}setUniform2x2f(t,s){const i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,s){const i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,s){const i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){const s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");const i=s.getUniformLocation(this.program,t);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){const s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");const i=s.getAttribLocation(this.program,t);if(i===-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);const t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){const s=`
3
+ attribute vec4 ${pt.POSITION};
4
+ attribute vec4 ${pt.COLOR};
5
+ attribute vec2 ${pt.TEXCOORDS};
6
+ uniform mat4 ${pt.MVP_MATRIX};
7
7
  varying vec4 v_color;
8
8
  varying vec2 v_texCoords;
9
9
 
10
10
  void main () {
11
- v_color = ${dt.COLOR};
12
- v_texCoords = ${dt.TEXCOORDS};
13
- gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION};
11
+ v_color = ${pt.COLOR};
12
+ v_texCoords = ${pt.TEXCOORDS};
13
+ gl_Position = ${pt.MVP_MATRIX} * ${pt.POSITION};
14
14
  }
15
15
  `,i=`
16
16
  #ifdef GL_ES
@@ -26,21 +26,21 @@ uniform sampler2D u_texture;
26
26
  void main () {
27
27
  gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
28
28
  }
29
- `;return new dt(t,s,i)}static newTwoColoredTextured(t){let s=`
30
- attribute vec4 ${dt.POSITION};
31
- attribute vec4 ${dt.COLOR};
32
- attribute vec4 ${dt.COLOR2};
33
- attribute vec2 ${dt.TEXCOORDS};
34
- uniform mat4 ${dt.MVP_MATRIX};
29
+ `;return new pt(t,s,i)}static newTwoColoredTextured(t){const s=`
30
+ attribute vec4 ${pt.POSITION};
31
+ attribute vec4 ${pt.COLOR};
32
+ attribute vec4 ${pt.COLOR2};
33
+ attribute vec2 ${pt.TEXCOORDS};
34
+ uniform mat4 ${pt.MVP_MATRIX};
35
35
  varying vec4 v_light;
36
36
  varying vec4 v_dark;
37
37
  varying vec2 v_texCoords;
38
38
 
39
39
  void main () {
40
- v_light = ${dt.COLOR};
41
- v_dark = ${dt.COLOR2};
42
- v_texCoords = ${dt.TEXCOORDS};
43
- gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION};
40
+ v_light = ${pt.COLOR};
41
+ v_dark = ${pt.COLOR2};
42
+ v_texCoords = ${pt.TEXCOORDS};
43
+ gl_Position = ${pt.MVP_MATRIX} * ${pt.POSITION};
44
44
  }
45
45
  `,i=`
46
46
  #ifdef GL_ES
@@ -59,15 +59,15 @@ void main () {
59
59
  gl_FragColor.a = texColor.a * v_light.a;
60
60
  gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
61
61
  }
62
- `;return new dt(t,s,i)}static newColored(t){let s=`
63
- attribute vec4 ${dt.POSITION};
64
- attribute vec4 ${dt.COLOR};
65
- uniform mat4 ${dt.MVP_MATRIX};
62
+ `;return new pt(t,s,i)}static newColored(t){const s=`
63
+ attribute vec4 ${pt.POSITION};
64
+ attribute vec4 ${pt.COLOR};
65
+ uniform mat4 ${pt.MVP_MATRIX};
66
66
  varying vec4 v_color;
67
67
 
68
68
  void main () {
69
- v_color = ${dt.COLOR};
70
- gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION};
69
+ v_color = ${pt.COLOR};
70
+ gl_Position = ${pt.MVP_MATRIX} * ${pt.POSITION};
71
71
  }
72
72
  `,i=`
73
73
  #ifdef GL_ES
@@ -81,4 +81,4 @@ varying LOWP vec4 v_color;
81
81
  void main () {
82
82
  gl_FragColor = v_color;
83
83
  }
84
- `;return new dt(t,s,i)}},ks=class{constructor(e,t,s,i){this.attributes=t,this.context=e instanceof xt?e:new xt(e),this.elementsPerVertex=0;for(let r=0;r<t.length;r++)this.elementsPerVertex+=t[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(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(var t=0;t<this.attributes.length;t++){let s=this.attributes[t];e+=s.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?r.drawElements(t,i,r.UNSIGNED_SHORT,s*2):r.drawArrays(t,s,i),this.unbind(e)}bind(e){let t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],h=e.getAttributeLocation(r.name);t.enableVertexAttribArray(h),t.vertexAttribPointer(h,r.numElements,t.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=r.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){let t=this.context.gl;for(let s=0;s<this.attributes.length;s++){let i=this.attributes[s],r=e.getAttributeLocation(i.name);t.disableVertexAttribArray(r)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){let e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},Ht=class{constructor(e,t,s){this.name=e,this.type=t,this.numElements=s}},ue=class extends Ht{constructor(){super(Tt.POSITION,0,2)}},Gr=class extends Ht{constructor(){super(Tt.POSITION,0,3)}},Fs=class extends Ht{constructor(e=0){super(Tt.TEXCOORDS+(e==0?"":e),0,2)}},me=class extends Ht{constructor(){super(Tt.COLOR,0,4)}},Ai=class extends Ht{constructor(){super(Tt.COLOR2,0,4)}},Ci=(e=>(e[e.Float=0]="Float",e))(Ci||{}),Xt=1,Hr=769,Si=770,Ti=771,Ii=774,Xs=class Ut{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(t,s=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=t instanceof xt?t:new xt(t);let r=s?[new ue,new me,new Fs,new Ai]:[new ue,new me,new Fs];this.mesh=new ks(t,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(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,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),Ut.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgb:Si,srcRgbPma:Xt,dstRgb:Ti,srcAlpha:Xt},{srcRgb:Si,srcRgbPma:Xt,dstRgb:Xt,srcAlpha:Xt},{srcRgb:Ii,srcRgbPma:Ii,dstRgb:Ti,srcAlpha:Xt},{srcRgb:Xt,srcRgbPma:Xt,dstRgb:Hr,srcAlpha:Xt}];setBlendMode(t,s){const i=Ut.blendModesGL[t],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(t,s,i){t!=this.lastTexture?(this.flush(),this.lastTexture=t):(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++,Ut.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 t=this.context.gl;t.disable(t.BLEND),Ut.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let t=Ut.globalDrawCalls;return Ut.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},Ps=class{context;isDrawing=!1;mesh;shapeType=4;color=new tt(1,1,1,1);shader=null;vertexIndex=0;tmp=new Vt;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error("Can't have more than 10920 triangles per batch: "+t);this.context=e instanceof xt?e:new xt(e),this.mesh=new ks(e,[new ue,new me],t,0);let s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,s){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,s,t,s))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,s,i){this.color.set(e,t,s,i)}point(e,t,s){this.check(0,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,r){this.check(1,2);let h=this.mesh.getVertices(),l=this.vertexIndex;r||(r=this.color),this.vertex(e,t,r),this.vertex(s,i,r)}triangle(e,t,s,i,r,h,l,n,a,o){this.check(e?4:1,3);let c=this.mesh.getVertices(),d=this.vertexIndex;n||(n=this.color),a||(a=this.color),o||(o=this.color),e?(this.vertex(t,s,n),this.vertex(i,r,a),this.vertex(h,l,o)):(this.vertex(t,s,n),this.vertex(i,r,a),this.vertex(i,r,n),this.vertex(h,l,a),this.vertex(h,l,n),this.vertex(t,s,a))}quad(e,t,s,i,r,h,l,n,a,o,c,d,f){this.check(e?4:1,3);let m=this.mesh.getVertices(),u=this.vertexIndex;o||(o=this.color),c||(c=this.color),d||(d=this.color),f||(f=this.color),e?(this.vertex(t,s,o),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,f),this.vertex(t,s,o)):(this.vertex(t,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,f),this.vertex(n,a,f),this.vertex(t,s,o))}rect(e,t,s,i,r,h){this.quad(e,t,s,t+i,s,t+i,s+r,t,s+r,h,h,h,h)}rectLine(e,t,s,i,r,h,l){this.check(e?4:1,8),l||(l=this.color);let n=this.tmp.set(r-s,t-i);n.normalize(),h*=.5;let a=n.x*h,o=n.y*h;e?(this.vertex(t+a,s+o,l),this.vertex(t-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(t-a,s-o,l)):(this.vertex(t+a,s+o,l),this.vertex(t-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(t+a,s+o,l),this.vertex(i-a,r-o,l),this.vertex(t-a,s-o,l))}x(e,t,s){this.line(e-s,t-s,e+s,t+s),this.line(e-s,t+s,e+s,t-s)}polygon(e,t,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;t<<=1,s<<=1;let l=e[t],n=e[t+1],a=t+s;for(let o=t,c=t+s-2;o<c;o+=2){let d=e[o],f=e[o+1],m=0,u=0;o+2>=a?(m=l,u=n):(m=e[o+2],u=e[o+3]),this.vertex(d,f,i),this.vertex(m,u,i)}}circle(e,t,s,i,r,h=0){if(h==0&&(h=Math.max(1,6*P.cbrt(i)|0)),h<=0)throw new Error("segments must be > 0.");r||(r=this.color);let l=2*P.PI/h,n=Math.cos(l),a=Math.sin(l),o=i,c=0;if(e){this.check(4,h*3+3),h--;for(let f=0;f<h;f++){this.vertex(t,s,r),this.vertex(t+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(t+o,s+c,r)}this.vertex(t,s,r),this.vertex(t+o,s+c,r)}else{this.check(1,h*2+2);for(let f=0;f<h;f++){this.vertex(t+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(t+o,s+c,r)}this.vertex(t+o,s+c,r)}let d=o;o=i,c=0,this.vertex(t+o,s+c,r)}curve(e,t,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,f=c*c*c,m=3*c,u=3*d,g=6*d,w=6*f,b=e-s*2+r,x=t-i*2+h,p=(s-r)*3-e+l,v=(i-h)*3-t+n,y=e,A=t,C=(s-e)*m+b*u+p*f,S=(i-t)*m+x*u+v*f,I=b*g+p*w,Y=x*g+v*w,k=p*w,F=v*w;for(;a-- >0;)this.vertex(y,A,o),y+=C,A+=S,C+=I,S+=Y,I+=k,Y+=F,this.vertex(y,A,o);this.vertex(y,A,o),this.vertex(l,n,o)}vertex(e,t,s){let i=this.vertexIndex,r=this.mesh.getVertices();r[i++]=e,r[i++]=t,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 e=this.context.gl;e.disable(e.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(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}},Mi=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(Mi||{}),Ei=class zs{boneLineColor=new tt(1,0,0,1);boneOriginColor=new tt(0,1,0,1);attachmentLineColor=new tt(0,0,1,.5);triangleLineColor=new tt(1,.64,0,.5);pathColor=new tt().setFromString("FF7F00");clipColor=new tt(.8,0,0,2);aabbColor=new tt(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 xi;temp=new Array;vertices=L.newFloatArray(2*1024);static LIGHT_GRAY=new tt(192/255,192/255,192/255,1);static GREEN=new tt(0,1,0,1);constructor(t){this.context=t instanceof xt?t:new xt(t)}draw(t,s,i){let r=s.x,h=s.y,l=this.context.gl,n=this.premultipliedAlpha?l.ONE:l.SRC_ALPHA;t.setBlendMode(n,l.ONE,l.ONE_MINUS_SRC_ALPHA);let a=s.bones;if(this.drawBones){t.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 f=d.data.length*d.a+d.worldX,m=d.data.length*d.c+d.worldY;t.rectLine(!0,d.worldX,d.worldY,f,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(r,h,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);let o=s.slots;for(let c=0,d=o.length;c<d;c++){let f=o[c],m=f.getAttachment();if(m instanceof te){let u=m,g=this.vertices;u.computeWorldVertices(f,g,0,2),t.line(g[0],g[1],g[2],g[3]),t.line(g[2],g[3],g[4],g[5]),t.line(g[4],g[5],g[6],g[7]),t.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 f=o[c];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof Wt))continue;let u=m,g=this.vertices;u.computeWorldVertices(f,0,u.worldVerticesLength,g,0,2);let w=u.triangles,b=u.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let x=0,p=w.length;x<p;x+=3){let v=w[x]*2,y=w[x+1]*2,A=w[x+2]*2;t.triangle(!1,g[v],g[v+1],g[y],g[y+1],g[A],g[A+1])}}if(this.drawMeshHull&&b>0){t.setColor(this.attachmentLineColor),b=(b>>1)*2;let x=g[b-2],p=g[b-1];for(let v=0,y=b;v<y;v+=2){let A=g[v],C=g[v+1];t.line(A,C,x,p),x=A,p=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(s,!0),t.setColor(this.aabbColor),t.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let c=o.polygons,d=o.boundingBoxes;for(let f=0,m=c.length;f<m;f++){let u=c[f];t.setColor(d[f].color),t.polygon(u,0,u.length)}}if(this.drawPaths){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let f=o[c];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof qt))continue;let u=m,g=u.worldVerticesLength,w=this.temp=L.setArraySize(this.temp,g,0);u.computeWorldVertices(f,0,g,w,0,2);let b=this.pathColor,x=w[2],p=w[3],v=0,y=0;if(u.closed){t.setColor(b);let A=w[0],C=w[1],S=w[g-2],I=w[g-1];v=w[g-4],y=w[g-3],t.curve(x,p,A,C,S,I,v,y,32),t.setColor(zs.LIGHT_GRAY),t.line(x,p,A,C),t.line(v,y,S,I)}g-=4;for(let A=4;A<g;A+=6){let C=w[A],S=w[A+1],I=w[A+2],Y=w[A+3];v=w[A+4],y=w[A+5],t.setColor(b),t.curve(x,p,C,S,I,Y,v,y,32),t.setColor(zs.LIGHT_GRAY),t.line(x,p,C,S),t.line(v,y,I,Y),x=v,p=y}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];i&&i.indexOf(d.data.name)>-1||t.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=s.slots;t.setColor(this.clipColor);for(let c=0,d=o.length;c<d;c++){let f=o[c];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof $t))continue;let u=m,g=u.worldVerticesLength,w=this.temp=L.setArraySize(this.temp,g,0);u.computeWorldVertices(f,0,g,w,0,2);for(let b=0,x=w.length;b<x;b+=2){let p=w[b],v=w[b+1],y=w[(b+2)%w.length],A=w[(b+3)%w.length];t.line(p,v,y,A)}}}}dispose(){}},_r=class{constructor(e,t,s){this.vertices=e,this.numVertices=t,this.numFloats=s}},Ri=class Gi{static QUAD_TRIANGLES=[0,1,2,2,3,0];premultipliedAlpha=!1;tempColor=new tt;tempColor2=new tt;vertices;vertexSize=8;twoColorTint=!1;renderable=new _r([],0,0);clipper=new wi;temp=new Vt;temp2=new Vt;temp3=new tt;temp4=new tt;constructor(t,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=L.newFloatArray(this.vertexSize*1024)}draw(t,s,i=-1,r=-1,h=null){let l=this.clipper,n=this.premultipliedAlpha,a=this.twoColorTint,o=null,c=this.renderable,d,f,m=s.drawOrder,u,g=s.color,w=a?12:8,b=!1;i==-1&&(b=!0);for(let x=0,p=m.length;x<p;x++){let v=l.isClipping()?2:w,y=m[x];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 te){let S=A;c.vertices=this.vertices,c.numVertices=4,c.numFloats=v<<2,S.computeWorldVertices(y,c.vertices,0,v),f=Gi.QUAD_TRIANGLES,d=S.uvs,C=S.region.texture,u=S.color}else if(A instanceof Wt){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=L.newFloatArray(c.numFloats)),S.computeWorldVertices(y,0,S.worldVerticesLength,c.vertices,0,v),f=S.triangles,C=S.region.texture,d=S.uvs,u=S.color}else if(A instanceof $t){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*u.r,I.g=g.g*S.g*u.g,I.b=g.b*S.b*u.b,I.a=g.a*S.a*u.a,n&&(I.r*=I.a,I.g*=I.a,I.b*=I.a);let Y=this.tempColor2;y.darkColor?(n?(Y.r=y.darkColor.r*I.a,Y.g=y.darkColor.g*I.a,Y.b=y.darkColor.b*I.a):Y.setFromColor(y.darkColor),Y.a=n?1:0):Y.set(0,0,0,1);let k=y.data.blendMode;if(k!=o&&(o=k,t.setBlendMode(o,n)),l.isClipping()){l.clipTriangles(c.vertices,f,f.length,d,I,Y,a);let F=new Float32Array(l.clippedVertices),X=l.clippedTriangles;h&&h(F,F.length,w),t.draw(C,F,X)}else{let F=c.vertices;if(a)for(let E=2,R=0,B=c.numFloats;E<B;E+=w,R+=2)F[E]=I.r,F[E+1]=I.g,F[E+2]=I.b,F[E+3]=I.a,F[E+4]=d[R],F[E+5]=d[R+1],F[E+6]=Y.r,F[E+7]=Y.g,F[E+8]=Y.b,F[E+9]=Y.a;else for(let E=2,R=0,B=c.numFloats;E<B;E+=w,R+=2)F[E]=I.r,F[E+1]=I.g,F[E+2]=I.b,F[E+3]=I.a,F[E+4]=d[R],F[E+5]=d[R+1];let X=c.vertices.subarray(0,c.numFloats);h&&h(c.vertices,c.numFloats,w),t.draw(C,X,f)}}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],ge=[0,1,2,2,3,0],xe=new tt(1,1,1,1),Yi=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;maxCanvasWidth=0;maxCanvasHeight=0;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,s=!0){this.canvas=e,this.context=t instanceof xt?t:new xt(t),this.twoColorTint=s,this.camera=new vi(e.width,e.height),this.batcherShader=s?Tt.newTwoColoredTextured(this.context):Tt.newColoredTextured(this.context),this.batcher=new Xs(this.context,s),this.shapesShader=Tt.newColored(this.context),this.shapes=new Ps(this.context),this.skeletonRenderer=new Ri(this.context,s),this.skeletonDebugRenderer=new Ei(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(e,t=!1,s=-1,i=-1,r=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=t,this.skeletonRenderer.draw(this.batcher,e,s,i,r)}drawSkeletonDebug(e,t=!1,s){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=t,this.skeletonDebugRenderer.draw(this.shapes,e,s)}drawTexture(e,t,s,i,r,h){this.enableRenderer(this.batcher),h||(h=xe);var l=0;T[l++]=t,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++]=t+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++]=t+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++]=t,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(e,T,ge)}drawTextureUV(e,t,s,i,r,h,l,n,a,o){this.enableRenderer(this.batcher),o||(o=xe);var c=0;T[c++]=t,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++]=t+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++]=t+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++]=t,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(e,T,ge)}drawTextureRotated(e,t,s,i,r,h,l,n,a){this.enableRenderer(this.batcher),a||(a=xe);let o=t+h,c=s+l,d=-h,f=-l,m=i-h,u=r-l,g=d,w=f,b=d,x=u,p=m,v=u,y=m,A=f,C=0,S=0,I=0,Y=0,k=0,F=0,X=0,E=0;if(n!=0){let B=P.cosDeg(n),st=P.sinDeg(n);C=B*g-st*w,S=st*g+B*w,X=B*b-st*x,E=st*b+B*x,k=B*p-st*v,F=st*p+B*v,I=k+(C-X),Y=F+(S-E)}else C=g,S=w,X=b,E=x,k=p,F=v,I=y,Y=A;C+=o,S+=c,I+=o,Y+=c,k+=o,F+=c,X+=o,E+=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++]=Y,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++]=k,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++]=X,T[R++]=E,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(e,T,ge)}drawRegion(e,t,s,i,r,h){this.enableRenderer(this.batcher),h||(h=xe);var l=0;T[l++]=t,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u,T[l++]=e.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u2,T[l++]=e.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u2,T[l++]=e.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u,T[l++]=e.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(e.page.texture,T,ge)}line(e,t,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.line(e,t,s,i,r)}triangle(e,t,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,s,i,r,h,l,n,a,o)}quad(e,t,s,i,r,h,l,n,a,o,c,d,f){this.enableRenderer(this.shapes),this.shapes.quad(e,t,s,i,r,h,l,n,a,o,c,d,f)}rect(e,t,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.rect(e,t,s,i,r,h)}rectLine(e,t,s,i,r,h,l){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,s,i,r,h,l)}polygon(e,t,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,s,i)}circle(e,t,s,i,r,h=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,s,i,r,h)}curve(e,t,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.curve(e,t,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(e){let t=this.canvas;var s=this.getSafeDevicePixelRatio(t.clientWidth,t.clientHeight),i=Math.round(t.clientWidth*s),r=Math.round(t.clientHeight*s);if((t.width!=i||t.height!=r)&&(t.width=i,t.height=r),this.context.gl.viewport(0,0,t.width,t.height),e===1)this.camera.setViewport(i,r);else if(e===2){let h=t.width,l=t.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()}getSafeDevicePixelRatio(e,t){const s=window.devicePixelRatio||1;if(e<=0||t<=0)return s;if(this.maxCanvasWidth===0||this.maxCanvasHeight===0){const i=this.context.gl,r=i.getParameter(i.MAX_RENDERBUFFER_SIZE),h=i.getParameter(i.MAX_VIEWPORT_DIMS);this.maxCanvasWidth=Math.min(r,h[0]),this.maxCanvasHeight=Math.min(r,h[1])}return Math.min(s,this.maxCanvasWidth/e,this.maxCanvasHeight/t)}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof Xs?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Tt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof Ps?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Tt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},ki=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(ki||{}),_t,Dt,Ls=0,jr=1,Bs=1,pe=165,we=108,It=163,Zr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Ee;backgroundColor=new tt(.135,.135,.135,1);tempColor=new tt;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!Dt){let t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Ls++;Dt=new Image,Dt.src=Jr,t||(Dt.crossOrigin="anonymous"),Dt.onload=s,_t=new Image,_t.src=Kr,t||(_t.crossOrigin="anonymous"),_t.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Ls<2||e&&this.fadeOut>Bs)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,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),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Bs)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/Bs,t=1-(t-1)*(t-1),s.a*=t,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)),t=1;t*=Math.min(this.fadeIn/jr,1),s.set(t,t,t,t),this.logo||(this.logo=new Gt(i.context,Dt),this.spinner=new Gt(i.context,_t)),i.camera.zoom=Math.max(1,It/r.height),i.begin(),i.drawTexture(this.logo,(r.width-pe)/2,(r.height-we)/2,pe,we,s),this.spinner&&i.drawTextureRotated(this.spinner,(r.width-It)/2,(r.height-It)/2,It,It,It/2,It/2,this.angle,s),i.end()}drawInCoordinates(e,t){if(Ls<2)return;this.timeKeeper.update();let s=this.renderer;s.batcher.setBlendMode(0,!0),this.logo||(this.logo=new Gt(s.context,Dt),this.spinner=new Gt(s.context,_t));const i=e-pe/2,r=t-we/2;s.drawTexture(this.logo,i,r,pe,we),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,r-25,It,It,It/2,It/2,this.angle)}},Kr="data:image/png;base64,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",Jr="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=",Qr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new xt(e,t.webglConfig),this.renderer=new Yi(e,this.context),this.gl=this.context.gl,this.assetManager=new bi(this.context,t.pathPrefix),this.input=new Ys(e),t.app.loadAssets&&t.app.loadAssets(this);let s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new Ee;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,s,i){this.gl.clearColor(e,t,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Ji(Ws)})();
84
+ `;return new pt(t,s,i)}},yi=class{constructor(e,t,s,i){this.attributes=t,this.context=e instanceof vt?e:new vt(e),this.elementsPerVertex=0;for(let n=0;n<t.length;n++)this.elementsPerVertex+=t[n].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(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(let t=0;t<this.attributes.length;t++){const s=this.attributes[t];e+=s.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error(`Mesh can't store more than ${this.maxVertices()} vertices`);this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error(`Mesh can't store more than ${this.maxIndices()} indices`);this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){const n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?n.drawElements(t,i,n.UNSIGNED_SHORT,s*2):n.drawArrays(t,s,i),this.unbind(e)}bind(e){const t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],r=e.getAttributeLocation(n.name);t.enableVertexAttribArray(r),t.vertexAttribPointer(r,n.numElements,t.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=n.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){const t=this.context.gl;for(let s=0;s<this.attributes.length;s++){const i=this.attributes[s],n=e.getAttributeLocation(i.name);t.disableVertexAttribArray(n)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){const e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);const e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},ce=class{constructor(e,t,s){this.name=e,this.type=t,this.numElements=s}},Ke=class extends ce{constructor(){super(Pt.POSITION,0,2)}},Wr=class extends ce{constructor(){super(Pt.POSITION,0,3)}},vi=class extends ce{constructor(e=0){super(Pt.TEXCOORDS+(e===0?"":e),0,2)}},Je=class extends ce{constructor(){super(Pt.COLOR,0,4)}},fn=class extends ce{constructor(){super(Pt.COLOR2,0,4)}},un=(e=>(e[e.Float=0]="Float",e))(un||{}),Ht=1,_r=769,mn=771,Gr=774,Ti=class se{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(t,s=!0,i=10920){if(i>10920)throw new Error(`Can't have more than 10920 triangles per batch: ${i}`);this.context=t instanceof vt?t:new vt(t);const n=s?[new Ke,new Je,new vi,new fn]:[new Ke,new Je,new vi];this.mesh=new yi(t,n,i,i*3);const r=this.context.gl;this.srcColorBlend=r.SRC_ALPHA,this.srcAlphaBlend=r.ONE,this.dstBlend=r.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,this.lastTexture=null,this.isDrawing=!0;const s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),se.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgbPma:Ht,dstRgb:mn,srcAlpha:Ht},{srcRgbPma:Ht,dstRgb:Ht,srcAlpha:Ht},{srcRgbPma:Gr,dstRgb:mn,srcAlpha:Ht},{srcRgbPma:Ht,dstRgb:_r,srcAlpha:Ht}];setBlendMode(t){const s=se.blendModesGL[t],i=s.srcRgbPma,n=s.srcAlpha,r=s.dstRgb;if(this.srcColorBlend===i&&this.srcAlphaBlend===n&&this.dstBlend===r)return;this.srcColorBlend=i,this.srcAlphaBlend=n,this.dstBlend=r,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(i,r,n,r)}draw(t,s,i){t!==this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();const n=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);const r=this.mesh.getIndices();for(let o=this.indicesLength,h=0;h<i.length;o++,h++)r[o]=i[h]+n;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++,se.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;const t=this.context.gl;t.disable(t.BLEND),se.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){const t=se.globalDrawCalls;return se.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},Ai=class{context;isDrawing=!1;mesh;shapeType=4;color=new W(1,1,1,1);shader=null;vertexIndex=0;tmp=new ie;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error(`Can't have more than 10920 triangles per batch: ${t}`);this.context=e instanceof vt?e:new vt(e),this.mesh=new yi(e,[new Ke,new Je],t,0);const s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;const t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,s){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,s,t,s))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,s,i){this.color.set(e,t,s,i)}point(e,t,s){this.check(0,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,n){this.check(1,2),n||(n=this.color),this.vertex(e,t,n),this.vertex(s,i,n)}triangle(e,t,s,i,n,r,o,h,l,a){this.check(e?4:1,3),h||(h=this.color),l||(l=this.color),a||(a=this.color),e?(this.vertex(t,s,h),this.vertex(i,n,l),this.vertex(r,o,a)):(this.vertex(t,s,h),this.vertex(i,n,l),this.vertex(i,n,h),this.vertex(r,o,l),this.vertex(r,o,h),this.vertex(t,s,l))}quad(e,t,s,i,n,r,o,h,l,a,c,d,u){this.check(e?4:1,3),a||(a=this.color),c||(c=this.color),d||(d=this.color),u||(u=this.color),e?(this.vertex(t,s,a),this.vertex(i,n,c),this.vertex(r,o,d),this.vertex(r,o,d),this.vertex(h,l,u),this.vertex(t,s,a)):(this.vertex(t,s,a),this.vertex(i,n,c),this.vertex(i,n,c),this.vertex(r,o,d),this.vertex(r,o,d),this.vertex(h,l,u),this.vertex(h,l,u),this.vertex(t,s,a))}rect(e,t,s,i,n,r){this.quad(e,t,s,t+i,s,t+i,s+n,t,s+n,r,r,r,r)}rectLine(e,t,s,i,n,r,o){this.check(e?4:1,8),o||(o=this.color);const h=this.tmp.set(n-s,t-i);h.normalize(),r*=.5;const l=h.x*r,a=h.y*r;e?(this.vertex(t+l,s+a,o),this.vertex(t-l,s-a,o),this.vertex(i+l,n+a,o),this.vertex(i-l,n-a,o),this.vertex(i+l,n+a,o),this.vertex(t-l,s-a,o)):(this.vertex(t+l,s+a,o),this.vertex(t-l,s-a,o),this.vertex(i+l,n+a,o),this.vertex(i-l,n-a,o),this.vertex(i+l,n+a,o),this.vertex(t+l,s+a,o),this.vertex(i-l,n-a,o),this.vertex(t-l,s-a,o))}x(e,t,s){this.line(e-s,t-s,e+s,t+s),this.line(e-s,t+s,e+s,t-s)}polygon(e,t,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color),t<<=1,s<<=1;const n=e[t],r=e[t+1],o=t+s;for(let h=t,l=t+s-2;h<l;h+=2){const a=e[h],c=e[h+1];let d=0,u=0;h+2>=o?(d=n,u=r):(d=e[h+2],u=e[h+3]),this.vertex(a,c,i),this.vertex(d,u,i)}}circle(e,t,s,i,n,r=0){if(r===0&&(r=Math.max(1,6*N.cbrt(i)|0)),r<=0)throw new Error("segments must be > 0.");n||(n=this.color);const o=2*N.PI/r,h=Math.cos(o),l=Math.sin(o);let a=i,c=0;if(e){this.check(4,r*3+3),r--;for(let d=0;d<r;d++){this.vertex(t,s,n),this.vertex(t+a,s+c,n);const u=a;a=h*a-l*c,c=l*u+h*c,this.vertex(t+a,s+c,n)}this.vertex(t,s,n),this.vertex(t+a,s+c,n)}else{this.check(1,r*2+2);for(let d=0;d<r;d++){this.vertex(t+a,s+c,n);const u=a;a=h*a-l*c,c=l*u+h*c,this.vertex(t+a,s+c,n)}this.vertex(t+a,s+c,n)}a=i,c=0,this.vertex(t+a,s+c,n)}curve(e,t,s,i,n,r,o,h,l,a){this.check(1,l*2+2),a||(a=this.color);const c=1/l,d=c*c,u=c*c*c,f=3*c,m=3*d,p=6*d,g=6*u,x=e-s*2+n,b=t-i*2+r,w=(s-n)*3-e+o,v=(i-r)*3-t+h;let y=e,T=t,A=(s-e)*f+x*m+w*u,S=(i-t)*f+b*m+v*u,C=x*p+w*g,I=b*p+v*g;const P=w*g,F=v*g;for(;l-- >0;)this.vertex(y,T,a),y+=A,T+=S,A+=C,S+=I,C+=P,I+=F,this.vertex(y,T,a);this.vertex(y,T,a),this.vertex(o,h,a)}vertex(e,t,s){let i=this.vertexIndex;const n=this.mesh.getVertices();n[i++]=e,n[i++]=t,n[i++]=s.r,n[i++]=s.g,n[i++]=s.b,n[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();const e=this.context.gl;e.disable(e.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(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType===e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}},gn=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(gn||{}),pn=class Fi{boneLineColor=new W(1,0,0,1);boneOriginColor=new W(0,1,0,1);attachmentLineColor=new W(0,0,1,.5);triangleLineColor=new W(1,.64,0,.5);pathColor=new W().setFromString("FF7F00");clipColor=new W(.8,0,0,2);aabbColor=new W(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;scale=1;boneWidth=2;context;bounds=new an;temp=[];vertices=B.newFloatArray(2*1024);static LIGHT_GRAY=new W(192/255,192/255,192/255,1);static GREEN=new W(0,1,0,1);constructor(t){this.context=t instanceof vt?t:new vt(t)}draw(t,s,i){const n=s.x,r=s.y,o=this.context.gl;t.setBlendMode(o.ONE,o.ONE,o.ONE_MINUS_SRC_ALPHA);const h=s.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let l=0,a=h.length;l<a;l++){const c=h[l];if(i&&i.indexOf(c.data.name)>-1||!c.parent)continue;const d=c.appliedPose,u=c.data.length*d.a+d.worldX,f=c.data.length*d.c+d.worldY;t.rectLine(!0,d.worldX,d.worldY,u,f,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(n,r,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);const l=s.slots;for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(u instanceof qt){const f=this.vertices;u.computeWorldVertices(d,u.getOffsets(d.appliedPose),f,0,2),t.line(f[0],f[1],f[2],f[3]),t.line(f[2],f[3],f[4],f[5]),t.line(f[4],f[5],f[6],f[7]),t.line(f[6],f[7],f[0],f[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){const l=s.slots;for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(!(u instanceof Ot))continue;const f=this.vertices;u.computeWorldVertices(s,d,0,u.worldVerticesLength,f,0,2);const m=u.triangles;let p=u.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let g=0,x=m.length;g<x;g+=3){const b=m[g]*2,w=m[g+1]*2,v=m[g+2]*2;t.triangle(!1,f[b],f[b+1],f[w],f[w+1],f[v],f[v+1])}}if(this.drawMeshHull&&p>0){t.setColor(this.attachmentLineColor),p=(p>>1)*2;let g=f[p-2],x=f[p-1];for(let b=0,w=p;b<w;b+=2){const v=f[b],y=f[b+1];t.line(v,y,g,x),g=v,x=y}}}}if(this.drawBoundingBoxes){const l=this.bounds;l.update(s,!0),t.setColor(this.aabbColor),t.rect(!1,l.minX,l.minY,l.getWidth(),l.getHeight());const a=l.polygons,c=l.boundingBoxes;for(let d=0,u=a.length;d<u;d++){const f=a[d];t.setColor(c[d].color),t.polygon(f,0,f.length)}}if(this.drawPaths){const l=s.slots;for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(!(u instanceof Te))continue;let f=u.worldVerticesLength;const m=this.temp=B.setArraySize(this.temp,f,0);u.computeWorldVertices(s,d,0,f,m,0,2);const p=this.pathColor;let g=m[2],x=m[3],b=0,w=0;if(u.closed){t.setColor(p);const v=m[0],y=m[1],T=m[f-2],A=m[f-1];b=m[f-4],w=m[f-3],t.curve(g,x,v,y,T,A,b,w,32),t.setColor(Fi.LIGHT_GRAY),t.line(g,x,v,y),t.line(b,w,T,A)}f-=4;for(let v=4;v<f;v+=6){const y=m[v],T=m[v+1],A=m[v+2],S=m[v+3];b=m[v+4],w=m[v+5],t.setColor(p),t.curve(g,x,y,T,A,S,b,w,32),t.setColor(Fi.LIGHT_GRAY),t.line(g,x,y,T),t.line(b,w,A,S),g=b,x=w}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let l=0,a=h.length;l<a;l++){const c=h[l];if(i&&i.indexOf(c.data.name)>-1)continue;const d=c.appliedPose;t.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){const l=s.slots;t.setColor(this.clipColor);for(let a=0,c=l.length;a<c;a++){const d=l[a];if(!d.bone.active)continue;const u=d.appliedPose.attachment;if(!(u instanceof $t))continue;const f=u.worldVerticesLength,m=this.temp=B.setArraySize(this.temp,f,0);u.computeWorldVertices(s,d,0,f,m,0,2);for(let p=0,g=m.length;p<g;p+=2){const x=m[p],b=m[p+1],w=m[(p+2)%m.length],v=m[(p+3)%m.length];t.line(x,b,w,v)}}}}dispose(){}},Hr=class{constructor(e,t,s){this.vertices=e,this.numVertices=t,this.numFloats=s}},xn=class kn{static QUAD_TRIANGLES=[0,1,2,2,3,0];tempColor=new W;tempColor2=new W;vertices;vertexSize=8;twoColorTint=!1;renderable=new Hr([],0,0);clipper=new xi;temp=new ie;temp2=new ie;temp3=new W;temp4=new W;constructor(t,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=B.newFloatArray(this.vertexSize*1024)}draw(t,s,i=-1,n=-1,r=null){const o=this.clipper,h=this.twoColorTint;let l=null;const a=this.renderable;let c,d;const u=s.drawOrder.appliedPose;let f;const m=s.color,p=h?12:8;let g=!1;i===-1&&(g=!0);for(let x=0,b=u.length;x<b;x++){const w=u[x];if(!w.bone.active){o.clipEnd(w);continue}if(i>=0&&i===w.data.index&&(g=!0),!g){o.clipEnd(w);continue}n>=0&&n===w.data.index&&(g=!1);const v=w.appliedPose,y=v.attachment;let T;if(y instanceof qt){a.vertices=this.vertices,a.numVertices=4,a.numFloats=p<<2;const A=y.sequence,S=A.resolveIndex(v);y.computeWorldVertices(w,y.getOffsets(v),a.vertices,0,p),d=kn.QUAD_TRIANGLES,c=A.getUVs(S),T=A.regions[S]?.texture,f=y.color}else if(y instanceof Ot){a.vertices=this.vertices,a.numVertices=y.worldVerticesLength>>1,a.numFloats=a.numVertices*p,a.numFloats>a.vertices.length&&(a.vertices=this.vertices=B.newFloatArray(a.numFloats)),y.computeWorldVertices(s,w,0,y.worldVerticesLength,a.vertices,0,p),d=y.triangles;const A=y.sequence,S=A.resolveIndex(v);T=A.regions[S]?.texture,c=A.getUVs(S),f=y.color}else if(y instanceof $t){o.clipEnd(w),o.clipStart(s,w,y);continue}else{o.clipEnd(w);continue}if(T){const A=v.color,S=this.tempColor,C=m.a*A.a*f.a;S.r=m.r*A.r*f.r*C,S.g=m.g*A.g*f.g*C,S.b=m.b*A.b*f.b*C,S.a=C;const I=this.tempColor2;v.darkColor?(I.r=v.darkColor.r*C,I.g=v.darkColor.g*C,I.b=v.darkColor.b*C,I.a=1):I.set(0,0,0,1);const P=w.data.blendMode;if(P!==l&&(l=P,t.setBlendMode(l)),o.isClipping()&&o.clipTriangles(a.vertices,d,d.length,c,S,I,h,p)){const F=new Float32Array(o.clippedVertices),k=o.clippedTriangles;r&&r(F,F.length,p),t.draw(T,F,k)}else{const F=a.vertices;if(h)for(let X=2,R=0,V=a.numFloats;X<V;X+=p,R+=2)F[X]=S.r,F[X+1]=S.g,F[X+2]=S.b,F[X+3]=C,F[X+4]=c[R],F[X+5]=c[R+1],F[X+6]=I.r,F[X+7]=I.g,F[X+8]=I.b,F[X+9]=I.a;else for(let X=2,R=0,V=a.numFloats;X<V;X+=p,R+=2)F[X]=S.r,F[X+1]=S.g,F[X+2]=S.b,F[X+3]=C,F[X+4]=c[R],F[X+5]=c[R+1];const k=a.vertices.subarray(0,a.numFloats);r&&r(a.vertices,a.numFloats,p),t.draw(T,k,d)}}o.clipEnd(w)}o.clipEnd()}getSkeletonClipping(){return this.clipper}},M=[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],Qe=[0,1,2,2,3,0],ts=new W(1,1,1,1),bn=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;maxCanvasWidth=0;maxCanvasHeight=0;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,s=!0){this.canvas=e,this.context=t instanceof vt?t:new vt(t),this.twoColorTint=s,this.camera=new hn(e.width,e.height),this.batcherShader=s?Pt.newTwoColoredTextured(this.context):Pt.newColoredTextured(this.context),this.batcher=new Ti(this.context,s),this.shapesShader=Pt.newColored(this.context),this.shapes=new Ai(this.context),this.skeletonRenderer=new xn(this.context,s),this.skeletonDebugRenderer=new pn(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(e,t=-1,s=-1,i=null){this.enableRenderer(this.batcher),this.skeletonRenderer.draw(this.batcher,e,t,s,i)}drawSkeletonDebug(e,t){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.draw(this.shapes,e,t)}drawTexture(e,t,s,i,n,r){this.enableRenderer(this.batcher),r||(r=ts);var o=0;M[o++]=t,M[o++]=s,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=0,M[o++]=1,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o++]=0),M[o++]=t+i,M[o++]=s,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=1,M[o++]=1,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o++]=0),M[o++]=t+i,M[o++]=s+n,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=1,M[o++]=0,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o++]=0),M[o++]=t,M[o++]=s+n,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=0,M[o++]=0,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o]=0),this.batcher.draw(e,M,Qe)}drawTextureUV(e,t,s,i,n,r,o,h,l,a){this.enableRenderer(this.batcher),a||(a=ts);var c=0;M[c++]=t,M[c++]=s,M[c++]=a.r,M[c++]=a.g,M[c++]=a.b,M[c++]=a.a,M[c++]=r,M[c++]=o,this.twoColorTint&&(M[c++]=0,M[c++]=0,M[c++]=0,M[c++]=0),M[c++]=t+i,M[c++]=s,M[c++]=a.r,M[c++]=a.g,M[c++]=a.b,M[c++]=a.a,M[c++]=h,M[c++]=o,this.twoColorTint&&(M[c++]=0,M[c++]=0,M[c++]=0,M[c++]=0),M[c++]=t+i,M[c++]=s+n,M[c++]=a.r,M[c++]=a.g,M[c++]=a.b,M[c++]=a.a,M[c++]=h,M[c++]=l,this.twoColorTint&&(M[c++]=0,M[c++]=0,M[c++]=0,M[c++]=0),M[c++]=t,M[c++]=s+n,M[c++]=a.r,M[c++]=a.g,M[c++]=a.b,M[c++]=a.a,M[c++]=r,M[c++]=l,this.twoColorTint&&(M[c++]=0,M[c++]=0,M[c++]=0,M[c]=0),this.batcher.draw(e,M,Qe)}drawTextureRotated(e,t,s,i,n,r,o,h,l){this.enableRenderer(this.batcher),l||(l=ts);const a=t+r,c=s+o,d=-r,u=-o,f=i-r,m=n-o,p=d,g=u,x=d,b=m,w=f,v=m,y=f,T=u;let A=0,S=0,C=0,I=0,P=0,F=0,k=0,X=0;if(h!==0){const V=N.cosDeg(h),ot=N.sinDeg(h);A=V*p-ot*g,S=ot*p+V*g,k=V*x-ot*b,X=ot*x+V*b,P=V*w-ot*v,F=ot*w+V*v,C=P+(A-k),I=F+(S-X)}else A=p,S=g,k=x,X=b,P=w,F=v,C=y,I=T;A+=a,S+=c,C+=a,I+=c,P+=a,F+=c,k+=a,X+=c;var R=0;M[R++]=A,M[R++]=S,M[R++]=l.r,M[R++]=l.g,M[R++]=l.b,M[R++]=l.a,M[R++]=0,M[R++]=1,this.twoColorTint&&(M[R++]=0,M[R++]=0,M[R++]=0,M[R++]=0),M[R++]=C,M[R++]=I,M[R++]=l.r,M[R++]=l.g,M[R++]=l.b,M[R++]=l.a,M[R++]=1,M[R++]=1,this.twoColorTint&&(M[R++]=0,M[R++]=0,M[R++]=0,M[R++]=0),M[R++]=P,M[R++]=F,M[R++]=l.r,M[R++]=l.g,M[R++]=l.b,M[R++]=l.a,M[R++]=1,M[R++]=0,this.twoColorTint&&(M[R++]=0,M[R++]=0,M[R++]=0,M[R++]=0),M[R++]=k,M[R++]=X,M[R++]=l.r,M[R++]=l.g,M[R++]=l.b,M[R++]=l.a,M[R++]=0,M[R++]=0,this.twoColorTint&&(M[R++]=0,M[R++]=0,M[R++]=0,M[R]=0),this.batcher.draw(e,M,Qe)}drawRegion(e,t,s,i,n,r){this.enableRenderer(this.batcher),r||(r=ts);var o=0;M[o++]=t,M[o++]=s,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=e.u,M[o++]=e.v2,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o++]=0),M[o++]=t+i,M[o++]=s,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=e.u2,M[o++]=e.v2,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o++]=0),M[o++]=t+i,M[o++]=s+n,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=e.u2,M[o++]=e.v,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o++]=0),M[o++]=t,M[o++]=s+n,M[o++]=r.r,M[o++]=r.g,M[o++]=r.b,M[o++]=r.a,M[o++]=e.u,M[o++]=e.v,this.twoColorTint&&(M[o++]=0,M[o++]=0,M[o++]=0,M[o]=0),this.batcher.draw(e.page.texture,M,Qe)}line(e,t,s,i,n,r){this.enableRenderer(this.shapes),this.shapes.line(e,t,s,i,n)}triangle(e,t,s,i,n,r,o,h,l,a){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,s,i,n,r,o,h,l,a)}quad(e,t,s,i,n,r,o,h,l,a,c,d,u){this.enableRenderer(this.shapes),this.shapes.quad(e,t,s,i,n,r,o,h,l,a,c,d,u)}rect(e,t,s,i,n,r){this.enableRenderer(this.shapes),this.shapes.rect(e,t,s,i,n,r)}rectLine(e,t,s,i,n,r,o){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,s,i,n,r,o)}polygon(e,t,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,s,i)}circle(e,t,s,i,n,r=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,s,i,n,r)}curve(e,t,s,i,n,r,o,h,l,a){this.enableRenderer(this.shapes),this.shapes.curve(e,t,s,i,n,r,o,h,l,a)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(e,t,s){const i=this.canvas,n=this.getSafeDevicePixelRatio(i.clientWidth,i.clientHeight);var r=Math.round(i.clientWidth*n),o=Math.round(i.clientHeight*n);if((i.width!==r||i.height!==o)&&(i.width=r,i.height=o),e===3&&t!==void 0&&s!==void 0){const h=o/r,l=s/t,a=h>l?r/t:o/s;t*=a,s*=a,this.camera.setViewport(t,s),this.context.gl.viewport((r-t)/2,(o-s)/2,t,s)}else{if(e===2){const h=this.camera.viewportWidth,l=this.camera.viewportHeight,a=l/h,c=o/r,d=a<c?h/r:l/o;this.camera.setViewport(r*d,o*d)}else e===1&&this.camera.setViewport(r,o);this.context.gl.viewport(0,0,r,o)}this.camera.update()}getSafeDevicePixelRatio(e,t){const s=window.devicePixelRatio||1;if(e<=0||t<=0)return s;if(this.maxCanvasWidth===0||this.maxCanvasHeight===0){const i=this.context.gl,n=i.getParameter(i.MAX_RENDERBUFFER_SIZE),r=i.getParameter(i.MAX_VIEWPORT_DIMS);this.maxCanvasWidth=Math.min(n,r[0]),this.maxCanvasHeight=Math.min(n,r[1])}return Math.min(s,this.maxCanvasWidth/e,this.maxCanvasHeight/t)}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof Ti?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Pt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof Ai?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Pt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},wn=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e[e.FitClip=3]="FitClip",e))(wn||{}),he,Qt,Si=0,jr=1,Ci=1,es=165,ss=108,Rt=163,Zr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new cs;backgroundColor=new W(.135,.135,.135,1);tempColor=new W;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!Qt){const t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Si++;Qt=new Image,Qt.src=Kr,t||(Qt.crossOrigin="anonymous"),Qt.onload=s,he=new Image,he.src=$r,t||(he.crossOrigin="anonymous"),he.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Si<2||e&&this.fadeOut>Ci)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,5));const s=this.tempColor,i=this.renderer,n=i.canvas,r=i.context.gl;if(i.resize(1),i.camera.position.set(n.width/2,n.height/2,0),i.batcher.setBlendMode(0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Ci)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/Ci,t=1-(t-1)*(t-1),s.a*=t,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(r.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),r.clear(r.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/jr,1),s.set(t,t,t,t),this.logo||(this.logo=new le(i.context,Qt,!0),this.spinner=new le(i.context,he,!0)),i.camera.zoom=Math.max(1,Rt/n.height),i.begin(),i.drawTexture(this.logo,(n.width-es)/2,(n.height-ss)/2,es,ss,s),this.spinner&&i.drawTextureRotated(this.spinner,(n.width-Rt)/2,(n.height-Rt)/2,Rt,Rt,Rt/2,Rt/2,this.angle,s),i.end()}drawInCoordinates(e,t){if(Si<2)return;this.timeKeeper.update();const s=this.renderer;s.batcher.setBlendMode(0),this.logo||(this.logo=new le(s.context,Qt,!0),this.spinner=new le(s.context,he,!0));const i=e-es/2,n=t-ss/2;s.drawTexture(this.logo,i,n,es,ss),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,n-25,Rt,Rt,Rt/2,Rt/2,this.angle)}},$r="data:image/png;base64,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",Kr="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=",Jr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new vt(e,t.webglConfig),this.renderer=new bn(e,this.context),this.gl=this.context.gl,this.assetManager=new cn(this.context,t.pathPrefix),this.input=new wi(e),t.app.loadAssets&&t.app.loadAssets(this);const s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new cs;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,s,i){this.gl.clearColor(e,t,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Un(Yi)})();