@esotericsoftware/spine-webgl 4.2.25 → 4.2.27
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.
- package/dist/AssetManager.d.ts +1 -1
- package/dist/AssetManager.js +2 -2
- package/dist/Camera.d.ts +2 -2
- package/dist/Camera.js +15 -15
- package/dist/CameraController.d.ts +1 -1
- package/dist/CameraController.js +5 -3
- package/dist/GLTexture.d.ts +1 -1
- package/dist/GLTexture.js +7 -6
- package/dist/Input.js +13 -9
- package/dist/LoadingScreen.d.ts +1 -1
- package/dist/LoadingScreen.js +14 -14
- package/dist/Matrix4.d.ts +1 -1
- package/dist/Matrix4.js +8 -8
- package/dist/Mesh.d.ts +2 -2
- package/dist/Mesh.js +17 -10
- package/dist/PolygonBatcher.d.ts +3 -3
- package/dist/PolygonBatcher.js +23 -18
- package/dist/SceneRenderer.d.ts +6 -6
- package/dist/SceneRenderer.js +19 -10
- package/dist/Shader.d.ts +1 -1
- package/dist/Shader.js +19 -14
- package/dist/ShapeRenderer.d.ts +2 -2
- package/dist/ShapeRenderer.js +14 -9
- package/dist/SkeletonDebugRenderer.d.ts +2 -2
- package/dist/SkeletonDebugRenderer.js +26 -25
- package/dist/SkeletonRenderer.d.ts +2 -2
- package/dist/SkeletonRenderer.js +17 -13
- package/dist/SpineCanvas.d.ts +1 -1
- package/dist/SpineCanvas.js +17 -5
- package/dist/Vector3.d.ts +1 -1
- package/dist/Vector3.js +5 -5
- package/dist/WebGL.js +4 -2
- package/dist/iife/spine-webgl.js +1821 -1299
- package/dist/iife/spine-webgl.js.map +4 -4
- package/dist/iife/spine-webgl.min.js +26 -26
- package/dist/index.d.ts +17 -17
- package/dist/index.js +18 -18
- package/package.json +3 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";var spine=(()=>{var Be=Object.defineProperty,Is=Object.getOwnPropertyDescriptor,Ys=Object.getOwnPropertyNames,Ms=Object.prototype.hasOwnProperty,Es=(t,e)=>{for(var i in e)Be(t,i,{get:e[i],enumerable:!0})},ks=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ys(e))!Ms.call(t,n)&&n!==i&&Be(t,n,{get:()=>e[n],enumerable:!(s=Is(e,n))||s.enumerable});return t},Rs=t=>ks(Be({},"__esModule",{value:!0}),t),Pi={};Es(Pi,{AlphaTimeline:()=>Qe,Animation:()=>fe,AnimationState:()=>qi,AnimationStateAdapter:()=>Bs,AnimationStateData:()=>Ds,AssetManager:()=>hs,AssetManagerBase:()=>es,AtlasAttachmentLoader:()=>Ns,Attachment:()=>Ve,AttachmentTimeline:()=>Wt,BinaryInput:()=>ls,BlendMode:()=>Te,Bone:()=>mi,BoneData:()=>ui,BoundingBoxAttachment:()=>we,CURRENT:()=>Zi,CameraController:()=>ur,ClippingAttachment:()=>le,Color:()=>B,Color2Attribute:()=>fs,ColorAttribute:()=>Ee,ConstraintData:()=>ve,CurveTimeline:()=>Tt,CurveTimeline1:()=>It,CurveTimeline2:()=>ue,DebugUtils:()=>Ls,DeformTimeline:()=>ei,Downloader:()=>gi,DrawOrderTimeline:()=>_t,Event:()=>xi,EventData:()=>wi,EventQueue:()=>Hi,EventTimeline:()=>ae,EventType:()=>pt,FIRST:()=>li,FakeTexture:()=>Os,GLTexture:()=>oe,HOLD_FIRST:()=>xe,HOLD_MIX:()=>ji,HOLD_SUBSEQUENT:()=>oi,IkConstraint:()=>is,IkConstraintData:()=>bi,IkConstraintTimeline:()=>ii,Input:()=>Ii,IntSet:()=>Fs,Interpolation:()=>Bi,LoadingScreen:()=>br,M00:()=>D,M01:()=>_,M02:()=>q,M03:()=>O,M10:()=>G,M11:()=>V,M12:()=>H,M13:()=>N,M20:()=>j,M21:()=>Z,M22:()=>U,M23:()=>z,M30:()=>J,M31:()=>Q,M32:()=>$,M33:()=>K,ManagedWebGLRenderingContext:()=>xt,MathUtils:()=>F,Matrix4:()=>Pt,Mesh:()=>Yi,MeshAttachment:()=>Ot,MixBlend:()=>Ui,MixDirection:()=>zi,OrthoCamera:()=>cs,PathAttachment:()=>qt,PathConstraint:()=>Jt,PathConstraintData:()=>pi,PathConstraintMixTimeline:()=>ai,PathConstraintPositionTimeline:()=>ri,PathConstraintSpacingTimeline:()=>ni,PointAttachment:()=>fi,PolygonBatcher:()=>$t,Pool:()=>re,Position2Attribute:()=>Me,Position3Attribute:()=>mr,PositionMode:()=>ye,Pow:()=>Di,PowOut:()=>Xs,RGB2Timeline:()=>ti,RGBA2Timeline:()=>$e,RGBATimeline:()=>Ke,RGBTimeline:()=>Je,RegionAttachment:()=>nt,ResizeMode:()=>Xe,RotateMode:()=>Ce,RotateTimeline:()=>ne,SETUP:()=>hi,SUBSEQUENT:()=>ge,ScaleTimeline:()=>_e,ScaleXTimeline:()=>qe,ScaleYTimeline:()=>Ge,SceneRenderer:()=>ws,SequenceTimeline:()=>Kt,Shader:()=>mt,ShapeRenderer:()=>Ei,ShapeType:()=>bt,ShearTimeline:()=>He,ShearXTimeline:()=>je,ShearYTimeline:()=>Ze,Skeleton:()=>as,SkeletonBinary:()=>Us,SkeletonBounds:()=>os,SkeletonClipping:()=>Ie,SkeletonData:()=>vi,SkeletonDebugRenderer:()=>ke,SkeletonJson:()=>dr,SkeletonRenderer:()=>Ri,Skin:()=>Se,SkinEntry:()=>yi,Slot:()=>ss,SlotData:()=>Ai,SpacingMode:()=>Ae,SpineCanvas:()=>yr,StringSet:()=>De,TexCoordAttribute:()=>Mi,Texture:()=>ci,TextureAtlas:()=>Qi,TextureAtlasPage:()=>$i,TextureAtlasRegion:()=>di,TextureFilter:()=>be,TextureRegion:()=>Ji,TextureWrap:()=>Ki,TimeKeeper:()=>Oe,Timeline:()=>ut,Touch:()=>ds,TrackEntry:()=>Gi,TransformConstraint:()=>rs,TransformConstraintData:()=>Ci,TransformConstraintTimeline:()=>si,TransformMode:()=>pe,TranslateTimeline:()=>Ue,TranslateXTimeline:()=>ze,TranslateYTimeline:()=>We,Triangulator:()=>vt,Utils:()=>P,Vector2:()=>zt,Vector3:()=>yt,VertexAttachment:()=>St,VertexAttribute:()=>Qt,VertexAttributeType:()=>Gt,WindowedMean:()=>Ps});var Fs=class{constructor(){this.array=new Array}add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},De=class{constructor(){this.entries={},this.size=0}add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var i=0,s=t.length;i<s;i++)this.add(t[i]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},Ut=class{constructor(t=0,e=0,i=0,s=0){this.r=t,this.g=e,this.b=i,this.a=s}set(t,e,i,s){return this.r=t,this.g=e,this.b=i,this.a=s,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,e,i,s){return this.r+=t,this.g+=e,this.b+=i,this.a+=s,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,e){t.r=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}static fromString(t){return new Ut().setFromString(t)}},B=Ut;B.WHITE=new Ut(1,1,1,1),B.RED=new Ut(1,0,0,1),B.GREEN=new Ut(0,1,0,1),B.BLUE=new Ut(0,0,1,1),B.MAGENTA=new Ut(1,0,1,1);var Ft=class{static clamp(t,e,i){return t<e?e:t>i?i:t}static cosDeg(t){return Math.cos(t*Ft.degRad)}static sinDeg(t){return Math.sin(t*Ft.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 e=Math.pow(Math.abs(t),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return Ft.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,i){let s=Math.random(),n=e-t;return s<=(i-t)/n?t+Math.sqrt(s*n*(i-t)):e-Math.sqrt((1-s)*n*(e-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},F=Ft;F.PI=3.1415927,F.PI2=Ft.PI*2,F.radiansToDegrees=180/Ft.PI,F.radDeg=Ft.radiansToDegrees,F.degreesToRadians=Ft.PI/180,F.degRad=Ft.degreesToRadians;var Bi=class{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}},Di=class extends Bi{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},Xs=class extends Di{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},Zt=class{static arrayCopy(t,e,i,s,n){for(let c=e,l=s;c<e+n;c++,l++)i[l]=t[c]}static arrayFill(t,e,i,s){for(let n=e;n<i;n++)t[n]=s}static setArraySize(t,e,i=0){let s=t.length;if(s==e)return t;if(t.length=e,s<e)for(let n=s;n<e;n++)t[n]=i;return t}static ensureArrayCapacity(t,e,i=0){return t.length>=e?t:Zt.setArraySize(t,e,i)}static newArray(t,e){let i=new Array(t);for(let s=0;s<t;s++)i[s]=e;return i}static newFloatArray(t){if(Zt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let i=0;i<e.length;i++)e[i]=0;return e}}static newShortArray(t){if(Zt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let i=0;i<e.length;i++)e[i]=0;return e}}static toFloatArray(t){return Zt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Zt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,i=!0){for(var s=0;s<t.length;s++)if(t[s]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},P=Zt;P.SUPPORTS_TYPED_ARRAYS=typeof Float32Array!="undefined";var Ls=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let i=t.bones[e];console.log(i.data.name+", "+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.worldX+", "+i.worldY)}}},re=class{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},zt=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},Oe=class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ps=class{constructor(t=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Ve=class{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},Oi=class extends Ve{constructor(t){super(t),this.id=Oi.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(t,e,i,s,n,c){i=n+(i>>1)*c;let l=t.bone.skeleton,r=t.deform,o=this.vertices,a=this.bones;if(!a){r.length>0&&(o=r);let u=t.bone,m=u.worldX,x=u.worldY,p=u.a,v=u.b,g=u.c,w=u.d;for(let b=e,y=n;y<i;b+=2,y+=c){let C=o[b],A=o[b+1];s[y]=C*p+A*v+m,s[y+1]=C*g+A*w+x}return}let h=0,d=0;for(let u=0;u<e;u+=2){let m=a[h];h+=m+1,d+=m}let f=l.bones;if(r.length==0)for(let u=n,m=d*3;u<i;u+=c){let x=0,p=0,v=a[h++];for(v+=h;h<v;h++,m+=3){let g=f[a[h]],w=o[m],b=o[m+1],y=o[m+2];x+=(w*g.a+b*g.b+g.worldX)*y,p+=(w*g.c+b*g.d+g.worldY)*y}s[u]=x,s[u+1]=p}else{let u=r;for(let m=n,x=d*3,p=d<<1;m<i;m+=c){let v=0,g=0,w=a[h++];for(w+=h;h<w;h++,x+=3,p+=2){let b=f[a[h]],y=o[x]+u[p],C=o[x+1]+u[p+1],A=o[x+2];v+=(y*b.a+C*b.b+b.worldX)*A,g+=(y*b.c+C*b.d+b.worldY)*A}s[m]=v,s[m+1]=g}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},St=Oi;St.nextID=0;var de=class{constructor(t){this.id=de.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(t)}copy(){let t=new de(this.regions.length);return P.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,e){let i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let s=this.regions[i];e.region!=s&&(e.region=s,e.updateRegion())}getPath(t,e){let i=t,s=(this.start+e).toString();for(let n=this.digits-s.length;n>0;n--)i+="0";return i+=s,i}static nextID(){return de._nextID++}},Ne=de;Ne._nextID=0;var Vi=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(Vi||{}),Ni=[0,1,2,3,4,5,6],fe=class{constructor(t,e,i){if(this.timelines=[],this.timelineIds=new De,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=i}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,i,s,n,c,l,r){if(!t)throw new Error("skeleton cannot be null.");s&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));let o=this.timelines;for(let a=0,h=o.length;a<h;a++)o[a].apply(t,e,i,n,c,l,r)}},Ui=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(Ui||{}),zi=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(zi||{}),ct={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19},ut=class{constructor(t,e){this.propertyIds=e,this.frames=P.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let i=t.length;for(let s=1;s<i;s++)if(t[s]>e)return s-1;return i-1}static search(t,e,i){let s=t.length;for(let n=i;n<s;n+=i)if(t[n]>e)return n-i;return s-i}},Tt=class extends ut{constructor(t,e,i){super(t,i),this.curves=P.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let i=P.newFloatArray(e);P.arrayCopy(this.curves,0,i,0,e),this.curves=i}}setBezier(t,e,i,s,n,c,l,r,o,a,h){let d=this.curves,f=this.getFrameCount()+t*18;i==0&&(d[e]=2+f);let u=(s-c*2+r)*.03,m=(n-l*2+o)*.03,x=((c-r)*3-s+a)*.006,p=((l-o)*3-n+h)*.006,v=u*2+x,g=m*2+p,w=(c-s)*.3+u+x*.16666667,b=(l-n)*.3+m+p*.16666667,y=s+w,C=n+b;for(let A=f+18;f<A;f+=2)d[f]=y,d[f+1]=C,w+=v,b+=g,v+=x,g+=p,y+=w,C+=b}getBezierValue(t,e,i,s){let n=this.curves;if(n[s]>t){let o=this.frames[e],a=this.frames[e+i];return a+(t-o)/(n[s]-o)*(n[s+1]-a)}let c=s+18;for(s+=2;s<c;s+=2)if(n[s]>=t){let o=n[s-2],a=n[s-1];return a+(t-o)/(n[s]-o)*(n[s+1]-a)}e+=this.getFrameEntries();let l=n[c-2],r=n[c-1];return r+(t-l)/(this.frames[e]-l)*(this.frames[e+i]-r)}},It=class extends Tt{constructor(t,e,i){super(t,e,[i])}getFrameEntries(){return 2}setFrame(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+1]=i}getCurveValue(t){let e=this.frames,i=e.length-2;for(let n=2;n<=i;n+=2)if(e[n]>t){i=n-2;break}let s=this.curves[i>>1];switch(s){case 0:let n=e[i],c=e[i+1];return c+(t-n)/(e[i+2]-n)*(e[i+2+1]-c);case 1:return e[i+1]}return this.getBezierValue(t,i,1,s-2)}},ue=class extends Tt{constructor(t,e,i,s){super(t,e,[i,s])}getFrameEntries(){return 3}setFrame(t,e,i,s){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s}},ne=class extends It{constructor(t,e,i){super(t,e,ct.rotate+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.rotation=r.data.rotation;return;case 1:r.rotation+=(r.data.rotation-r.rotation)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.rotation=r.data.rotation+a*n;break;case 1:case 2:a+=r.data.rotation-r.rotation;case 3:r.rotation+=a*n}}},Ue=class extends ue{constructor(t,e,i){super(t,e,ct.x+"|"+i,ct.y+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let a=0,h=0,d=ut.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+3]-u);a+=(o[d+3+1]-a)*m,h+=(o[d+3+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}switch(c){case 0:r.x=r.data.x+a*n,r.y=r.data.y+h*n;break;case 1:case 2:r.x+=(r.data.x+a-r.x)*n,r.y+=(r.data.y+h-r.y)*n;break;case 3:r.x+=a*n,r.y+=h*n}}},ze=class extends It{constructor(t,e,i){super(t,e,ct.x+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.x=r.data.x;return;case 1:r.x+=(r.data.x-r.x)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.x=r.data.x+a*n;break;case 1:case 2:r.x+=(r.data.x+a-r.x)*n;break;case 3:r.x+=a*n}}},We=class extends It{constructor(t,e,i){super(t,e,ct.y+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.y=r.data.y;return;case 1:r.y+=(r.data.y-r.y)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.y=r.data.y+a*n;break;case 1:case 2:r.y+=(r.data.y+a-r.y)*n;break;case 3:r.y+=a*n}}},_e=class extends ue{constructor(t,e,i){super(t,e,ct.scaleX+"|"+i,ct.scaleY+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let a,h,d=ut.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+3]-u);a+=(o[d+3+1]-a)*m,h+=(o[d+3+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}if(a*=r.data.scaleX,h*=r.data.scaleY,n==1)c==3?(r.scaleX+=a-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=a,r.scaleY=h);else{let u=0,m=0;if(l==1)switch(c){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(a)*F.signum(u)-u)*n,r.scaleY=m+(Math.abs(h)*F.signum(m)-m)*n;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(a)*F.signum(u)-u)*n,r.scaleY=m+(Math.abs(h)*F.signum(m)-m)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n,r.scaleY+=(h-r.data.scaleY)*n}else switch(c){case 0:u=Math.abs(r.data.scaleX)*F.signum(a),m=Math.abs(r.data.scaleY)*F.signum(h),r.scaleX=u+(a-u)*n,r.scaleY=m+(h-m)*n;break;case 1:case 2:u=Math.abs(r.scaleX)*F.signum(a),m=Math.abs(r.scaleY)*F.signum(h),r.scaleX=u+(a-u)*n,r.scaleY=m+(h-m)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n,r.scaleY+=(h-r.data.scaleY)*n}}}},qe=class extends It{constructor(t,e,i){super(t,e,ct.scaleX+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.scaleX=r.data.scaleX;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*n}return}let a=this.getCurveValue(i)*r.data.scaleX;if(n==1)c==3?r.scaleX+=a-r.data.scaleX:r.scaleX=a;else{let h=0;if(l==1)switch(c){case 0:h=r.data.scaleX,r.scaleX=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 1:case 2:h=r.scaleX,r.scaleX=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n}else switch(c){case 0:h=Math.abs(r.data.scaleX)*F.signum(a),r.scaleX=h+(a-h)*n;break;case 1:case 2:h=Math.abs(r.scaleX)*F.signum(a),r.scaleX=h+(a-h)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n}}}},Ge=class extends It{constructor(t,e,i){super(t,e,ct.scaleY+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.scaleY=r.data.scaleY;return;case 1:r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let a=this.getCurveValue(i)*r.data.scaleY;if(n==1)c==3?r.scaleY+=a-r.data.scaleY:r.scaleY=a;else{let h=0;if(l==1)switch(c){case 0:h=r.data.scaleY,r.scaleY=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 1:case 2:h=r.scaleY,r.scaleY=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 3:r.scaleY+=(a-r.data.scaleY)*n}else switch(c){case 0:h=Math.abs(r.data.scaleY)*F.signum(a),r.scaleY=h+(a-h)*n;break;case 1:case 2:h=Math.abs(r.scaleY)*F.signum(a),r.scaleY=h+(a-h)*n;break;case 3:r.scaleY+=(a-r.data.scaleY)*n}}}},He=class extends ue{constructor(t,e,i){super(t,e,ct.shearX+"|"+i,ct.shearY+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let a=0,h=0,d=ut.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+3]-u);a+=(o[d+3+1]-a)*m,h+=(o[d+3+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}switch(c){case 0:r.shearX=r.data.shearX+a*n,r.shearY=r.data.shearY+h*n;break;case 1:case 2:r.shearX+=(r.data.shearX+a-r.shearX)*n,r.shearY+=(r.data.shearY+h-r.shearY)*n;break;case 3:r.shearX+=a*n,r.shearY+=h*n}}},je=class extends It{constructor(t,e,i){super(t,e,ct.shearX+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.shearX=r.data.shearX;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.shearX=r.data.shearX+a*n;break;case 1:case 2:r.shearX+=(r.data.shearX+a-r.shearX)*n;break;case 3:r.shearX+=a*n}}},Ze=class extends It{constructor(t,e,i){super(t,e,ct.shearY+"|"+i),this.boneIndex=0,this.boneIndex=i}apply(t,e,i,s,n,c,l){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.shearY=r.data.shearY;return;case 1:r.shearY+=(r.data.shearY-r.shearY)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.shearY=r.data.shearY+a*n;break;case 1:case 2:r.shearY+=(r.data.shearY+a-r.shearY)*n;break;case 3:r.shearY+=a*n}}},Ke=class extends Tt{constructor(t,e,i){super(t,e,[ct.rgb+"|"+i,ct.alpha+"|"+i]),this.slotIndex=0,this.slotIndex=i}getFrameEntries(){return 5}setFrame(t,e,i,s,n,c){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=n,this.frames[t+4]=c}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color;if(i<o[0]){let p=r.data.color;switch(c){case 0:a.setFromColor(p);return;case 1:a.add((p.r-a.r)*n,(p.g-a.g)*n,(p.b-a.b)*n,(p.a-a.a)*n)}return}let h=0,d=0,f=0,u=0,m=ut.search(o,i,5),x=this.curves[m/5];switch(x){case 0:let p=o[m];h=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];let v=(i-p)/(o[m+5]-p);h+=(o[m+5+1]-h)*v,d+=(o[m+5+2]-d)*v,f+=(o[m+5+3]-f)*v,u+=(o[m+5+4]-u)*v;break;case 1:h=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];break;default:h=this.getBezierValue(i,m,1,x-2),d=this.getBezierValue(i,m,2,x+18-2),f=this.getBezierValue(i,m,3,x+18*2-2),u=this.getBezierValue(i,m,4,x+18*3-2)}n==1?a.set(h,d,f,u):(c==0&&a.setFromColor(r.data.color),a.add((h-a.r)*n,(d-a.g)*n,(f-a.b)*n,(u-a.a)*n))}},Je=class extends Tt{constructor(t,e,i){super(t,e,[ct.rgb+"|"+i]),this.slotIndex=0,this.slotIndex=i}getFrameEntries(){return 4}setFrame(t,e,i,s,n){t<<=2,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=n}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color;if(i<o[0]){let x=r.data.color;switch(c){case 0:a.r=x.r,a.g=x.g,a.b=x.b;return;case 1:a.r+=(x.r-a.r)*n,a.g+=(x.g-a.g)*n,a.b+=(x.b-a.b)*n}return}let h=0,d=0,f=0,u=ut.search(o,i,4),m=this.curves[u>>2];switch(m){case 0:let x=o[u];h=o[u+1],d=o[u+2],f=o[u+3];let p=(i-x)/(o[u+4]-x);h+=(o[u+4+1]-h)*p,d+=(o[u+4+2]-d)*p,f+=(o[u+4+3]-f)*p;break;case 1:h=o[u+1],d=o[u+2],f=o[u+3];break;default:h=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2),f=this.getBezierValue(i,u,3,m+18*2-2)}if(n==1)a.r=h,a.g=d,a.b=f;else{if(c==0){let x=r.data.color;a.r=x.r,a.g=x.g,a.b=x.b}a.r+=(h-a.r)*n,a.g+=(d-a.g)*n,a.b+=(f-a.b)*n}}},Qe=class extends It{constructor(t,e,i){super(t,e,ct.alpha+"|"+i),this.slotIndex=0,this.slotIndex=i}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(i<this.frames[0]){let h=r.data.color;switch(c){case 0:o.a=h.a;return;case 1:o.a+=(h.a-o.a)*n}return}let a=this.getCurveValue(i);n==1?o.a=a:(c==0&&(o.a=r.data.color.a),o.a+=(a-o.a)*n)}},$e=class extends Tt{constructor(t,e,i){super(t,e,[ct.rgb+"|"+i,ct.alpha+"|"+i,ct.rgb2+"|"+i]),this.slotIndex=0,this.slotIndex=i}getFrameEntries(){return 8}setFrame(t,e,i,s,n,c,l,r,o){t<<=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=n,this.frames[t+4]=c,this.frames[t+5]=l,this.frames[t+6]=r,this.frames[t+7]=o}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color,h=r.darkColor;if(i<o[0]){let b=r.data.color,y=r.data.darkColor;switch(c){case 0:a.setFromColor(b),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:a.add((b.r-a.r)*n,(b.g-a.g)*n,(b.b-a.b)*n,(b.a-a.a)*n),h.r+=(y.r-h.r)*n,h.g+=(y.g-h.g)*n,h.b+=(y.b-h.b)*n}return}let d=0,f=0,u=0,m=0,x=0,p=0,v=0,g=ut.search(o,i,8),w=this.curves[g>>3];switch(w){case 0:let b=o[g];d=o[g+1],f=o[g+2],u=o[g+3],m=o[g+4],x=o[g+5],p=o[g+6],v=o[g+7];let y=(i-b)/(o[g+8]-b);d+=(o[g+8+1]-d)*y,f+=(o[g+8+2]-f)*y,u+=(o[g+8+3]-u)*y,m+=(o[g+8+4]-m)*y,x+=(o[g+8+5]-x)*y,p+=(o[g+8+6]-p)*y,v+=(o[g+8+7]-v)*y;break;case 1:d=o[g+1],f=o[g+2],u=o[g+3],m=o[g+4],x=o[g+5],p=o[g+6],v=o[g+7];break;default:d=this.getBezierValue(i,g,1,w-2),f=this.getBezierValue(i,g,2,w+18-2),u=this.getBezierValue(i,g,3,w+18*2-2),m=this.getBezierValue(i,g,4,w+18*3-2),x=this.getBezierValue(i,g,5,w+18*4-2),p=this.getBezierValue(i,g,6,w+18*5-2),v=this.getBezierValue(i,g,7,w+18*6-2)}if(n==1)a.set(d,f,u,m),h.r=x,h.g=p,h.b=v;else{if(c==0){a.setFromColor(r.data.color);let b=r.data.darkColor;h.r=b.r,h.g=b.g,h.b=b.b}a.add((d-a.r)*n,(f-a.g)*n,(u-a.b)*n,(m-a.a)*n),h.r+=(x-h.r)*n,h.g+=(p-h.g)*n,h.b+=(v-h.b)*n}}},ti=class extends Tt{constructor(t,e,i){super(t,e,[ct.rgb+"|"+i,ct.rgb2+"|"+i]),this.slotIndex=0,this.slotIndex=i}getFrameEntries(){return 7}setFrame(t,e,i,s,n,c,l,r){t*=7,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=n,this.frames[t+4]=c,this.frames[t+5]=l,this.frames[t+6]=r}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color,h=r.darkColor;if(i<o[0]){let b=r.data.color,y=r.data.darkColor;switch(c){case 0:a.r=b.r,a.g=b.g,a.b=b.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:a.r+=(b.r-a.r)*n,a.g+=(b.g-a.g)*n,a.b+=(b.b-a.b)*n,h.r+=(y.r-h.r)*n,h.g+=(y.g-h.g)*n,h.b+=(y.b-h.b)*n}return}let d=0,f=0,u=0,m=0,x=0,p=0,v=0,g=ut.search(o,i,7),w=this.curves[g/7];switch(w){case 0:let b=o[g];d=o[g+1],f=o[g+2],u=o[g+3],x=o[g+4],p=o[g+5],v=o[g+6];let y=(i-b)/(o[g+7]-b);d+=(o[g+7+1]-d)*y,f+=(o[g+7+2]-f)*y,u+=(o[g+7+3]-u)*y,x+=(o[g+7+4]-x)*y,p+=(o[g+7+5]-p)*y,v+=(o[g+7+6]-v)*y;break;case 1:d=o[g+1],f=o[g+2],u=o[g+3],x=o[g+4],p=o[g+5],v=o[g+6];break;default:d=this.getBezierValue(i,g,1,w-2),f=this.getBezierValue(i,g,2,w+18-2),u=this.getBezierValue(i,g,3,w+18*2-2),x=this.getBezierValue(i,g,4,w+18*3-2),p=this.getBezierValue(i,g,5,w+18*4-2),v=this.getBezierValue(i,g,6,w+18*5-2)}if(n==1)a.r=d,a.g=f,a.b=u,h.r=x,h.g=p,h.b=v;else{if(c==0){let b=r.data.color,y=r.data.darkColor;a.r=b.r,a.g=b.g,a.b=b.b,h.r=y.r,h.g=y.g,h.b=y.b}a.r+=(d-a.r)*n,a.g+=(f-a.g)*n,a.b+=(u-a.b)*n,h.r+=(x-h.r)*n,h.g+=(p-h.g)*n,h.b+=(v-h.b)*n}}},Wt=class extends ut{constructor(t,e){super(t,[ct.attachment+"|"+e]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(r.bone.active){if(l==1){c==0&&this.setAttachment(t,r,r.data.attachmentName);return}if(i<this.frames[0]){(c==0||c==1)&&this.setAttachment(t,r,r.data.attachmentName);return}this.setAttachment(t,r,this.attachmentNames[ut.search1(this.frames,i)])}}setAttachment(t,e,i){e.setAttachment(i?t.getAttachment(this.slotIndex,i):null)}},ei=class extends Tt{constructor(t,e,i,s){super(t,e,[ct.deform+"|"+i+"|"+s.id]),this.slotIndex=0,this.slotIndex=i,this.attachment=s,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.vertices[t]=i}setBezier(t,e,i,s,n,c,l,r,o,a,h){let d=this.curves,f=this.getFrameCount()+t*18;i==0&&(d[e]=2+f);let u=(s-c*2+r)*.03,m=o*.03-l*.06,x=((c-r)*3-s+a)*.006,p=(l-o+.33333333)*.018,v=u*2+x,g=m*2+p,w=(c-s)*.3+u+x*.16666667,b=l*.3+m+p*.16666667,y=s+w,C=b;for(let A=f+18;f<A;f+=2)d[f]=y,d[f+1]=C,w+=v,b+=g,v+=x,g+=p,y+=w,C+=b}getCurvePercent(t,e){let i=this.curves,s=i[e];switch(s){case 0:let r=this.frames[e];return(t-r)/(this.frames[e+this.getFrameEntries()]-r);case 1:return 0}if(s-=2,i[s]>t){let r=this.frames[e];return i[s+1]*(t-r)/(i[s]-r)}let n=s+18;for(s+=2;s<n;s+=2)if(i[s]>=t){let r=i[s-2],o=i[s-1];return o+(t-r)/(i[s]-r)*(i[s+1]-o)}let c=i[n-2],l=i[n-1];return l+(1-l)*(t-c)/(this.frames[e+this.getFrameEntries()]-c)}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof St)||o.timelineAttachment!=this.attachment)return;let a=r.deform;a.length==0&&(c=0);let h=this.vertices,d=h[0].length,f=this.frames;if(i<f[0]){switch(c){case 0:a.length=0;return;case 1:if(n==1){a.length=0;return}a.length=d;let g=o;if(g.bones){n=1-n;for(var u=0;u<d;u++)a[u]*=n}else{let w=g.vertices;for(var u=0;u<d;u++)a[u]+=(w[u]-a[u])*n}}return}if(a.length=d,i>=f[f.length-1]){let g=h[f.length-1];if(n==1)if(c==3){let w=o;if(w.bones)for(let b=0;b<d;b++)a[b]+=g[b];else{let b=w.vertices;for(let y=0;y<d;y++)a[y]+=g[y]-b[y]}}else P.arrayCopy(g,0,a,0,d);else switch(c){case 0:{let b=o;if(b.bones)for(let y=0;y<d;y++)a[y]=g[y]*n;else{let y=b.vertices;for(let C=0;C<d;C++){let A=y[C];a[C]=A+(g[C]-A)*n}}break}case 1:case 2:for(let b=0;b<d;b++)a[b]+=(g[b]-a[b])*n;break;case 3:let w=o;if(w.bones)for(let b=0;b<d;b++)a[b]+=g[b]*n;else{let b=w.vertices;for(let y=0;y<d;y++)a[y]+=(g[y]-b[y])*n}}return}let m=ut.search1(f,i),x=this.getCurvePercent(i,m),p=h[m],v=h[m+1];if(n==1)if(c==3){let g=o;if(g.bones)for(let w=0;w<d;w++){let b=p[w];a[w]+=b+(v[w]-b)*x}else{let w=g.vertices;for(let b=0;b<d;b++){let y=p[b];a[b]+=y+(v[b]-y)*x-w[b]}}}else for(let g=0;g<d;g++){let w=p[g];a[g]=w+(v[g]-w)*x}else switch(c){case 0:{let w=o;if(w.bones)for(let b=0;b<d;b++){let y=p[b];a[b]=(y+(v[b]-y)*x)*n}else{let b=w.vertices;for(let y=0;y<d;y++){let C=p[y],A=b[y];a[y]=A+(C+(v[y]-C)*x-A)*n}}break}case 1:case 2:for(let w=0;w<d;w++){let b=p[w];a[w]+=(b+(v[w]-b)*x-a[w])*n}break;case 3:let g=o;if(g.bones)for(let w=0;w<d;w++){let b=p[w];a[w]+=(b+(v[w]-b)*x)*n}else{let w=g.vertices;for(let b=0;b<d;b++){let y=p[b];a[b]+=(y+(v[b]-y)*x-w[b])*n}}}}},Wi=class extends ut{constructor(t){super(t,Wi.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,i,s,n,c,l){if(!s)return;let r=this.frames,o=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,s,n,c,l),e=-1;else if(e>=r[o-1])return;if(i<r[0])return;let a=0;if(e<r[0])a=0;else{a=ut.search1(r,e)+1;let h=r[a];for(;a>0&&r[a-1]==h;)a--}for(;a<o&&i>=r[a];a++)s.push(this.events[a])}},ae=Wi;ae.propertyIds=[""+ct.event];var _i=class extends ut{constructor(t){super(t,_i.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.drawOrders[t]=i}apply(t,e,i,s,n,c,l){if(l==1){c==0&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(c==0||c==1)&&P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let r=ut.search1(this.frames,i),o=this.drawOrders[r];if(!o)P.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let a=t.drawOrder,h=t.slots;for(let d=0,f=o.length;d<f;d++)a[d]=h[o[d]]}}},_t=_i;_t.propertyIds=[""+ct.drawOrder];var ii=class extends Tt{constructor(t,e,i){super(t,e,[ct.ikConstraint+"|"+i]),this.ikConstraintIndex=0,this.ikConstraintIndex=i}getFrameEntries(){return 6}setFrame(t,e,i,s,n,c,l){t*=6,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=n,this.frames[t+4]=c?1:0,this.frames[t+5]=l?1:0}apply(t,e,i,s,n,c,l){let r=t.ikConstraints[this.ikConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let a=0,h=0,d=ut.search(o,i,6),f=this.curves[d/6];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+6]-u);a+=(o[d+6+1]-a)*m,h+=(o[d+6+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}c==0?(r.mix=r.data.mix+(a-r.data.mix)*n,r.softness=r.data.softness+(h-r.data.softness)*n,l==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(a-r.mix)*n,r.softness+=(h-r.softness)*n,l==0&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}},si=class extends Tt{constructor(t,e,i){super(t,e,[ct.transformConstraint+"|"+i]),this.transformConstraintIndex=0,this.transformConstraintIndex=i}getFrameEntries(){return 7}setFrame(t,e,i,s,n,c,l,r){let o=this.frames;t*=7,o[t]=e,o[t+1]=i,o[t+2]=s,o[t+3]=n,o[t+4]=c,o[t+5]=l,o[t+6]=r}apply(t,e,i,s,n,c,l){let r=t.transformConstraints[this.transformConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){let v=r.data;switch(c){case 0:r.mixRotate=v.mixRotate,r.mixX=v.mixX,r.mixY=v.mixY,r.mixScaleX=v.mixScaleX,r.mixScaleY=v.mixScaleY,r.mixShearY=v.mixShearY;return;case 1:r.mixRotate+=(v.mixRotate-r.mixRotate)*n,r.mixX+=(v.mixX-r.mixX)*n,r.mixY+=(v.mixY-r.mixY)*n,r.mixScaleX+=(v.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(v.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(v.mixShearY-r.mixShearY)*n}return}let a,h,d,f,u,m,x=ut.search(o,i,7),p=this.curves[x/7];switch(p){case 0:let v=o[x];a=o[x+1],h=o[x+2],d=o[x+3],f=o[x+4],u=o[x+5],m=o[x+6];let g=(i-v)/(o[x+7]-v);a+=(o[x+7+1]-a)*g,h+=(o[x+7+2]-h)*g,d+=(o[x+7+3]-d)*g,f+=(o[x+7+4]-f)*g,u+=(o[x+7+5]-u)*g,m+=(o[x+7+6]-m)*g;break;case 1:a=o[x+1],h=o[x+2],d=o[x+3],f=o[x+4],u=o[x+5],m=o[x+6];break;default:a=this.getBezierValue(i,x,1,p-2),h=this.getBezierValue(i,x,2,p+18-2),d=this.getBezierValue(i,x,3,p+18*2-2),f=this.getBezierValue(i,x,4,p+18*3-2),u=this.getBezierValue(i,x,5,p+18*4-2),m=this.getBezierValue(i,x,6,p+18*5-2)}if(c==0){let v=r.data;r.mixRotate=v.mixRotate+(a-v.mixRotate)*n,r.mixX=v.mixX+(h-v.mixX)*n,r.mixY=v.mixY+(d-v.mixY)*n,r.mixScaleX=v.mixScaleX+(f-v.mixScaleX)*n,r.mixScaleY=v.mixScaleY+(u-v.mixScaleY)*n,r.mixShearY=v.mixShearY+(m-v.mixShearY)*n}else r.mixRotate+=(a-r.mixRotate)*n,r.mixX+=(h-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(f-r.mixScaleX)*n,r.mixScaleY+=(u-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}},ri=class extends It{constructor(t,e,i){super(t,e,ct.pathConstraintPosition+"|"+i),this.pathConstraintIndex=0,this.pathConstraintIndex=i}apply(t,e,i,s,n,c,l){let r=t.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.position=r.data.position;return;case 1:r.position+=(r.data.position-r.position)*n}return}let a=this.getCurveValue(i);c==0?r.position=r.data.position+(a-r.data.position)*n:r.position+=(a-r.position)*n}},ni=class extends It{constructor(t,e,i){super(t,e,ct.pathConstraintSpacing+"|"+i),this.pathConstraintIndex=0,this.pathConstraintIndex=i}apply(t,e,i,s,n,c,l){let r=t.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.spacing=r.data.spacing;return;case 1:r.spacing+=(r.data.spacing-r.spacing)*n}return}let a=this.getCurveValue(i);c==0?r.spacing=r.data.spacing+(a-r.data.spacing)*n:r.spacing+=(a-r.spacing)*n}},ai=class extends Tt{constructor(t,e,i){super(t,e,[ct.pathConstraintMix+"|"+i]),this.pathConstraintIndex=0,this.pathConstraintIndex=i}getFrameEntries(){return 4}setFrame(t,e,i,s,n){let c=this.frames;t<<=2,c[t]=e,c[t+1]=i,c[t+2]=s,c[t+3]=n}apply(t,e,i,s,n,c,l){let r=t.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let a,h,d,f=ut.search(o,i,4),u=this.curves[f>>2];switch(u){case 0:let m=o[f];a=o[f+1],h=o[f+2],d=o[f+3];let x=(i-m)/(o[f+4]-m);a+=(o[f+4+1]-a)*x,h+=(o[f+4+2]-h)*x,d+=(o[f+4+3]-d)*x;break;case 1:a=o[f+1],h=o[f+2],d=o[f+3];break;default:a=this.getBezierValue(i,f,1,u-2),h=this.getBezierValue(i,f,2,u+18-2),d=this.getBezierValue(i,f,3,u+18*2-2)}if(c==0){let m=r.data;r.mixRotate=m.mixRotate+(a-m.mixRotate)*n,r.mixX=m.mixX+(h-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(a-r.mixRotate)*n,r.mixX+=(h-r.mixX)*n,r.mixY+=(d-r.mixY)*n}},Dt=class extends ut{constructor(t,e,i){super(t,[ct.sequence+"|"+e+"|"+i.sequence.id]),this.slotIndex=e,this.attachment=i}getFrameEntries(){return Dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,i,s,n){let c=this.frames;t*=Dt.ENTRIES,c[t]=e,c[t+Dt.MODE]=i|s<<4,c[t+Dt.DELAY]=n}apply(t,e,i,s,n,c,l){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,a=this.attachment;if(o!=a&&(!(o instanceof St)||o.timelineAttachment!=a))return;let h=this.frames;if(i<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let d=ut.search(h,i,Dt.ENTRIES),f=h[d],u=h[d+Dt.MODE],m=h[d+Dt.DELAY];if(!this.attachment.sequence)return;let x=u>>4,p=this.attachment.sequence.regions.length,v=Ni[u&15];if(v!=0)switch(x+=(i-f)/m+1e-5|0,v){case 1:x=Math.min(p-1,x);break;case 2:x%=p;break;case 3:{let g=(p<<1)-2;x=g==0?0:x%g,x>=p&&(x=g-x);break}case 4:x=Math.max(p-1-x,0);break;case 5:x=p-1-x%p;break;case 6:{let g=(p<<1)-2;x=g==0?0:(x+p-1)%g,x>=p&&(x=g-x)}}r.sequenceIndex=x}},Kt=Dt;Kt.ENTRIES=3,Kt.MODE=1,Kt.DELAY=2;var me=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Hi(this),this.propertyIDs=new De,this.animationsChanged=!1,this.trackEntryPool=new re(()=>new Gi),this.data=t}static emptyAnimation(){return me._emptyAnimation}update(t){t*=this.timeScale;let e=this.tracks;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let c=t*n.timeScale;if(n.delay>0){if(n.delay-=c,n.delay>0)continue;c=-n.delay,n.delay=0}let l=n.next;if(l){let r=n.trackLast-l.delay;if(r>=0){for(l.delay=0,l.trackTime+=n.timeScale==0?0:(r/n.timeScale+t)*l.timeScale,n.trackTime+=c,this.setCurrent(i,l,!0);l.mixingFrom;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[i]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=c}this.queue.drain()}updateMixingFrom(t,e){let i=t.mixingFrom;if(!i)return!0;let s=this.updateMixingFrom(i,e);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),s):(i.trackTime+=e*i.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,i=this.tracks,s=!1;for(let d=0,f=i.length;d<f;d++){let u=i[d];if(!u||u.delay>0)continue;s=!0;let m=d==0?1:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,t,m):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let p=u.animationLast,v=u.getAnimationTime(),g=v,w=e;u.reverse&&(g=u.animation.duration-g,w=null);let b=u.animation.timelines,y=b.length;if(d==0&&x==1||m==3)for(let C=0;C<y;C++){P.webkit602BugfixHelper(x,m);var n=b[C];n instanceof Wt?this.applyAttachmentTimeline(n,t,g,m,!0):n.apply(t,p,g,w,x,m,0)}else{let C=u.timelineMode,A=u.shortestRotation,T=!A&&u.timelinesRotation.length!=y<<1;T&&(u.timelinesRotation.length=y<<1);for(let E=0;E<y;E++){let R=b[E],L=C[E]==ge?m:0;!A&&R instanceof ne?this.applyRotateTimeline(R,t,g,x,L,u.timelinesRotation,E<<1,T):R instanceof Wt?this.applyAttachmentTimeline(R,t,g,m,!0):(P.webkit602BugfixHelper(x,m),R.apply(t,p,g,w,x,L,0))}}this.queueEvents(u,v),e.length=0,u.nextAnimationLast=v,u.nextTrackLast=u.trackTime}for(var c=this.unkeyedState+hi,l=t.slots,r=0,o=t.slots.length;r<o;r++){var a=l[r];if(a.attachmentState==c){var h=a.data.attachmentName;a.setAttachment(h?t.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(t,e,i){let s=t.mixingFrom;s.mixingFrom&&this.applyMixingFrom(s,e,i);let n=0;t.mixDuration==0?(n=1,i==1&&(i=0)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),i!=1&&(i=s.mixBlend));let c=n<s.attachmentThreshold,l=n<s.drawOrderThreshold,r=s.animation.timelines,o=r.length,a=s.alpha*t.interruptAlpha,h=a*(1-n),d=s.animationLast,f=s.getAnimationTime(),u=f,m=null;if(s.reverse?u=s.animation.duration-u:n<s.eventThreshold&&(m=this.events),i==3)for(let x=0;x<o;x++)r[x].apply(e,d,u,m,h,i,1);else{let x=s.timelineMode,p=s.timelineHoldMix,v=s.shortestRotation,g=!v&&s.timelinesRotation.length!=o<<1;g&&(s.timelinesRotation.length=o<<1),s.totalAlpha=0;for(let w=0;w<o;w++){let b=r[w],y=1,C,A=0;switch(x[w]){case ge:if(!l&&b instanceof _t)continue;C=i,A=h;break;case li:C=0,A=h;break;case oi:C=i,A=a;break;case xe:C=0,A=a;break;default:C=0;let T=p[w];A=a*Math.max(0,1-T.mixTime/T.mixDuration);break}s.totalAlpha+=A,!v&&b instanceof ne?this.applyRotateTimeline(b,e,u,A,C,s.timelinesRotation,w<<1,g):b instanceof Wt?this.applyAttachmentTimeline(b,e,u,C,c):(P.webkit602BugfixHelper(A,i),l&&b instanceof _t&&C==0&&(y=0),b.apply(e,d,u,m,A,C,y))}}return t.mixDuration>0&&this.queueEvents(s,f),this.events.length=0,s.nextAnimationLast=f,s.nextTrackLast=s.trackTime,n}applyAttachmentTimeline(t,e,i,s,n){var c=e.slots[t.slotIndex];c.bone.active&&(i<t.frames[0]?(s==0||s==1)&&this.setAttachment(e,c,c.data.attachmentName,n):this.setAttachment(e,c,t.attachmentNames[ut.search1(t.frames,i)],n),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+hi))}setAttachment(t,e,i,s){e.setAttachment(i?t.getAttachment(e.data.index,i):null),s&&(e.attachmentState=this.unkeyedState+Zi)}applyRotateTimeline(t,e,i,s,n,c,l,r){if(r&&(c[l]=0),s==1){t.apply(e,0,i,null,1,n,0);return}let o=e.bones[t.boneIndex];if(!o.active)return;let a=t.frames,h=0,d=0;if(i<a[0])switch(n){case 0:o.rotation=o.data.rotation;default:return;case 1:h=o.rotation,d=o.data.rotation}else h=n==0?o.data.rotation:o.rotation,d=o.data.rotation+t.getCurveValue(i);let f=0,u=d-h;if(u-=(16384-(16384.499999999996-u/360|0))*360,u==0)f=c[l];else{let m=0,x=0;r?(m=0,x=u):(m=c[l],x=c[l+1]);let p=m-m%360;f=u+p;let v=u>=0,g=m>=0;Math.abs(x)<=90&&F.signum(x)!=F.signum(u)&&(Math.abs(m-p)>180?(f+=360*F.signum(m),g=v):p!=0?f-=360*F.signum(m):g=v),g!=v&&(f+=360*F.signum(m)),c[l]=f}c[l+1]=u,o.rotation=h+f*s}queueEvents(t,e){let i=t.animationStart,s=t.animationEnd,n=s-i,c=t.trackLast%n,l=this.events,r=0,o=l.length;for(;r<o;r++){let h=l[r];if(h.time<c)break;h.time>s||this.queue.event(t,h)}let a=!1;for(t.loop?a=n==0||c>t.trackTime%n:a=e>=s&&t.animationLast<s,a&&this.queue.complete(t);r<o;r++){let h=l[r];h.time<i||this.queue.event(t,h)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let i=e;for(;;){let s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,i){let s=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,s&&(i&&this.queue.interrupt(s),e.mixingFrom=s,s.mixingTo=e,e.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(e.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,i=!1){let s=this.data.skeletonData.findAnimation(e);if(!s)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,s,i)}setAnimationWith(t,e,i=!1){if(!e)throw new Error("animation cannot be null.");let s=!0,n=this.expandToIndex(t);n&&(n.nextTrackLast==-1?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,s=!1):this.clearNext(n));let c=this.trackEntry(t,e,i,n);return this.setCurrent(t,c,s),this.queue.drain(),c}addAnimation(t,e,i=!1,s=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,i,s)}addAnimationWith(t,e,i=!1,s=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let c=this.trackEntry(t,e,i,n);return n?(n.next=c,c.previous=n,s<=0&&(s+=n.getTrackComplete()-c.mixDuration)):(this.setCurrent(t,c,!0),this.queue.drain()),c.delay=s,c}setEmptyAnimation(t,e=0){let i=this.setAnimationWith(t,me.emptyAnimation(),!1);return i.mixDuration=e,i.trackEnd=e,i}addEmptyAnimation(t,e=0,i=0){let s=this.addAnimationWith(t,me.emptyAnimation(),!1,i);return i<=0&&(s.delay+=s.mixDuration-e),s.mixDuration=e,s.trackEnd=e,s}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++){let n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(P.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,i,s){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=i,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.attachmentThreshold=0,n.drawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=s?this.data.getMix(s.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,i=t.length;e<i;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do(!s.mixingTo||s.mixBlend!=3)&&this.computeHold(s),s=s.mixingTo;while(s)}}}computeHold(t){let e=t.mixingTo,i=t.animation.timelines,s=t.animation.timelines.length,n=t.timelineMode;n.length=s;let c=t.timelineHoldMix;c.length=0;let l=this.propertyIDs;if(e&&e.holdPrevious){for(let r=0;r<s;r++)n[r]=l.addAll(i[r].getPropertyIds())?xe:oi;return}t:for(let r=0;r<s;r++){let o=i[r],a=o.getPropertyIds();if(!l.addAll(a))n[r]=ge;else if(!e||o instanceof Wt||o instanceof _t||o instanceof ae||!e.animation.hasTimeline(a))n[r]=li;else{for(let h=e.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(a)){if(t.mixDuration>0){n[r]=ji,c[r]=h;continue t}break}n[r]=xe}}}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 e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},qi=me;qi._emptyAnimation=new fe("<empty>",[],0);var Gi=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=2,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}},Hi=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(pt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(pt.interrupt),this.objects.push(t)}end(t){this.objects.push(pt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(pt.dispose),this.objects.push(t)}complete(t){this.objects.push(pt.complete),this.objects.push(t)}event(t,e){this.objects.push(pt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let i=0;i<t.length;i+=2){let s=t[i],n=t[i+1];switch(s){case pt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let l=0;l<e.length;l++){let r=e[l];r.start&&r.start(n)}break;case pt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let l=0;l<e.length;l++){let r=e[l];r.interrupt&&r.interrupt(n)}break;case pt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let l=0;l<e.length;l++){let r=e[l];r.end&&r.end(n)}case pt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let l=0;l<e.length;l++){let r=e[l];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case pt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let l=0;l<e.length;l++){let r=e[l];r.complete&&r.complete(n)}break;case pt.event:let c=t[i+++2];n.listener&&n.listener.event&&n.listener.event(n,c);for(let l=0;l<e.length;l++){let r=e[l];r.event&&r.event(n,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},pt=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(pt||{}),Bs=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},ge=0,li=1,oi=2,xe=3,ji=4,hi=1,Zi=2,Ds=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,i){let s=this.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(s,n,i)}setMixWith(t,e,i){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let s=t.name+"."+e.name;this.animationToMixTime[s]=i}getMix(t,e){let i=t.name+"."+e.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}},we=class extends St{constructor(t){super(t),this.color=new B(1,1,1,1)}copy(){let t=new we(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},le=class extends St{constructor(t){super(t),this.endSlot=null,this.color=new B(.2275,.2275,.8078,1)}copy(){let t=new le(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},ci=class{constructor(t){this._image=t}getImage(){return this._image}},be=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(be||{}),Ki=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Ki||{}),Ji=class{constructor(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Os=class extends ci{setFilters(t,e){}setWraps(t,e){}dispose(){}},Qi=class{constructor(t){this.pages=new Array,this.regions=new Array;let e=new Vs(t),i=new Array(4),s={};s.size=a=>{a.width=parseInt(i[1]),a.height=parseInt(i[2])},s.format=()=>{},s.filter=a=>{a.minFilter=P.enumValue(be,i[1]),a.magFilter=P.enumValue(be,i[2])},s.repeat=a=>{i[1].indexOf("x")!=-1&&(a.uWrap=10497),i[1].indexOf("y")!=-1&&(a.vWrap=10497)},s.pma=a=>{a.pma=i[1]=="true"};var n={};n.xy=a=>{a.x=parseInt(i[1]),a.y=parseInt(i[2])},n.size=a=>{a.width=parseInt(i[1]),a.height=parseInt(i[2])},n.bounds=a=>{a.x=parseInt(i[1]),a.y=parseInt(i[2]),a.width=parseInt(i[3]),a.height=parseInt(i[4])},n.offset=a=>{a.offsetX=parseInt(i[1]),a.offsetY=parseInt(i[2])},n.orig=a=>{a.originalWidth=parseInt(i[1]),a.originalHeight=parseInt(i[2])},n.offsets=a=>{a.offsetX=parseInt(i[1]),a.offsetY=parseInt(i[2]),a.originalWidth=parseInt(i[3]),a.originalHeight=parseInt(i[4])},n.rotate=a=>{let h=i[1];h=="true"?a.degrees=90:h!="false"&&(a.degrees=parseInt(h))},n.index=a=>{a.index=parseInt(i[1])};let c=e.readLine();for(;c&&c.trim().length==0;)c=e.readLine();for(;!(!c||c.trim().length==0||e.readEntry(i,c)==0);)c=e.readLine();let l=null,r=null,o=null;for(;c!==null;)if(c.trim().length==0)l=null,c=e.readLine();else if(l){let a=new di(l,c);for(;;){let h=e.readEntry(i,c=e.readLine());if(h==0)break;let d=n[i[0]];if(d)d(a);else{r||(r=[]),o||(o=[]),r.push(i[0]);let f=[];for(let u=0;u<h;u++)f.push(parseInt(i[u+1]));o.push(f)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height),r&&r.length>0&&o&&o.length>0&&(a.names=r,a.values=o,r=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees==90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new $i(c.trim());e.readEntry(i,c=e.readLine())!=0;){let a=s[i[0]];a&&a(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let i of this.pages)i.setTexture(t.get(e+i.name))}dispose(){var t;for(let e=0;e<this.pages.length;e++)(t=this.pages[e].texture)==null||t.dispose()}},Vs=class{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let i=e.indexOf(":");if(i==-1)return 0;t[0]=e.substr(0,i).trim();for(let s=1,n=i+1;;s++){let c=e.indexOf(",",n);if(c==-1)return t[s]=e.substr(n).trim(),s;if(t[s]=e.substr(n,c-n).trim(),n=c+1,s==4)return 4}}},$i=class{constructor(t){this.minFilter=9728,this.magFilter=9728,this.uWrap=33071,this.vWrap=33071,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},di=class extends Ji{constructor(t,e){super(),this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=t,this.name=e,t.regions.push(this)}},Ot=class extends St{constructor(t,e){super(t),this.region=null,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new B(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new B(0,0,0,0),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=P.newFloatArray(t.length));let e=this.uvs,i=this.uvs.length,s=this.region.u,n=this.region.v,c=0,l=0;if(this.region instanceof di){let r=this.region,o=r.page,a=o.width,h=o.height;switch(r.degrees){case 90:s-=(r.originalHeight-r.offsetY-r.height)/a,n-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/a,l=r.originalWidth/h;for(let d=0;d<i;d+=2)e[d]=s+t[d+1]*c,e[d+1]=n+(1-t[d])*l;return;case 180:s-=(r.originalWidth-r.offsetX-r.width)/a,n-=r.offsetY/h,c=r.originalWidth/a,l=r.originalHeight/h;for(let d=0;d<i;d+=2)e[d]=s+(1-t[d])*c,e[d+1]=n+(1-t[d+1])*l;return;case 270:s-=r.offsetY/a,n-=r.offsetX/h,c=r.originalHeight/a,l=r.originalWidth/h;for(let d=0;d<i;d+=2)e[d]=s+(1-t[d+1])*c,e[d+1]=n+t[d]*l;return}s-=r.offsetX/a,n-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/a,l=r.originalHeight/h}else this.region?(c=this.region.u2-s,l=this.region.v2-n):(s=n=0,c=l=1);for(let r=0;r<i;r+=2)e[r]=s+t[r]*c,e[r+1]=n+t[r+1]*l}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 Ot(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),P.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),P.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),P.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,i,s,n,c){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,i,s,n,c)}newLinkedMesh(){let t=new Ot(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 extends St{constructor(t){super(t),this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new B(1,1,1,1)}copy(){let t=new qt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},fi=class extends St{constructor(t){super(t),this.x=0,this.y=0,this.rotation=0,this.color=new B(.38,.94,0,1)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){let e=F.cosDeg(this.rotation),i=F.sinDeg(this.rotation),s=e*t.a+i*t.b,n=e*t.c+i*t.d;return Math.atan2(n,s)*F.radDeg}copy(){let t=new fi(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},ts=class extends Ve{constructor(t,e){super(t),this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new B(1,1,1,1),this.region=null,this.sequence=null,this.offset=P.newFloatArray(8),this.uvs=P.newFloatArray(8),this.tempColor=new B(1,1,1,1),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(t==null){e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,e[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,s=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*i,c=-this.height/2*this.scaleY+this.region.offsetY*s,l=n+this.region.width*i,r=c+this.region.height*s,o=this.rotation*Math.PI/180,a=Math.cos(o),h=Math.sin(o),d=this.x,f=this.y,u=n*a+d,m=n*h,x=c*a+f,p=c*h,v=l*a+d,g=l*h,w=r*a+f,b=r*h,y=this.offset;y[0]=u-p,y[1]=x+m,y[2]=u-b,y[3]=w+m,y[4]=v-b,y[5]=w+g,y[6]=v-p,y[7]=x+g,t.degrees==90?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,i,s){this.sequence!=null&&this.sequence.apply(t,this);let n=t.bone,c=this.offset,l=n.worldX,r=n.worldY,o=n.a,a=n.b,h=n.c,d=n.d,f=0,u=0;f=c[0],u=c[1],e[i]=f*o+u*a+l,e[i+1]=f*h+u*d+r,i+=s,f=c[2],u=c[3],e[i]=f*o+u*a+l,e[i+1]=f*h+u*d+r,i+=s,f=c[4],u=c[5],e[i]=f*o+u*a+l,e[i+1]=f*h+u*d+r,i+=s,f=c[6],u=c[7],e[i]=f*o+u*a+l,e[i+1]=f*h+u*d+r}copy(){let t=new ts(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,P.arrayCopy(this.uvs,0,t.uvs,0,8),P.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}},nt=ts;nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31;var Ns=class{constructor(t){this.atlas=t}loadSequence(t,e,i){let s=i.regions;for(let n=0,c=s.length;n<c;n++){let l=i.getPath(e,n),r=this.atlas.findRegion(l);if(r==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+t+")");s[n]=r}}newRegionAttachment(t,e,i,s){let n=new nt(e,i);if(s!=null)this.loadSequence(e,i,s);else{let c=this.atlas.findRegion(i);if(!c)throw new Error("Region not found in atlas: "+i+" (region attachment: "+e+")");n.region=c}return n}newMeshAttachment(t,e,i,s){let n=new Ot(e,i);if(s!=null)this.loadSequence(e,i,s);else{let c=this.atlas.findRegion(i);if(!c)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+e+")");n.region=c}return n}newBoundingBoxAttachment(t,e){return new we(e)}newPathAttachment(t,e){return new qt(e)}newPointAttachment(t,e){return new fi(e)}newClippingAttachment(t,e){return new le(e)}},ui=class{constructor(t,e,i){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=pe.Normal,this.skinRequired=!1,this.color=new B,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=i}},pe=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(pe||{}),mi=class{constructor(t,e,i){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()}isActive(){return this.active}update(){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,i,s,n,c,l){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=s,this.ascaleY=n,this.ashearX=c,this.ashearY=l;let r=this.parent;if(!r){let f=this.skeleton,u=i+90+l,m=f.scaleX,x=f.scaleY;this.a=F.cosDeg(i+c)*s*m,this.b=F.cosDeg(u)*n*m,this.c=F.sinDeg(i+c)*s*x,this.d=F.sinDeg(u)*n*x,this.worldX=t*m+f.x,this.worldY=e*x+f.y;return}let o=r.a,a=r.b,h=r.c,d=r.d;switch(this.worldX=o*t+a*e+r.worldX,this.worldY=h*t+d*e+r.worldY,this.data.transformMode){case 0:{let f=i+90+l,u=F.cosDeg(i+c)*s,m=F.cosDeg(f)*n,x=F.sinDeg(i+c)*s,p=F.sinDeg(f)*n;this.a=o*u+a*x,this.b=o*m+a*p,this.c=h*u+d*x,this.d=h*m+d*p;return}case 1:{let f=i+90+l;this.a=F.cosDeg(i+c)*s,this.b=F.cosDeg(f)*n,this.c=F.sinDeg(i+c)*s,this.d=F.sinDeg(f)*n;break}case 2:{let f=o*o+h*h,u=0;f>1e-4?(f=Math.abs(o*d-a*h)/f,o/=this.skeleton.scaleX,h/=this.skeleton.scaleY,a=h*f,d=o*f,u=Math.atan2(h,o)*F.radDeg):(o=0,h=0,u=90-Math.atan2(d,a)*F.radDeg);let m=i+c-u,x=i+l-u+90,p=F.cosDeg(m)*s,v=F.cosDeg(x)*n,g=F.sinDeg(m)*s,w=F.sinDeg(x)*n;this.a=o*p-a*g,this.b=o*v-a*w,this.c=h*p+d*g,this.d=h*v+d*w;break}case 3:case 4:{let f=F.cosDeg(i),u=F.sinDeg(i),m=(o*f+a*u)/this.skeleton.scaleX,x=(h*f+d*u)/this.skeleton.scaleY,p=Math.sqrt(m*m+x*x);p>1e-5&&(p=1/p),m*=p,x*=p,p=Math.sqrt(m*m+x*x),this.data.transformMode==3&&o*d-a*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let v=Math.PI/2+Math.atan2(x,m),g=Math.cos(v)*p,w=Math.sin(v)*p,b=F.cosDeg(c)*s,y=F.cosDeg(90+l)*n,C=F.sinDeg(c)*s,A=F.sinDeg(90+l)*n;this.a=m*b+g*C,this.b=m*y+g*A,this.c=x*b+w*C,this.d=x*y+w*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.c,this.a)*F.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*F.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)}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*F.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)*F.radDeg;return}let e=t.a,i=t.b,s=t.c,n=t.d,c=1/(e*n-i*s),l=n*c,r=i*c,o=s*c,a=e*c,h=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=h*l-d*r,this.ay=d*a-h*o;let f,u,m,x;if(this.data.transformMode==1)f=this.a,u=this.b,m=this.c,x=this.d;else{switch(this.data.transformMode){case 2:{let b=Math.abs(e*n-i*s)/(e*e+s*s),y=e/this.skeleton.scaleX;i=-(s/this.skeleton.scaleY)*b*this.skeleton.scaleX,n=y*b*this.skeleton.scaleY,c=1/(e*n-i*s),l=n*c,r=i*c;break}case 3:case 4:let p=F.cosDeg(this.rotation),v=F.sinDeg(this.rotation);e=(e*p+i*v)/this.skeleton.scaleX,s=(s*p+n*v)/this.skeleton.scaleY;let g=Math.sqrt(e*e+s*s);g>1e-5&&(g=1/g),e*=g,s*=g,g=Math.sqrt(e*e+s*s),this.data.transformMode==3&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let w=F.PI/2+Math.atan2(s,e);i=Math.cos(w)*g,n=Math.sin(w)*g,c=1/(e*n-i*s),l=n*c,r=i*c,o=s*c,a=e*c}f=l*this.a-r*this.c,u=l*this.b-r*this.d,m=a*this.c-o*this.a,x=a*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+m*m),this.ascaleX>1e-4){let p=f*x-u*m;this.ascaleY=p/this.ascaleX,this.ashearY=-Math.atan2(f*u+m*x,p)*F.radDeg,this.arotation=Math.atan2(m,f)*F.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*F.radDeg}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),i=t.x-this.worldX,s=t.y-this.worldY;return t.x=i*this.d*e-s*this.b*e,t.y=s*this.a*e-i*this.c*e,t}localToWorld(t){let e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t}worldToLocalRotation(t){let e=F.sinDeg(t),i=F.cosDeg(t);return Math.atan2(this.a*e-this.c*i,this.d*i-this.b*e)*F.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=F.sinDeg(t),i=F.cosDeg(t);return Math.atan2(i*this.c+e*this.d,i*this.a+e*this.b)*F.radDeg}rotateWorld(t){let e=this.a,i=this.b,s=this.c,n=this.d,c=F.cosDeg(t),l=F.sinDeg(t);this.a=c*e-l*s,this.b=c*i-l*n,this.c=l*e+c*s,this.d=l*i+c*n}},ve=class{constructor(t,e,i){this.name=t,this.order=e,this.skinRequired=i}},es=class{constructor(t,e="",i=new gi){this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=t,this.pathPrefix=e,this.downloader=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,i){this.toLoad--,this.loaded++,this.assets[e]=i,t&&t(e,i)}error(t,e,i){this.toLoad--,this.loaded++,this.errors[e]=i,t&&t(e,i)}loadAll(){return new Promise((e,i)=>{let s=()=>{if(this.isLoadingComplete()){this.hasErrors()?i(this.errors):e(this);return}requestAnimationFrame(s)};requestAnimationFrame(s)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},i=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,s=>{this.success(e,t,s)},(s,n)=>{this.error(i,t,`Couldn't load binary ${t}: status ${s}, ${n}`)})}loadText(t,e=()=>{},i=()=>{}){t=this.start(t),this.downloader.downloadText(t,s=>{this.success(e,t,s)},(s,n)=>{this.error(i,t,`Couldn't load text ${t}: status ${s}, ${n}`)})}loadJson(t,e=()=>{},i=()=>{}){t=this.start(t),this.downloader.downloadJson(t,s=>{this.success(e,t,s)},(s,n)=>{this.error(i,t,`Couldn't load JSON ${t}: status ${s}, ${n}`)})}loadTexture(t,e=()=>{},i=()=>{}){if(t=this.start(t),!!!(typeof window!="undefined"&&typeof navigator!="undefined"&&window.document))fetch(t,{mode:"cors"}).then(c=>c.ok?c.blob():(this.error(i,t,`Couldn't load image: ${t}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(e,t,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(e,t,this.textureLoader(c))},c.onerror=()=>{this.error(i,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),c.src=t}}loadTextureAtlas(t,e=()=>{},i=()=>{},s){let n=t.lastIndexOf("/"),c=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,l=>{try{let r=new Qi(l),o=r.pages.length,a=!1;for(let h of r.pages)this.loadTexture(s?s[h.name]:c+h.name,(d,f)=>{a||(h.setTexture(f),--o==0&&this.success(e,t,r))},(d,f)=>{a||this.error(i,t,`Couldn't load texture atlas ${t} page image: ${d}`),a=!0})}catch(r){this.error(i,t,`Couldn't parse texture atlas ${t}: ${r.message}`)}},(l,r)=>{this.error(i,t,`Couldn't load texture atlas ${t}: status ${l}, ${r}`)})}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let i=this.errors[t];throw Error("Asset not found: "+t+(i?`
|
|
2
|
-
`+i:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},gi=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),i=e.length,s=new Uint8Array(i),n=0;n<i;n++)s[n]=e.charCodeAt(n);return s}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,i){if(this.start(t,e,i))return;if(this.rawDataUris[t]){try{let c=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(c))}catch(c){this.finish(t,400,JSON.stringify(c))}return}let s=new XMLHttpRequest;s.overrideMimeType("text/html"),s.open("GET",t,!0);let n=()=>{this.finish(t,s.status,s.responseText)};s.onload=n,s.onerror=n,s.send()}downloadJson(t,e,i){this.downloadText(t,s=>{e(JSON.parse(s))},i)}downloadBinary(t,e,i){if(this.start(t,e,i))return;if(this.rawDataUris[t]){try{let c=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(c))}catch(c){this.finish(t,400,JSON.stringify(c))}return}let s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="arraybuffer";let n=()=>{this.finish(t,s.status,s.response)};s.onload=()=>{s.status==200||s.status==0?this.finish(t,200,new Uint8Array(s.response)):n()},s.onerror=n,s.send()}start(t,e,i){let s=this.callbacks[t];try{if(s)return!0;this.callbacks[t]=s=[]}finally{s.push(e,i)}}finish(t,e,i){let s=this.callbacks[t];delete this.callbacks[t];let n=e==200||e==0?[i]:[e,i];for(let c=n.length-1,l=s.length;c<l;c+=2)s[c].apply(null,n)}},xi=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},wi=class{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}},is=class{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(n)}let i=e.findBone(t.target.name);if(!i)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=i}isActive(){return this.active}update(){if(this.mix==0)return;let t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,i,s,n,c,l){let r=t.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,a=r.b,h=r.c,d=r.d,f=-t.ashearX-t.arotation,u=0,m=0;switch(t.data.transformMode){case 1:u=e-t.worldX,m=i-t.worldY;break;case 2:let v=Math.abs(o*d-a*h)/Math.max(1e-4,o*o+h*h),g=o/t.skeleton.scaleX,w=h/t.skeleton.scaleY;a=-w*v*t.skeleton.scaleX,d=g*v*t.skeleton.scaleY,f+=Math.atan2(w,g)*F.radDeg;default:let b=e-r.worldX,y=i-r.worldY,C=o*d-a*h;Math.abs(C)<=1e-4?(u=0,m=0):(u=(b*d-y*a)/C-t.ax,m=(y*o-b*h)/C-t.ay)}f+=Math.atan2(m,u)*F.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let x=t.ascaleX,p=t.ascaleY;if(s||n){switch(t.data.transformMode){case 3:case 4:u=e-t.worldX,m=i-t.worldY}let v=t.data.length*x,g=Math.sqrt(u*u+m*m);if(s&&g<v||n&&g>v&&v>1e-4){let w=(g/v-1)*l+1;x*=w,c&&(p*=w)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*l,x,p,t.ashearX,t.ashearY)}apply2(t,e,i,s,n,c,l,r,o){let a=t.ax,h=t.ay,d=t.ascaleX,f=t.ascaleY,u=d,m=f,x=e.ascaleX,p=0,v=0,g=0;d<0?(d=-d,p=180,g=-1):(p=0,g=1),f<0&&(f=-f,g=-g),x<0?(x=-x,v=180):v=0;let w=e.ax,b=0,y=0,C=0,A=t.a,T=t.b,E=t.c,R=t.d,L=Math.abs(d-f)<=1e-4;!L||c?(b=0,y=A*w+t.worldX,C=E*w+t.worldY):(b=e.ay,y=A*w+T*b+t.worldX,C=E*w+R*b+t.worldY);let X=t.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,T=X.b,E=X.c,R=X.d;let k=A*R-T*E,M=y-X.worldX,I=C-X.worldY;k=Math.abs(k)<=1e-4?0:1/k;let W=(M*R-I*T)*k-a,it=(I*A-M*E)*k-h,tt=Math.sqrt(W*W+it*it),lt=e.data.length*x,st,ht;if(tt<1e-4){this.apply1(t,i,s,!1,c,!1,o),e.updateWorldTransformWith(w,b,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}M=i-X.worldX,I=s-X.worldY;let rt=(M*R-I*T)*k-a,et=(I*A-M*E)*k-h,dt=rt*rt+et*et;if(r!=0){r*=d*(x+1)*.5;let gt=Math.sqrt(dt),At=gt-tt-lt*d+r;if(At>0){let Ct=Math.min(1,At/(r*2))-1;Ct=(At-r*(1-Ct*Ct))/gt,rt-=Ct*rt,et-=Ct*et,dt=rt*rt+et*et}}t:if(L){lt*=d;let gt=(dt-tt*tt-lt*lt)/(2*tt*lt);gt<-1?(gt=-1,ht=Math.PI*n):gt>1?(gt=1,ht=0,c&&(A=(Math.sqrt(dt)/(tt+lt)-1)*o+1,u*=A,l&&(m*=A))):ht=Math.acos(gt)*n,A=tt+lt*gt,T=lt*Math.sin(ht),st=Math.atan2(et*A-rt*T,rt*A+et*T)}else{A=d*lt,T=f*lt;let gt=A*A,At=T*T,Ct=Math.atan2(et,rt);E=At*tt*tt+gt*dt-gt*At;let Nt=-2*At*tt,ee=At-gt;if(R=Nt*Nt-4*ee*E,R>=0){let ie=Math.sqrt(R);Nt<0&&(ie=-ie),ie=-(Nt+ie)*.5;let Ss=ie/ee,Ts=E/ie,se=Math.abs(Ss)<Math.abs(Ts)?Ss:Ts;if(se*se<=dt){I=Math.sqrt(dt-se*se)*n,st=Ct-Math.atan2(I,se),ht=Math.atan2(I/f,(se-tt)/d);break t}}let ce=F.PI,Le=tt-A,Xi=Le*Le,ys=0,As=0,Pe=tt+A,Li=Pe*Pe,Cs=0;E=-A*tt/(gt-At),E>=-1&&E<=1&&(E=Math.acos(E),M=A*Math.cos(E)+tt,I=T*Math.sin(E),R=M*M+I*I,R<Xi&&(ce=E,Xi=R,Le=M,ys=I),R>Li&&(As=E,Li=R,Pe=M,Cs=I)),dt<=(Xi+Li)*.5?(st=Ct-Math.atan2(ys*n,Le),ht=ce*n):(st=Ct-Math.atan2(Cs*n,Pe),ht=As*n)}let wt=Math.atan2(b,w)*g,kt=t.arotation;st=(st-wt)*F.radDeg+p-kt,st>180?st-=360:st<-180&&(st+=360),t.updateWorldTransformWith(a,h,kt+st*o,u,m,0,0),kt=e.arotation,ht=((ht+wt)*F.radDeg-e.ashearX)*g+v-kt,ht>180?ht-=360:ht<-180&&(ht+=360),e.updateWorldTransformWith(w,b,kt+ht*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},bi=class extends ve{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},pi=class extends ve{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ye.Fixed,this.spacingMode=Ae.Fixed,this.rotateMode=Ce.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},ye=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(ye||{}),Ae=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ae||{}),Ce=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(Ce||{}),Xt=class{constructor(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,n=t.bones.length;s<n;s++){let c=e.findBone(t.bones[s].name);if(!c)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(c)}let i=e.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}update(){let t=this.target.getAttachment();if(!(t instanceof qt))return;let e=this.mixRotate,i=this.mixX,s=this.mixY;if(e==0&&i==0&&s==0)return;let n=this.data,c=n.rotateMode==0,l=n.rotateMode==2,r=this.bones,o=r.length,a=c?o:o+1,h=P.setArraySize(this.spaces,a),d=l?this.lengths=P.setArraySize(this.lengths,o):[],f=this.spacing;switch(n.spacingMode){case 2:if(l)for(let b=0,y=a-1;b<y;b++){let C=r[b],A=C.data.length;if(A<Xt.epsilon)d[b]=0;else{let T=A*C.a,E=A*C.c;d[b]=Math.sqrt(T*T+E*E)}}P.arrayFill(h,1,a,f);break;case 3:let g=0;for(let b=0,y=a-1;b<y;){let C=r[b],A=C.data.length;if(A<Xt.epsilon)l&&(d[b]=0),h[++b]=f;else{let T=A*C.a,E=A*C.c,R=Math.sqrt(T*T+E*E);l&&(d[b]=R),h[++b]=R,g+=R}}if(g>0){g=a/g*f;for(let b=1;b<a;b++)h[b]*=g}break;default:let w=n.spacingMode==0;for(let b=0,y=a-1;b<y;){let C=r[b],A=C.data.length;if(A<Xt.epsilon)l&&(d[b]=0),h[++b]=f;else{let T=A*C.a,E=A*C.c,R=Math.sqrt(T*T+E*E);l&&(d[b]=R),h[++b]=(w?A+f:f)*R/A}}}let u=this.computeWorldPositions(t,a,c),m=u[0],x=u[1],p=n.offsetRotation,v=!1;if(p==0)v=n.rotateMode==1;else{v=!1;let g=this.target.bone;p*=g.a*g.d-g.b*g.c>0?F.degRad:-F.degRad}for(let g=0,w=3;g<o;g++,w+=3){let b=r[g];b.worldX+=(m-b.worldX)*i,b.worldY+=(x-b.worldY)*s;let y=u[w],C=u[w+1],A=y-m,T=C-x;if(l){let E=d[g];if(E!=0){let R=(Math.sqrt(A*A+T*T)/E-1)*e+1;b.a*=R,b.c*=R}}if(m=y,x=C,e>0){let E=b.a,R=b.b,L=b.c,X=b.d,k=0,M=0,I=0;if(c?k=u[w-1]:h[g+1]==0?k=u[w+2]:k=Math.atan2(T,A),k-=Math.atan2(L,E),v){M=Math.cos(k),I=Math.sin(k);let W=b.data.length;m+=(W*(M*E-I*L)-A)*e,x+=(W*(I*E+M*L)-T)*e}else k+=p;k>F.PI?k-=F.PI2:k<-F.PI&&(k+=F.PI2),k*=e,M=Math.cos(k),I=Math.sin(k),b.a=M*E-I*L,b.b=M*R-I*X,b.c=I*E+M*L,b.d=I*R+M*X}b.updateAppliedTransform()}}computeWorldPositions(t,e,i){let s=this.target,n=this.position,c=this.spaces,l=P.setArraySize(this.positions,e*3+2),r=this.world,o=t.closed,a=t.worldVerticesLength,h=a/6,d=Xt.NONE;if(!t.constantSpeed){let it=t.lengths;h-=o?1:2;let tt=it[h];this.data.positionMode==1&&(n*=tt);let lt;switch(this.data.spacingMode){case 2:lt=tt;break;case 3:lt=tt/e;break;default:lt=1}r=P.setArraySize(this.world,8);for(let st=0,ht=0,rt=0;st<e;st++,ht+=3){let et=c[st]*lt;n+=et;let dt=n;if(o)dt%=tt,dt<0&&(dt+=tt),rt=0;else if(dt<0){d!=Xt.BEFORE&&(d=Xt.BEFORE,t.computeWorldVertices(s,2,4,r,0,2)),this.addBeforePosition(dt,r,0,l,ht);continue}else if(dt>tt){d!=Xt.AFTER&&(d=Xt.AFTER,t.computeWorldVertices(s,a-6,4,r,0,2)),this.addAfterPosition(dt-tt,r,0,l,ht);continue}for(;;rt++){let wt=it[rt];if(!(dt>wt)){if(rt==0)dt/=wt;else{let kt=it[rt-1];dt=(dt-kt)/(wt-kt)}break}}rt!=d&&(d=rt,o&&rt==h?(t.computeWorldVertices(s,a-4,4,r,0,2),t.computeWorldVertices(s,0,4,r,4,2)):t.computeWorldVertices(s,rt*6+2,8,r,0,2)),this.addCurvePosition(dt,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],l,ht,i||st>0&&et==0)}return l}o?(a+=2,r=P.setArraySize(this.world,a),t.computeWorldVertices(s,2,a-4,r,0,2),t.computeWorldVertices(s,0,2,r,a-4,2),r[a-2]=r[0],r[a-1]=r[1]):(h--,a-=4,r=P.setArraySize(this.world,a),t.computeWorldVertices(s,2,a,r,0,2));let f=P.setArraySize(this.curves,h),u=0,m=r[0],x=r[1],p=0,v=0,g=0,w=0,b=0,y=0,C=0,A=0,T=0,E=0,R=0,L=0,X=0,k=0;for(let it=0,tt=2;it<h;it++,tt+=6)p=r[tt],v=r[tt+1],g=r[tt+2],w=r[tt+3],b=r[tt+4],y=r[tt+5],C=(m-p*2+g)*.1875,A=(x-v*2+w)*.1875,T=((p-g)*3-m+b)*.09375,E=((v-w)*3-x+y)*.09375,R=C*2+T,L=A*2+E,X=(p-m)*.75+C+T*.16666667,k=(v-x)*.75+A+E*.16666667,u+=Math.sqrt(X*X+k*k),X+=R,k+=L,R+=T,L+=E,u+=Math.sqrt(X*X+k*k),X+=R,k+=L,u+=Math.sqrt(X*X+k*k),X+=R+T,k+=L+E,u+=Math.sqrt(X*X+k*k),f[it]=u,m=b,x=y;this.data.positionMode==1&&(n*=u);let M;switch(this.data.spacingMode){case 2:M=u;break;case 3:M=u/e;break;default:M=1}let I=this.segments,W=0;for(let it=0,tt=0,lt=0,st=0;it<e;it++,tt+=3){let ht=c[it]*M;n+=ht;let rt=n;if(o)rt%=u,rt<0&&(rt+=u),lt=0;else if(rt<0){this.addBeforePosition(rt,r,0,l,tt);continue}else if(rt>u){this.addAfterPosition(rt-u,r,a-4,l,tt);continue}for(;;lt++){let et=f[lt];if(!(rt>et)){if(lt==0)rt/=et;else{let dt=f[lt-1];rt=(rt-dt)/(et-dt)}break}}if(lt!=d){d=lt;let et=lt*6;for(m=r[et],x=r[et+1],p=r[et+2],v=r[et+3],g=r[et+4],w=r[et+5],b=r[et+6],y=r[et+7],C=(m-p*2+g)*.03,A=(x-v*2+w)*.03,T=((p-g)*3-m+b)*.006,E=((v-w)*3-x+y)*.006,R=C*2+T,L=A*2+E,X=(p-m)*.3+C+T*.16666667,k=(v-x)*.3+A+E*.16666667,W=Math.sqrt(X*X+k*k),I[0]=W,et=1;et<8;et++)X+=R,k+=L,R+=T,L+=E,W+=Math.sqrt(X*X+k*k),I[et]=W;X+=R,k+=L,W+=Math.sqrt(X*X+k*k),I[8]=W,X+=R+T,k+=L+E,W+=Math.sqrt(X*X+k*k),I[9]=W,st=0}for(rt*=W;;st++){let et=I[st];if(!(rt>et)){if(st==0)rt/=et;else{let dt=I[st-1];rt=st+(rt-dt)/(et-dt)}break}}this.addCurvePosition(rt*.1,m,x,p,v,g,w,b,y,l,tt,i||it>0&&ht==0)}return l}addBeforePosition(t,e,i,s,n){let c=e[i],l=e[i+1],r=e[i+2]-c,o=e[i+3]-l,a=Math.atan2(o,r);s[n]=c+t*Math.cos(a),s[n+1]=l+t*Math.sin(a),s[n+2]=a}addAfterPosition(t,e,i,s,n){let c=e[i+2],l=e[i+3],r=c-e[i],o=l-e[i+1],a=Math.atan2(o,r);s[n]=c+t*Math.cos(a),s[n+1]=l+t*Math.sin(a),s[n+2]=a}addCurvePosition(t,e,i,s,n,c,l,r,o,a,h,d){if(t==0||isNaN(t)){a[h]=e,a[h+1]=i,a[h+2]=Math.atan2(n-i,s-e);return}let f=t*t,u=f*t,m=1-t,x=m*m,p=x*m,v=m*t,g=v*3,w=m*g,b=g*t,y=e*p+s*w+c*b+r*u,C=i*p+n*w+l*b+o*u;a[h]=y,a[h+1]=C,d&&(t<.001?a[h+2]=Math.atan2(n-i,s-e):a[h+2]=Math.atan2(C-(i*x+n*v*2+l*f),y-(e*x+s*v*2+c*f)))}},Jt=Xt;Jt.NONE=-1,Jt.BEFORE=-2,Jt.AFTER=-3,Jt.epsilon=1e-5;var ss=class{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new B,this.darkColor=t.darkColor?new B:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof St)||!(this.attachment instanceof St)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},rs=class{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new zt,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(n)}let i=e.findBone(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=i}isActive(){return this.active}update(){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=e!=0||i!=0,r=this.target,o=r.a,a=r.b,h=r.c,d=r.d,f=o*d-a*h>0?F.degRad:-F.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,x=this.bones;for(let p=0,v=x.length;p<v;p++){let g=x[p];if(t!=0){let w=g.a,b=g.b,y=g.c,C=g.d,A=Math.atan2(h,o)-Math.atan2(y,w)+u;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=t;let T=Math.cos(A),E=Math.sin(A);g.a=T*w-E*y,g.b=T*b-E*C,g.c=E*w+T*y,g.d=E*b+T*C}if(l){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(w.x-g.worldX)*e,g.worldY+=(w.y-g.worldY)*i}if(s!=0){let w=Math.sqrt(g.a*g.a+g.c*g.c);w!=0&&(w=(w+(Math.sqrt(o*o+h*h)-w+this.data.offsetScaleX)*s)/w),g.a*=w,g.c*=w}if(n!=0){let w=Math.sqrt(g.b*g.b+g.d*g.d);w!=0&&(w=(w+(Math.sqrt(a*a+d*d)-w+this.data.offsetScaleY)*n)/w),g.b*=w,g.d*=w}if(c>0){let w=g.b,b=g.d,y=Math.atan2(b,w),C=Math.atan2(d,a)-Math.atan2(h,o)-(y-Math.atan2(g.c,g.a));C>F.PI?C-=F.PI2:C<-F.PI&&(C+=F.PI2),C=y+(C+m)*c;let A=Math.sqrt(w*w+b*b);g.b=Math.cos(C)*A,g.d=Math.sin(C)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=e!=0||i!=0,r=this.target,o=r.a,a=r.b,h=r.c,d=r.d,f=o*d-a*h>0?F.degRad:-F.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,x=this.bones;for(let p=0,v=x.length;p<v;p++){let g=x[p];if(t!=0){let w=g.a,b=g.b,y=g.c,C=g.d,A=Math.atan2(h,o)+u;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=t;let T=Math.cos(A),E=Math.sin(A);g.a=T*w-E*y,g.b=T*b-E*C,g.c=E*w+T*y,g.d=E*b+T*C}if(l){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),g.worldX+=w.x*e,g.worldY+=w.y*i}if(s!=0){let w=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*s+1;g.a*=w,g.c*=w}if(n!=0){let w=(Math.sqrt(a*a+d*d)-1+this.data.offsetScaleY)*n+1;g.b*=w,g.d*=w}if(c>0){let w=Math.atan2(d,a)-Math.atan2(h,o);w>F.PI?w-=F.PI2:w<-F.PI&&(w+=F.PI2);let b=g.b,y=g.d;w=Math.atan2(y,b)+(w-F.PI/2+m)*c;let C=Math.sqrt(b*b+y*y);g.b=Math.cos(w)*C,g.d=Math.sin(w)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=this.target,r=this.bones;for(let o=0,a=r.length;o<a;o++){let h=r[o],d=h.arotation;if(t!=0){let v=l.arotation-d+this.data.offsetRotation;v-=(16384-(16384.499999999996-v/360|0))*360,d+=v*t}let f=h.ax,u=h.ay;f+=(l.ax-f+this.data.offsetX)*e,u+=(l.ay-u+this.data.offsetY)*i;let m=h.ascaleX,x=h.ascaleY;s!=0&&m!=0&&(m=(m+(l.ascaleX-m+this.data.offsetScaleX)*s)/m),n!=0&&x!=0&&(x=(x+(l.ascaleY-x+this.data.offsetScaleY)*n)/x);let p=h.ashearY;if(c!=0){let v=l.ashearY-p+this.data.offsetShearY;v-=(16384-(16384.499999999996-v/360|0))*360,p+=v*c}h.updateWorldTransformWith(f,u,d,m,x,h.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=this.target,r=this.bones;for(let o=0,a=r.length;o<a;o++){let h=r[o],d=h.arotation+(l.arotation+this.data.offsetRotation)*t,f=h.ax+(l.ax+this.data.offsetX)*e,u=h.ay+(l.ay+this.data.offsetY)*i,m=h.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*s+1),x=h.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*n+1),p=h.ashearY+(l.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(f,u,d,m,x,h.ashearX,p)}}},ns=class{constructor(t){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let i=t.bones[e],s;if(!i.parent)s=new mi(i,this,null);else{let n=this.bones[i.parent.index];s=new mi(i,this,n),n.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let i=t.slots[e],s=this.bones[i.boneData.index],n=new ss(i,s);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let i=t.ikConstraints[e];this.ikConstraints.push(new is(i,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let i=t.transformConstraints[e];this.transformConstraints.push(new rs(i,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let i=t.pathConstraints[e];this.pathConstraints.push(new Jt(i,this))}this.color=new B(1,1,1,1),this.updateCache()}get scaleY(){return ns.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}updateCache(){let t=this._updateCache;t.length=0;let e=this.bones;for(let a=0,h=e.length;a<h;a++){let d=e[a];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let a=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let f=this.bones[a[h].index];do f.sorted=!1,f.active=!0,f=f.parent;while(f)}}let i=this.ikConstraints,s=this.transformConstraints,n=this.pathConstraints,c=i.length,l=s.length,r=n.length,o=c+l+r;t:for(let a=0;a<o;a++){for(let h=0;h<c;h++){let d=i[h];if(d.data.order==a){this.sortIkConstraint(d);continue t}}for(let h=0;h<l;h++){let d=s[h];if(d.data.order==a){this.sortTransformConstraint(d);continue t}}for(let h=0;h<r;h++){let d=n[h];if(d.data.order==a){this.sortPathConstraint(d);continue t}}}for(let a=0,h=e.length;a<h;a++)this.sortBone(e[a])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let i=t.bones,s=i[0];if(this.sortBone(s),i.length==1)this._updateCache.push(t),this.sortReset(s.children);else{let n=i[i.length-1];this.sortBone(n),this._updateCache.push(t),this.sortReset(s.children),n.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,i=e.data.index,s=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,s),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,s);for(let r=0,o=this.data.skins.length;r<o;r++)this.sortPathConstraintAttachment(this.data.skins[r],i,s);let n=e.getAttachment();n instanceof qt&&this.sortPathConstraintAttachmentWith(n,s);let c=t.bones,l=c.length;for(let r=0;r<l;r++)this.sortBone(c[r]);this._updateCache.push(t);for(let r=0;r<l;r++)this.sortReset(c[r].children);for(let r=0;r<l;r++)c[r].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&P.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,i=e.length;if(t.data.local)for(let s=0;s<i;s++){let n=e[s];this.sortBone(n.parent),this.sortBone(n)}else for(let s=0;s<i;s++)this.sortBone(e[s]);this._updateCache.push(t);for(let s=0;s<i;s++)this.sortReset(e[s].children);for(let s=0;s<i;s++)e[s].sorted=!0}sortPathConstraintAttachment(t,e,i){let s=t.attachments[e];if(s)for(let n in s)this.sortPathConstraintAttachmentWith(s[n],i)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof qt))return;let i=t.bones;if(!i)this.sortBone(e);else{let s=this.bones;for(let n=0,c=i.length;n<c;){let l=i[n++];for(l+=n;n<l;)this.sortBone(s[i[n++]])}}}sortBone(t){if(!t||t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,i=t.length;e<i;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){let t=this.bones;for(let i=0,s=t.length;i<s;i++){let n=t[i];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY}let e=this._updateCache;for(let i=0,s=e.length;i<s;i++)e[i].update()}updateWorldTransformWith(t){let e=this.getRootBone();if(!e)throw new Error("Root bone must not be null.");let i=t.a,s=t.b,n=t.c,c=t.d;e.worldX=i*this.x+s*this.y+t.worldX,e.worldY=n*this.x+c*this.y+t.worldY;let l=e.rotation+90+e.shearY,r=F.cosDeg(e.rotation+e.shearX)*e.scaleX,o=F.cosDeg(l)*e.scaleY,a=F.sinDeg(e.rotation+e.shearX)*e.scaleX,h=F.sinDeg(l)*e.scaleY;e.a=(i*r+s*a)*this.scaleX,e.b=(i*o+s*h)*this.scaleX,e.c=(n*r+c*a)*this.scaleY,e.d=(n*o+c*h)*this.scaleY;let d=this._updateCache;for(let f=0,u=d.length;f<u;f++){let m=d[f];m!=e&&m.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let t=this.bones;for(let n=0,c=t.length;n<c;n++)t[n].setToSetupPose();let e=this.ikConstraints;for(let n=0,c=e.length;n<c;n++){let l=e[n];l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}let i=this.transformConstraints;for(let n=0,c=i.length;n<c;n++){let l=i[n],r=l.data;l.mixRotate=r.mixRotate,l.mixX=r.mixX,l.mixY=r.mixY,l.mixScaleX=r.mixScaleX,l.mixScaleY=r.mixScaleY,l.mixShearY=r.mixShearY}let s=this.pathConstraints;for(let n=0,c=s.length;n<c;n++){let l=s[n],r=l.data;l.position=r.position,l.spacing=r.spacing,l.mixRotate=r.mixRotate,l.mixX=r.mixX,l.mixY=r.mixY}}setSlotsToSetupPose(){let t=this.slots;P.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,i=t.length;e<i;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let i=0,s=e.length;i<s;i++){let n=e[i],c=n.data.attachmentName;if(c){let l=t.getAttachment(i,c);l&&n.setAttachment(l)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let s=0,n=i.length;s<n;s++){let c=i[s];if(c.data.name==t){let l=null;if(e&&(l=this.getAttachment(s,e),!l))throw new Error("Attachment not found: "+e+", for slot: "+t);c.setAttachment(l);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.data.name==t)return n}return null}getBoundsRect(){let t=new zt,e=new zt;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,i=new Array(2)){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let s=this.drawOrder,n=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let o=0,a=s.length;o<a;o++){let h=s[o];if(!h.bone.active)continue;let d=0,f=null,u=h.getAttachment();if(u instanceof nt)d=8,f=P.setArraySize(i,d,0),u.computeWorldVertices(h,f,0,2);else if(u instanceof Ot){let m=u;d=m.worldVerticesLength,f=P.setArraySize(i,d,0),m.computeWorldVertices(h,0,d,f,0,2)}if(f)for(let m=0,x=f.length;m<x;m+=2){let p=f[m],v=f[m+1];n=Math.min(n,p),c=Math.min(c,v),l=Math.max(l,p),r=Math.max(r,v)}}t.set(n,c),e.set(l-n,r-c)}},as=ns;as.yDown=!1;var vi=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.ikConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.transformConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");let e=this.pathConstraints;for(let i=0,s=e.length;i<s;i++){let n=e[i];if(n.name==t)return n}return null}},yi=class{constructor(t=0,e,i){this.slotIndex=t,this.name=e,this.attachment=i}},Se=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,i){if(!i)throw new Error("attachment cannot be null.");let s=this.attachments;t>=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=i}addSkin(t){for(let s=0;s<t.bones.length;s++){let n=t.bones[s],c=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==n){c=!0;break}c||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){let n=t.constraints[s],c=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==n){c=!0;break}c||this.constraints.push(n)}let e=t.getAttachments();for(let s=0;s<e.length;s++){var i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){let n=t.bones[s],c=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==n){c=!0;break}c||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){let n=t.constraints[s],c=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==n){c=!0;break}c||this.constraints.push(n)}let e=t.getAttachments();for(let s=0;s<e.length;s++){var i=e[s];i.attachment&&(i.attachment instanceof Ot?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(t,e){let i=this.attachments[t];return i?i[e]:null}removeAttachment(t,e){let i=this.attachments[t];i&&delete i[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let i=this.attachments[e];if(i)for(let s in i){let n=i[s];n&&t.push(new yi(e,s,n))}}return t}getAttachmentsForSlot(t,e){let i=this.attachments[t];if(i)for(let s in i){let n=i[s];n&&e.push(new yi(t,s,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let i=0;for(let s=0;s<t.slots.length;s++){let n=t.slots[s],c=n.getAttachment();if(c&&i<e.attachments.length){let l=e.attachments[i];for(let r in l){let o=l[r];if(c==o){let a=this.getAttachment(i,r);a&&n.setAttachment(a);break}}}i++}}},Ai=class{constructor(t,e,i){if(this.index=0,this.color=new B(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=Te.Normal,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=i}},Te=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Te||{}),Ci=class extends ve{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Us=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,i=new vi;i.name="";let s=new ls(t),n=s.readInt32(),c=s.readInt32();i.hash=c==0&&n==0?null:c.toString(16)+n.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat();let l=s.readBoolean();l&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let r=0;r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("String in string table must not be null.");s.strings.push(h)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Bone name must not be null.");let d=a==0?null:i.bones[s.readInt(!0)],f=new ui(a,h,d);f.rotation=s.readFloat(),f.x=s.readFloat()*e,f.y=s.readFloat()*e,f.scaleX=s.readFloat(),f.scaleY=s.readFloat(),f.shearX=s.readFloat(),f.shearY=s.readFloat(),f.length=s.readFloat()*e,f.transformMode=s.readInt(!0),f.skinRequired=s.readBoolean(),l&&B.rgba8888ToColor(f.color,s.readInt32()),i.bones.push(f)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Slot name must not be null.");let d=i.bones[s.readInt(!0)],f=new Ai(a,h,d);B.rgba8888ToColor(f.color,s.readInt32());let u=s.readInt32();u!=-1&&B.rgb888ToColor(f.darkColor=new B,u),f.attachmentName=s.readStringRef(),f.blendMode=s.readInt(!0),i.slots.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new bi(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)],f.mix=s.readFloat(),f.softness=s.readFloat()*e,f.bendDirection=s.readByte(),f.compress=s.readBoolean(),f.stretch=s.readBoolean(),f.uniform=s.readBoolean(),i.ikConstraints.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Ci(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)],f.local=s.readBoolean(),f.relative=s.readBoolean(),f.offsetRotation=s.readFloat(),f.offsetX=s.readFloat()*e,f.offsetY=s.readFloat()*e,f.offsetScaleX=s.readFloat(),f.offsetScaleY=s.readFloat(),f.offsetShearY=s.readFloat(),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),f.mixScaleX=s.readFloat(),f.mixScaleY=s.readFloat(),f.mixShearY=s.readFloat(),i.transformConstraints.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new pi(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.slots[s.readInt(!0)],f.positionMode=s.readInt(!0),f.spacingMode=s.readInt(!0),f.rotateMode=s.readInt(!0),f.offsetRotation=s.readFloat(),f.position=s.readFloat(),f.positionMode==0&&(f.position*=e),f.spacing=s.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=e),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),i.pathConstraints.push(f)}let o=this.readSkin(s,i,!0,l);o&&(i.defaultSkin=o,i.skins.push(o));{let a=i.skins.length;for(P.setArraySize(i.skins,r=a+s.readInt(!0));a<r;a++){let h=this.readSkin(s,i,!1,l);if(!h)throw new Error("readSkin() should not have returned null.");i.skins[a]=h}}r=this.linkedMeshes.length;for(let a=0;a<r;a++){let h=this.linkedMeshes[a],d=h.skin?i.findSkin(h.skin):i.defaultSkin;if(!d)throw new Error("Not skin found for linked mesh.");if(!h.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(h.slotIndex,h.parent);if(!f)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?f:h.mesh,h.mesh.setParentMesh(f),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readStringRef();if(!h)throw new Error;let d=new wi(h);d.intValue=s.readInt(!1),d.floatValue=s.readFloat(),d.stringValue=s.readString(),d.audioPath=s.readString(),d.audioPath&&(d.volume=s.readFloat(),d.balance=s.readFloat()),i.events.push(d)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,h,i))}return i}readSkin(t,e,i,s){let n=null,c=0;if(i){if(c=t.readInt(!0),c==0)return null;n=new Se("default")}else{let l=t.readStringRef();if(!l)throw new Error("Skin name must not be null.");n=new Se(l),n.bones.length=t.readInt(!0);for(let r=0,o=n.bones.length;r<o;r++)n.bones[r]=e.bones[t.readInt(!0)];for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);c=t.readInt(!0)}for(let l=0;l<c;l++){let r=t.readInt(!0);for(let o=0,a=t.readInt(!0);o<a;o++){let h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,n,r,h,s);d&&n.setAttachment(r,h,d)}}return n}readAttachment(t,e,i,s,n,c){let l=this.scale,r=t.readStringRef();switch(r||(r=n),t.readByte()){case Vt.Region:{let o=t.readStringRef(),a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=t.readFloat(),u=t.readFloat(),m=t.readFloat(),x=t.readFloat(),p=t.readInt32(),v=this.readSequence(t);o||(o=r);let g=this.attachmentLoader.newRegionAttachment(i,r,o,v);return g?(g.path=o,g.x=h*l,g.y=d*l,g.scaleX=f,g.scaleY=u,g.rotation=a,g.width=m*l,g.height=x*l,B.rgba8888ToColor(g.color,p),g.sequence=v,v==null&&g.updateRegion(),g):null}case Vt.BoundingBox:{let o=t.readInt(!0),a=this.readVertices(t,o),h=c?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,r);return d?(d.worldVerticesLength=o<<1,d.vertices=a.vertices,d.bones=a.bones,c&&B.rgba8888ToColor(d.color,h),d):null}case Vt.Mesh:{let o=t.readStringRef(),a=t.readInt32(),h=t.readInt(!0),d=this.readFloatArray(t,h<<1,1),f=this.readShortArray(t),u=this.readVertices(t,h),m=t.readInt(!0),x=this.readSequence(t),p=[],v=0,g=0;c&&(p=this.readShortArray(t),v=t.readFloat(),g=t.readFloat()),o||(o=r);let w=this.attachmentLoader.newMeshAttachment(i,r,o,x);return w?(w.path=o,B.rgba8888ToColor(w.color,a),w.bones=u.bones,w.vertices=u.vertices,w.worldVerticesLength=h<<1,w.triangles=f,w.regionUVs=d,x==null&&w.updateRegion(),w.hullLength=m<<1,w.sequence=x,c&&(w.edges=p,w.width=v*l,w.height=g*l),w):null}case Vt.LinkedMesh:{let o=t.readStringRef(),a=t.readInt32(),h=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),u=this.readSequence(t),m=0,x=0;c&&(m=t.readFloat(),x=t.readFloat()),o||(o=r);let p=this.attachmentLoader.newMeshAttachment(i,r,o,u);return p?(p.path=o,B.rgba8888ToColor(p.color,a),p.sequence=u,c&&(p.width=m*l,p.height=x*l),this.linkedMeshes.push(new zs(p,h,s,d,f)),p):null}case Vt.Path:{let o=t.readBoolean(),a=t.readBoolean(),h=t.readInt(!0),d=this.readVertices(t,h),f=P.newArray(h/3,0);for(let x=0,p=f.length;x<p;x++)f[x]=t.readFloat()*l;let u=c?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,r);return m?(m.closed=o,m.constantSpeed=a,m.worldVerticesLength=h<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,c&&B.rgba8888ToColor(m.color,u),m):null}case Vt.Point:{let o=t.readFloat(),a=t.readFloat(),h=t.readFloat(),d=c?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(i,r);return f?(f.x=a*l,f.y=h*l,f.rotation=o,c&&B.rgba8888ToColor(f.color,d),f):null}case Vt.Clipping:{let o=t.readInt(!0),a=t.readInt(!0),h=this.readVertices(t,a),d=c?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,r);return f?(f.endSlot=e.slots[o],f.worldVerticesLength=a<<1,f.vertices=h.vertices,f.bones=h.bones,c&&B.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(!t.readBoolean())return null;let e=new Ne(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){let i=this.scale,s=e<<1,n=new Ws;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,s,i),n;let c=new Array,l=new Array;for(let r=0;r<e;r++){let o=t.readInt(!0);l.push(o);for(let a=0;a<o;a++)l.push(t.readInt(!0)),c.push(t.readFloat()*i),c.push(t.readFloat()*i),c.push(t.readFloat())}return n.vertices=P.toFloatArray(c),n.bones=l,n}readFloatArray(t,e,i){let s=new Array(e);if(i==1)for(let n=0;n<e;n++)s[n]=t.readFloat();else for(let n=0;n<e;n++)s[n]=t.readFloat()*i;return s}readShortArray(t){let e=t.readInt(!0),i=new Array(e);for(let s=0;s<e;s++)i[s]=t.readShort();return i}readAnimation(t,e,i){t.readInt(!0);let s=new Array,n=this.scale,c=new B,l=new B;for(let h=0,d=t.readInt(!0);h<d;h++){let f=t.readInt(!0);for(let u=0,m=t.readInt(!0);u<m;u++){let x=t.readByte(),p=t.readInt(!0),v=p-1;switch(x){case tr:{let g=new Wt(p,f);for(let w=0;w<p;w++)g.setFrame(w,t.readFloat(),t.readStringRef());s.push(g);break}case er:{let g=t.readInt(!0),w=new Ke(p,g,f),b=t.readFloat(),y=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let E=0,R=0;w.setFrame(E,b,y,C,A,T),E!=v;E++){let L=t.readFloat(),X=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;switch(t.readByte()){case Yt:w.setStepped(E);break;case Mt:at(t,w,R++,E,0,b,L,y,X,1),at(t,w,R++,E,1,b,L,C,k,1),at(t,w,R++,E,2,b,L,A,M,1),at(t,w,R++,E,3,b,L,T,I,1)}b=L,y=X,C=k,A=M,T=I}s.push(w);break}case ir:{let g=t.readInt(!0),w=new Je(p,g,f),b=t.readFloat(),y=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let T=0,E=0;w.setFrame(T,b,y,C,A),T!=v;T++){let R=t.readFloat(),L=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;switch(t.readByte()){case Yt:w.setStepped(T);break;case Mt:at(t,w,E++,T,0,b,R,y,L,1),at(t,w,E++,T,1,b,R,C,X,1),at(t,w,E++,T,2,b,R,A,k,1)}b=R,y=L,C=X,A=k}s.push(w);break}case sr:{let g=t.readInt(!0),w=new $e(p,g,f),b=t.readFloat(),y=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;for(let X=0,k=0;w.setFrame(X,b,y,C,A,T,E,R,L),X!=v;X++){let M=t.readFloat(),I=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255,it=t.readUnsignedByte()/255,tt=t.readUnsignedByte()/255,lt=t.readUnsignedByte()/255,st=t.readUnsignedByte()/255,ht=t.readUnsignedByte()/255;switch(t.readByte()){case Yt:w.setStepped(X);break;case Mt:at(t,w,k++,X,0,b,M,y,I,1),at(t,w,k++,X,1,b,M,C,W,1),at(t,w,k++,X,2,b,M,A,it,1),at(t,w,k++,X,3,b,M,T,tt,1),at(t,w,k++,X,4,b,M,E,lt,1),at(t,w,k++,X,5,b,M,R,st,1),at(t,w,k++,X,6,b,M,L,ht,1)}b=M,y=I,C=W,A=it,T=tt,E=lt,R=st,L=ht}s.push(w);break}case rr:{let g=t.readInt(!0),w=new ti(p,g,f),b=t.readFloat(),y=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;for(let L=0,X=0;w.setFrame(L,b,y,C,A,T,E,R),L!=v;L++){let k=t.readFloat(),M=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255,it=t.readUnsignedByte()/255,tt=t.readUnsignedByte()/255,lt=t.readUnsignedByte()/255;switch(t.readByte()){case Yt:w.setStepped(L);break;case Mt:at(t,w,X++,L,0,b,k,y,M,1),at(t,w,X++,L,1,b,k,C,I,1),at(t,w,X++,L,2,b,k,A,W,1),at(t,w,X++,L,3,b,k,T,it,1),at(t,w,X++,L,4,b,k,E,tt,1),at(t,w,X++,L,5,b,k,R,lt,1)}b=k,y=M,C=I,A=W,T=it,E=tt,R=lt}s.push(w);break}case nr:{let g=new Qe(p,t.readInt(!0),f),w=t.readFloat(),b=t.readUnsignedByte()/255;for(let y=0,C=0;g.setFrame(y,w,b),y!=v;y++){let A=t.readFloat(),T=t.readUnsignedByte()/255;switch(t.readByte()){case Yt:g.setStepped(y);break;case Mt:at(t,g,C++,y,0,w,A,b,T,1)}w=A,b=T}s.push(g)}}}}for(let h=0,d=t.readInt(!0);h<d;h++){let f=t.readInt(!0);for(let u=0,m=t.readInt(!0);u<m;u++){let x=t.readByte(),p=t.readInt(!0),v=t.readInt(!0);switch(x){case _s:s.push(Lt(t,new ne(p,v,f),1));break;case qs:s.push(Si(t,new Ue(p,v,f),n));break;case Gs:s.push(Lt(t,new ze(p,v,f),n));break;case Hs:s.push(Lt(t,new We(p,v,f),n));break;case js:s.push(Si(t,new _e(p,v,f),1));break;case Zs:s.push(Lt(t,new qe(p,v,f),1));break;case Ks:s.push(Lt(t,new Ge(p,v,f),1));break;case Js:s.push(Si(t,new He(p,v,f),1));break;case Qs:s.push(Lt(t,new je(p,v,f),1));break;case $s:s.push(Lt(t,new Ze(p,v,f),1))}}}for(let h=0,d=t.readInt(!0);h<d;h++){let f=t.readInt(!0),u=t.readInt(!0),m=u-1,x=new ii(u,t.readInt(!0),f),p=t.readFloat(),v=t.readFloat(),g=t.readFloat()*n;for(let w=0,b=0;x.setFrame(w,p,v,g,t.readByte(),t.readBoolean(),t.readBoolean()),w!=m;w++){let y=t.readFloat(),C=t.readFloat(),A=t.readFloat()*n;switch(t.readByte()){case Yt:x.setStepped(w);break;case Mt:at(t,x,b++,w,0,p,y,v,C,1),at(t,x,b++,w,1,p,y,g,A,n)}p=y,v=C,g=A}s.push(x)}for(let h=0,d=t.readInt(!0);h<d;h++){let f=t.readInt(!0),u=t.readInt(!0),m=u-1,x=new si(u,t.readInt(!0),f),p=t.readFloat(),v=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),y=t.readFloat(),C=t.readFloat();for(let A=0,T=0;x.setFrame(A,p,v,g,w,b,y,C),A!=m;A++){let E=t.readFloat(),R=t.readFloat(),L=t.readFloat(),X=t.readFloat(),k=t.readFloat(),M=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Yt:x.setStepped(A);break;case Mt:at(t,x,T++,A,0,p,E,v,R,1),at(t,x,T++,A,1,p,E,g,L,1),at(t,x,T++,A,2,p,E,w,X,1),at(t,x,T++,A,3,p,E,b,k,1),at(t,x,T++,A,4,p,E,y,M,1),at(t,x,T++,A,5,p,E,C,I,1)}p=E,v=R,g=L,w=X,b=k,y=M,C=I}s.push(x)}for(let h=0,d=t.readInt(!0);h<d;h++){let f=t.readInt(!0),u=i.pathConstraints[f];for(let m=0,x=t.readInt(!0);m<x;m++)switch(t.readByte()){case or:s.push(Lt(t,new ri(t.readInt(!0),t.readInt(!0),f),u.positionMode==0?n:1));break;case hr:s.push(Lt(t,new ni(t.readInt(!0),t.readInt(!0),f),u.spacingMode==0||u.spacingMode==1?n:1));break;case cr:let p=new ai(t.readInt(!0),t.readInt(!0),f),v=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat();for(let y=0,C=0,A=p.getFrameCount()-1;p.setFrame(y,v,g,w,b),y!=A;y++){let T=t.readFloat(),E=t.readFloat(),R=t.readFloat(),L=t.readFloat();switch(t.readByte()){case Yt:p.setStepped(y);break;case Mt:at(t,p,C++,y,0,v,T,g,E,1),at(t,p,C++,y,1,v,T,w,R,1),at(t,p,C++,y,2,v,T,b,L,1)}v=T,g=E,w=R,b=L}s.push(p)}}for(let h=0,d=t.readInt(!0);h<d;h++){let f=i.skins[t.readInt(!0)];for(let u=0,m=t.readInt(!0);u<m;u++){let x=t.readInt(!0);for(let p=0,v=t.readInt(!0);p<v;p++){let g=t.readStringRef();if(!g)throw new Error("attachmentName must not be null.");let w=f.getAttachment(x,g),b=t.readByte(),y=t.readInt(!0),C=y-1;switch(b){case ar:{let A=w,T=A.bones,E=A.vertices,R=T?E.length/3*2:E.length,L=t.readInt(!0),X=new ei(y,L,x,A),k=t.readFloat();for(let M=0,I=0;;M++){let W,it=t.readInt(!0);if(it==0)W=T?P.newFloatArray(R):E;else{W=P.newFloatArray(R);let lt=t.readInt(!0);if(it+=lt,n==1)for(let st=lt;st<it;st++)W[st]=t.readFloat();else for(let st=lt;st<it;st++)W[st]=t.readFloat()*n;if(!T)for(let st=0,ht=W.length;st<ht;st++)W[st]+=E[st]}if(X.setFrame(M,k,W),M==C)break;let tt=t.readFloat();switch(t.readByte()){case Yt:X.setStepped(M);break;case Mt:at(t,X,I++,M,0,k,tt,0,1,1)}k=tt}s.push(X);break}case lr:{let A=new Kt(y,x,w);for(let T=0;T<y;T++){let E=t.readFloat(),R=t.readInt32();A.setFrame(T,E,Ni[R&15],R>>4,t.readFloat())}s.push(A);break}}}}}let r=t.readInt(!0);if(r>0){let h=new _t(r),d=i.slots.length;for(let f=0;f<r;f++){let u=t.readFloat(),m=t.readInt(!0),x=P.newArray(d,0);for(let w=d-1;w>=0;w--)x[w]=-1;let p=P.newArray(d-m,0),v=0,g=0;for(let w=0;w<m;w++){let b=t.readInt(!0);for(;v!=b;)p[g++]=v++;x[v+t.readInt(!0)]=v++}for(;v<d;)p[g++]=v++;for(let w=d-1;w>=0;w--)x[w]==-1&&(x[w]=p[--g]);h.setFrame(f,u,x)}s.push(h)}let o=t.readInt(!0);if(o>0){let h=new ae(o);for(let d=0;d<o;d++){let f=t.readFloat(),u=i.events[t.readInt(!0)],m=new xi(f,u);m.intValue=t.readInt(!1),m.floatValue=t.readFloat(),m.stringValue=t.readBoolean()?t.readString():u.stringValue,m.data.audioPath&&(m.volume=t.readFloat(),m.balance=t.readFloat()),h.setFrame(d,m)}s.push(h)}let a=0;for(let h=0,d=s.length;h<d;h++)a=Math.max(a,s[h].getDuration());return new fe(e,s,a)}},ls=class{constructor(t,e=new Array,i=0,s=new DataView(t.buffer)){this.strings=e,this.index=i,this.buffer=s}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),i=e&127;return e&128&&(e=this.readByte(),i|=(e&127)<<7,e&128&&(e=this.readByte(),i|=(e&127)<<14,e&128&&(e=this.readByte(),i|=(e&127)<<21,e&128&&(e=this.readByte(),i|=(e&127)<<28)))),t?i:i>>>1^-(i&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",i=0;for(let s=0;s<t;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},zs=class{constructor(t,e,i,s,n){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}},Ws=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},Vt=(t=>(t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping",t))(Vt||{});function Lt(t,e,i){let s=t.readFloat(),n=t.readFloat()*i;for(let c=0,l=0,r=e.getFrameCount()-1;e.setFrame(c,s,n),c!=r;c++){let o=t.readFloat(),a=t.readFloat()*i;switch(t.readByte()){case Yt:e.setStepped(c);break;case Mt:at(t,e,l++,c,0,s,o,n,a,i)}s=o,n=a}return e}function Si(t,e,i){let s=t.readFloat(),n=t.readFloat()*i,c=t.readFloat()*i;for(let l=0,r=0,o=e.getFrameCount()-1;e.setFrame(l,s,n,c),l!=o;l++){let a=t.readFloat(),h=t.readFloat()*i,d=t.readFloat()*i;switch(t.readByte()){case Yt:e.setStepped(l);break;case Mt:at(t,e,r++,l,0,s,a,n,h,i),at(t,e,r++,l,1,s,a,c,d,i)}s=a,n=h,c=d}return e}function at(t,e,i,s,n,c,l,r,o,a){e.setBezier(i,s,n,c,r,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,l,o)}var _s=0,qs=1,Gs=2,Hs=3,js=4,Zs=5,Ks=6,Js=7,Qs=8,$s=9,tr=0,er=1,ir=2,sr=3,rr=4,nr=5,ar=0,lr=1,or=0,hr=1,cr=2,Yt=1,Mt=2,os=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new re(()=>P.newFloatArray(16))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,n=this.polygonPool,c=t.slots,l=c.length;i.length=0,n.freeAll(s),s.length=0;for(let r=0;r<l;r++){let o=c[r];if(!o.bone.active)continue;let a=o.getAttachment();if(a instanceof we){let h=a;i.push(h);let d=n.obtain();d.length!=h.worldVerticesLength&&(d=P.newFloatArray(h.worldVerticesLength)),s.push(d),h.computeWorldVertices(o,0,h.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=this.polygons;for(let c=0,l=n.length;c<l;c++){let r=n[c],o=r;for(let a=0,h=r.length;a<h;a+=2){let d=o[a],f=o[a+1];t=Math.min(t,d),e=Math.min(e,f),i=Math.max(i,d),s=Math.max(s,f)}}this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,i,s){let n=this.minX,c=this.minY,l=this.maxX,r=this.maxY;if(t<=n&&i<=n||e<=c&&s<=c||t>=l&&i>=l||e>=r&&s>=r)return!1;let o=(s-e)/(i-t),a=o*(n-t)+e;if(a>c&&a<r||(a=o*(l-t)+e,a>c&&a<r))return!0;let h=(c-e)/o+t;return h>n&&h<l||(h=(r-e)/o+t,h>n&&h<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let i=this.polygons;for(let s=0,n=i.length;s<n;s++)if(this.containsPointPolygon(i[s],t,e))return this.boundingBoxes[s];return null}containsPointPolygon(t,e,i){let s=t,n=t.length,c=n-2,l=!1;for(let r=0;r<n;r+=2){let o=s[r+1],a=s[c+1];if(o<i&&a>=i||a<i&&o>=i){let h=s[r];h+(i-o)/(a-o)*(s[c]-h)<e&&(l=!l)}c=r}return l}intersectsSegment(t,e,i,s){let n=this.polygons;for(let c=0,l=n.length;c<l;c++)if(this.intersectsSegmentPolygon(n[c],t,e,i,s))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(t,e,i,s,n){let c=t,l=t.length,r=e-s,o=i-n,a=e*n-i*s,h=c[l-2],d=c[l-1];for(let f=0;f<l;f+=2){let u=c[f],m=c[f+1],x=h*m-d*u,p=h-u,v=d-m,g=r*v-o*p,w=(a*p-r*x)/g;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=e&&w<=s||w>=s&&w<=e)){let b=(a*v-o*x)/g;if((b>=d&&b<=m||b>=m&&b<=d)&&(b>=i&&b<=n||b>=n&&b<=i))return!0}h=u,d=m}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},vt=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new re(()=>new Array),this.polygonIndicesPool=new re(()=>new Array)}triangulate(t){let e=t,i=t.length>>1,s=this.indicesArray;s.length=0;for(let l=0;l<i;l++)s[l]=l;let n=this.isConcaveArray;n.length=0;for(let l=0,r=i;l<r;++l)n[l]=vt.isConcave(l,i,e,s);let c=this.triangles;for(c.length=0;i>3;){let l=i-1,r=0,o=1;for(;;){t:if(!n[r]){let d=s[l]<<1,f=s[r]<<1,u=s[o]<<1,m=e[d],x=e[d+1],p=e[f],v=e[f+1],g=e[u],w=e[u+1];for(let b=(o+1)%i;b!=l;b=(b+1)%i){if(!n[b])continue;let y=s[b]<<1,C=e[y],A=e[y+1];if(vt.positiveArea(g,w,m,x,C,A)&&vt.positiveArea(m,x,p,v,C,A)&&vt.positiveArea(p,v,g,w,C,A))break t}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}l=r,r=o,o=(o+1)%i}c.push(s[(i+r-1)%i]),c.push(s[r]),c.push(s[(r+1)%i]),s.splice(r,1),n.splice(r,1),i--;let a=(i+r-1)%i,h=r==i?0:r;n[a]=vt.isConcave(a,i,e,s),n[h]=vt.isConcave(h,i,e,s)}return i==3&&(c.push(s[2]),c.push(s[0]),c.push(s[1])),c}decompose(t,e){let i=t,s=this.convexPolygons;this.polygonPool.freeAll(s),s.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let c=this.polygonIndicesPool.obtain();c.length=0;let l=this.polygonPool.obtain();l.length=0;let r=-1,o=0;for(let a=0,h=e.length;a<h;a+=3){let d=e[a]<<1,f=e[a+1]<<1,u=e[a+2]<<1,m=i[d],x=i[d+1],p=i[f],v=i[f+1],g=i[u],w=i[u+1],b=!1;if(r==d){let y=l.length-4,C=vt.winding(l[y],l[y+1],l[y+2],l[y+3],g,w),A=vt.winding(g,w,l[0],l[1],l[2],l[3]);C==o&&A==o&&(l.push(g),l.push(w),c.push(u),b=!0)}b||(l.length>0?(s.push(l),n.push(c)):(this.polygonPool.free(l),this.polygonIndicesPool.free(c)),l=this.polygonPool.obtain(),l.length=0,l.push(m),l.push(x),l.push(p),l.push(v),l.push(g),l.push(w),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(d),c.push(f),c.push(u),o=vt.winding(m,x,p,v,g,w),r=d)}l.length>0&&(s.push(l),n.push(c));for(let a=0,h=s.length;a<h;a++){if(c=n[a],c.length==0)continue;let d=c[0],f=c[c.length-1];l=s[a];let u=l.length-4,m=l[u],x=l[u+1],p=l[u+2],v=l[u+3],g=l[0],w=l[1],b=l[2],y=l[3],C=vt.winding(m,x,p,v,g,w);for(let A=0;A<h;A++){if(A==a)continue;let T=n[A];if(T.length!=3)continue;let E=T[0],R=T[1],L=T[2],X=s[A],k=X[X.length-2],M=X[X.length-1];if(E!=d||R!=f)continue;let I=vt.winding(m,x,p,v,k,M),W=vt.winding(k,M,g,w,b,y);I==C&&W==C&&(X.length=0,T.length=0,l.push(k),l.push(M),c.push(L),m=p,x=v,p=k,v=M,A=0)}}for(let a=s.length-1;a>=0;a--)l=s[a],l.length==0&&(s.splice(a,1),this.polygonPool.free(l),c=n[a],n.splice(a,1),this.polygonIndicesPool.free(c));return s}static isConcave(t,e,i,s){let n=s[(e+t-1)%e]<<1,c=s[t]<<1,l=s[(t+1)%e]<<1;return!this.positiveArea(i[n],i[n+1],i[c],i[c+1],i[l],i[l+1])}static positiveArea(t,e,i,s,n,c){return t*(c-s)+i*(e-c)+n*(s-e)>=0}static winding(t,e,i,s,n,c){let l=i-t,r=s-e;return n*r-c*l+l*e-t*r>=0?1:-1}},Ie=class{constructor(){this.triangulator=new vt,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let i=e.worldVerticesLength,s=P.setArraySize(this.clippingPolygon,i);e.computeWorldVertices(t,0,i,s,0,2);let n=this.clippingPolygon;Ie.makeClockwise(n);let c=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let l=0,r=c.length;l<r;l++){let o=c[l];Ie.makeClockwise(o),o.push(o[0]),o.push(o[1])}return c.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,e,i,s,n,c,l,r){let o=this.clipOutput,a=this.clippedVertices,h=this.clippedTriangles,d=this.clippingPolygons,f=d.length,u=r?12:8,m=0;a.length=0,h.length=0;t:for(let x=0;x<s;x+=3){let p=i[x]<<1,v=t[p],g=t[p+1],w=n[p],b=n[p+1];p=i[x+1]<<1;let y=t[p],C=t[p+1],A=n[p],T=n[p+1];p=i[x+2]<<1;let E=t[p],R=t[p+1],L=n[p],X=n[p+1];for(let k=0;k<f;k++){let M=a.length;if(this.clip(v,g,y,C,E,R,d[k],o)){let I=o.length;if(I==0)continue;let W=C-R,it=E-y,tt=v-E,lt=R-g,st=1/(W*tt+it*(g-R)),ht=I>>1,rt=this.clipOutput,et=P.setArraySize(a,M+ht*u);for(let wt=0;wt<I;wt+=2){let kt=rt[wt],gt=rt[wt+1];et[M]=kt,et[M+1]=gt,et[M+2]=c.r,et[M+3]=c.g,et[M+4]=c.b,et[M+5]=c.a;let At=kt-E,Ct=gt-R,Nt=(W*At+it*Ct)*st,ee=(lt*At+tt*Ct)*st,ce=1-Nt-ee;et[M+6]=w*Nt+A*ee+L*ce,et[M+7]=b*Nt+T*ee+X*ce,r&&(et[M+8]=l.r,et[M+9]=l.g,et[M+10]=l.b,et[M+11]=l.a),M+=u}M=h.length;let dt=P.setArraySize(h,M+3*(ht-2));ht--;for(let wt=1;wt<ht;wt++)dt[M]=m,dt[M+1]=m+wt,dt[M+2]=m+wt+1,M+=3;m+=ht+1}else{let I=P.setArraySize(a,M+3*u);I[M]=v,I[M+1]=g,I[M+2]=c.r,I[M+3]=c.g,I[M+4]=c.b,I[M+5]=c.a,r?(I[M+6]=w,I[M+7]=b,I[M+8]=l.r,I[M+9]=l.g,I[M+10]=l.b,I[M+11]=l.a,I[M+12]=y,I[M+13]=C,I[M+14]=c.r,I[M+15]=c.g,I[M+16]=c.b,I[M+17]=c.a,I[M+18]=A,I[M+19]=T,I[M+20]=l.r,I[M+21]=l.g,I[M+22]=l.b,I[M+23]=l.a,I[M+24]=E,I[M+25]=R,I[M+26]=c.r,I[M+27]=c.g,I[M+28]=c.b,I[M+29]=c.a,I[M+30]=L,I[M+31]=X,I[M+32]=l.r,I[M+33]=l.g,I[M+34]=l.b,I[M+35]=l.a):(I[M+6]=w,I[M+7]=b,I[M+8]=y,I[M+9]=C,I[M+10]=c.r,I[M+11]=c.g,I[M+12]=c.b,I[M+13]=c.a,I[M+14]=A,I[M+15]=T,I[M+16]=E,I[M+17]=R,I[M+18]=c.r,I[M+19]=c.g,I[M+20]=c.b,I[M+21]=c.a,I[M+22]=L,I[M+23]=X),M=h.length;let W=P.setArraySize(h,M+3);W[M]=m,W[M+1]=m+1,W[M+2]=m+2,m+=3;continue t}}}}clip(t,e,i,s,n,c,l,r){let o=r,a=!1,h;l.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(t),h.push(e),h.push(i),h.push(s),h.push(n),h.push(c),h.push(t),h.push(e),r.length=0;let d=l,f=l.length-4;for(let u=0;;u+=2){let m=d[u],x=d[u+1],p=d[u+2],v=d[u+3],g=m-p,w=x-v,b=h,y=h.length-2,C=r.length;for(let T=0;T<y;T+=2){let E=b[T],R=b[T+1],L=b[T+2],X=b[T+3],k=g*(X-v)-w*(L-p)>0;if(g*(R-v)-w*(E-p)>0){if(k){r.push(L),r.push(X);continue}let M=X-R,I=L-E,W=M*(p-m)-I*(v-x);if(Math.abs(W)>1e-6){let it=(I*(x-R)-M*(m-E))/W;r.push(m+(p-m)*it),r.push(x+(v-x)*it)}else r.push(m),r.push(x)}else if(k){let M=X-R,I=L-E,W=M*(p-m)-I*(v-x);if(Math.abs(W)>1e-6){let it=(I*(x-R)-M*(m-E))/W;r.push(m+(p-m)*it),r.push(x+(v-x)*it)}else r.push(m),r.push(x);r.push(L),r.push(X)}a=!0}if(C==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let A=r;r=h,r.length=0,h=A}if(o!=r){o.length=0;for(let u=0,m=r.length-2;u<m;u++)o[u]=r[u]}else o.length=o.length-2;return a}static makeClockwise(t){let e=t,i=t.length,s=e[i-2]*e[1]-e[0]*e[i-1],n=0,c=0,l=0,r=0;for(let o=0,a=i-3;o<a;o+=2)n=e[o],c=e[o+1],l=e[o+2],r=e[o+3],s+=n*r-l*c;if(!(s<0))for(let o=0,a=i-2,h=i>>1;o<h;o+=2){let d=e[o],f=e[o+1],u=a-o;e[o]=e[u],e[o+1]=e[u+1],e[u]=d,e[u+1]=f}}},dr=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,i=new vi,s=typeof t=="string"?JSON.parse(t):t,n=s.skeleton;if(n&&(i.hash=n.hash,i.version=n.spine,i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height,i.fps=n.fps,i.imagesPath=n.images),s.bones)for(let c=0;c<s.bones.length;c++){let l=s.bones[c],r=null,o=Y(l,"parent",null);o&&(r=i.findBone(o));let a=new ui(i.bones.length,l.name,r);a.length=Y(l,"length",0)*e,a.x=Y(l,"x",0)*e,a.y=Y(l,"y",0)*e,a.rotation=Y(l,"rotation",0),a.scaleX=Y(l,"scaleX",1),a.scaleY=Y(l,"scaleY",1),a.shearX=Y(l,"shearX",0),a.shearY=Y(l,"shearY",0),a.transformMode=P.enumValue(pe,Y(l,"transform","Normal")),a.skinRequired=Y(l,"skin",!1);let h=Y(l,"color",null);h&&a.color.setFromString(h),i.bones.push(a)}if(s.slots)for(let c=0;c<s.slots.length;c++){let l=s.slots[c],r=i.findBone(l.bone);if(!r)throw new Error(`Couldn't find bone ${l.bone} for slot ${l.name}`);let o=new Ai(i.slots.length,l.name,r),a=Y(l,"color",null);a&&o.color.setFromString(a);let h=Y(l,"dark",null);h&&(o.darkColor=B.fromString(h)),o.attachmentName=Y(l,"attachment",null),o.blendMode=P.enumValue(Te,Y(l,"blend","normal")),i.slots.push(o)}if(s.ik)for(let c=0;c<s.ik.length;c++){let l=s.ik[c],r=new bi(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let a=0;a<l.bones.length;a++){let h=i.findBone(l.bones[a]);if(!h)throw new Error(`Couldn't find bone ${l.bones[a]} for IK constraint ${l.name}.`);r.bones.push(h)}let o=i.findBone(l.target);if(!o)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);r.target=o,r.mix=Y(l,"mix",1),r.softness=Y(l,"softness",0)*e,r.bendDirection=Y(l,"bendPositive",!0)?1:-1,r.compress=Y(l,"compress",!1),r.stretch=Y(l,"stretch",!1),r.uniform=Y(l,"uniform",!1),i.ikConstraints.push(r)}if(s.transform)for(let c=0;c<s.transform.length;c++){let l=s.transform[c],r=new Ci(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);r.bones.push(f)}let o=l.target,a=i.findBone(o);if(!a)throw new Error(`Couldn't find target bone ${o} for transform constraint ${l.name}.`);r.target=a,r.local=Y(l,"local",!1),r.relative=Y(l,"relative",!1),r.offsetRotation=Y(l,"rotation",0),r.offsetX=Y(l,"x",0)*e,r.offsetY=Y(l,"y",0)*e,r.offsetScaleX=Y(l,"scaleX",0),r.offsetScaleY=Y(l,"scaleY",0),r.offsetShearY=Y(l,"shearY",0),r.mixRotate=Y(l,"mixRotate",1),r.mixX=Y(l,"mixX",1),r.mixY=Y(l,"mixY",r.mixX),r.mixScaleX=Y(l,"mixScaleX",1),r.mixScaleY=Y(l,"mixScaleY",r.mixScaleX),r.mixShearY=Y(l,"mixShearY",1),i.transformConstraints.push(r)}if(s.path)for(let c=0;c<s.path.length;c++){let l=s.path[c],r=new pi(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);r.bones.push(f)}let o=l.target,a=i.findSlot(o);if(!a)throw new Error(`Couldn't find target slot ${o} for path constraint ${l.name}.`);r.target=a,r.positionMode=P.enumValue(ye,Y(l,"positionMode","Percent")),r.spacingMode=P.enumValue(Ae,Y(l,"spacingMode","Length")),r.rotateMode=P.enumValue(Ce,Y(l,"rotateMode","Tangent")),r.offsetRotation=Y(l,"rotation",0),r.position=Y(l,"position",0),r.positionMode==0&&(r.position*=e),r.spacing=Y(l,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=e),r.mixRotate=Y(l,"mixRotate",1),r.mixX=Y(l,"mixX",1),r.mixY=Y(l,"mixY",r.mixX),i.pathConstraints.push(r)}if(s.skins)for(let c=0;c<s.skins.length;c++){let l=s.skins[c],r=new Se(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){let a=l.bones[o],h=i.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);r.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){let a=l.ik[o],h=i.findIkConstraint(a);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){let a=l.transform[o],h=i.findTransformConstraint(a);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){let a=l.path[o],h=i.findPathConstraint(a);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}for(let o in l.attachments){let a=i.findSlot(o);if(!a)throw new Error(`Couldn't find slot ${o} for skin ${l.name}.`);let h=l.attachments[o];for(let d in h){let f=this.readAttachment(h[d],r,a.index,d,i);f&&r.setAttachment(a.index,d,f)}}i.skins.push(r),r.name=="default"&&(i.defaultSkin=r)}for(let c=0,l=this.linkedMeshes.length;c<l;c++){let r=this.linkedMeshes[c],o=r.skin?i.findSkin(r.skin):i.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let a=o.getAttachment(r.slotIndex,r.parent);if(!a)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?a:r.mesh,r.mesh.setParentMesh(a),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let c in s.events){let l=s.events[c],r=new wi(c);r.intValue=Y(l,"int",0),r.floatValue=Y(l,"float",0),r.stringValue=Y(l,"string",""),r.audioPath=Y(l,"audio",null),r.audioPath&&(r.volume=Y(l,"volume",1),r.balance=Y(l,"balance",0)),i.events.push(r)}if(s.animations)for(let c in s.animations){let l=s.animations[c];this.readAnimation(l,c,i)}return i}readAttachment(t,e,i,s,n){let c=this.scale;switch(s=Y(t,"name",s),Y(t,"type","region")){case"region":{let l=Y(t,"path",s),r=this.readSequence(Y(t,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(e,s,l,r);if(!o)return null;o.path=l,o.x=Y(t,"x",0)*c,o.y=Y(t,"y",0)*c,o.scaleX=Y(t,"scaleX",1),o.scaleY=Y(t,"scaleY",1),o.rotation=Y(t,"rotation",0),o.width=t.width*c,o.height=t.height*c,o.sequence=r;let a=Y(t,"color",null);return a&&o.color.setFromString(a),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,s);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let r=Y(t,"color",null);return r&&l.color.setFromString(r),l}case"mesh":case"linkedmesh":{let l=Y(t,"path",s),r=this.readSequence(Y(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,s,l,r);if(!o)return null;o.path=l;let a=Y(t,"color",null);a&&o.color.setFromString(a),o.width=Y(t,"width",0)*c,o.height=Y(t,"height",0)*c,o.sequence=r;let h=Y(t,"parent",null);if(h)return this.linkedMeshes.push(new fr(o,Y(t,"skin",null),i,h,Y(t,"timelines",!0))),o;let d=t.uvs;return this.readVertices(t,o,d.length),o.triangles=t.triangles,o.regionUVs=d,o.region!=null&&o.updateRegion(),o.edges=Y(t,"edges",null),o.hullLength=Y(t,"hull",0)*2,o}case"path":{let l=this.attachmentLoader.newPathAttachment(e,s);if(!l)return null;l.closed=Y(t,"closed",!1),l.constantSpeed=Y(t,"constantSpeed",!0);let r=t.vertexCount;this.readVertices(t,l,r<<1);let o=P.newArray(r/3,0);for(let h=0;h<t.lengths.length;h++)o[h]=t.lengths[h]*c;l.lengths=o;let a=Y(t,"color",null);return a&&l.color.setFromString(a),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,s);if(!l)return null;l.x=Y(t,"x",0)*c,l.y=Y(t,"y",0)*c,l.rotation=Y(t,"rotation",0);let r=Y(t,"color",null);return r&&l.color.setFromString(r),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,s);if(!l)return null;let r=Y(t,"end",null);r&&(l.endSlot=n.findSlot(r));let o=t.vertexCount;this.readVertices(t,l,o<<1);let a=Y(t,"color",null);return a&&l.color.setFromString(a),l}}return null}readSequence(t){if(t==null)return null;let e=new Ne(Y(t,"count",0));return e.start=Y(t,"start",1),e.digits=Y(t,"digits",0),e.setupIndex=Y(t,"setup",0),e}readVertices(t,e,i){let s=this.scale;e.worldVerticesLength=i;let n=t.vertices;if(i==n.length){let r=P.toFloatArray(n);if(s!=1)for(let o=0,a=n.length;o<a;o++)r[o]*=s;e.vertices=r;return}let c=new Array,l=new Array;for(let r=0,o=n.length;r<o;){let a=n[r++];l.push(a);for(let h=r+a*4;r<h;r+=4)l.push(n[r]),c.push(n[r+1]*s),c.push(n[r+2]*s),c.push(n[r+3])}e.bones=l,e.vertices=P.toFloatArray(c)}readAnimation(t,e,i){let s=this.scale,n=new Array;if(t.slots)for(let l in t.slots){let r=t.slots[l],o=i.findSlot(l);if(!o)throw new Error("Slot not found: "+l);let a=o.index;for(let h in r){let d=r[h];if(!d)continue;let f=d.length;if(h=="attachment"){let u=new Wt(f,a);for(let m=0;m<f;m++){let x=d[m];u.setFrame(m,Y(x,"time",0),Y(x,"name",null))}n.push(u)}else if(h=="rgba"){let u=new Ke(f,f<<2,a),m=d[0],x=Y(m,"time",0),p=B.fromString(m.color);for(let v=0,g=0;;v++){u.setFrame(v,x,p.r,p.g,p.b,p.a);let w=d[v+1];if(!w){u.shrink(g);break}let b=Y(w,"time",0),y=B.fromString(w.color),C=m.curve;C&&(g=ot(C,u,g,v,0,x,b,p.r,y.r,1),g=ot(C,u,g,v,1,x,b,p.g,y.g,1),g=ot(C,u,g,v,2,x,b,p.b,y.b,1),g=ot(C,u,g,v,3,x,b,p.a,y.a,1)),x=b,p=y,m=w}n.push(u)}else if(h=="rgb"){let u=new Je(f,f*3,a),m=d[0],x=Y(m,"time",0),p=B.fromString(m.color);for(let v=0,g=0;;v++){u.setFrame(v,x,p.r,p.g,p.b);let w=d[v+1];if(!w){u.shrink(g);break}let b=Y(w,"time",0),y=B.fromString(w.color),C=m.curve;C&&(g=ot(C,u,g,v,0,x,b,p.r,y.r,1),g=ot(C,u,g,v,1,x,b,p.g,y.g,1),g=ot(C,u,g,v,2,x,b,p.b,y.b,1)),x=b,p=y,m=w}n.push(u)}else if(h=="alpha")n.push(Rt(d,new Qe(f,f,a),0,1));else if(h=="rgba2"){let u=new $e(f,f*7,a),m=d[0],x=Y(m,"time",0),p=B.fromString(m.light),v=B.fromString(m.dark);for(let g=0,w=0;;g++){u.setFrame(g,x,p.r,p.g,p.b,p.a,v.r,v.g,v.b);let b=d[g+1];if(!b){u.shrink(w);break}let y=Y(b,"time",0),C=B.fromString(b.light),A=B.fromString(b.dark),T=m.curve;T&&(w=ot(T,u,w,g,0,x,y,p.r,C.r,1),w=ot(T,u,w,g,1,x,y,p.g,C.g,1),w=ot(T,u,w,g,2,x,y,p.b,C.b,1),w=ot(T,u,w,g,3,x,y,p.a,C.a,1),w=ot(T,u,w,g,4,x,y,v.r,A.r,1),w=ot(T,u,w,g,5,x,y,v.g,A.g,1),w=ot(T,u,w,g,6,x,y,v.b,A.b,1)),x=y,p=C,v=A,m=b}n.push(u)}else if(h=="rgb2"){let u=new ti(f,f*6,a),m=d[0],x=Y(m,"time",0),p=B.fromString(m.light),v=B.fromString(m.dark);for(let g=0,w=0;;g++){u.setFrame(g,x,p.r,p.g,p.b,v.r,v.g,v.b);let b=d[g+1];if(!b){u.shrink(w);break}let y=Y(b,"time",0),C=B.fromString(b.light),A=B.fromString(b.dark),T=m.curve;T&&(w=ot(T,u,w,g,0,x,y,p.r,C.r,1),w=ot(T,u,w,g,1,x,y,p.g,C.g,1),w=ot(T,u,w,g,2,x,y,p.b,C.b,1),w=ot(T,u,w,g,3,x,y,v.r,A.r,1),w=ot(T,u,w,g,4,x,y,v.g,A.g,1),w=ot(T,u,w,g,5,x,y,v.b,A.b,1)),x=y,p=C,v=A,m=b}n.push(u)}}}if(t.bones)for(let l in t.bones){let r=t.bones[l],o=i.findBone(l);if(!o)throw new Error("Bone not found: "+l);let a=o.index;for(let h in r){let d=r[h],f=d.length;if(f!=0){if(h==="rotate")n.push(Rt(d,new ne(f,f,a),0,1));else if(h==="translate"){let u=new Ue(f,f<<1,a);n.push(Ti(d,u,"x","y",0,s))}else if(h==="translatex"){let u=new ze(f,f,a);n.push(Rt(d,u,0,s))}else if(h==="translatey"){let u=new We(f,f,a);n.push(Rt(d,u,0,s))}else if(h==="scale"){let u=new _e(f,f<<1,a);n.push(Ti(d,u,"x","y",1,1))}else if(h==="scalex"){let u=new qe(f,f,a);n.push(Rt(d,u,1,1))}else if(h==="scaley"){let u=new Ge(f,f,a);n.push(Rt(d,u,1,1))}else if(h==="shear"){let u=new He(f,f<<1,a);n.push(Ti(d,u,"x","y",0,1))}else if(h==="shearx"){let u=new je(f,f,a);n.push(Rt(d,u,0,1))}else if(h==="sheary"){let u=new Ze(f,f,a);n.push(Rt(d,u,0,1))}}}}if(t.ik)for(let l in t.ik){let r=t.ik[l],o=r[0];if(!o)continue;let a=i.findIkConstraint(l);if(!a)throw new Error("IK Constraint not found: "+l);let h=i.ikConstraints.indexOf(a),d=new ii(r.length,r.length<<1,h),f=Y(o,"time",0),u=Y(o,"mix",1),m=Y(o,"softness",0)*s;for(let x=0,p=0;;x++){d.setFrame(x,f,u,m,Y(o,"bendPositive",!0)?1:-1,Y(o,"compress",!1),Y(o,"stretch",!1));let v=r[x+1];if(!v){d.shrink(p);break}let g=Y(v,"time",0),w=Y(v,"mix",1),b=Y(v,"softness",0)*s,y=o.curve;y&&(p=ot(y,d,p,x,0,f,g,u,w,1),p=ot(y,d,p,x,1,f,g,m,b,s)),f=g,u=w,m=b,o=v}n.push(d)}if(t.transform)for(let l in t.transform){let r=t.transform[l],o=r[0];if(!o)continue;let a=i.findTransformConstraint(l);if(!a)throw new Error("Transform constraint not found: "+l);let h=i.transformConstraints.indexOf(a),d=new si(r.length,r.length*6,h),f=Y(o,"time",0),u=Y(o,"mixRotate",1),m=Y(o,"mixX",1),x=Y(o,"mixY",m),p=Y(o,"mixScaleX",1),v=Y(o,"mixScaleY",p),g=Y(o,"mixShearY",1);for(let w=0,b=0;;w++){d.setFrame(w,f,u,m,x,p,v,g);let y=r[w+1];if(!y){d.shrink(b);break}let C=Y(y,"time",0),A=Y(y,"mixRotate",1),T=Y(y,"mixX",1),E=Y(y,"mixY",T),R=Y(y,"mixScaleX",1),L=Y(y,"mixScaleY",R),X=Y(y,"mixShearY",1),k=o.curve;k&&(b=ot(k,d,b,w,0,f,C,u,A,1),b=ot(k,d,b,w,1,f,C,m,T,1),b=ot(k,d,b,w,2,f,C,x,E,1),b=ot(k,d,b,w,3,f,C,p,R,1),b=ot(k,d,b,w,4,f,C,v,L,1),b=ot(k,d,b,w,5,f,C,g,X,1)),f=C,u=A,m=T,x=E,p=R,v=L,p=R,o=y}n.push(d)}if(t.path)for(let l in t.path){let r=t.path[l],o=i.findPathConstraint(l);if(!o)throw new Error("Path constraint not found: "+l);let a=i.pathConstraints.indexOf(o);for(let h in r){let d=r[h],f=d[0];if(!f)continue;let u=d.length;if(h==="position"){let m=new ri(u,u,a);n.push(Rt(d,m,0,o.positionMode==0?s:1))}else if(h==="spacing"){let m=new ni(u,u,a);n.push(Rt(d,m,0,o.spacingMode==0||o.spacingMode==1?s:1))}else if(h==="mix"){let m=new ai(u,u*3,a),x=Y(f,"time",0),p=Y(f,"mixRotate",1),v=Y(f,"mixX",1),g=Y(f,"mixY",v);for(let w=0,b=0;;w++){m.setFrame(w,x,p,v,g);let y=d[w+1];if(!y){m.shrink(b);break}let C=Y(y,"time",0),A=Y(y,"mixRotate",1),T=Y(y,"mixX",1),E=Y(y,"mixY",T),R=f.curve;R&&(b=ot(R,m,b,w,0,x,C,p,A,1),b=ot(R,m,b,w,1,x,C,v,T,1),b=ot(R,m,b,w,2,x,C,g,E,1)),x=C,p=A,v=T,g=E,f=y}n.push(m)}}}if(t.attachments)for(let l in t.attachments){let r=t.attachments[l],o=i.findSkin(l);if(!o)throw new Error("Skin not found: "+l);for(let a in r){let h=r[a],d=i.findSlot(a);if(!d)throw new Error("Slot not found: "+a);let f=d.index;for(let u in h){let m=h[u],x=o.getAttachment(f,u);for(let p in m){let v=m[p],g=v[0];if(g){if(p=="deform"){let w=x.bones,b=x.vertices,y=w?b.length/3*2:b.length,C=new ei(v.length,v.length,f,x),A=Y(g,"time",0);for(let T=0,E=0;;T++){let R,L=Y(g,"vertices",null);if(!L)R=w?P.newFloatArray(y):b;else{R=P.newFloatArray(y);let I=Y(g,"offset",0);if(P.arrayCopy(L,0,R,I,L.length),s!=1)for(let W=I,it=W+L.length;W<it;W++)R[W]*=s;if(!w)for(let W=0;W<y;W++)R[W]+=b[W]}C.setFrame(T,A,R);let X=v[T+1];if(!X){C.shrink(E);break}let k=Y(X,"time",0),M=g.curve;M&&(E=ot(M,C,E,T,0,A,k,0,1,1)),A=k,g=X}n.push(C)}else if(p=="sequence"){let w=new Kt(v.length,f,x),b=0;for(let y=0;y<v.length;y++){let C=Y(g,"delay",b),A=Y(g,"time",0),T=Vi[Y(g,"mode","hold")],E=Y(g,"index",0);w.setFrame(y,A,T,E,C),b=C,g=v[y+1]}n.push(w)}}}}}}if(t.drawOrder){let l=new _t(t.drawOrder.length),r=i.slots.length,o=0;for(let a=0;a<t.drawOrder.length;a++,o++){let h=t.drawOrder[a],d=null,f=Y(h,"offsets",null);if(f){d=P.newArray(r,-1);let u=P.newArray(r-f.length,0),m=0,x=0;for(let p=0;p<f.length;p++){let v=f[p],g=i.findSlot(v.slot);if(!g)throw new Error("Slot not found: "+g);let w=g.index;for(;m!=w;)u[x++]=m++;d[m+v.offset]=m++}for(;m<r;)u[x++]=m++;for(let p=r-1;p>=0;p--)d[p]==-1&&(d[p]=u[--x])}l.setFrame(o,Y(h,"time",0),d)}n.push(l)}if(t.events){let l=new ae(t.events.length),r=0;for(let o=0;o<t.events.length;o++,r++){let a=t.events[o],h=i.findEvent(a.name);if(!h)throw new Error("Event not found: "+a.name);let d=new xi(P.toSinglePrecision(Y(a,"time",0)),h);d.intValue=Y(a,"int",h.intValue),d.floatValue=Y(a,"float",h.floatValue),d.stringValue=Y(a,"string",h.stringValue),d.data.audioPath&&(d.volume=Y(a,"volume",1),d.balance=Y(a,"balance",0)),l.setFrame(r,d)}n.push(l)}let c=0;for(let l=0,r=n.length;l<r;l++)c=Math.max(c,n[l].getDuration());i.animations.push(new fe(e,n,c))}},fr=class{constructor(t,e,i,s,n){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}};function Rt(t,e,i,s){let n=t[0],c=Y(n,"time",0),l=Y(n,"value",i)*s,r=0;for(let o=0;;o++){e.setFrame(o,c,l);let a=t[o+1];if(!a)return e.shrink(r),e;let h=Y(a,"time",0),d=Y(a,"value",i)*s;n.curve&&(r=ot(n.curve,e,r,o,0,c,h,l,d,s)),c=h,l=d,n=a}}function Ti(t,e,i,s,n,c){let l=t[0],r=Y(l,"time",0),o=Y(l,i,n)*c,a=Y(l,s,n)*c,h=0;for(let d=0;;d++){e.setFrame(d,r,o,a);let f=t[d+1];if(!f)return e.shrink(h),e;let u=Y(f,"time",0),m=Y(f,i,n)*c,x=Y(f,s,n)*c,p=l.curve;p&&(h=ot(p,e,h,d,0,r,u,o,m,c),h=ot(p,e,h,d,1,r,u,a,x,c)),r=u,o=m,a=x,l=f}}function ot(t,e,i,s,n,c,l,r,o,a){if(t=="stepped")return e.setStepped(s),i;let h=n<<2,d=t[h],f=t[h+1]*a,u=t[h+2],m=t[h+3]*a;return e.setBezier(i,s,n,c,r,d,f,u,m,l,o),i+1}function Y(t,e,i){return t[e]!==void 0?t[e]:i}typeof Math.fround=="undefined"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var xt=class{constructor(t,e={alpha:"true"}){if(this.restorables=new Array,t instanceof WebGLRenderingContext||typeof WebGL2RenderingContext!="undefined"&&t instanceof WebGL2RenderingContext)this.gl=t,this.canvas=this.gl.canvas;else{let i=t;this.gl=i.getContext("webgl2",e)||i.getContext("webgl",e),this.canvas=i,i.addEventListener("webglcontextlost",s=>{let n=s;s&&s.preventDefault()}),i.addEventListener("webglcontextrestored",s=>{for(let n=0,c=this.restorables.length;n<c;n++)this.restorables[n].restore()})}}addRestorable(t){this.restorables.push(t)}removeRestorable(t){let e=this.restorables.indexOf(t);e>-1&&this.restorables.splice(e,1)}},Ye=class extends ci{constructor(t,e,i=!1){super(e),this.texture=null,this.boundUnit=0,this.useMipMaps=!1,this.context=t instanceof xt?t:new xt(t),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(t,e){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,Ye.validateMagFilter(e)),this.useMipMaps=Ye.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,e){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,e)}update(t){let e=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Ye.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this._image),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t&&e.generateMipmap(e.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){let e=this.context.gl;this.boundUnit=t,e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.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)}},oe=Ye;oe.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;var hs=class extends es{constructor(t,e="",i=new gi){super(s=>new oe(t,s),e,i)}},yt=class{constructor(t=0,e=0,i=0){this.x=0,this.y=0,this.z=0,this.x=t,this.y=e,this.z=i}setFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}normalize(){let t=this.length();return t==0?this:(t=1/t,this.x*=t,this.y*=t,this.z*=t,this)}cross(t){return this.set(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}multiply(t){let e=t.values;return this.set(this.x*e[D]+this.y*e[_]+this.z*e[q]+e[O],this.x*e[G]+this.y*e[V]+this.z*e[H]+e[N],this.x*e[j]+this.y*e[Z]+this.z*e[U]+e[z])}project(t){let e=t.values,i=1/(this.x*e[J]+this.y*e[Q]+this.z*e[$]+e[K]);return this.set((this.x*e[D]+this.y*e[_]+this.z*e[q]+e[O])*i,(this.x*e[G]+this.y*e[V]+this.z*e[H]+e[N])*i,(this.x*e[j]+this.y*e[Z]+this.z*e[U]+e[z])*i)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(t){let e=t.x-this.x,i=t.y-this.y,s=t.z-this.z;return Math.sqrt(e*e+i*i+s*s)}},D=0,_=4,q=8,O=12,G=1,V=5,H=9,N=13,j=2,Z=6,U=10,z=14,J=3,Q=7,$=11,K=15,Et=class{constructor(){this.temp=new Float32Array(16),this.values=new Float32Array(16);let t=this.values;t[D]=1,t[V]=1,t[U]=1,t[K]=1}set(t){return this.values.set(t),this}transpose(){let t=this.temp,e=this.values;return t[D]=e[D],t[_]=e[G],t[q]=e[j],t[O]=e[J],t[G]=e[_],t[V]=e[V],t[H]=e[Z],t[N]=e[Q],t[j]=e[q],t[Z]=e[H],t[U]=e[U],t[z]=e[$],t[J]=e[O],t[Q]=e[N],t[$]=e[z],t[K]=e[K],this.set(t)}identity(){let t=this.values;return t[D]=1,t[_]=0,t[q]=0,t[O]=0,t[G]=0,t[V]=1,t[H]=0,t[N]=0,t[j]=0,t[Z]=0,t[U]=1,t[z]=0,t[J]=0,t[Q]=0,t[$]=0,t[K]=1,this}invert(){let t=this.values,e=this.temp,i=t[J]*t[Z]*t[H]*t[O]-t[j]*t[Q]*t[H]*t[O]-t[J]*t[V]*t[U]*t[O]+t[G]*t[Q]*t[U]*t[O]+t[j]*t[V]*t[$]*t[O]-t[G]*t[Z]*t[$]*t[O]-t[J]*t[Z]*t[q]*t[N]+t[j]*t[Q]*t[q]*t[N]+t[J]*t[_]*t[U]*t[N]-t[D]*t[Q]*t[U]*t[N]-t[j]*t[_]*t[$]*t[N]+t[D]*t[Z]*t[$]*t[N]+t[J]*t[V]*t[q]*t[z]-t[G]*t[Q]*t[q]*t[z]-t[J]*t[_]*t[H]*t[z]+t[D]*t[Q]*t[H]*t[z]+t[G]*t[_]*t[$]*t[z]-t[D]*t[V]*t[$]*t[z]-t[j]*t[V]*t[q]*t[K]+t[G]*t[Z]*t[q]*t[K]+t[j]*t[_]*t[H]*t[K]-t[D]*t[Z]*t[H]*t[K]-t[G]*t[_]*t[U]*t[K]+t[D]*t[V]*t[U]*t[K];if(i==0)throw new Error("non-invertible matrix");let s=1/i;return e[D]=t[H]*t[z]*t[Q]-t[N]*t[U]*t[Q]+t[N]*t[Z]*t[$]-t[V]*t[z]*t[$]-t[H]*t[Z]*t[K]+t[V]*t[U]*t[K],e[_]=t[O]*t[U]*t[Q]-t[q]*t[z]*t[Q]-t[O]*t[Z]*t[$]+t[_]*t[z]*t[$]+t[q]*t[Z]*t[K]-t[_]*t[U]*t[K],e[q]=t[q]*t[N]*t[Q]-t[O]*t[H]*t[Q]+t[O]*t[V]*t[$]-t[_]*t[N]*t[$]-t[q]*t[V]*t[K]+t[_]*t[H]*t[K],e[O]=t[O]*t[H]*t[Z]-t[q]*t[N]*t[Z]-t[O]*t[V]*t[U]+t[_]*t[N]*t[U]+t[q]*t[V]*t[z]-t[_]*t[H]*t[z],e[G]=t[N]*t[U]*t[J]-t[H]*t[z]*t[J]-t[N]*t[j]*t[$]+t[G]*t[z]*t[$]+t[H]*t[j]*t[K]-t[G]*t[U]*t[K],e[V]=t[q]*t[z]*t[J]-t[O]*t[U]*t[J]+t[O]*t[j]*t[$]-t[D]*t[z]*t[$]-t[q]*t[j]*t[K]+t[D]*t[U]*t[K],e[H]=t[O]*t[H]*t[J]-t[q]*t[N]*t[J]-t[O]*t[G]*t[$]+t[D]*t[N]*t[$]+t[q]*t[G]*t[K]-t[D]*t[H]*t[K],e[N]=t[q]*t[N]*t[j]-t[O]*t[H]*t[j]+t[O]*t[G]*t[U]-t[D]*t[N]*t[U]-t[q]*t[G]*t[z]+t[D]*t[H]*t[z],e[j]=t[V]*t[z]*t[J]-t[N]*t[Z]*t[J]+t[N]*t[j]*t[Q]-t[G]*t[z]*t[Q]-t[V]*t[j]*t[K]+t[G]*t[Z]*t[K],e[Z]=t[O]*t[Z]*t[J]-t[_]*t[z]*t[J]-t[O]*t[j]*t[Q]+t[D]*t[z]*t[Q]+t[_]*t[j]*t[K]-t[D]*t[Z]*t[K],e[U]=t[_]*t[N]*t[J]-t[O]*t[V]*t[J]+t[O]*t[G]*t[Q]-t[D]*t[N]*t[Q]-t[_]*t[G]*t[K]+t[D]*t[V]*t[K],e[z]=t[O]*t[V]*t[j]-t[_]*t[N]*t[j]-t[O]*t[G]*t[Z]+t[D]*t[N]*t[Z]+t[_]*t[G]*t[z]-t[D]*t[V]*t[z],e[J]=t[H]*t[Z]*t[J]-t[V]*t[U]*t[J]-t[H]*t[j]*t[Q]+t[G]*t[U]*t[Q]+t[V]*t[j]*t[$]-t[G]*t[Z]*t[$],e[Q]=t[_]*t[U]*t[J]-t[q]*t[Z]*t[J]+t[q]*t[j]*t[Q]-t[D]*t[U]*t[Q]-t[_]*t[j]*t[$]+t[D]*t[Z]*t[$],e[$]=t[q]*t[V]*t[J]-t[_]*t[H]*t[J]-t[q]*t[G]*t[Q]+t[D]*t[H]*t[Q]+t[_]*t[G]*t[$]-t[D]*t[V]*t[$],e[K]=t[_]*t[H]*t[j]-t[q]*t[V]*t[j]+t[q]*t[G]*t[Z]-t[D]*t[H]*t[Z]-t[_]*t[G]*t[U]+t[D]*t[V]*t[U],t[D]=e[D]*s,t[_]=e[_]*s,t[q]=e[q]*s,t[O]=e[O]*s,t[G]=e[G]*s,t[V]=e[V]*s,t[H]=e[H]*s,t[N]=e[N]*s,t[j]=e[j]*s,t[Z]=e[Z]*s,t[U]=e[U]*s,t[z]=e[z]*s,t[J]=e[J]*s,t[Q]=e[Q]*s,t[$]=e[$]*s,t[K]=e[K]*s,this}determinant(){let t=this.values;return t[J]*t[Z]*t[H]*t[O]-t[j]*t[Q]*t[H]*t[O]-t[J]*t[V]*t[U]*t[O]+t[G]*t[Q]*t[U]*t[O]+t[j]*t[V]*t[$]*t[O]-t[G]*t[Z]*t[$]*t[O]-t[J]*t[Z]*t[q]*t[N]+t[j]*t[Q]*t[q]*t[N]+t[J]*t[_]*t[U]*t[N]-t[D]*t[Q]*t[U]*t[N]-t[j]*t[_]*t[$]*t[N]+t[D]*t[Z]*t[$]*t[N]+t[J]*t[V]*t[q]*t[z]-t[G]*t[Q]*t[q]*t[z]-t[J]*t[_]*t[H]*t[z]+t[D]*t[Q]*t[H]*t[z]+t[G]*t[_]*t[$]*t[z]-t[D]*t[V]*t[$]*t[z]-t[j]*t[V]*t[q]*t[K]+t[G]*t[Z]*t[q]*t[K]+t[j]*t[_]*t[H]*t[K]-t[D]*t[Z]*t[H]*t[K]-t[G]*t[_]*t[U]*t[K]+t[D]*t[V]*t[U]*t[K]}translate(t,e,i){let s=this.values;return s[O]+=t,s[N]+=e,s[z]+=i,this}copy(){return new Et().set(this.values)}projection(t,e,i,s){this.identity();let n=1/Math.tan(i*(Math.PI/180)/2),c=(e+t)/(t-e),l=2*e*t/(t-e),r=this.values;return r[D]=n/s,r[G]=0,r[j]=0,r[J]=0,r[_]=0,r[V]=n,r[Z]=0,r[Q]=0,r[q]=0,r[H]=0,r[U]=c,r[$]=-1,r[O]=0,r[N]=0,r[z]=l,r[K]=0,this}ortho2d(t,e,i,s){return this.ortho(t,t+i,e,e+s,0,1)}ortho(t,e,i,s,n,c){this.identity();let l=2/(e-t),r=2/(s-i),o=-2/(c-n),a=-(e+t)/(e-t),h=-(s+i)/(s-i),d=-(c+n)/(c-n),f=this.values;return f[D]=l,f[G]=0,f[j]=0,f[J]=0,f[_]=0,f[V]=r,f[Z]=0,f[Q]=0,f[q]=0,f[H]=0,f[U]=o,f[$]=0,f[O]=a,f[N]=h,f[z]=d,f[K]=1,this}multiply(t){let e=this.temp,i=this.values,s=t.values;return e[D]=i[D]*s[D]+i[_]*s[G]+i[q]*s[j]+i[O]*s[J],e[_]=i[D]*s[_]+i[_]*s[V]+i[q]*s[Z]+i[O]*s[Q],e[q]=i[D]*s[q]+i[_]*s[H]+i[q]*s[U]+i[O]*s[$],e[O]=i[D]*s[O]+i[_]*s[N]+i[q]*s[z]+i[O]*s[K],e[G]=i[G]*s[D]+i[V]*s[G]+i[H]*s[j]+i[N]*s[J],e[V]=i[G]*s[_]+i[V]*s[V]+i[H]*s[Z]+i[N]*s[Q],e[H]=i[G]*s[q]+i[V]*s[H]+i[H]*s[U]+i[N]*s[$],e[N]=i[G]*s[O]+i[V]*s[N]+i[H]*s[z]+i[N]*s[K],e[j]=i[j]*s[D]+i[Z]*s[G]+i[U]*s[j]+i[z]*s[J],e[Z]=i[j]*s[_]+i[Z]*s[V]+i[U]*s[Z]+i[z]*s[Q],e[U]=i[j]*s[q]+i[Z]*s[H]+i[U]*s[U]+i[z]*s[$],e[z]=i[j]*s[O]+i[Z]*s[N]+i[U]*s[z]+i[z]*s[K],e[J]=i[J]*s[D]+i[Q]*s[G]+i[$]*s[j]+i[K]*s[J],e[Q]=i[J]*s[_]+i[Q]*s[V]+i[$]*s[Z]+i[K]*s[Q],e[$]=i[J]*s[q]+i[Q]*s[H]+i[$]*s[U]+i[K]*s[$],e[K]=i[J]*s[O]+i[Q]*s[N]+i[$]*s[z]+i[K]*s[K],this.set(this.temp)}multiplyLeft(t){let e=this.temp,i=this.values,s=t.values;return e[D]=s[D]*i[D]+s[_]*i[G]+s[q]*i[j]+s[O]*i[J],e[_]=s[D]*i[_]+s[_]*i[V]+s[q]*i[Z]+s[O]*i[Q],e[q]=s[D]*i[q]+s[_]*i[H]+s[q]*i[U]+s[O]*i[$],e[O]=s[D]*i[O]+s[_]*i[N]+s[q]*i[z]+s[O]*i[K],e[G]=s[G]*i[D]+s[V]*i[G]+s[H]*i[j]+s[N]*i[J],e[V]=s[G]*i[_]+s[V]*i[V]+s[H]*i[Z]+s[N]*i[Q],e[H]=s[G]*i[q]+s[V]*i[H]+s[H]*i[U]+s[N]*i[$],e[N]=s[G]*i[O]+s[V]*i[N]+s[H]*i[z]+s[N]*i[K],e[j]=s[j]*i[D]+s[Z]*i[G]+s[U]*i[j]+s[z]*i[J],e[Z]=s[j]*i[_]+s[Z]*i[V]+s[U]*i[Z]+s[z]*i[Q],e[U]=s[j]*i[q]+s[Z]*i[H]+s[U]*i[U]+s[z]*i[$],e[z]=s[j]*i[O]+s[Z]*i[N]+s[U]*i[z]+s[z]*i[K],e[J]=s[J]*i[D]+s[Q]*i[G]+s[$]*i[j]+s[K]*i[J],e[Q]=s[J]*i[_]+s[Q]*i[V]+s[$]*i[Z]+s[K]*i[Q],e[$]=s[J]*i[q]+s[Q]*i[H]+s[$]*i[U]+s[K]*i[$],e[K]=s[J]*i[O]+s[Q]*i[N]+s[$]*i[z]+s[K]*i[K],this.set(this.temp)}lookAt(t,e,i){let s=Et.xAxis,n=Et.yAxis,c=Et.zAxis;c.setFrom(e).normalize(),s.setFrom(e).normalize(),s.cross(i).normalize(),n.setFrom(s).cross(c).normalize(),this.identity();let l=this.values;return l[D]=s.x,l[_]=s.y,l[q]=s.z,l[G]=n.x,l[V]=n.y,l[H]=n.z,l[j]=-c.x,l[Z]=-c.y,l[U]=-c.z,Et.tmpMatrix.identity(),Et.tmpMatrix.values[O]=-t.x,Et.tmpMatrix.values[N]=-t.y,Et.tmpMatrix.values[z]=-t.z,this.multiply(Et.tmpMatrix),this}},Pt=Et;Pt.xAxis=new yt,Pt.yAxis=new yt,Pt.zAxis=new yt,Pt.tmpMatrix=new Et;var cs=class{constructor(t,e){this.position=new yt(0,0,0),this.direction=new yt(0,0,-1),this.up=new yt(0,1,0),this.near=0,this.far=100,this.zoom=1,this.viewportWidth=0,this.viewportHeight=0,this.projectionView=new Pt,this.inverseProjectionView=new Pt,this.projection=new Pt,this.view=new Pt,this.viewportWidth=t,this.viewportHeight=e,this.update()}update(){let t=this.projection,e=this.view,i=this.projectionView,s=this.inverseProjectionView,n=this.zoom,c=this.viewportWidth,l=this.viewportHeight;t.ortho(n*(-c/2),n*(c/2),n*(-l/2),n*(l/2),this.near,this.far),e.lookAt(this.position,this.direction,this.up),i.set(t.values),i.multiply(e),s.set(i.values).invert()}screenToWorld(t,e,i){let s=t.x,n=i-t.y-1;return t.x=2*s/e-1,t.y=2*n/i-1,t.z=2*t.z-1,t.project(this.inverseProjectionView),t}worldToScreen(t,e,i){return t.project(this.projectionView),t.x=e*(t.x+1)/2,t.y=i*(t.y+1)/2,t.z=(t.z+1)/2,t}setViewport(t,e){this.viewportWidth=t,this.viewportHeight=e}},Ii=class{constructor(t){this.mouseX=0,this.mouseY=0,this.buttonDown=!1,this.touch0=null,this.touch1=null,this.initialPinchDistance=0,this.listeners=new Array,this.eventListeners=[],this.element=t,this.setupCallbacks(t)}setupCallbacks(t){let e=l=>{if(l instanceof MouseEvent){let r=t.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.clientY-r.top,this.buttonDown=!0,this.listeners.map(o=>{o.down&&o.down(this.mouseX,this.mouseY)}),document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}},i=l=>{if(l instanceof MouseEvent){let r=t.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.clientY-r.top,this.listeners.map(o=>{this.buttonDown?o.dragged&&o.dragged(this.mouseX,this.mouseY):o.moved&&o.moved(this.mouseX,this.mouseY)})}},s=l=>{if(l instanceof MouseEvent){let r=t.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.clientY-r.top,this.buttonDown=!1,this.listeners.map(o=>{o.up&&o.up(this.mouseX,this.mouseY)}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}},n=l=>{l.preventDefault();let r=l.deltaY;l.deltaMode==WheelEvent.DOM_DELTA_LINE&&(r*=8),l.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(r*=24),this.listeners.map(o=>{o.wheel&&o.wheel(l.deltaY)})};t.addEventListener("mousedown",e,!0),t.addEventListener("mousemove",i,!0),t.addEventListener("mouseup",s,!0),t.addEventListener("wheel",n,!0),t.addEventListener("touchstart",l=>{if(!this.touch0||!this.touch1){var r=l.changedTouches;let o=r.item(0);if(!o)return;let a=t.getBoundingClientRect(),h=o.clientX-a.left,d=o.clientY-a.top,f=new ds(o.identifier,h,d);if(this.mouseX=h,this.mouseY=d,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(u=>{u.down&&u.down(f.x,f.y)});else if(!this.touch1){this.touch1=f;let u=this.touch1.x-this.touch0.x,m=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(u*u+m*m),this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,this.initialPinchDistance)})}}l.preventDefault()},!1),t.addEventListener("touchmove",l=>{if(this.touch0){var r=l.changedTouches;let h=t.getBoundingClientRect();for(var o=0;o<r.length;o++){var a=r[o];let d=a.clientX-h.left,f=a.clientY-h.top;this.touch0.identifier===a.identifier&&(this.touch0.x=this.mouseX=d,this.touch0.y=this.mouseY=f,this.listeners.map(u=>{u.dragged&&u.dragged(d,f)})),this.touch1&&this.touch1.identifier===a.identifier&&(this.touch1.x=this.mouseX=d,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let d=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,u=Math.sqrt(d*d+f*f);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,u)})}}l.preventDefault()},!1);let c=l=>{if(this.touch0){var r=l.changedTouches;let h=t.getBoundingClientRect();for(var o=0;o<r.length;o++){var a=r[o];let d=a.clientX-h.left,f=a.clientY-h.top;if(this.touch0.identifier===a.identifier)if(this.touch0=null,this.mouseX=d,this.mouseY=f,this.listeners.map(u=>{u.up&&u.up(d,f)}),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(u=>{u.down&&u.down(this.touch0.x,this.touch0.y)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}l.preventDefault()};t.addEventListener("touchend",c,!1),t.addEventListener("touchcancel",c)}addListener(t){this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},ds=class{constructor(t,e,i){this.identifier=t,this.x=e,this.y=i}},ur=class{constructor(t,e){this.canvas=t,this.camera=e;let i=0,s=0,n=0,c=0,l=0,r=0,o=0,a=0;new Ii(t).addListener({down:(h,d)=>{i=e.position.x,s=e.position.y,c=r=h,l=o=d,a=e.zoom},dragged:(h,d)=>{let f=h-c,u=d-l,m=e.screenToWorld(new yt(0,0),t.clientWidth,t.clientHeight),x=e.screenToWorld(new yt(f,u),t.clientWidth,t.clientHeight).sub(m);e.position.set(i-x.x,s-x.y,0),e.update(),r=h,o=d},wheel:h=>{let d=h/200*e.zoom,f=e.zoom+d;if(f>0){let u=0,m=0;if(h<0)u=r,m=o;else{let v=new yt(t.clientWidth/2+15,t.clientHeight/2),g=r-v.x,w=t.clientHeight-1-o-v.y;u=v.x-g,m=t.clientHeight-1-v.y+w}let x=e.screenToWorld(new yt(u,m),t.clientWidth,t.clientHeight);e.zoom=f,e.update();let p=e.screenToWorld(new yt(u,m),t.clientWidth,t.clientHeight);e.position.add(x.sub(p)),e.update()}},zoom:(h,d)=>{let f=h/d;e.zoom=a*f},up:(h,d)=>{r=h,o=d},moved:(h,d)=>{r=h,o=d}})}},ft=class{constructor(t,e,i){this.vertexShader=e,this.fragmentShader=i,this.vs=null,this.fs=null,this.program=null,this.tmp2x2=new Float32Array(2*2),this.tmp3x3=new Float32Array(3*3),this.tmp4x4=new Float32Array(4*4),this.vsSource=e,this.fsSource=i,this.context=t instanceof xt?t:new xt(t),this.context.addRestorable(this),this.compile()}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(e){throw this.dispose(),e}}compileShader(t,e){let i=this.context.gl,s=i.createShader(t);if(!s)throw new Error("Couldn't create shader.");if(i.shaderSource(s,e),i.compileShader(s),!i.getShaderParameter(s,i.COMPILE_STATUS)){let n="Couldn't compile shader: "+i.getShaderInfoLog(s);if(i.deleteShader(s),!i.isContextLost())throw new Error(n)}return s}compileProgram(t,e){let i=this.context.gl,s=i.createProgram();if(!s)throw new Error("Couldn't compile program.");if(i.attachShader(s,t),i.attachShader(s,e),i.linkProgram(s),!i.getProgramParameter(s,i.LINK_STATUS)){let n="Couldn't compile shader program: "+i.getProgramInfoLog(s);if(i.deleteProgram(s),!i.isContextLost())throw new Error(n)}return s}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,e){this.context.gl.uniform1i(this.getUniformLocation(t),e)}setUniformf(t,e){this.context.gl.uniform1f(this.getUniformLocation(t),e)}setUniform2f(t,e,i){this.context.gl.uniform2f(this.getUniformLocation(t),e,i)}setUniform3f(t,e,i,s){this.context.gl.uniform3f(this.getUniformLocation(t),e,i,s)}setUniform4f(t,e,i,s,n){this.context.gl.uniform4f(this.getUniformLocation(t),e,i,s,n)}setUniform2x2f(t,e){let i=this.context.gl;this.tmp2x2.set(e),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,e){let i=this.context.gl;this.tmp3x3.set(e),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,e){let i=this.context.gl;this.tmp4x4.set(e),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){let e=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=e.getUniformLocation(this.program,t);if(!i&&!e.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){let e=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=e.getAttribLocation(this.program,t);if(i==-1&&!e.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 e=`
|
|
3
|
-
attribute vec4 ${
|
|
4
|
-
attribute vec4 ${
|
|
5
|
-
attribute vec2 ${
|
|
6
|
-
uniform mat4 ${
|
|
1
|
+
"use strict";var spine=(()=>{var ut=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,Fs=Object.getOwnPropertyNames,Xs=Object.prototype.hasOwnProperty,Ls=(e,t,i)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ps=(e,t)=>{for(var i in t)ut(e,i,{get:t[i],enumerable:!0})},Bs=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Fs(t))!Xs.call(e,n)&&n!==i&&ut(e,n,{get:()=>t[n],enumerable:!(s=ks(t,n))||s.enumerable});return e},Os=e=>Bs(ut({},"__esModule",{value:!0}),e),B=(e,t,i)=>(Ls(e,typeof t!="symbol"?t+"":t,i),i),Oi={};Ps(Oi,{AlphaTimeline:()=>ei,Animation:()=>gt,AnimationState:()=>Zi,AnimationStateAdapter:()=>Zs,AnimationStateData:()=>Ks,AssetManager:()=>ms,AssetManagerBase:()=>ns,AtlasAttachmentLoader:()=>$s,Attachment:()=>Ut,AttachmentTimeline:()=>qe,BinaryInput:()=>fs,BlendMode:()=>Et,Bone:()=>xi,BoneData:()=>gi,BoundingBoxAttachment:()=>vt,CURRENT:()=>$i,CameraController:()=>Mr,ClippingAttachment:()=>ht,Color:()=>V,Color2Attribute:()=>ps,ColorAttribute:()=>Ft,ConstraintData:()=>Ct,CurveTimeline:()=>Ee,CurveTimeline1:()=>Ae,CurveTimeline2:()=>xt,DebugUtils:()=>Ns,DeformTimeline:()=>si,Downloader:()=>pi,DrawOrderTimeline:()=>Ge,Event:()=>wi,EventData:()=>bi,EventQueue:()=>Ji,EventTimeline:()=>ot,EventType:()=>ve,FIRST:()=>hi,FakeTexture:()=>Js,GLTexture:()=>ct,HOLD_FIRST:()=>bt,HOLD_MIX:()=>Qi,HOLD_SUBSEQUENT:()=>ci,IkConstraint:()=>as,IkConstraintData:()=>vi,IkConstraintTimeline:()=>ri,Input:()=>Ei,IntSet:()=>Vs,Interpolation:()=>Vi,LoadingScreen:()=>Fr,M00:()=>D,M01:()=>q,M02:()=>G,M03:()=>N,M10:()=>H,M11:()=>U,M12:()=>j,M13:()=>_,M20:()=>Z,M21:()=>K,M22:()=>W,M23:()=>z,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>pe,MathUtils:()=>L,Matrix4:()=>Pe,Mesh:()=>Ri,MeshAttachment:()=>De,MixBlend:()=>Wi,MixDirection:()=>zi,OrthoCamera:()=>gs,PathAttachment:()=>He,PathConstraint:()=>$e,PathConstraintData:()=>yi,PathConstraintMixTimeline:()=>oi,PathConstraintPositionTimeline:()=>ai,PathConstraintSpacingTimeline:()=>li,Physics:()=>ds,PhysicsConstraintDampingTimeline:()=>zs,PhysicsConstraintGravityTimeline:()=>Hs,PhysicsConstraintInertiaTimeline:()=>_s,PhysicsConstraintMassTimeline:()=>qs,PhysicsConstraintMixTimeline:()=>js,PhysicsConstraintResetTimeline:()=>ji,PhysicsConstraintStrengthTimeline:()=>Ws,PhysicsConstraintTimeline:()=>Oe,PhysicsConstraintWindTimeline:()=>Gs,PointAttachment:()=>mi,PolygonBatcher:()=>tt,Pool:()=>at,Position2Attribute:()=>kt,Position3Attribute:()=>Er,PositionMode:()=>St,Pow:()=>Di,PowOut:()=>Ds,RGB2Timeline:()=>ii,RGBA2Timeline:()=>ti,RGBATimeline:()=>Qt,RGBTimeline:()=>$t,RegionAttachment:()=>le,ResizeMode:()=>Bt,RotateMode:()=>It,RotateTimeline:()=>lt,SETUP:()=>di,SUBSEQUENT:()=>wt,ScaleTimeline:()=>Gt,ScaleXTimeline:()=>Ht,ScaleYTimeline:()=>jt,SceneRenderer:()=>As,SequenceTimeline:()=>Qe,Shader:()=>ge,ShapeRenderer:()=>ki,ShapeType:()=>be,ShearTimeline:()=>Zt,ShearXTimeline:()=>Kt,ShearYTimeline:()=>Jt,Skeleton:()=>cs,SkeletonBinary:()=>tr,SkeletonBounds:()=>us,SkeletonClipping:()=>Rt,SkeletonData:()=>Ai,SkeletonDebugRenderer:()=>Xt,SkeletonJson:()=>Tr,SkeletonRenderer:()=>Xi,Skin:()=>Mt,SkinEntry:()=>Ci,Slot:()=>ls,SlotData:()=>Si,SpacingMode:()=>Tt,SpineCanvas:()=>Pr,StringSet:()=>Dt,TexCoordAttribute:()=>Yi,Texture:()=>fi,TextureAtlas:()=>is,TextureAtlasPage:()=>ss,TextureAtlasRegion:()=>ui,TextureFilter:()=>yt,TextureRegion:()=>ts,TextureWrap:()=>es,TimeKeeper:()=>Nt,Timeline:()=>me,Touch:()=>xs,TrackEntry:()=>Ki,TransformConstraint:()=>os,TransformConstraintData:()=>Ti,TransformConstraintTimeline:()=>ni,TransformMode:()=>At,TranslateTimeline:()=>Wt,TranslateXTimeline:()=>zt,TranslateYTimeline:()=>qt,Triangulator:()=>ye,Utils:()=>P,Vector2:()=>ze,Vector3:()=>Ce,VertexAttachment:()=>Me,VertexAttribute:()=>et,VertexAttributeType:()=>je,WindowedMean:()=>Us});var Vs=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}},Dt=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 i=0,s=e.length;i<s;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},We=class{constructor(e=0,t=0,i=0,s=0){this.r=e,this.g=t,this.b=i,this.a=s}set(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new We().setFromString(e)}},V=We;B(V,"WHITE",new We(1,1,1,1)),B(V,"RED",new We(1,0,0,1)),B(V,"GREEN",new We(0,1,0,1)),B(V,"BLUE",new We(0,0,1,1)),B(V,"MAGENTA",new We(1,0,1,1));var Ie=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*Ie.degRad)}static sinDeg(e){return Math.sin(e*Ie.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*Ie.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return Ie.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){let s=Math.random(),n=t-e;return s<=(i-e)/n?e+Math.sqrt(s*n*(i-e)):t-Math.sqrt((1-s)*n*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},L=Ie;B(L,"PI",3.1415927),B(L,"PI2",Ie.PI*2),B(L,"invPI2",1/Ie.PI2),B(L,"radiansToDegrees",180/Ie.PI),B(L,"radDeg",Ie.radiansToDegrees),B(L,"degreesToRadians",Ie.PI/180),B(L,"degRad",Ie.degreesToRadians);var Vi=class{apply(e,t,i){return e+(t-e)*this.applyInternal(i)}},Di=class extends Vi{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}},Ds=class extends Di{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Je=class{static arrayCopy(e,t,i,s,n){for(let h=t,a=s;h<t+n;h++,a++)i[a]=e[h]}static arrayFill(e,t,i,s){for(let n=t;n<i;n++)e[n]=s}static setArraySize(e,t,i=0){let s=e.length;if(s==t)return e;if(e.length=t,s<t)for(let n=s;n<t;n++)e[n]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Je.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let s=0;s<e;s++)i[s]=t;return i}static newFloatArray(e){if(Je.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static newShortArray(e){if(Je.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static toFloatArray(e){return Je.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Je.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,i=!0){for(var s=0;s<e.length;s++)if(e[s]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},P=Je;B(P,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ns=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let i=e.bones[t];console.log(i.data.name+", "+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.worldX+", "+i.worldY)}}},at=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}},ze=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}},Nt=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)}},Us=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}},Ut=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Ni=class extends Ut{id=Ni.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,i,s,n,h){i=n+(i>>1)*h;let a=e.bone.skeleton,r=e.deform,o=this.vertices,l=this.bones;if(!l){r.length>0&&(o=r);let u=e.bone,m=u.worldX,x=u.worldY,w=u.a,y=u.b,p=u.c,g=u.d;for(let b=t,v=n;v<i;b+=2,v+=h){let C=o[b],A=o[b+1];s[v]=C*w+A*y+m,s[v+1]=C*p+A*g+x}return}let c=0,f=0;for(let u=0;u<t;u+=2){let m=l[c];c+=m+1,f+=m}let d=a.bones;if(r.length==0)for(let u=n,m=f*3;u<i;u+=h){let x=0,w=0,y=l[c++];for(y+=c;c<y;c++,m+=3){let p=d[l[c]],g=o[m],b=o[m+1],v=o[m+2];x+=(g*p.a+b*p.b+p.worldX)*v,w+=(g*p.c+b*p.d+p.worldY)*v}s[u]=x,s[u+1]=w}else{let u=r;for(let m=n,x=f*3,w=f<<1;m<i;m+=h){let y=0,p=0,g=l[c++];for(g+=c;c<g;c++,x+=3,w+=2){let b=d[l[c]],v=o[x]+u[w],C=o[x+1]+u[w+1],A=o[x+2];y+=(v*b.a+C*b.b+b.worldX)*A,p+=(v*b.c+C*b.d+b.worldY)*A}s[m]=y,s[m+1]=p}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),P.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=P.newFloatArray(this.vertices.length),P.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Me=Ni;B(Me,"nextID",0);var mt=class{id=mt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new mt(this.regions.length);return P.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let s=this.regions[i];t.region!=s&&(t.region=s,t.updateRegion())}getPath(e,t){let i=e,s=(this.start+t).toString();for(let n=this.digits-s.length;n>0;n--)i+="0";return i+=s,i}static nextID(){return mt._nextID++}},_t=mt;B(_t,"_nextID",0);var Ui=(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))(Ui||{}),_i=[0,1,2,3,4,5,6],gt=class{name;timelines=[];timelineIds=new Dt;duration;constructor(e,t,i){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=i}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,i,s,n,h,a,r){if(!e)throw new Error("skeleton cannot be null.");s&&this.duration!=0&&(i%=this.duration,t>0&&(t%=this.duration));let o=this.timelines;for(let l=0,c=o.length;l<c;l++)o[l].apply(e,t,i,n,h,a,r)}},Wi=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Wi||{}),zi=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(zi||{}),ne={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,physicsConstraintInertia:19,physicsConstraintStrength:20,physicsConstraintDamping:21,physicsConstraintMass:22,physicsConstraintWind:23,physicsConstraintGravity:24,physicsConstraintMix:25,physicsConstraintReset:26,sequence:27},me=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=P.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 i=e.length;for(let s=1;s<i;s++)if(e[s]>t)return s-1;return i-1}static search(e,t,i){let s=e.length;for(let n=i;n<s;n+=i)if(e[n]>t)return n-i;return s-i}},Ee=class extends me{curves;constructor(e,t,i){super(e,i),this.curves=P.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 i=P.newFloatArray(t);P.arrayCopy(this.curves,0,i,0,t),this.curves=i}}setBezier(e,t,i,s,n,h,a,r,o,l,c){let f=this.curves,d=this.getFrameCount()+e*18;i==0&&(f[t]=2+d);let u=(s-h*2+r)*.03,m=(n-a*2+o)*.03,x=((h-r)*3-s+l)*.006,w=((a-o)*3-n+c)*.006,y=u*2+x,p=m*2+w,g=(h-s)*.3+u+x*.16666667,b=(a-n)*.3+m+w*.16666667,v=s+g,C=n+b;for(let A=d+18;d<A;d+=2)f[d]=v,f[d+1]=C,g+=y,b+=p,y+=x,p+=w,v+=g,C+=b}getBezierValue(e,t,i,s){let n=this.curves;if(n[s]>e){let o=this.frames[t],l=this.frames[t+i];return l+(e-o)/(n[s]-o)*(n[s+1]-l)}let h=s+18;for(s+=2;s<h;s+=2)if(n[s]>=e){let o=n[s-2],l=n[s-1];return l+(e-o)/(n[s]-o)*(n[s+1]-l)}t+=this.getFrameEntries();let a=n[h-2],r=n[h-1];return r+(e-a)/(this.frames[t]-a)*(this.frames[t+i]-r)}},Ae=class extends Ee{constructor(e,t,i){super(e,t,[i])}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){let t=this.frames,i=t.length-2;for(let n=2;n<=i;n+=2)if(t[n]>e){i=n-2;break}let s=this.curves[i>>1];switch(s){case 0:let n=t[i],h=t[i+1];return h+(e-n)/(t[i+2]-n)*(t[i+2+1]-h);case 1:return t[i+1]}return this.getBezierValue(e,i,1,s-2)}getRelativeValue(e,t,i,s,n){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}let h=this.getCurveValue(e);switch(i){case 0:return n+h*t;case 1:case 2:h+=n-s}return s+h*t}getAbsoluteValue(e,t,i,s,n){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}let h=this.getCurveValue(e);return i==0?n+(h-n)*t:s+(h-s)*t}getAbsoluteValue2(e,t,i,s,n,h){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}return i==0?n+(h-n)*t:s+(h-s)*t}getScaleValue(e,t,i,s,n,h){const a=this.frames;if(e<a[0]){switch(i){case 0:return h;case 1:return n+(h-n)*t}return n}let r=this.getCurveValue(e)*h;if(t==1)return i==3?n+r-h:r;if(s==1)switch(i){case 0:return h+(Math.abs(r)*L.signum(h)-h)*t;case 1:case 2:return n+(Math.abs(r)*L.signum(n)-n)*t}else{let o=0;switch(i){case 0:return o=Math.abs(h)*L.signum(r),o+(r-o)*t;case 1:case 2:return o=Math.abs(n)*L.signum(r),o+(r-o)*t}}return n+(r-h)*t}},xt=class extends Ee{constructor(e,t,i,s){super(e,t,[i,s])}getFrameEntries(){return 3}setFrame(e,t,i,s){e*=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s}},lt=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.rotate+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(i,n,h,r.rotation,r.data.rotation))}},Wt=class extends xt{boneIndex=0;constructor(e,t,i){super(e,t,ne.x+"|"+i,ne.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let l=0,c=0,f=me.search(o,i,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+3]-u);l+=(o[f+3+1]-l)*m,c+=(o[f+3+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+18-2)}switch(h){case 0:r.x=r.data.x+l*n,r.y=r.data.y+c*n;break;case 1:case 2:r.x+=(r.data.x+l-r.x)*n,r.y+=(r.data.y+c-r.y)*n;break;case 3:r.x+=l*n,r.y+=c*n}}},zt=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.x+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(i,n,h,r.x,r.data.x))}},qt=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(i,n,h,r.y,r.data.y))}},Gt=class extends xt{boneIndex=0;constructor(e,t,i){super(e,t,ne.scaleX+"|"+i,ne.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let l,c,f=me.search(o,i,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+3]-u);l+=(o[f+3+1]-l)*m,c+=(o[f+3+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+18-2)}if(l*=r.data.scaleX,c*=r.data.scaleY,n==1)h==3?(r.scaleX+=l-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=l,r.scaleY=c);else{let u=0,m=0;if(a==1)switch(h){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(l)*L.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*L.signum(m)-m)*n;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(l)*L.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*L.signum(m)-m)*n;break;case 3:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}else switch(h){case 0:u=Math.abs(r.data.scaleX)*L.signum(l),m=Math.abs(r.data.scaleY)*L.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 1:case 2:u=Math.abs(r.scaleX)*L.signum(l),m=Math.abs(r.scaleY)*L.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 3:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}}}},Ht=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.scaleX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(i,n,h,a,r.scaleX,r.data.scaleX))}},jt=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(i,n,h,a,r.scaleX,r.data.scaleY))}},Zt=class extends xt{boneIndex=0;constructor(e,t,i){super(e,t,ne.shearX+"|"+i,ne.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let l=0,c=0,f=me.search(o,i,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+3]-u);l+=(o[f+3+1]-l)*m,c+=(o[f+3+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+18-2)}switch(h){case 0:r.shearX=r.data.shearX+l*n,r.shearY=r.data.shearY+c*n;break;case 1:case 2:r.shearX+=(r.data.shearX+l-r.shearX)*n,r.shearY+=(r.data.shearY+c-r.shearY)*n;break;case 3:r.shearX+=l*n,r.shearY+=c*n}}},Kt=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.shearX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(i,n,h,r.shearX,r.data.shearX))}},Jt=class extends Ae{boneIndex=0;constructor(e,t,i){super(e,t,ne.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(i,n,h,r.shearX,r.data.shearY))}},Qt=class extends Ee{slotIndex=0;constructor(e,t,i){super(e,t,[ne.rgb+"|"+i,ne.alpha+"|"+i]),this.slotIndex=i}getFrameEntries(){return 5}setFrame(e,t,i,s,n,h){e*=5,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(i<o[0]){let w=r.data.color;switch(h){case 0:l.setFromColor(w);return;case 1:l.add((w.r-l.r)*n,(w.g-l.g)*n,(w.b-l.b)*n,(w.a-l.a)*n)}return}let c=0,f=0,d=0,u=0,m=me.search(o,i,5),x=this.curves[m/5];switch(x){case 0:let w=o[m];c=o[m+1],f=o[m+2],d=o[m+3],u=o[m+4];let y=(i-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*y,f+=(o[m+5+2]-f)*y,d+=(o[m+5+3]-d)*y,u+=(o[m+5+4]-u)*y;break;case 1:c=o[m+1],f=o[m+2],d=o[m+3],u=o[m+4];break;default:c=this.getBezierValue(i,m,1,x-2),f=this.getBezierValue(i,m,2,x+18-2),d=this.getBezierValue(i,m,3,x+18*2-2),u=this.getBezierValue(i,m,4,x+18*3-2)}n==1?l.set(c,f,d,u):(h==0&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(f-l.g)*n,(d-l.b)*n,(u-l.a)*n))}},$t=class extends Ee{slotIndex=0;constructor(e,t,i){super(e,t,[ne.rgb+"|"+i]),this.slotIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){e<<=2,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(i<o[0]){let x=r.data.color;switch(h){case 0:l.r=x.r,l.g=x.g,l.b=x.b;return;case 1:l.r+=(x.r-l.r)*n,l.g+=(x.g-l.g)*n,l.b+=(x.b-l.b)*n}return}let c=0,f=0,d=0,u=me.search(o,i,4),m=this.curves[u>>2];switch(m){case 0:let x=o[u];c=o[u+1],f=o[u+2],d=o[u+3];let w=(i-x)/(o[u+4]-x);c+=(o[u+4+1]-c)*w,f+=(o[u+4+2]-f)*w,d+=(o[u+4+3]-d)*w;break;case 1:c=o[u+1],f=o[u+2],d=o[u+3];break;default:c=this.getBezierValue(i,u,1,m-2),f=this.getBezierValue(i,u,2,m+18-2),d=this.getBezierValue(i,u,3,m+18*2-2)}if(n==1)l.r=c,l.g=f,l.b=d;else{if(h==0){let x=r.data.color;l.r=x.r,l.g=x.g,l.b=x.b}l.r+=(c-l.r)*n,l.g+=(f-l.g)*n,l.b+=(d-l.b)*n}}},ei=class extends Ae{slotIndex=0;constructor(e,t,i){super(e,t,ne.alpha+"|"+i),this.slotIndex=i}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(i<this.frames[0]){let c=r.data.color;switch(h){case 0:o.a=c.a;return;case 1:o.a+=(c.a-o.a)*n}return}let l=this.getCurveValue(i);n==1?o.a=l:(h==0&&(o.a=r.data.color.a),o.a+=(l-o.a)*n)}},ti=class extends Ee{slotIndex=0;constructor(e,t,i){super(e,t,[ne.rgb+"|"+i,ne.alpha+"|"+i,ne.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 8}setFrame(e,t,i,s,n,h,a,r,o){e<<=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=a,this.frames[e+6]=r,this.frames[e+7]=o}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(i<o[0]){let b=r.data.color,v=r.data.darkColor;switch(h){case 0:l.setFromColor(b),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((b.r-l.r)*n,(b.g-l.g)*n,(b.b-l.b)*n,(b.a-l.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let f=0,d=0,u=0,m=0,x=0,w=0,y=0,p=me.search(o,i,8),g=this.curves[p>>3];switch(g){case 0:let b=o[p];f=o[p+1],d=o[p+2],u=o[p+3],m=o[p+4],x=o[p+5],w=o[p+6],y=o[p+7];let v=(i-b)/(o[p+8]-b);f+=(o[p+8+1]-f)*v,d+=(o[p+8+2]-d)*v,u+=(o[p+8+3]-u)*v,m+=(o[p+8+4]-m)*v,x+=(o[p+8+5]-x)*v,w+=(o[p+8+6]-w)*v,y+=(o[p+8+7]-y)*v;break;case 1:f=o[p+1],d=o[p+2],u=o[p+3],m=o[p+4],x=o[p+5],w=o[p+6],y=o[p+7];break;default:f=this.getBezierValue(i,p,1,g-2),d=this.getBezierValue(i,p,2,g+18-2),u=this.getBezierValue(i,p,3,g+18*2-2),m=this.getBezierValue(i,p,4,g+18*3-2),x=this.getBezierValue(i,p,5,g+18*4-2),w=this.getBezierValue(i,p,6,g+18*5-2),y=this.getBezierValue(i,p,7,g+18*6-2)}if(n==1)l.set(f,d,u,m),c.r=x,c.g=w,c.b=y;else{if(h==0){l.setFromColor(r.data.color);let b=r.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}l.add((f-l.r)*n,(d-l.g)*n,(u-l.b)*n,(m-l.a)*n),c.r+=(x-c.r)*n,c.g+=(w-c.g)*n,c.b+=(y-c.b)*n}}},ii=class extends Ee{slotIndex=0;constructor(e,t,i){super(e,t,[ne.rgb+"|"+i,ne.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,h,a,r){e*=7,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=a,this.frames[e+6]=r}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(i<o[0]){let b=r.data.color,v=r.data.darkColor;switch(h){case 0:l.r=b.r,l.g=b.g,l.b=b.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(b.r-l.r)*n,l.g+=(b.g-l.g)*n,l.b+=(b.b-l.b)*n,c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let f=0,d=0,u=0,m=0,x=0,w=0,y=0,p=me.search(o,i,7),g=this.curves[p/7];switch(g){case 0:let b=o[p];f=o[p+1],d=o[p+2],u=o[p+3],x=o[p+4],w=o[p+5],y=o[p+6];let v=(i-b)/(o[p+7]-b);f+=(o[p+7+1]-f)*v,d+=(o[p+7+2]-d)*v,u+=(o[p+7+3]-u)*v,x+=(o[p+7+4]-x)*v,w+=(o[p+7+5]-w)*v,y+=(o[p+7+6]-y)*v;break;case 1:f=o[p+1],d=o[p+2],u=o[p+3],x=o[p+4],w=o[p+5],y=o[p+6];break;default:f=this.getBezierValue(i,p,1,g-2),d=this.getBezierValue(i,p,2,g+18-2),u=this.getBezierValue(i,p,3,g+18*2-2),x=this.getBezierValue(i,p,4,g+18*3-2),w=this.getBezierValue(i,p,5,g+18*4-2),y=this.getBezierValue(i,p,6,g+18*5-2)}if(n==1)l.r=f,l.g=d,l.b=u,c.r=x,c.g=w,c.b=y;else{if(h==0){let b=r.data.color,v=r.data.darkColor;l.r=b.r,l.g=b.g,l.b=b.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(f-l.r)*n,l.g+=(d-l.g)*n,l.b+=(u-l.b)*n,c.r+=(x-c.r)*n,c.g+=(w-c.g)*n,c.b+=(y-c.b)*n}}},qe=class extends me{slotIndex=0;attachmentNames;constructor(e,t){super(e,[ne.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.attachmentNames[e]=i}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(r.bone.active){if(a==1){h==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(i<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[me.search1(this.frames,i)])}}setAttachment(e,t,i){t.setAttachment(i?e.getAttachment(this.slotIndex,i):null)}},si=class extends Ee{slotIndex=0;attachment;vertices;constructor(e,t,i,s){super(e,t,[ne.deform+"|"+i+"|"+s.id]),this.slotIndex=i,this.attachment=s,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.vertices[e]=i}setBezier(e,t,i,s,n,h,a,r,o,l,c){let f=this.curves,d=this.getFrameCount()+e*18;i==0&&(f[t]=2+d);let u=(s-h*2+r)*.03,m=o*.03-a*.06,x=((h-r)*3-s+l)*.006,w=(a-o+.33333333)*.018,y=u*2+x,p=m*2+w,g=(h-s)*.3+u+x*.16666667,b=a*.3+m+w*.16666667,v=s+g,C=b;for(let A=d+18;d<A;d+=2)f[d]=v,f[d+1]=C,g+=y,b+=p,y+=x,p+=w,v+=g,C+=b}getCurvePercent(e,t){let i=this.curves,s=i[t];switch(s){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(s-=2,i[s]>e){let r=this.frames[t];return i[s+1]*(e-r)/(i[s]-r)}let n=s+18;for(s+=2;s<n;s+=2)if(i[s]>=e){let r=i[s-2],o=i[s-1];return o+(e-r)/(i[s]-r)*(i[s+1]-o)}let h=i[n-2],a=i[n-1];return a+(1-a)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof Me)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(i<d[0]){switch(h){case 0:l.length=0;return;case 1:if(n==1){l.length=0;return}l.length=f;let p=o;if(p.bones){n=1-n;for(var u=0;u<f;u++)l[u]*=n}else{let g=p.vertices;for(var u=0;u<f;u++)l[u]+=(g[u]-l[u])*n}}return}if(l.length=f,i>=d[d.length-1]){let p=c[d.length-1];if(n==1)if(h==3){let g=o;if(g.bones)for(let b=0;b<f;b++)l[b]+=p[b];else{let b=g.vertices;for(let v=0;v<f;v++)l[v]+=p[v]-b[v]}}else P.arrayCopy(p,0,l,0,f);else switch(h){case 0:{let b=o;if(b.bones)for(let v=0;v<f;v++)l[v]=p[v]*n;else{let v=b.vertices;for(let C=0;C<f;C++){let A=v[C];l[C]=A+(p[C]-A)*n}}break}case 1:case 2:for(let b=0;b<f;b++)l[b]+=(p[b]-l[b])*n;break;case 3:let g=o;if(g.bones)for(let b=0;b<f;b++)l[b]+=p[b]*n;else{let b=g.vertices;for(let v=0;v<f;v++)l[v]+=(p[v]-b[v])*n}}return}let m=me.search1(d,i),x=this.getCurvePercent(i,m),w=c[m],y=c[m+1];if(n==1)if(h==3){let p=o;if(p.bones)for(let g=0;g<f;g++){let b=w[g];l[g]+=b+(y[g]-b)*x}else{let g=p.vertices;for(let b=0;b<f;b++){let v=w[b];l[b]+=v+(y[b]-v)*x-g[b]}}}else for(let p=0;p<f;p++){let g=w[p];l[p]=g+(y[p]-g)*x}else switch(h){case 0:{let g=o;if(g.bones)for(let b=0;b<f;b++){let v=w[b];l[b]=(v+(y[b]-v)*x)*n}else{let b=g.vertices;for(let v=0;v<f;v++){let C=w[v],A=b[v];l[v]=A+(C+(y[v]-C)*x-A)*n}}break}case 1:case 2:for(let g=0;g<f;g++){let b=w[g];l[g]+=(b+(y[g]-b)*x-l[g])*n}break;case 3:let p=o;if(p.bones)for(let g=0;g<f;g++){let b=w[g];l[g]+=(b+(y[g]-b)*x)*n}else{let g=p.vertices;for(let b=0;b<f;b++){let v=w[b];l[b]+=(v+(y[b]-v)*x-g[b])*n}}}}},qi=class extends me{events;constructor(e){super(e,qi.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,i,s,n,h,a){if(!s)return;let r=this.frames,o=this.frames.length;if(t>i)this.apply(e,t,Number.MAX_VALUE,s,n,h,a),t=-1;else if(t>=r[o-1])return;if(i<r[0])return;let l=0;if(t<r[0])l=0;else{l=me.search1(r,t)+1;let c=r[l];for(;l>0&&r[l-1]==c;)l--}for(;l<o&&i>=r[l];l++)s.push(this.events[l])}},ot=qi;B(ot,"propertyIds",[""+ne.event]);var Gi=class extends me{drawOrders;constructor(e){super(e,Gi.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.drawOrders[e]=i}apply(e,t,i,s,n,h,a){if(a==1){h==0&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(h==0||h==1)&&P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=me.search1(this.frames,i),o=this.drawOrders[r];if(!o)P.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let l=e.drawOrder,c=e.slots;for(let f=0,d=o.length;f<d;f++)l[f]=c[o[f]]}}},Ge=Gi;B(Ge,"propertyIds",[""+ne.drawOrder]);var ri=class extends Ee{constraintIndex=0;constructor(e,t,i){super(e,t,[ne.ikConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 6}setFrame(e,t,i,s,n,h,a){e*=6,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h?1:0,this.frames[e+5]=a?1:0}apply(e,t,i,s,n,h,a){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,c=0,f=me.search(o,i,6),d=this.curves[f/6];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+6]-u);l+=(o[f+6+1]-l)*m,c+=(o[f+6+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+18-2)}h==0?(r.mix=r.data.mix+(l-r.data.mix)*n,r.softness=r.data.softness+(c-r.data.softness)*n,a==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[f+3],r.compress=o[f+4]!=0,r.stretch=o[f+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==0&&(r.bendDirection=o[f+3],r.compress=o[f+4]!=0,r.stretch=o[f+5]!=0))}},ni=class extends Ee{constraintIndex=0;constructor(e,t,i){super(e,t,[ne.transformConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,h,a,r){let o=this.frames;e*=7,o[e]=t,o[e+1]=i,o[e+2]=s,o[e+3]=n,o[e+4]=h,o[e+5]=a,o[e+6]=r}apply(e,t,i,s,n,h,a){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){let y=r.data;switch(h){case 0:r.mixRotate=y.mixRotate,r.mixX=y.mixX,r.mixY=y.mixY,r.mixScaleX=y.mixScaleX,r.mixScaleY=y.mixScaleY,r.mixShearY=y.mixShearY;return;case 1:r.mixRotate+=(y.mixRotate-r.mixRotate)*n,r.mixX+=(y.mixX-r.mixX)*n,r.mixY+=(y.mixY-r.mixY)*n,r.mixScaleX+=(y.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(y.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(y.mixShearY-r.mixShearY)*n}return}let l,c,f,d,u,m,x=me.search(o,i,7),w=this.curves[x/7];switch(w){case 0:let y=o[x];l=o[x+1],c=o[x+2],f=o[x+3],d=o[x+4],u=o[x+5],m=o[x+6];let p=(i-y)/(o[x+7]-y);l+=(o[x+7+1]-l)*p,c+=(o[x+7+2]-c)*p,f+=(o[x+7+3]-f)*p,d+=(o[x+7+4]-d)*p,u+=(o[x+7+5]-u)*p,m+=(o[x+7+6]-m)*p;break;case 1:l=o[x+1],c=o[x+2],f=o[x+3],d=o[x+4],u=o[x+5],m=o[x+6];break;default:l=this.getBezierValue(i,x,1,w-2),c=this.getBezierValue(i,x,2,w+18-2),f=this.getBezierValue(i,x,3,w+18*2-2),d=this.getBezierValue(i,x,4,w+18*3-2),u=this.getBezierValue(i,x,5,w+18*4-2),m=this.getBezierValue(i,x,6,w+18*5-2)}if(h==0){let y=r.data;r.mixRotate=y.mixRotate+(l-y.mixRotate)*n,r.mixX=y.mixX+(c-y.mixX)*n,r.mixY=y.mixY+(f-y.mixY)*n,r.mixScaleX=y.mixScaleX+(d-y.mixScaleX)*n,r.mixScaleY=y.mixScaleY+(u-y.mixScaleY)*n,r.mixShearY=y.mixShearY+(m-y.mixShearY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(f-r.mixY)*n,r.mixScaleX+=(d-r.mixScaleX)*n,r.mixScaleY+=(u-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}},ai=class extends Ae{constraintIndex=0;constructor(e,t,i){super(e,t,ne.pathConstraintPosition+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(i,n,h,r.position,r.data.position))}},li=class extends Ae{constraintIndex=0;constructor(e,t,i){super(e,t,ne.pathConstraintSpacing+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(i,n,h,r.spacing,r.data.spacing))}},oi=class extends Ee{constraintIndex=0;constructor(e,t,i){super(e,t,[ne.pathConstraintMix+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){let h=this.frames;e<<=2,h[e]=t,h[e+1]=i,h[e+2]=s,h[e+3]=n}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let l,c,f,d=me.search(o,i,4),u=this.curves[d>>2];switch(u){case 0:let m=o[d];l=o[d+1],c=o[d+2],f=o[d+3];let x=(i-m)/(o[d+4]-m);l+=(o[d+4+1]-l)*x,c+=(o[d+4+2]-c)*x,f+=(o[d+4+3]-f)*x;break;case 1:l=o[d+1],c=o[d+2],f=o[d+3];break;default:l=this.getBezierValue(i,d,1,u-2),c=this.getBezierValue(i,d,2,u+18-2),f=this.getBezierValue(i,d,3,u+18*2-2)}if(h==0){let m=r.data;r.mixRotate=m.mixRotate+(l-m.mixRotate)*n,r.mixX=m.mixX+(c-m.mixX)*n,r.mixY=m.mixY+(f-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(f-r.mixY)*n}},Oe=class extends Ae{constraintIndex=0;constructor(e,t,i,s){super(e,t,s+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r;if(this.constraintIndex==-1){const o=i>=this.frames[0]?this.getCurveValue(i):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(i,n,h,this.get(l),this.setup(l),o))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(i,n,h,this.get(r),this.setup(r)))}},_s=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Ws=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},zs=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},qs=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.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}},Gs=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Hs=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},js=class extends Oe{constructor(e,t,i,s){super(e,t,i,ne.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Hi=class extends me{constraintIndex;constructor(e,t){super(e,Hi.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,i,s,n,h,a){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(t>i)this.apply(e,t,Number.MAX_VALUE,[],n,h,a),t=-1;else if(t>=o[o.length-1])return;if(!(i<o[0])&&(t<o[0]||i>=o[me.search1(o,t)+1]))if(r!=null)r.reset();else for(const l of e.physicsConstraints)l.active&&l.reset()}},ji=Hi;B(ji,"propertyIds",[ne.physicsConstraintReset.toString()]);var Ve=class extends me{slotIndex;attachment;constructor(e,t,i){super(e,[ne.sequence+"|"+t+"|"+i.sequence.id]),this.slotIndex=t,this.attachment=i}getFrameEntries(){return Ve.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,i,s,n){let h=this.frames;e*=Ve.ENTRIES,h[e]=t,h[e+Ve.MODE]=i|s<<4,h[e+Ve.DELAY]=n}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,l=this.attachment;if(o!=l&&(!(o instanceof Me)||o.timelineAttachment!=l))return;let c=this.frames;if(i<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let f=me.search(c,i,Ve.ENTRIES),d=c[f],u=c[f+Ve.MODE],m=c[f+Ve.DELAY];if(!this.attachment.sequence)return;let x=u>>4,w=this.attachment.sequence.regions.length,y=_i[u&15];if(y!=0)switch(x+=(i-d)/m+1e-5|0,y){case 1:x=Math.min(w-1,x);break;case 2:x%=w;break;case 3:{let p=(w<<1)-2;x=p==0?0:x%p,x>=w&&(x=p-x);break}case 4:x=Math.max(w-1-x,0);break;case 5:x=w-1-x%w;break;case 6:{let p=(w<<1)-2;x=p==0?0:(x+w-1)%p,x>=w&&(x=p-x)}}r.sequenceIndex=x}},Qe=Ve;B(Qe,"ENTRIES",3),B(Qe,"MODE",1),B(Qe,"DELAY",2);var pt=class{static emptyAnimation(){return pt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ji(this);propertyIDs=new Dt;animationsChanged=!1;trackEntryPool=new at(()=>new Ki);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=e*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let a=n.next;if(a){let r=n.trackLast-a.delay;if(r>=0){for(a.delay=0,a.trackTime+=n.timeScale==0?0:(r/n.timeScale+e)*a.timeScale,n.trackTime+=h,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){t[i]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,e)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let i=e.mixingFrom;if(!i)return!0;let s=this.updateMixingFrom(i,t);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),s):(i.trackTime+=t*i.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,i=this.tracks,s=!1;for(let f=0,d=i.length;f<d;f++){let u=i[f];if(!u||u.delay>0)continue;s=!0;let m=f==0?1:u.mixBlend,x=u.alpha;u.mixingFrom?x*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(x=0);let w=x>=u.alphaAttachmentThreshold,y=u.animationLast,p=u.getAnimationTime(),g=p,b=t;u.reverse&&(g=u.animation.duration-g,b=null);let v=u.animation.timelines,C=v.length;if(f==0&&x==1||m==3){f==0&&(w=!0);for(let A=0;A<C;A++){P.webkit602BugfixHelper(x,m);var n=v[A];n instanceof qe?this.applyAttachmentTimeline(n,e,g,m,w):n.apply(e,y,g,b,x,m,0)}}else{let A=u.timelineMode,T=u.shortestRotation,R=!T&&u.timelinesRotation.length!=C<<1;R&&(u.timelinesRotation.length=C<<1);for(let Y=0;Y<C;Y++){let F=v[Y],X=A[Y]==wt?m:0;!T&&F instanceof lt?this.applyRotateTimeline(F,e,g,x,X,u.timelinesRotation,Y<<1,R):F instanceof qe?this.applyAttachmentTimeline(F,e,g,m,w):(P.webkit602BugfixHelper(x,m),F.apply(e,y,g,b,x,X,0))}}this.queueEvents(u,p),t.length=0,u.nextAnimationLast=p,u.nextTrackLast=u.trackTime}for(var h=this.unkeyedState+di,a=e.slots,r=0,o=e.slots.length;r<o;r++){var l=a[r];if(l.attachmentState==h){var c=l.data.attachmentName;l.setAttachment(c?e.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(e,t,i){let s=e.mixingFrom;s.mixingFrom&&this.applyMixingFrom(s,t,i);let n=0;e.mixDuration==0?(n=1,i==1&&(i=0)):(n=e.mixTime/e.mixDuration,n>1&&(n=1),i!=1&&(i=s.mixBlend));let h=n<s.mixAttachmentThreshold,a=n<s.mixDrawOrderThreshold,r=s.animation.timelines,o=r.length,l=s.alpha*e.interruptAlpha,c=l*(1-n),f=s.animationLast,d=s.getAnimationTime(),u=d,m=null;if(s.reverse?u=s.animation.duration-u:n<s.eventThreshold&&(m=this.events),i==3)for(let x=0;x<o;x++)r[x].apply(t,f,u,m,c,i,1);else{let x=s.timelineMode,w=s.timelineHoldMix,y=s.shortestRotation,p=!y&&s.timelinesRotation.length!=o<<1;p&&(s.timelinesRotation.length=o<<1),s.totalAlpha=0;for(let g=0;g<o;g++){let b=r[g],v=1,C,A=0;switch(x[g]){case wt:if(!a&&b instanceof Ge)continue;C=i,A=c;break;case hi:C=0,A=c;break;case ci:C=i,A=l;break;case bt:C=0,A=l;break;default:C=0;let T=w[g];A=l*Math.max(0,1-T.mixTime/T.mixDuration);break}s.totalAlpha+=A,!y&&b instanceof lt?this.applyRotateTimeline(b,t,u,A,C,s.timelinesRotation,g<<1,p):b instanceof qe?this.applyAttachmentTimeline(b,t,u,C,h&&A>=s.alphaAttachmentThreshold):(P.webkit602BugfixHelper(A,i),a&&b instanceof Ge&&C==0&&(v=0),b.apply(t,f,u,m,A,C,v))}}return e.mixDuration>0&&this.queueEvents(s,d),this.events.length=0,s.nextAnimationLast=d,s.nextTrackLast=s.trackTime,n}applyAttachmentTimeline(e,t,i,s,n){var h=t.slots[e.slotIndex];h.bone.active&&(i<e.frames[0]?(s==0||s==1)&&this.setAttachment(t,h,h.data.attachmentName,n):this.setAttachment(t,h,e.attachmentNames[me.search1(e.frames,i)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+di))}setAttachment(e,t,i,s){t.setAttachment(i?e.getAttachment(t.data.index,i):null),s&&(t.attachmentState=this.unkeyedState+$i)}applyRotateTimeline(e,t,i,s,n,h,a,r){if(r&&(h[a]=0),s==1){e.apply(t,0,i,null,1,n,0);return}let o=t.bones[e.boneIndex];if(!o.active)return;let l=e.frames,c=0,f=0;if(i<l[0])switch(n){case 0:o.rotation=o.data.rotation;default:return;case 1:c=o.rotation,f=o.data.rotation}else c=n==0?o.data.rotation:o.rotation,f=o.data.rotation+e.getCurveValue(i);let d=0,u=f-c;if(u-=Math.ceil(u/360-.5)*360,u==0)d=h[a];else{let m=0,x=0;r?(m=0,x=u):(m=h[a],x=h[a+1]);let w=m-m%360;d=u+w;let y=u>=0,p=m>=0;Math.abs(x)<=90&&L.signum(x)!=L.signum(u)&&(Math.abs(m-w)>180?(d+=360*L.signum(m),p=y):w!=0?d-=360*L.signum(m):p=y),p!=y&&(d+=360*L.signum(m)),h[a]=d}h[a+1]=u,o.rotation=c+d*s}queueEvents(e,t){let i=e.animationStart,s=e.animationEnd,n=s-i,h=e.trackLast%n,a=this.events,r=0,o=a.length;for(;r<o;r++){let c=a[r];if(c.time<h)break;c.time>s||this.queue.event(e,c)}let l=!1;for(e.loop?l=n==0||h>e.trackTime%n:l=t>=s&&e.animationLast<s,l&&this.queue.complete(e);r<o;r++){let c=a[r];c.time<i||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){let s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,i){let s=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,s&&(i&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){let s=this.data.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,s,i)}setAnimationWith(e,t,i=!1){if(!t)throw new Error("animation cannot be null.");let s=!0,n=this.expandToIndex(e);n&&(n.nextTrackLast==-1?(this.tracks[e]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,s=!1):this.clearNext(n));let h=this.trackEntry(e,t,i,n);return this.setCurrent(e,h,s),this.queue.drain(),h}addAnimation(e,t,i=!1,s=0){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,n,i,s)}addAnimationWith(e,t,i=!1,s=0){if(!t)throw new Error("animation cannot be null.");let n=this.expandToIndex(e);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(e,t,i,n);return n?(n.next=h,h.previous=n,s<=0&&(s+=n.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=s,h}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,pt.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,pt.emptyAnimation(),!1,i);return i<=0&&(s.delay+=s.mixDuration-t),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++){let n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(P.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,s){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=e,n.animation=t,n.loop=i,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=t.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=s?this.data.getMix(s.animation,t):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,i=e.length;t<i;t++){let s=e[t];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do(!s.mixingTo||s.mixBlend!=3)&&this.computeHold(s),s=s.mixingTo;while(s)}}}computeHold(e){let t=e.mixingTo,i=e.animation.timelines,s=e.animation.timelines.length,n=e.timelineMode;n.length=s;let h=e.timelineHoldMix;h.length=0;let a=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<s;r++)n[r]=a.addAll(i[r].getPropertyIds())?bt:ci;return}e:for(let r=0;r<s;r++){let o=i[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=wt;else if(!t||o instanceof qe||o instanceof Ge||o instanceof ot||!t.animation.hasTimeline(l))n[r]=hi;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(e.mixDuration>0){n[r]=Qi,h[r]=c;continue e}break}n[r]=bt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Zi=pt;B(Zi,"_emptyAnimation",new gt("<empty>",[],0));var Ki=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,this.previous!=null&&this.delay<=0&&(this.delay+=this.previous.getTrackComplete()-e),this.delay=this.delay}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}},Ji=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ve.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ve.interrupt),this.objects.push(e)}end(e){this.objects.push(ve.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ve.dispose),this.objects.push(e)}complete(e){this.objects.push(ve.complete),this.objects.push(e)}event(e,t){this.objects.push(ve.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let i=0;i<e.length;i+=2){let s=e[i],n=e[i+1];switch(s){case ve.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<t.length;a++){let r=t[a];r.start&&r.start(n)}break;case ve.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<t.length;a++){let r=t[a];r.interrupt&&r.interrupt(n)}break;case ve.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<t.length;a++){let r=t[a];r.end&&r.end(n)}case ve.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<t.length;a++){let r=t[a];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ve.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<t.length;a++){let r=t[a];r.complete&&r.complete(n)}break;case ve.event:let h=e[i+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let a=0;a<t.length;a++){let r=t[a];r.event&&r.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ve=(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))(ve||{}),Zs=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},wt=0,hi=1,ci=2,bt=3,Qi=4,di=1,$i=2,Ks=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let s=this.skeletonData.findAnimation(e);if(!s)throw new Error("Animation not found: "+e);let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);this.setMixWith(s,n,i)}setMixWith(e,t,i){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let s=e.name+"."+t.name;this.animationToMixTime[s]=i}getMix(e,t){let i=e.name+"."+t.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}},vt=class extends Me{color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new vt(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},ht=class extends Me{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new ht(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},fi=class{_image;constructor(e){this._image=e}getImage(){return this._image}},yt=(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))(yt||{}),es=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(es||{}),ts=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Js=class extends fi{setFilters(e,t){}setWraps(e,t){}dispose(){}},is=class{pages=new Array;regions=new Array;constructor(e){let t=new Qs(e),i=new Array(4),s={};s.size=l=>{l.width=parseInt(i[1]),l.height=parseInt(i[2])},s.format=()=>{},s.filter=l=>{l.minFilter=P.enumValue(yt,i[1]),l.magFilter=P.enumValue(yt,i[2])},s.repeat=l=>{i[1].indexOf("x")!=-1&&(l.uWrap=10497),i[1].indexOf("y")!=-1&&(l.vWrap=10497)},s.pma=l=>{l.pma=i[1]=="true"};var n={};n.xy=l=>{l.x=parseInt(i[1]),l.y=parseInt(i[2])},n.size=l=>{l.width=parseInt(i[1]),l.height=parseInt(i[2])},n.bounds=l=>{l.x=parseInt(i[1]),l.y=parseInt(i[2]),l.width=parseInt(i[3]),l.height=parseInt(i[4])},n.offset=l=>{l.offsetX=parseInt(i[1]),l.offsetY=parseInt(i[2])},n.orig=l=>{l.originalWidth=parseInt(i[1]),l.originalHeight=parseInt(i[2])},n.offsets=l=>{l.offsetX=parseInt(i[1]),l.offsetY=parseInt(i[2]),l.originalWidth=parseInt(i[3]),l.originalHeight=parseInt(i[4])},n.rotate=l=>{let c=i[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},n.index=l=>{l.index=parseInt(i[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(i,h)==0);)h=t.readLine();let a=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)a=null,h=t.readLine();else if(a){let l=new ui(a,h);for(;;){let c=t.readEntry(i,h=t.readLine());if(c==0)break;let f=n[i[0]];if(f)f(l);else{r||(r=[]),o||(o=[]),r.push(i[0]);let d=[];for(let u=0;u<c;u++)d.push(parseInt(i[u+1]));o.push(d)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),r&&r.length>0&&o&&o.length>0&&(l.names=r,l.values=o,r=null,o=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new ss(h.trim());t.readEntry(i,h=t.readLine())!=0;){let l=s[i[0]];l&&l(a)}this.pages.push(a)}}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 i of this.pages)i.setTexture(e.get(t+i.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Qs=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 i=t.indexOf(":");if(i==-1)return 0;e[0]=t.substr(0,i).trim();for(let s=1,n=i+1;;s++){let h=t.indexOf(",",n);if(h==-1)return e[s]=t.substr(n).trim(),s;if(e[s]=t.substr(n,h-n).trim(),n=h+1,s==4)return 4}}},ss=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}},ui=class extends ts{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)}},De=class extends Me{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=P.newFloatArray(e.length));let t=this.uvs,i=this.uvs.length,s=this.region.u,n=this.region.v,h=0,a=0;if(this.region instanceof ui){let r=this.region,o=r.page,l=o.width,c=o.height;switch(r.degrees){case 90:s-=(r.originalHeight-r.offsetY-r.height)/l,n-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let f=0;f<i;f+=2)t[f]=s+e[f+1]*h,t[f+1]=n+(1-e[f])*a;return;case 180:s-=(r.originalWidth-r.offsetX-r.width)/l,n-=r.offsetY/c,h=r.originalWidth/l,a=r.originalHeight/c;for(let f=0;f<i;f+=2)t[f]=s+(1-e[f])*h,t[f+1]=n+(1-e[f+1])*a;return;case 270:s-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let f=0;f<i;f+=2)t[f]=s+(1-e[f+1])*h,t[f+1]=n+e[f]*a;return}s-=r.offsetX/l,n-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/l,a=r.originalHeight/c}else this.region?(h=this.region.u2-s,a=this.region.v2-n):(s=n=0,h=a=1);for(let r=0;r<i;r+=2)t[r]=s+e[r]*h,t[r+1]=n+e[r+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new De(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),P.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),P.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),P.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),P.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,i,s,n,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,i,s,n,h)}newLinkedMesh(){let e=new De(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},He=class extends Me{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new He(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),P.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},mi=class extends Me{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*L.degRad,i=Math.cos(t),s=Math.sin(t),n=i*e.a+s*e.b,h=i*e.c+s*e.d;return L.atan2Deg(h,n)}copy(){let e=new mi(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},rs=class extends Ut{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=P.newFloatArray(8);uvs=P.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,s=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*i,h=-this.height/2*this.scaleY+this.region.offsetY*s,a=n+this.region.width*i,r=h+this.region.height*s,o=this.rotation*L.degRad,l=Math.cos(o),c=Math.sin(o),f=this.x,d=this.y,u=n*l+f,m=n*c,x=h*l+d,w=h*c,y=a*l+f,p=a*c,g=r*l+d,b=r*c,v=this.offset;v[0]=u-w,v[1]=x+m,v[2]=u-b,v[3]=g+m,v[4]=y-b,v[5]=g+p,v[6]=y-w,v[7]=x+p,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,i,s){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,h=this.offset,a=n.worldX,r=n.worldY,o=n.a,l=n.b,c=n.c,f=n.d,d=0,u=0;d=h[0],u=h[1],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r,i+=s,d=h[2],u=h[3],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r,i+=s,d=h[4],u=h[5],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r,i+=s,d=h[6],u=h[7],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r}copy(){let e=new rs(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,P.arrayCopy(this.uvs,0,e.uvs,0,8),P.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},le=rs;B(le,"X1",0),B(le,"Y1",1),B(le,"C1R",2),B(le,"C1G",3),B(le,"C1B",4),B(le,"C1A",5),B(le,"U1",6),B(le,"V1",7),B(le,"X2",8),B(le,"Y2",9),B(le,"C2R",10),B(le,"C2G",11),B(le,"C2B",12),B(le,"C2A",13),B(le,"U2",14),B(le,"V2",15),B(le,"X3",16),B(le,"Y3",17),B(le,"C3R",18),B(le,"C3G",19),B(le,"C3B",20),B(le,"C3A",21),B(le,"U3",22),B(le,"V3",23),B(le,"X4",24),B(le,"Y4",25),B(le,"C4R",26),B(le,"C4G",27),B(le,"C4B",28),B(le,"C4A",29),B(le,"U4",30),B(le,"V4",31);var $s=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,i){let s=i.regions;for(let n=0,h=s.length;n<h;n++){let a=i.getPath(t,n),r=this.atlas.findRegion(a);if(r==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+e+")");s[n]=r}}newRegionAttachment(e,t,i,s){let n=new le(t,i);if(s!=null)this.loadSequence(t,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (region attachment: "+t+")");n.region=h}return n}newMeshAttachment(e,t,i,s){let n=new De(t,i);if(s!=null)this.loadSequence(t,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+t+")");n.region=h}return n}newBoundingBoxAttachment(e,t){return new vt(t)}newPathAttachment(e,t){return new He(t)}newPointAttachment(e,t){return new mi(t)}newClippingAttachment(e,t){return new ht(t)}},gi=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;transformMode=At.Normal;skinRequired=!1;color=new V;icon;visible=!1;constructor(e,t,i){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=i}},At=(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))(At||{}),xi=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;sorted=!1;active=!1;constructor(e,t,i){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=i,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,i,s,n,h,a){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=s,this.ascaleY=n,this.ashearX=h,this.ashearY=a;let r=this.parent;if(!r){let d=this.skeleton;const u=d.scaleX,m=d.scaleY,x=(i+h)*L.degRad,w=(i+90+a)*L.degRad;this.a=Math.cos(x)*s*u,this.b=Math.cos(w)*n*u,this.c=Math.sin(x)*s*m,this.d=Math.sin(w)*n*m,this.worldX=e*u+d.x,this.worldY=t*m+d.y;return}let o=r.a,l=r.b,c=r.c,f=r.d;switch(this.worldX=o*e+l*t+r.worldX,this.worldY=c*e+f*t+r.worldY,this.data.transformMode){case 0:{const d=(i+h)*L.degRad,u=(i+90+a)*L.degRad,m=Math.cos(d)*s,x=Math.cos(u)*n,w=Math.sin(d)*s,y=Math.sin(u)*n;this.a=o*m+l*w,this.b=o*x+l*y,this.c=c*m+f*w,this.d=c*x+f*y;return}case 1:{const d=(i+h)*L.degRad,u=(i+90+a)*L.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(u)*n,this.c=Math.sin(d)*s,this.d=Math.sin(u)*n;break}case 2:{let d=o*o+c*c,u=0;d>1e-4?(d=Math.abs(o*f-l*c)/d,o/=this.skeleton.scaleX,c/=this.skeleton.scaleY,l=c*d,f=o*d,u=Math.atan2(c,o)*L.radDeg):(o=0,c=0,u=90-Math.atan2(f,l)*L.radDeg);const m=(i+h-u)*L.degRad,x=(i+a-u+90)*L.degRad,w=Math.cos(m)*s,y=Math.cos(x)*n,p=Math.sin(m)*s,g=Math.sin(x)*n;this.a=o*w-l*p,this.b=o*y-l*g,this.c=c*w+f*p,this.d=c*y+f*g;break}case 3:case 4:{i*=L.degRad;const d=Math.cos(i),u=Math.sin(i);let m=(o*d+l*u)/this.skeleton.scaleX,x=(c*d+f*u)/this.skeleton.scaleY,w=Math.sqrt(m*m+x*x);w>1e-5&&(w=1/w),m*=w,x*=w,w=Math.sqrt(m*m+x*x),this.data.transformMode==3&&o*f-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),i=Math.PI/2+Math.atan2(x,m);const y=Math.cos(i)*w,p=Math.sin(i)*w;h*=L.degRad,a=(90+a)*L.degRad;const g=Math.cos(h)*s,b=Math.cos(a)*n,v=Math.sin(h)*s,C=Math.sin(a)*n;this.a=m*g+y*v,this.b=m*b+y*C,this.c=x*g+p*v,this.d=x*b+p*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY}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)*L.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*L.radDeg;return}let t=e.a,i=e.b,s=e.c,n=e.d,h=1/(t*n-i*s),a=n*h,r=i*h,o=s*h,l=t*h,c=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=c*a-f*r,this.ay=f*l-c*o;let d,u,m,x;if(this.data.transformMode==1)d=this.a,u=this.b,m=this.c,x=this.d;else{switch(this.data.transformMode){case 2:{let b=Math.abs(t*n-i*s)/(t*t+s*s),v=t/this.skeleton.scaleX;i=-(s/this.skeleton.scaleY)*b*this.skeleton.scaleX,n=v*b*this.skeleton.scaleY,h=1/(t*n-i*s),a=n*h,r=i*h;break}case 3:case 4:let w=L.cosDeg(this.rotation),y=L.sinDeg(this.rotation);t=(t*w+i*y)/this.skeleton.scaleX,s=(s*w+n*y)/this.skeleton.scaleY;let p=Math.sqrt(t*t+s*s);p>1e-5&&(p=1/p),t*=p,s*=p,p=Math.sqrt(t*t+s*s),this.data.transformMode==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let g=L.PI/2+Math.atan2(s,t);i=Math.cos(g)*p,n=Math.sin(g)*p,h=1/(t*n-i*s),a=n*h,r=i*h,o=s*h,l=t*h}d=a*this.a-r*this.c,u=a*this.b-r*this.d,m=l*this.c-o*this.a,x=l*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){let w=d*x-u*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(d*u+m*x,w)*L.radDeg,this.arotation=Math.atan2(m,d)*L.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+x*x),this.ashearY=0,this.arotation=90-Math.atan2(x,u)*L.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*L.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*L.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),i=e.x-this.worldX,s=e.y-this.worldY;return e.x=i*this.d*t-s*this.b*t,e.y=s*this.a*t-i*this.c*t,e}localToWorld(e){let t=e.x,i=e.y;return e.x=t*this.a+i*this.b+this.worldX,e.y=t*this.c+i*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=L.sinDeg(e),i=L.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*L.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=L.sinDeg(e),i=L.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*L.radDeg}rotateWorld(e){e*=L.degRad;const t=Math.sin(e),i=Math.cos(e),s=this.a,n=this.b;this.a=i*s-t*this.c,this.b=i*n-t*this.d,this.c=t*s+i*this.c,this.d=t*n+i*this.d}},Ct=class{constructor(e,t,i){this.name=e,this.order=t,this.skinRequired=i}},ns=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",i=new pi){this.textureLoader=e,this.pathPrefix=t,this.downloader=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,i){this.toLoad--,this.loaded++,this.assets[t]=i,e&&e(t,i)}error(e,t,i){this.toLoad--,this.loaded++,this.errors[t]=i,e&&e(t,i)}loadAll(){return new Promise((t,i)=>{let s=()=>{if(this.isLoadingComplete()){this.hasErrors()?i(this.errors):t(this);return}requestAnimationFrame(s)};requestAnimationFrame(s)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load binary ${e}: status ${s}, ${n}`)})}loadText(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadText(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load text ${e}: status ${s}, ${n}`)})}loadJson(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadJson(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load JSON ${e}: status ${s}, ${n}`)})}loadTexture(e,t=()=>{},i=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(i,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(i,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},i=()=>{},s){let n=e.lastIndexOf("/"),h=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,a=>{try{let r=new is(a),o=r.pages.length,l=!1;for(let c of r.pages)this.loadTexture(s?s[c.name]:h+c.name,(f,d)=>{l||(c.setTexture(d),--o==0&&this.success(t,e,r))},(f,d)=>{l||this.error(i,e,`Couldn't load texture atlas ${e} page image: ${f}`),l=!0})}catch(r){this.error(i,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(a,r)=>{this.error(i,e,`Couldn't load texture atlas ${e}: status ${a}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let i=this.errors[e];throw Error("Asset not found: "+e+(i?`
|
|
2
|
+
`+i:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},pi=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),i=t.length,s=new Uint8Array(i),n=0;n<i;n++)s[n]=t.charCodeAt(n);return s}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,i){if(this.start(e,t,i))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let s=new XMLHttpRequest;s.overrideMimeType("text/html"),s.open("GET",e,!0);let n=()=>{this.finish(e,s.status,s.responseText)};s.onload=n,s.onerror=n,s.send()}downloadJson(e,t,i){this.downloadText(e,s=>{t(JSON.parse(s))},i)}downloadBinary(e,t,i){if(this.start(e,t,i))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer";let n=()=>{this.finish(e,s.status,s.response)};s.onload=()=>{s.status==200||s.status==0?this.finish(e,200,new Uint8Array(s.response)):n()},s.onerror=n,s.send()}start(e,t,i){let s=this.callbacks[e];try{if(s)return!0;this.callbacks[e]=s=[]}finally{s.push(t,i)}}finish(e,t,i){let s=this.callbacks[e];delete this.callbacks[e];let n=t==200||t==0?[i]:[t,i];for(let h=n.length-1,a=s.length;h<a;h+=2)s[h].apply(null,n)}},wi=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}},bi=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},as=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.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let n=t.findBone(e.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[s].name}`);this.bones.push(n)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=i}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,i=this.bones;switch(i.length){case 1:this.apply1(i[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,i,s,n,h,a){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,l=r.b,c=r.c,f=r.d,d=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=t-e.worldX,m=i-e.worldY;break;case 2:let y=Math.abs(o*f-l*c)/Math.max(1e-4,o*o+c*c),p=o/e.skeleton.scaleX,g=c/e.skeleton.scaleY;l=-g*y*e.skeleton.scaleX,f=p*y*e.skeleton.scaleY,d+=Math.atan2(g,p)*L.radDeg;default:let b=t-r.worldX,v=i-r.worldY,C=o*f-l*c;Math.abs(C)<=1e-4?(u=0,m=0):(u=(b*f-v*l)/C-e.ax,m=(v*o-b*c)/C-e.ay)}d+=Math.atan2(m,u)*L.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let x=e.ascaleX,w=e.ascaleY;if(s||n){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=i-e.worldY}const y=e.data.length*x;if(y>1e-4){const p=u*u+m*m;if(s&&p<y*y||n&&p>y*y){const g=(Math.sqrt(p)/y-1)*a+1;x*=g,h&&(w*=g)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*a,x,w,e.ashearX,e.ashearY)}apply2(e,t,i,s,n,h,a,r,o){let l=e.ax,c=e.ay,f=e.ascaleX,d=e.ascaleY,u=f,m=d,x=t.ascaleX,w=0,y=0,p=0;f<0?(f=-f,w=180,p=-1):(w=0,p=1),d<0&&(d=-d,p=-p),x<0?(x=-x,y=180):y=0;let g=t.ax,b=0,v=0,C=0,A=e.a,T=e.b,R=e.c,Y=e.d,F=Math.abs(f-d)<=1e-4;!F||h?(b=0,v=A*g+e.worldX,C=R*g+e.worldY):(b=t.ay,v=A*g+T*b+e.worldX,C=R*g+Y*b+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,T=X.b,R=X.c,Y=X.d;let k=A*Y-T*R,M=v-X.worldX,I=C-X.worldY;k=Math.abs(k)<=1e-4?0:1/k;let O=(M*Y-I*T)*k-l,ie=(I*A-M*R)*k-c,te=Math.sqrt(O*O+ie*ie),he=t.data.length*x,re,de;if(te<1e-4){this.apply1(e,i,s,!1,h,!1,o),t.updateWorldTransformWith(g,b,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}M=i-X.worldX,I=s-X.worldY;let ae=(M*Y-I*T)*k-l,se=(I*A-M*R)*k-c,fe=ae*ae+se*se;if(r!=0){r*=f*(x+1)*.5;let xe=Math.sqrt(fe),Se=xe-te-he*f+r;if(Se>0){let Te=Math.min(1,Se/(r*2))-1;Te=(Se-r*(1-Te*Te))/xe,ae-=Te*ae,se-=Te*se,fe=ae*ae+se*se}}e:if(F){he*=f;let xe=(fe-te*te-he*he)/(2*te*he);xe<-1?(xe=-1,de=Math.PI*n):xe>1?(xe=1,de=0,h&&(A=(Math.sqrt(fe)/(te+he)-1)*o+1,u*=A,a&&(m*=A))):de=Math.acos(xe)*n,A=te+he*xe,T=he*Math.sin(de),re=Math.atan2(se*A-ae*T,ae*A+se*T)}else{A=f*he,T=d*he;let xe=A*A,Se=T*T,Te=Math.atan2(se,ae);R=Se*te*te+xe*fe-xe*Se;let _e=-2*Se*te,st=Se-xe;if(Y=_e*_e-4*st*R,Y>=0){let rt=Math.sqrt(Y);_e<0&&(rt=-rt),rt=-(_e+rt)*.5;let Rs=rt/st,Ys=R/rt,nt=Math.abs(Rs)<Math.abs(Ys)?Rs:Ys;if(nt*nt<=fe){I=Math.sqrt(fe-nt*nt)*n,re=Te-Math.atan2(I,nt),de=Math.atan2(I/d,(nt-te)/f);break e}}let ft=L.PI,Ot=te-A,Pi=Ot*Ot,Is=0,Ms=0,Vt=te+A,Bi=Vt*Vt,Es=0;R=-A*te/(xe-Se),R>=-1&&R<=1&&(R=Math.acos(R),M=A*Math.cos(R)+te,I=T*Math.sin(R),Y=M*M+I*I,Y<Pi&&(ft=R,Pi=Y,Ot=M,Is=I),Y>Bi&&(Ms=R,Bi=Y,Vt=M,Es=I)),fe<=(Pi+Bi)*.5?(re=Te-Math.atan2(Is*n,Ot),de=ft*n):(re=Te-Math.atan2(Es*n,Vt),de=Ms*n)}let we=Math.atan2(b,g)*p,Fe=e.arotation;re=(re-we)*L.radDeg+w-Fe,re>180?re-=360:re<-180&&(re+=360),e.updateWorldTransformWith(l,c,Fe+re*o,u,m,0,0),Fe=t.arotation,de=((de+we)*L.radDeg-t.ashearX)*p+y-Fe,de>180?de-=360:de<-180&&(de+=360),t.updateWorldTransformWith(g,b,Fe+de*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},vi=class extends Ct{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},yi=class extends Ct{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=St.Fixed;spacingMode=Tt.Fixed;rotateMode=It.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},St=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(St||{}),Tt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Tt||{}),It=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(It||{}),Ne=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,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 s=0,n=e.bones.length;s<n;s++){let h=t.findBone(e.bones[s].name);if(!h)throw new Error(`Couldn't find bone ${e.bones[s].name}.`);this.bones.push(h)}let i=t.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof He))return;let i=this.mixRotate,s=this.mixX,n=this.mixY;if(i==0&&s==0&&n==0)return;let h=this.data,a=h.rotateMode==0,r=h.rotateMode==2,o=this.bones,l=o.length,c=a?l:l+1,f=P.setArraySize(this.spaces,c),d=r?this.lengths=P.setArraySize(this.lengths,l):[],u=this.spacing;switch(h.spacingMode){case 2:if(r)for(let v=0,C=c-1;v<C;v++){let A=o[v],T=A.data.length,R=T*A.a,Y=T*A.c;d[v]=Math.sqrt(R*R+Y*Y)}P.arrayFill(f,1,c,u);break;case 3:let g=0;for(let v=0,C=c-1;v<C;){let A=o[v],T=A.data.length;if(T<Ne.epsilon)r&&(d[v]=0),f[++v]=u;else{let R=T*A.a,Y=T*A.c,F=Math.sqrt(R*R+Y*Y);r&&(d[v]=F),f[++v]=F,g+=F}}if(g>0){g=c/g*u;for(let v=1;v<c;v++)f[v]*=g}break;default:let b=h.spacingMode==0;for(let v=0,C=c-1;v<C;){let A=o[v],T=A.data.length;if(T<Ne.epsilon)r&&(d[v]=0),f[++v]=u;else{let R=T*A.a,Y=T*A.c,F=Math.sqrt(R*R+Y*Y);r&&(d[v]=F),f[++v]=(b?T+u:u)*F/T}}}let m=this.computeWorldPositions(t,c,a),x=m[0],w=m[1],y=h.offsetRotation,p=!1;if(y==0)p=h.rotateMode==1;else{p=!1;let g=this.target.bone;y*=g.a*g.d-g.b*g.c>0?L.degRad:-L.degRad}for(let g=0,b=3;g<l;g++,b+=3){let v=o[g];v.worldX+=(x-v.worldX)*s,v.worldY+=(w-v.worldY)*n;let C=m[b],A=m[b+1],T=C-x,R=A-w;if(r){let Y=d[g];if(Y!=0){let F=(Math.sqrt(T*T+R*R)/Y-1)*i+1;v.a*=F,v.c*=F}}if(x=C,w=A,i>0){let Y=v.a,F=v.b,X=v.c,k=v.d,M=0,I=0,O=0;if(a?M=m[b-1]:f[g+1]==0?M=m[b+2]:M=Math.atan2(R,T),M-=Math.atan2(X,Y),p){I=Math.cos(M),O=Math.sin(M);let ie=v.data.length;x+=(ie*(I*Y-O*X)-T)*i,w+=(ie*(O*Y+I*X)-R)*i}else M+=y;M>L.PI?M-=L.PI2:M<-L.PI&&(M+=L.PI2),M*=i,I=Math.cos(M),O=Math.sin(M),v.a=I*Y-O*X,v.b=I*F-O*k,v.c=O*Y+I*X,v.d=O*F+I*k}v.updateAppliedTransform()}}computeWorldPositions(e,t,i){let s=this.target,n=this.position,h=this.spaces,a=P.setArraySize(this.positions,t*3+2),r=this.world,o=e.closed,l=e.worldVerticesLength,c=l/6,f=Ne.NONE;if(!e.constantSpeed){let ie=e.lengths;c-=o?1:2;let te=ie[c];this.data.positionMode==1&&(n*=te);let he;switch(this.data.spacingMode){case 2:he=te;break;case 3:he=te/t;break;default:he=1}r=P.setArraySize(this.world,8);for(let re=0,de=0,ae=0;re<t;re++,de+=3){let se=h[re]*he;n+=se;let fe=n;if(o)fe%=te,fe<0&&(fe+=te),ae=0;else if(fe<0){f!=Ne.BEFORE&&(f=Ne.BEFORE,e.computeWorldVertices(s,2,4,r,0,2)),this.addBeforePosition(fe,r,0,a,de);continue}else if(fe>te){f!=Ne.AFTER&&(f=Ne.AFTER,e.computeWorldVertices(s,l-6,4,r,0,2)),this.addAfterPosition(fe-te,r,0,a,de);continue}for(;;ae++){let we=ie[ae];if(!(fe>we)){if(ae==0)fe/=we;else{let Fe=ie[ae-1];fe=(fe-Fe)/(we-Fe)}break}}ae!=f&&(f=ae,o&&ae==c?(e.computeWorldVertices(s,l-4,4,r,0,2),e.computeWorldVertices(s,0,4,r,4,2)):e.computeWorldVertices(s,ae*6+2,8,r,0,2)),this.addCurvePosition(fe,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],a,de,i||re>0&&se==0)}return a}o?(l+=2,r=P.setArraySize(this.world,l),e.computeWorldVertices(s,2,l-4,r,0,2),e.computeWorldVertices(s,0,2,r,l-4,2),r[l-2]=r[0],r[l-1]=r[1]):(c--,l-=4,r=P.setArraySize(this.world,l),e.computeWorldVertices(s,2,l,r,0,2));let d=P.setArraySize(this.curves,c),u=0,m=r[0],x=r[1],w=0,y=0,p=0,g=0,b=0,v=0,C=0,A=0,T=0,R=0,Y=0,F=0,X=0,k=0;for(let ie=0,te=2;ie<c;ie++,te+=6)w=r[te],y=r[te+1],p=r[te+2],g=r[te+3],b=r[te+4],v=r[te+5],C=(m-w*2+p)*.1875,A=(x-y*2+g)*.1875,T=((w-p)*3-m+b)*.09375,R=((y-g)*3-x+v)*.09375,Y=C*2+T,F=A*2+R,X=(w-m)*.75+C+T*.16666667,k=(y-x)*.75+A+R*.16666667,u+=Math.sqrt(X*X+k*k),X+=Y,k+=F,Y+=T,F+=R,u+=Math.sqrt(X*X+k*k),X+=Y,k+=F,u+=Math.sqrt(X*X+k*k),X+=Y+T,k+=F+R,u+=Math.sqrt(X*X+k*k),d[ie]=u,m=b,x=v;this.data.positionMode==1&&(n*=u);let M;switch(this.data.spacingMode){case 2:M=u;break;case 3:M=u/t;break;default:M=1}let I=this.segments,O=0;for(let ie=0,te=0,he=0,re=0;ie<t;ie++,te+=3){let de=h[ie]*M;n+=de;let ae=n;if(o)ae%=u,ae<0&&(ae+=u),he=0;else if(ae<0){this.addBeforePosition(ae,r,0,a,te);continue}else if(ae>u){this.addAfterPosition(ae-u,r,l-4,a,te);continue}for(;;he++){let se=d[he];if(!(ae>se)){if(he==0)ae/=se;else{let fe=d[he-1];ae=(ae-fe)/(se-fe)}break}}if(he!=f){f=he;let se=he*6;for(m=r[se],x=r[se+1],w=r[se+2],y=r[se+3],p=r[se+4],g=r[se+5],b=r[se+6],v=r[se+7],C=(m-w*2+p)*.03,A=(x-y*2+g)*.03,T=((w-p)*3-m+b)*.006,R=((y-g)*3-x+v)*.006,Y=C*2+T,F=A*2+R,X=(w-m)*.3+C+T*.16666667,k=(y-x)*.3+A+R*.16666667,O=Math.sqrt(X*X+k*k),I[0]=O,se=1;se<8;se++)X+=Y,k+=F,Y+=T,F+=R,O+=Math.sqrt(X*X+k*k),I[se]=O;X+=Y,k+=F,O+=Math.sqrt(X*X+k*k),I[8]=O,X+=Y+T,k+=F+R,O+=Math.sqrt(X*X+k*k),I[9]=O,re=0}for(ae*=O;;re++){let se=I[re];if(!(ae>se)){if(re==0)ae/=se;else{let fe=I[re-1];ae=re+(ae-fe)/(se-fe)}break}}this.addCurvePosition(ae*.1,m,x,w,y,p,g,b,v,a,te,i||ie>0&&de==0)}return a}addBeforePosition(e,t,i,s,n){let h=t[i],a=t[i+1],r=t[i+2]-h,o=t[i+3]-a,l=Math.atan2(o,r);s[n]=h+e*Math.cos(l),s[n+1]=a+e*Math.sin(l),s[n+2]=l}addAfterPosition(e,t,i,s,n){let h=t[i+2],a=t[i+3],r=h-t[i],o=a-t[i+1],l=Math.atan2(o,r);s[n]=h+e*Math.cos(l),s[n+1]=a+e*Math.sin(l),s[n+2]=l}addCurvePosition(e,t,i,s,n,h,a,r,o,l,c,f){if(e==0||isNaN(e)){l[c]=t,l[c+1]=i,l[c+2]=Math.atan2(n-i,s-t);return}let d=e*e,u=d*e,m=1-e,x=m*m,w=x*m,y=m*e,p=y*3,g=m*p,b=p*e,v=t*w+s*g+h*b+r*u,C=i*w+n*g+a*b+o*u;l[c]=v,l[c+1]=C,f&&(e<.001?l[c+2]=Math.atan2(n-i,s-t):l[c+2]=Math.atan2(C-(i*x+n*y*2+a*d),v-(t*x+s*y*2+h*d)))}},$e=Ne;B($e,"NONE",-1),B($e,"BEFORE",-2),B($e,"AFTER",-3),B($e,"epsilon",1e-5);var er=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 i=this.data.x>0,s=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,a=this.bone,r=a.data.length;switch(e){case 0:return;case 1:this.reset();case 2:this.remaining+=Math.max(this.skeleton.time-this.lastTime,0),this.lastTime=this.skeleton.time;const o=a.worldX,l=a.worldY;if(this._reset)this._reset=!1,this.ux=o,this.uy=l;else{let c=this.remaining,f=this.inertia,d=this.data.step;if(i||s){if(i&&(this.xOffset+=(this.ux-o)*f,this.ux=o),s&&(this.yOffset+=(this.uy-l)*f,this.uy=l),c>=d){const u=this.massInverse*d,m=this.strength,x=this.wind*100,w=this.gravity*-100,y=Math.pow(this.damping,60*d);do i&&(this.xVelocity+=(x-this.xOffset*m)*u,this.xOffset+=this.xVelocity*d,this.xVelocity*=y),s&&(this.yVelocity+=(w-this.yOffset*m)*u,this.yOffset+=this.yVelocity*d,this.yVelocity*=y),c-=d;while(c>=d)}i&&(a.worldX+=this.xOffset*t*this.data.x),s&&(a.worldY+=this.yOffset*t*this.data.y)}if(n||h){let u=Math.atan2(a.c,a.a),m=0,x=0,w=0;if(n){w=t*this.data.rotate;let y=this.cx-a.worldX,p=this.cy-a.worldY,g=Math.atan2(p+this.ty,y+this.tx)-u-this.rotateOffset*w;this.rotateOffset+=(g-Math.ceil(g*L.invPI2-.5)*L.PI2)*f,g=this.rotateOffset*w+u,m=Math.cos(g),x=Math.sin(g),h&&(g=r*a.getWorldScaleX(),g>0&&(this.scaleOffset+=(y*m+p*x)*f/g))}else{m=Math.cos(u),x=Math.sin(u);const y=r*a.getWorldScaleX();y>0&&(this.scaleOffset+=((this.cx-a.worldX)*m+(this.cy-a.worldY)*x)*f/y)}if(c=this.remaining,c>=d){const y=this.massInverse*d,p=this.strength,g=this.wind,b=this.gravity,v=Math.pow(this.damping,60*d);for(;;)if(c-=d,h&&(this.scaleVelocity+=(g*m-b*x-this.scaleOffset*p)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),n){if(this.rotateVelocity+=(-.01*r*(g*x+b*m)-this.rotateOffset*p)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,c<d)break;const C=this.rotateOffset*w+u;m=Math.cos(C),x=Math.sin(C)}else if(c<d)break}}this.remaining=c}this.cx=a.worldX,this.cy=a.worldY;break;case 3:i&&(a.worldX+=this.xOffset*t*this.data.x),s&&(a.worldY+=this.yOffset*t*this.data.y)}if(n){let o=this.rotateOffset*t,l=0,c=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=o*this.data.rotate,l=Math.sin(d),c=Math.cos(d),f=a.b,a.b=c*f-l*a.d,a.d=l*f+c*a.d),d+=o*this.data.shearX,l=Math.sin(d),c=Math.cos(d),f=a.a,a.a=c*f-l*a.c,a.c=l*f+c*a.c}else o*=this.data.rotate,l=Math.sin(o),c=Math.cos(o),f=a.a,a.a=c*f-l*a.c,a.c=l*f+c*a.c,f=a.b,a.b=c*f-l*a.d,a.d=l*f+c*a.d}if(h){const o=1+this.scaleOffset*t*this.data.scaleX;a.a*=o,a.c*=o}e!=3&&(this.tx=r*a.a,this.ty=r*a.c),a.updateAppliedTransform()}},ls=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 V,this.darkColor=e.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Me)||!(this.attachment instanceof Me)||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}},os=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new ze;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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let n=t.findBone(e.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[s].name}.`);this.bones.push(n)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=i}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,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=t!=0||i!=0,r=this.target,o=r.a,l=r.b,c=r.c,f=r.d,d=o*f-l*c>0?L.degRad:-L.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let w=0,y=x.length;w<y;w++){let p=x[w];if(e!=0){let g=p.a,b=p.b,v=p.c,C=p.d,A=Math.atan2(c,o)-Math.atan2(v,g)+u;A>L.PI?A-=L.PI2:A<-L.PI&&(A+=L.PI2),A*=e;let T=Math.cos(A),R=Math.sin(A);p.a=T*g-R*v,p.b=T*b-R*C,p.c=R*g+T*v,p.d=R*b+T*C}if(a){let g=this.temp;r.localToWorld(g.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(g.x-p.worldX)*t,p.worldY+=(g.y-p.worldY)*i}if(s!=0){let g=Math.sqrt(p.a*p.a+p.c*p.c);g!=0&&(g=(g+(Math.sqrt(o*o+c*c)-g+this.data.offsetScaleX)*s)/g),p.a*=g,p.c*=g}if(n!=0){let g=Math.sqrt(p.b*p.b+p.d*p.d);g!=0&&(g=(g+(Math.sqrt(l*l+f*f)-g+this.data.offsetScaleY)*n)/g),p.b*=g,p.d*=g}if(h>0){let g=p.b,b=p.d,v=Math.atan2(b,g),C=Math.atan2(f,l)-Math.atan2(c,o)-(v-Math.atan2(p.c,p.a));C>L.PI?C-=L.PI2:C<-L.PI&&(C+=L.PI2),C=v+(C+m)*h;let A=Math.sqrt(g*g+b*b);p.b=Math.cos(C)*A,p.d=Math.sin(C)*A}p.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=t!=0||i!=0,r=this.target,o=r.a,l=r.b,c=r.c,f=r.d,d=o*f-l*c>0?L.degRad:-L.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,x=this.bones;for(let w=0,y=x.length;w<y;w++){let p=x[w];if(e!=0){let g=p.a,b=p.b,v=p.c,C=p.d,A=Math.atan2(c,o)+u;A>L.PI?A-=L.PI2:A<-L.PI&&(A+=L.PI2),A*=e;let T=Math.cos(A),R=Math.sin(A);p.a=T*g-R*v,p.b=T*b-R*C,p.c=R*g+T*v,p.d=R*b+T*C}if(a){let g=this.temp;r.localToWorld(g.set(this.data.offsetX,this.data.offsetY)),p.worldX+=g.x*t,p.worldY+=g.y*i}if(s!=0){let g=(Math.sqrt(o*o+c*c)-1+this.data.offsetScaleX)*s+1;p.a*=g,p.c*=g}if(n!=0){let g=(Math.sqrt(l*l+f*f)-1+this.data.offsetScaleY)*n+1;p.b*=g,p.d*=g}if(h>0){let g=Math.atan2(f,l)-Math.atan2(c,o);g>L.PI?g-=L.PI2:g<-L.PI&&(g+=L.PI2);let b=p.b,v=p.d;g=Math.atan2(v,b)+(g-L.PI/2+m)*h;let C=Math.sqrt(b*b+v*v);p.b=Math.cos(g)*C,p.d=Math.sin(g)*C}p.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],f=c.arotation;if(e!=0){let y=a.arotation-f+this.data.offsetRotation;y-=Math.ceil(y/360-.5)*360,f+=y*e}let d=c.ax,u=c.ay;d+=(a.ax-d+this.data.offsetX)*t,u+=(a.ay-u+this.data.offsetY)*i;let m=c.ascaleX,x=c.ascaleY;s!=0&&m!=0&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*s)/m),n!=0&&x!=0&&(x=(x+(a.ascaleY-x+this.data.offsetScaleY)*n)/x);let w=c.ashearY;if(h!=0){let y=a.ashearY-w+this.data.offsetShearY;y-=Math.ceil(y/360-.5)*360,w+=y*h}c.updateWorldTransformWith(d,u,f,m,x,c.ashearX,w)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],f=c.arotation+(a.arotation+this.data.offsetRotation)*e,d=c.ax+(a.ax+this.data.offsetX)*t,u=c.ay+(a.ay+this.data.offsetY)*i,m=c.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*s+1),x=c.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),w=c.ashearY+(a.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,u,f,m,x,c.ashearX,w)}}},hs=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return hs.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let i=e.bones[t],s;if(!i.parent)s=new xi(i,this,null);else{let n=this.bones[i.parent.index];s=new xi(i,this,n),n.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let i=e.slots[t],s=this.bones[i.boneData.index],n=new ls(i,s);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let i=e.ikConstraints[t];this.ikConstraints.push(new as(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new os(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new $e(i,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let i=e.physicsConstraints[t];this.physicsConstraints.push(new er(i,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,d=t.length;f<d;f++){let u=t[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,u=this.skin.bones.length;d<u;d++){let m=this.bones[f[d].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let i=this.ikConstraints,s=this.transformConstraints,n=this.pathConstraints,h=this.physicsConstraints,a=i.length,r=s.length,o=n.length,l=this.physicsConstraints.length,c=a+r+o+l;e:for(let f=0;f<c;f++){for(let d=0;d<a;d++){let u=i[d];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let d=0;d<r;d++){let u=s[d];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let d=0;d<o;d++){let u=n[d];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let d=0;d<l;d++){const u=h[d];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let i=e.bones,s=i[0];if(this.sortBone(s),i.length==1)this._updateCache.push(e),this.sortReset(s.children);else{let n=i[i.length-1];this.sortBone(n),this._updateCache.push(e),this.sortReset(s.children),n.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,i=t.data.index,s=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,s),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,s);for(let r=0,o=this.data.skins.length;r<o;r++)this.sortPathConstraintAttachment(this.data.skins[r],i,s);let n=t.getAttachment();n instanceof He&&this.sortPathConstraintAttachmentWith(n,s);let h=e.bones,a=h.length;for(let r=0;r<a;r++)this.sortBone(h[r]);this._updateCache.push(e);for(let r=0;r<a;r++)this.sortReset(h[r].children);for(let r=0;r<a;r++)h[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&P.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,i=t.length;if(e.data.local)for(let s=0;s<i;s++){let n=t[s];this.sortBone(n.parent),this.sortBone(n)}else for(let s=0;s<i;s++)this.sortBone(t[s]);this._updateCache.push(e);for(let s=0;s<i;s++)this.sortReset(t[s].children);for(let s=0;s<i;s++)t[s].sorted=!0}sortPathConstraintAttachment(e,t,i){let s=e.attachments[t];if(s)for(let n in s)this.sortPathConstraintAttachmentWith(s[n],i)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof He))return;let i=e.bones;if(!i)this.sortBone(t);else{let s=this.bones;for(let n=0,h=i.length;n<h;){let a=i[n++];for(a+=n;n<a;)this.sortBone(s[i[n++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&!e.data.skinRequired||this.skin!=null&&P.contains(this.skin.constraints,e.data,!0),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,i=e.length;t<i;t++){let s=e[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(e){if(!e)throw new Error("physics is undefined");let t=this.bones;for(let s=0,n=t.length;s<n;s++){let h=t[s];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let i=this._updateCache;for(let s=0,n=i.length;s<n;s++)i[s].update(e)}updateWorldTransformWith(e,t){let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let s=t.a,n=t.b,h=t.c,a=t.d;i.worldX=s*this.x+n*this.y+t.worldX,i.worldY=h*this.x+a*this.y+t.worldY;const r=(i.rotation+i.shearX)*L.degRad,o=(i.rotation+90+i.shearY)*L.degRad,l=Math.cos(r)*i.scaleX,c=Math.cos(o)*i.scaleY,f=Math.sin(r)*i.scaleX,d=Math.sin(o)*i.scaleY;i.a=(s*l+n*f)*this.scaleX,i.b=(s*c+n*d)*this.scaleX,i.c=(h*l+a*f)*this.scaleY,i.d=(h*c+a*d)*this.scaleY;let u=this._updateCache;for(let m=0,x=u.length;m<x;m++){let w=u[m];w!=i&&w.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;P.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,i=e.length;t<i;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let i=0,s=t.length;i<s;i++){let n=t[i],h=n.data.attachmentName;if(h){let a=e.getAttachment(i,h);a&&n.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,t);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let s=0,n=i.length;s<n;s++){let h=i[s];if(h.data.name==e){let a=null;if(t&&(a=this.getAttachment(s,t),!a))throw new Error("Attachment not found: "+t+", for slot: "+e);h.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(){let e=new ze,t=new ze;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,i=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let s=this.drawOrder,n=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){let c=s[o];if(!c.bone.active)continue;let f=0,d=null,u=c.getAttachment();if(u instanceof le)f=8,d=P.setArraySize(i,f,0),u.computeWorldVertices(c,d,0,2);else if(u instanceof De){let m=u;f=m.worldVerticesLength,d=P.setArraySize(i,f,0),m.computeWorldVertices(c,0,f,d,0,2)}if(d)for(let m=0,x=d.length;m<x;m+=2){let w=d[m],y=d[m+1];n=Math.min(n,w),h=Math.min(h,y),a=Math.max(a,w),r=Math.max(r,y)}}e.set(n,h),t.set(a-n,r-h)}update(e){this.time+=e}},cs=hs;B(cs,"yDown",!1);var ds=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ds||{}),Ai=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;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 i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}},Ci=class{constructor(e=0,t,i){this.slotIndex=e,this.name=t,this.attachment=i}},Mt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,i){if(!i)throw new Error("attachment cannot be null.");let s=this.attachments;e>=s.length&&(s.length=e+1),s[e]||(s[e]={}),s[e][t]=i}addSkin(e){for(let s=0;s<e.bones.length;s++){let n=e.bones[s],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let t=e.getAttachments();for(let s=0;s<t.length;s++){var i=t[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){let n=e.bones[s],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let t=e.getAttachments();for(let s=0;s<t.length;s++){var i=t[s];i.attachment&&(i.attachment instanceof De?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(e,t){let i=this.attachments[e];return i?i[t]:null}removeAttachment(e,t){let i=this.attachments[e];i&&delete i[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let i=this.attachments[t];if(i)for(let s in i){let n=i[s];n&&e.push(new Ci(t,s,n))}}return e}getAttachmentsForSlot(e,t){let i=this.attachments[e];if(i)for(let s in i){let n=i[s];n&&t.push(new Ci(e,s,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let s=0;s<e.slots.length;s++){let n=e.slots[s],h=n.getAttachment();if(h&&i<t.attachments.length){let a=t.attachments[i];for(let r in a){let o=a[r];if(h==o){let l=this.getAttachment(i,r);l&&n.setAttachment(l);break}}}i++}}},Si=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Et.Normal;visible=!0;constructor(e,t,i){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=i}},Et=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Et||{}),Ti=class extends Ct{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)}},tr=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Ai;i.name="";let s=new fs(e),n=s.readInt32(),h=s.readInt32();i.hash=h==0&&n==0?null:h.toString(16)+n.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat();let a=s.readBoolean();a&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let r=0;r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("String in string table must not be null.");s.strings.push(c)}r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Bone name must not be null.");let f=l==0?null:i.bones[s.readInt(!0)],d=new gi(l,c,f);d.rotation=s.readFloat(),d.x=s.readFloat()*t,d.y=s.readFloat()*t,d.scaleX=s.readFloat(),d.scaleY=s.readFloat(),d.shearX=s.readFloat(),d.shearY=s.readFloat(),d.length=s.readFloat()*t,d.transformMode=s.readInt(!0),d.skinRequired=s.readBoolean(),a&&V.rgba8888ToColor(d.color,s.readInt32()),i.bones.push(d)}r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Slot name must not be null.");let f=i.bones[s.readInt(!0)],d=new Si(l,c,f);V.rgba8888ToColor(d.color,s.readInt32());let u=s.readInt32();u!=-1&&V.rgb888ToColor(d.darkColor=new V,u),d.attachmentName=s.readStringRef(),d.blendMode=s.readInt(!0),i.slots.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let f=s.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new vi(f);d.order=s.readInt(!0),d.skinRequired=s.readBoolean(),c=s.readInt(!0);for(let u=0;u<c;u++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.bones[s.readInt(!0)],d.mix=s.readFloat(),d.softness=s.readFloat()*t,d.bendDirection=s.readByte(),d.compress=s.readBoolean(),d.stretch=s.readBoolean(),d.uniform=s.readBoolean(),i.ikConstraints.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let f=s.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Ti(f);d.order=s.readInt(!0),d.skinRequired=s.readBoolean(),c=s.readInt(!0);for(let u=0;u<c;u++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.bones[s.readInt(!0)],d.local=s.readBoolean(),d.relative=s.readBoolean(),d.offsetRotation=s.readFloat(),d.offsetX=s.readFloat()*t,d.offsetY=s.readFloat()*t,d.offsetScaleX=s.readFloat(),d.offsetScaleY=s.readFloat(),d.offsetShearY=s.readFloat(),d.mixRotate=s.readFloat(),d.mixX=s.readFloat(),d.mixY=s.readFloat(),d.mixScaleX=s.readFloat(),d.mixScaleY=s.readFloat(),d.mixShearY=s.readFloat(),i.transformConstraints.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let f=s.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new yi(f);d.order=s.readInt(!0),d.skinRequired=s.readBoolean(),c=s.readInt(!0);for(let u=0;u<c;u++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.slots[s.readInt(!0)],d.positionMode=s.readInt(!0),d.spacingMode=s.readInt(!0),d.rotateMode=s.readInt(!0),d.offsetRotation=s.readFloat(),d.position=s.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=s.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=s.readFloat(),d.mixX=s.readFloat(),d.mixY=s.readFloat(),i.pathConstraints.push(d)}let o=this.readSkin(s,i,!0,a);o&&(i.defaultSkin=o,i.skins.push(o));{let l=i.skins.length;for(P.setArraySize(i.skins,r=l+s.readInt(!0));l<r;l++){let c=this.readSkin(s,i,!1,a);if(!c)throw new Error("readSkin() should not have returned null.");i.skins[l]=c}}r=this.linkedMeshes.length;for(let l=0;l<r;l++){let c=this.linkedMeshes[l],f=c.skin?i.findSkin(c.skin):i.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readStringRef();if(!c)throw new Error;let f=new bi(c);f.intValue=s.readInt(!1),f.floatValue=s.readFloat(),f.stringValue=s.readString(),f.audioPath=s.readString(),f.audioPath&&(f.volume=s.readFloat(),f.balance=s.readFloat()),i.events.push(f)}r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,c,i))}return i}readSkin(e,t,i,s){let n=null,h=0;if(i){if(h=e.readInt(!0),h==0)return null;n=new Mt("default")}else{let a=e.readStringRef();if(!a)throw new Error("Skin name must not be null.");n=new Mt(a),n.bones.length=e.readInt(!0);for(let r=0,o=n.bones.length;r<o;r++)n.bones[r]=t.bones[e.readInt(!0)];for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.pathConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let a=0;a<h;a++){let r=e.readInt(!0);for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,n,r,c,s);f&&n.setAttachment(r,c,f)}}return n}readAttachment(e,t,i,s,n,h){let a=this.scale,r=e.readStringRef();switch(r||(r=n),e.readByte()){case Ue.Region:{let o=e.readStringRef(),l=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=e.readFloat(),u=e.readFloat(),m=e.readFloat(),x=e.readFloat(),w=e.readInt32(),y=this.readSequence(e);o||(o=r);let p=this.attachmentLoader.newRegionAttachment(i,r,o,y);return p?(p.path=o,p.x=c*a,p.y=f*a,p.scaleX=d,p.scaleY=u,p.rotation=l,p.width=m*a,p.height=x*a,V.rgba8888ToColor(p.color,w),p.sequence=y,y==null&&p.updateRegion(),p):null}case Ue.BoundingBox:{let o=e.readInt(!0),l=this.readVertices(e,o),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(i,r);return f?(f.worldVerticesLength=o<<1,f.vertices=l.vertices,f.bones=l.bones,h&&V.rgba8888ToColor(f.color,c),f):null}case Ue.Mesh:{let o=e.readStringRef(),l=e.readInt32(),c=e.readInt(!0),f=this.readFloatArray(e,c<<1,1),d=this.readShortArray(e),u=this.readVertices(e,c),m=e.readInt(!0),x=this.readSequence(e),w=[],y=0,p=0;h&&(w=this.readShortArray(e),y=e.readFloat(),p=e.readFloat()),o||(o=r);let g=this.attachmentLoader.newMeshAttachment(i,r,o,x);return g?(g.path=o,V.rgba8888ToColor(g.color,l),g.bones=u.bones,g.vertices=u.vertices,g.worldVerticesLength=c<<1,g.triangles=d,g.regionUVs=f,x==null&&g.updateRegion(),g.hullLength=m<<1,g.sequence=x,h&&(g.edges=w,g.width=y*a,g.height=p*a),g):null}case Ue.LinkedMesh:{let o=e.readStringRef(),l=e.readInt32(),c=e.readStringRef(),f=e.readStringRef(),d=e.readBoolean(),u=this.readSequence(e),m=0,x=0;h&&(m=e.readFloat(),x=e.readFloat()),o||(o=r);let w=this.attachmentLoader.newMeshAttachment(i,r,o,u);return w?(w.path=o,V.rgba8888ToColor(w.color,l),w.sequence=u,h&&(w.width=m*a,w.height=x*a),this.linkedMeshes.push(new ir(w,c,s,f,d)),w):null}case Ue.Path:{let o=e.readBoolean(),l=e.readBoolean(),c=e.readInt(!0),f=this.readVertices(e,c),d=P.newArray(c/3,0);for(let x=0,w=d.length;x<w;x++)d[x]=e.readFloat()*a;let u=h?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,r);return m?(m.closed=o,m.constantSpeed=l,m.worldVerticesLength=c<<1,m.vertices=f.vertices,m.bones=f.bones,m.lengths=d,h&&V.rgba8888ToColor(m.color,u),m):null}case Ue.Point:{let o=e.readFloat(),l=e.readFloat(),c=e.readFloat(),f=h?e.readInt32():0,d=this.attachmentLoader.newPointAttachment(i,r);return d?(d.x=l*a,d.y=c*a,d.rotation=o,h&&V.rgba8888ToColor(d.color,f),d):null}case Ue.Clipping:{let o=e.readInt(!0),l=e.readInt(!0),c=this.readVertices(e,l),f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(i,r);return d?(d.endSlot=t.slots[o],d.worldVerticesLength=l<<1,d.vertices=c.vertices,d.bones=c.bones,h&&V.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new _t(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){let i=this.scale,s=t<<1,n=new sr;if(!e.readBoolean())return n.vertices=this.readFloatArray(e,s,i),n;let h=new Array,a=new Array;for(let r=0;r<t;r++){let o=e.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(e.readInt(!0)),h.push(e.readFloat()*i),h.push(e.readFloat()*i),h.push(e.readFloat())}return n.vertices=P.toFloatArray(h),n.bones=a,n}readFloatArray(e,t,i){let s=new Array(t);if(i==1)for(let n=0;n<t;n++)s[n]=e.readFloat();else for(let n=0;n<t;n++)s[n]=e.readFloat()*i;return s}readShortArray(e){let t=e.readInt(!0),i=new Array(t);for(let s=0;s<t;s++)i[s]=e.readShort();return i}readAnimation(e,t,i){e.readInt(!0);let s=new Array,n=this.scale,h=new V,a=new V;for(let c=0,f=e.readInt(!0);c<f;c++){let d=e.readInt(!0);for(let u=0,m=e.readInt(!0);u<m;u++){let x=e.readByte(),w=e.readInt(!0),y=w-1;switch(x){case mr:{let p=new qe(w,d);for(let g=0;g<w;g++)p.setFrame(g,e.readFloat(),e.readStringRef());s.push(p);break}case gr:{let p=e.readInt(!0),g=new Qt(w,p,d),b=e.readFloat(),v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let R=0,Y=0;g.setFrame(R,b,v,C,A,T),R!=y;R++){let F=e.readFloat(),X=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;switch(e.readByte()){case Re:g.setStepped(R);break;case Ye:oe(e,g,Y++,R,0,b,F,v,X,1),oe(e,g,Y++,R,1,b,F,C,k,1),oe(e,g,Y++,R,2,b,F,A,M,1),oe(e,g,Y++,R,3,b,F,T,I,1)}b=F,v=X,C=k,A=M,T=I}s.push(g);break}case xr:{let p=e.readInt(!0),g=new $t(w,p,d),b=e.readFloat(),v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let T=0,R=0;g.setFrame(T,b,v,C,A),T!=y;T++){let Y=e.readFloat(),F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case Re:g.setStepped(T);break;case Ye:oe(e,g,R++,T,0,b,Y,v,F,1),oe(e,g,R++,T,1,b,Y,C,X,1),oe(e,g,R++,T,2,b,Y,A,k,1)}b=Y,v=F,C=X,A=k}s.push(g);break}case pr:{let p=e.readInt(!0),g=new ti(w,p,d),b=e.readFloat(),v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let X=0,k=0;g.setFrame(X,b,v,C,A,T,R,Y,F),X!=y;X++){let M=e.readFloat(),I=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,ie=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,he=e.readUnsignedByte()/255,re=e.readUnsignedByte()/255,de=e.readUnsignedByte()/255;switch(e.readByte()){case Re:g.setStepped(X);break;case Ye:oe(e,g,k++,X,0,b,M,v,I,1),oe(e,g,k++,X,1,b,M,C,O,1),oe(e,g,k++,X,2,b,M,A,ie,1),oe(e,g,k++,X,3,b,M,T,te,1),oe(e,g,k++,X,4,b,M,R,he,1),oe(e,g,k++,X,5,b,M,Y,re,1),oe(e,g,k++,X,6,b,M,F,de,1)}b=M,v=I,C=O,A=ie,T=te,R=he,Y=re,F=de}s.push(g);break}case wr:{let p=e.readInt(!0),g=new ii(w,p,d),b=e.readFloat(),v=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255;for(let F=0,X=0;g.setFrame(F,b,v,C,A,T,R,Y),F!=y;F++){let k=e.readFloat(),M=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,ie=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,he=e.readUnsignedByte()/255;switch(e.readByte()){case Re:g.setStepped(F);break;case Ye:oe(e,g,X++,F,0,b,k,v,M,1),oe(e,g,X++,F,1,b,k,C,I,1),oe(e,g,X++,F,2,b,k,A,O,1),oe(e,g,X++,F,3,b,k,T,ie,1),oe(e,g,X++,F,4,b,k,R,te,1),oe(e,g,X++,F,5,b,k,Y,he,1)}b=k,v=M,C=I,A=O,T=ie,R=te,Y=he}s.push(g);break}case br:{let p=new ei(w,e.readInt(!0),d),g=e.readFloat(),b=e.readUnsignedByte()/255;for(let v=0,C=0;p.setFrame(v,g,b),v!=y;v++){let A=e.readFloat(),T=e.readUnsignedByte()/255;switch(e.readByte()){case Re:p.setStepped(v);break;case Ye:oe(e,p,C++,v,0,g,A,b,T,1)}g=A,b=T}s.push(p)}}}}for(let c=0,f=e.readInt(!0);c<f;c++){let d=e.readInt(!0);for(let u=0,m=e.readInt(!0);u<m;u++){let x=e.readByte(),w=e.readInt(!0),y=e.readInt(!0);switch(x){case rr:s.push(Le(e,new lt(w,y,d),1));break;case nr:s.push(Ii(e,new Wt(w,y,d),n));break;case ar:s.push(Le(e,new zt(w,y,d),n));break;case lr:s.push(Le(e,new qt(w,y,d),n));break;case or:s.push(Ii(e,new Gt(w,y,d),1));break;case hr:s.push(Le(e,new Ht(w,y,d),1));break;case cr:s.push(Le(e,new jt(w,y,d),1));break;case dr:s.push(Ii(e,new Zt(w,y,d),1));break;case fr:s.push(Le(e,new Kt(w,y,d),1));break;case ur:s.push(Le(e,new Jt(w,y,d),1))}}}for(let c=0,f=e.readInt(!0);c<f;c++){let d=e.readInt(!0),u=e.readInt(!0),m=u-1,x=new ri(u,e.readInt(!0),d),w=e.readFloat(),y=e.readFloat(),p=e.readFloat()*n;for(let g=0,b=0;x.setFrame(g,w,y,p,e.readByte(),e.readBoolean(),e.readBoolean()),g!=m;g++){let v=e.readFloat(),C=e.readFloat(),A=e.readFloat()*n;switch(e.readByte()){case Re:x.setStepped(g);break;case Ye:oe(e,x,b++,g,0,w,v,y,C,1),oe(e,x,b++,g,1,w,v,p,A,n)}w=v,y=C,p=A}s.push(x)}for(let c=0,f=e.readInt(!0);c<f;c++){let d=e.readInt(!0),u=e.readInt(!0),m=u-1,x=new ni(u,e.readInt(!0),d),w=e.readFloat(),y=e.readFloat(),p=e.readFloat(),g=e.readFloat(),b=e.readFloat(),v=e.readFloat(),C=e.readFloat();for(let A=0,T=0;x.setFrame(A,w,y,p,g,b,v,C),A!=m;A++){let R=e.readFloat(),Y=e.readFloat(),F=e.readFloat(),X=e.readFloat(),k=e.readFloat(),M=e.readFloat(),I=e.readFloat();switch(e.readByte()){case Re:x.setStepped(A);break;case Ye:oe(e,x,T++,A,0,w,R,y,Y,1),oe(e,x,T++,A,1,w,R,p,F,1),oe(e,x,T++,A,2,w,R,g,X,1),oe(e,x,T++,A,3,w,R,b,k,1),oe(e,x,T++,A,4,w,R,v,M,1),oe(e,x,T++,A,5,w,R,C,I,1)}w=R,y=Y,p=F,g=X,b=k,v=M,C=I}s.push(x)}for(let c=0,f=e.readInt(!0);c<f;c++){let d=e.readInt(!0),u=i.pathConstraints[d];for(let m=0,x=e.readInt(!0);m<x;m++)switch(e.readByte()){case Ar:s.push(Le(e,new ai(e.readInt(!0),e.readInt(!0),d),u.positionMode==0?n:1));break;case Cr:s.push(Le(e,new li(e.readInt(!0),e.readInt(!0),d),u.spacingMode==0||u.spacingMode==1?n:1));break;case Sr:let w=new oi(e.readInt(!0),e.readInt(!0),d),y=e.readFloat(),p=e.readFloat(),g=e.readFloat(),b=e.readFloat();for(let v=0,C=0,A=w.getFrameCount()-1;w.setFrame(v,y,p,g,b),v!=A;v++){let T=e.readFloat(),R=e.readFloat(),Y=e.readFloat(),F=e.readFloat();switch(e.readByte()){case Re:w.setStepped(v);break;case Ye:oe(e,w,C++,v,0,y,T,p,R,1),oe(e,w,C++,v,1,y,T,g,Y,1),oe(e,w,C++,v,2,y,T,b,F,1)}y=T,p=R,g=Y,b=F}s.push(w)}}for(let c=0,f=e.readInt(!0);c<f;c++){let d=i.skins[e.readInt(!0)];for(let u=0,m=e.readInt(!0);u<m;u++){let x=e.readInt(!0);for(let w=0,y=e.readInt(!0);w<y;w++){let p=e.readStringRef();if(!p)throw new Error("attachmentName must not be null.");let g=d.getAttachment(x,p),b=e.readByte(),v=e.readInt(!0),C=v-1;switch(b){case vr:{let A=g,T=A.bones,R=A.vertices,Y=T?R.length/3*2:R.length,F=e.readInt(!0),X=new si(v,F,x,A),k=e.readFloat();for(let M=0,I=0;;M++){let O,ie=e.readInt(!0);if(ie==0)O=T?P.newFloatArray(Y):R;else{O=P.newFloatArray(Y);let he=e.readInt(!0);if(ie+=he,n==1)for(let re=he;re<ie;re++)O[re]=e.readFloat();else for(let re=he;re<ie;re++)O[re]=e.readFloat()*n;if(!T)for(let re=0,de=O.length;re<de;re++)O[re]+=R[re]}if(X.setFrame(M,k,O),M==C)break;let te=e.readFloat();switch(e.readByte()){case Re:X.setStepped(M);break;case Ye:oe(e,X,I++,M,0,k,te,0,1,1)}k=te}s.push(X);break}case yr:{let A=new Qe(v,x,g);for(let T=0;T<v;T++){let R=e.readFloat(),Y=e.readInt32();A.setFrame(T,R,_i[Y&15],Y>>4,e.readFloat())}s.push(A);break}}}}}let r=e.readInt(!0);if(r>0){let c=new Ge(r),f=i.slots.length;for(let d=0;d<r;d++){let u=e.readFloat(),m=e.readInt(!0),x=P.newArray(f,0);for(let g=f-1;g>=0;g--)x[g]=-1;let w=P.newArray(f-m,0),y=0,p=0;for(let g=0;g<m;g++){let b=e.readInt(!0);for(;y!=b;)w[p++]=y++;x[y+e.readInt(!0)]=y++}for(;y<f;)w[p++]=y++;for(let g=f-1;g>=0;g--)x[g]==-1&&(x[g]=w[--p]);c.setFrame(d,u,x)}s.push(c)}let o=e.readInt(!0);if(o>0){let c=new ot(o);for(let f=0;f<o;f++){let d=e.readFloat(),u=i.events[e.readInt(!0)],m=new wi(d,u);m.intValue=e.readInt(!1),m.floatValue=e.readFloat(),m.stringValue=e.readBoolean()?e.readString():u.stringValue,m.data.audioPath&&(m.volume=e.readFloat(),m.balance=e.readFloat()),c.setFrame(f,m)}s.push(c)}let l=0;for(let c=0,f=s.length;c<f;c++)l=Math.max(l,s[c].getDuration());return new gt(t,s,l)}},fs=class{constructor(e,t=new Array,i=0,s=new DataView(e.buffer)){this.strings=t,this.index=i,this.buffer=s}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(),i=t&127;return t&128&&(t=this.readByte(),i|=(t&127)<<7,t&128&&(t=this.readByte(),i|=(t&127)<<14,t&128&&(t=this.readByte(),i|=(t&127)<<21,t&128&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>1^-(i&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="",i=0;for(let s=0;s<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},ir=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,i,s,n){this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}},sr=class{constructor(e=null,t=null){this.bones=e,this.vertices=t}},Ue=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(Ue||{});function Le(e,t,i){let s=e.readFloat(),n=e.readFloat()*i;for(let h=0,a=0,r=t.getFrameCount()-1;t.setFrame(h,s,n),h!=r;h++){let o=e.readFloat(),l=e.readFloat()*i;switch(e.readByte()){case Re:t.setStepped(h);break;case Ye:oe(e,t,a++,h,0,s,o,n,l,i)}s=o,n=l}return t}function Ii(e,t,i){let s=e.readFloat(),n=e.readFloat()*i,h=e.readFloat()*i;for(let a=0,r=0,o=t.getFrameCount()-1;t.setFrame(a,s,n,h),a!=o;a++){let l=e.readFloat(),c=e.readFloat()*i,f=e.readFloat()*i;switch(e.readByte()){case Re:t.setStepped(a);break;case Ye:oe(e,t,r++,a,0,s,l,n,c,i),oe(e,t,r++,a,1,s,l,h,f,i)}s=l,n=c,h=f}return t}function oe(e,t,i,s,n,h,a,r,o,l){t.setBezier(i,s,n,h,r,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,a,o)}var rr=0,nr=1,ar=2,lr=3,or=4,hr=5,cr=6,dr=7,fr=8,ur=9,mr=0,gr=1,xr=2,pr=3,wr=4,br=5,vr=0,yr=1,Ar=0,Cr=1,Sr=2,Re=1,Ye=2,us=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new at(()=>P.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,n=this.polygonPool,h=e.slots,a=h.length;i.length=0,n.freeAll(s),s.length=0;for(let r=0;r<a;r++){let o=h[r];if(!o.bone.active)continue;let l=o.getAttachment();if(l instanceof vt){let c=l;i.push(c);let f=n.obtain();f.length!=c.worldVerticesLength&&(f=P.newFloatArray(c.worldVerticesLength)),s.push(f),c.computeWorldVertices(o,0,c.worldVerticesLength,f,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,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=this.polygons;for(let h=0,a=n.length;h<a;h++){let r=n[h],o=r;for(let l=0,c=r.length;l<c;l+=2){let f=o[l],d=o[l+1];e=Math.min(e,f),t=Math.min(t,d),i=Math.max(i,f),s=Math.max(s,d)}}this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,i,s){let n=this.minX,h=this.minY,a=this.maxX,r=this.maxY;if(e<=n&&i<=n||t<=h&&s<=h||e>=a&&i>=a||t>=r&&s>=r)return!1;let o=(s-t)/(i-e),l=o*(n-e)+t;if(l>h&&l<r||(l=o*(a-e)+t,l>h&&l<r))return!0;let c=(h-t)/o+e;return c>n&&c<a||(c=(r-t)/o+e,c>n&&c<a)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let i=this.polygons;for(let s=0,n=i.length;s<n;s++)if(this.containsPointPolygon(i[s],e,t))return this.boundingBoxes[s];return null}containsPointPolygon(e,t,i){let s=e,n=e.length,h=n-2,a=!1;for(let r=0;r<n;r+=2){let o=s[r+1],l=s[h+1];if(o<i&&l>=i||l<i&&o>=i){let c=s[r];c+(i-o)/(l-o)*(s[h]-c)<t&&(a=!a)}h=r}return a}intersectsSegment(e,t,i,s){let n=this.polygons;for(let h=0,a=n.length;h<a;h++)if(this.intersectsSegmentPolygon(n[h],e,t,i,s))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,i,s,n){let h=e,a=e.length,r=t-s,o=i-n,l=t*n-i*s,c=h[a-2],f=h[a-1];for(let d=0;d<a;d+=2){let u=h[d],m=h[d+1],x=c*m-f*u,w=c-u,y=f-m,p=r*y-o*w,g=(l*w-r*x)/p;if((g>=c&&g<=u||g>=u&&g<=c)&&(g>=t&&g<=s||g>=s&&g<=t)){let b=(l*y-o*x)/p;if((b>=f&&b<=m||b>=m&&b<=f)&&(b>=i&&b<=n||b>=n&&b<=i))return!0}c=u,f=m}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}},ye=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new at(()=>new Array);polygonIndicesPool=new at(()=>new Array);triangulate(e){let t=e,i=e.length>>1,s=this.indicesArray;s.length=0;for(let a=0;a<i;a++)s[a]=a;let n=this.isConcaveArray;n.length=0;for(let a=0,r=i;a<r;++a)n[a]=ye.isConcave(a,i,t,s);let h=this.triangles;for(h.length=0;i>3;){let a=i-1,r=0,o=1;for(;;){e:if(!n[r]){let f=s[a]<<1,d=s[r]<<1,u=s[o]<<1,m=t[f],x=t[f+1],w=t[d],y=t[d+1],p=t[u],g=t[u+1];for(let b=(o+1)%i;b!=a;b=(b+1)%i){if(!n[b])continue;let v=s[b]<<1,C=t[v],A=t[v+1];if(ye.positiveArea(p,g,m,x,C,A)&&ye.positiveArea(m,x,w,y,C,A)&&ye.positiveArea(w,y,p,g,C,A))break e}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}a=r,r=o,o=(o+1)%i}h.push(s[(i+r-1)%i]),h.push(s[r]),h.push(s[(r+1)%i]),s.splice(r,1),n.splice(r,1),i--;let l=(i+r-1)%i,c=r==i?0:r;n[l]=ye.isConcave(l,i,t,s),n[c]=ye.isConcave(c,i,t,s)}return i==3&&(h.push(s[2]),h.push(s[0]),h.push(s[1])),h}decompose(e,t){let i=e,s=this.convexPolygons;this.polygonPool.freeAll(s),s.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let a=this.polygonPool.obtain();a.length=0;let r=-1,o=0;for(let l=0,c=t.length;l<c;l+=3){let f=t[l]<<1,d=t[l+1]<<1,u=t[l+2]<<1,m=i[f],x=i[f+1],w=i[d],y=i[d+1],p=i[u],g=i[u+1],b=!1;if(r==f){let v=a.length-4,C=ye.winding(a[v],a[v+1],a[v+2],a[v+3],p,g),A=ye.winding(p,g,a[0],a[1],a[2],a[3]);C==o&&A==o&&(a.push(p),a.push(g),h.push(u),b=!0)}b||(a.length>0?(s.push(a),n.push(h)):(this.polygonPool.free(a),this.polygonIndicesPool.free(h)),a=this.polygonPool.obtain(),a.length=0,a.push(m),a.push(x),a.push(w),a.push(y),a.push(p),a.push(g),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(f),h.push(d),h.push(u),o=ye.winding(m,x,w,y,p,g),r=f)}a.length>0&&(s.push(a),n.push(h));for(let l=0,c=s.length;l<c;l++){if(h=n[l],h.length==0)continue;let f=h[0],d=h[h.length-1];a=s[l];let u=a.length-4,m=a[u],x=a[u+1],w=a[u+2],y=a[u+3],p=a[0],g=a[1],b=a[2],v=a[3],C=ye.winding(m,x,w,y,p,g);for(let A=0;A<c;A++){if(A==l)continue;let T=n[A];if(T.length!=3)continue;let R=T[0],Y=T[1],F=T[2],X=s[A],k=X[X.length-2],M=X[X.length-1];if(R!=f||Y!=d)continue;let I=ye.winding(m,x,w,y,k,M),O=ye.winding(k,M,p,g,b,v);I==C&&O==C&&(X.length=0,T.length=0,a.push(k),a.push(M),h.push(F),m=w,x=y,w=k,y=M,A=0)}}for(let l=s.length-1;l>=0;l--)a=s[l],a.length==0&&(s.splice(l,1),this.polygonPool.free(a),h=n[l],n.splice(l,1),this.polygonIndicesPool.free(h));return s}static isConcave(e,t,i,s){let n=s[(t+e-1)%t]<<1,h=s[e]<<1,a=s[(e+1)%t]<<1;return!this.positiveArea(i[n],i[n+1],i[h],i[h+1],i[a],i[a+1])}static positiveArea(e,t,i,s,n,h){return e*(h-s)+i*(t-h)+n*(s-t)>=0}static winding(e,t,i,s,n,h){let a=i-e,r=s-t;return n*r-h*a+a*t-e*r>=0?1:-1}},Rt=class{triangulator=new ye;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,s=P.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,s,0,2);let n=this.clippingPolygon;Rt.makeClockwise(n);let h=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let a=0,r=h.length;a<r;a++){let o=h[a];Rt.makeClockwise(o),o.push(o[0]),o.push(o[1])}return h.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,i,s,n,h,a,r){let o=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,f=this.clippingPolygons,d=f.length,u=r?12:8,m=0;l.length=0,c.length=0;e:for(let x=0;x<s;x+=3){let w=i[x]<<1,y=e[w],p=e[w+1],g=n[w],b=n[w+1];w=i[x+1]<<1;let v=e[w],C=e[w+1],A=n[w],T=n[w+1];w=i[x+2]<<1;let R=e[w],Y=e[w+1],F=n[w],X=n[w+1];for(let k=0;k<d;k++){let M=l.length;if(this.clip(y,p,v,C,R,Y,f[k],o)){let I=o.length;if(I==0)continue;let O=C-Y,ie=R-v,te=y-R,he=Y-p,re=1/(O*te+ie*(p-Y)),de=I>>1,ae=this.clipOutput,se=P.setArraySize(l,M+de*u);for(let we=0;we<I;we+=2){let Fe=ae[we],xe=ae[we+1];se[M]=Fe,se[M+1]=xe,se[M+2]=h.r,se[M+3]=h.g,se[M+4]=h.b,se[M+5]=h.a;let Se=Fe-R,Te=xe-Y,_e=(O*Se+ie*Te)*re,st=(he*Se+te*Te)*re,ft=1-_e-st;se[M+6]=g*_e+A*st+F*ft,se[M+7]=b*_e+T*st+X*ft,r&&(se[M+8]=a.r,se[M+9]=a.g,se[M+10]=a.b,se[M+11]=a.a),M+=u}M=c.length;let fe=P.setArraySize(c,M+3*(de-2));de--;for(let we=1;we<de;we++)fe[M]=m,fe[M+1]=m+we,fe[M+2]=m+we+1,M+=3;m+=de+1}else{let I=P.setArraySize(l,M+3*u);I[M]=y,I[M+1]=p,I[M+2]=h.r,I[M+3]=h.g,I[M+4]=h.b,I[M+5]=h.a,r?(I[M+6]=g,I[M+7]=b,I[M+8]=a.r,I[M+9]=a.g,I[M+10]=a.b,I[M+11]=a.a,I[M+12]=v,I[M+13]=C,I[M+14]=h.r,I[M+15]=h.g,I[M+16]=h.b,I[M+17]=h.a,I[M+18]=A,I[M+19]=T,I[M+20]=a.r,I[M+21]=a.g,I[M+22]=a.b,I[M+23]=a.a,I[M+24]=R,I[M+25]=Y,I[M+26]=h.r,I[M+27]=h.g,I[M+28]=h.b,I[M+29]=h.a,I[M+30]=F,I[M+31]=X,I[M+32]=a.r,I[M+33]=a.g,I[M+34]=a.b,I[M+35]=a.a):(I[M+6]=g,I[M+7]=b,I[M+8]=v,I[M+9]=C,I[M+10]=h.r,I[M+11]=h.g,I[M+12]=h.b,I[M+13]=h.a,I[M+14]=A,I[M+15]=T,I[M+16]=R,I[M+17]=Y,I[M+18]=h.r,I[M+19]=h.g,I[M+20]=h.b,I[M+21]=h.a,I[M+22]=F,I[M+23]=X),M=c.length;let O=P.setArraySize(c,M+3);O[M]=m,O[M+1]=m+1,O[M+2]=m+2,m+=3;continue e}}}}clip(e,t,i,s,n,h,a,r){let o=r,l=!1,c;a.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(e),c.push(t),c.push(i),c.push(s),c.push(n),c.push(h),c.push(e),c.push(t),r.length=0;let f=a,d=a.length-4;for(let u=0;;u+=2){let m=f[u],x=f[u+1],w=f[u+2],y=f[u+3],p=m-w,g=x-y,b=c,v=c.length-2,C=r.length;for(let T=0;T<v;T+=2){let R=b[T],Y=b[T+1],F=b[T+2],X=b[T+3],k=p*(X-y)-g*(F-w)>0;if(p*(Y-y)-g*(R-w)>0){if(k){r.push(F),r.push(X);continue}let M=X-Y,I=F-R,O=M*(w-m)-I*(y-x);if(Math.abs(O)>1e-6){let ie=(I*(x-Y)-M*(m-R))/O;r.push(m+(w-m)*ie),r.push(x+(y-x)*ie)}else r.push(m),r.push(x)}else if(k){let M=X-Y,I=F-R,O=M*(w-m)-I*(y-x);if(Math.abs(O)>1e-6){let ie=(I*(x-Y)-M*(m-R))/O;r.push(m+(w-m)*ie),r.push(x+(y-x)*ie)}else r.push(m),r.push(x);r.push(F),r.push(X)}l=!0}if(C==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==d)break;let A=r;r=c,r.length=0,c=A}if(o!=r){o.length=0;for(let u=0,m=r.length-2;u<m;u++)o[u]=r[u]}else o.length=o.length-2;return l}static makeClockwise(e){let t=e,i=e.length,s=t[i-2]*t[1]-t[0]*t[i-1],n=0,h=0,a=0,r=0;for(let o=0,l=i-3;o<l;o+=2)n=t[o],h=t[o+1],a=t[o+2],r=t[o+3],s+=n*r-a*h;if(!(s<0))for(let o=0,l=i-2,c=i>>1;o<c;o+=2){let f=t[o],d=t[o+1],u=l-o;t[o]=t[u],t[o+1]=t[u+1],t[u]=f,t[u+1]=d}}},Tr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Ai,s=typeof e=="string"?JSON.parse(e):e,n=s.skeleton;if(n&&(i.hash=n.hash,i.version=n.spine,i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height,i.fps=n.fps,i.imagesPath=n.images),s.bones)for(let h=0;h<s.bones.length;h++){let a=s.bones[h],r=null,o=E(a,"parent",null);o&&(r=i.findBone(o));let l=new gi(i.bones.length,a.name,r);l.length=E(a,"length",0)*t,l.x=E(a,"x",0)*t,l.y=E(a,"y",0)*t,l.rotation=E(a,"rotation",0),l.scaleX=E(a,"scaleX",1),l.scaleY=E(a,"scaleY",1),l.shearX=E(a,"shearX",0),l.shearY=E(a,"shearY",0),l.transformMode=P.enumValue(At,E(a,"transform","Normal")),l.skinRequired=E(a,"skin",!1);let c=E(a,"color",null);c&&l.color.setFromString(c),i.bones.push(l)}if(s.slots)for(let h=0;h<s.slots.length;h++){let a=s.slots[h],r=i.findBone(a.bone);if(!r)throw new Error(`Couldn't find bone ${a.bone} for slot ${a.name}`);let o=new Si(i.slots.length,a.name,r),l=E(a,"color",null);l&&o.color.setFromString(l);let c=E(a,"dark",null);c&&(o.darkColor=V.fromString(c)),o.attachmentName=E(a,"attachment",null),o.blendMode=P.enumValue(Et,E(a,"blend","normal")),i.slots.push(o)}if(s.ik)for(let h=0;h<s.ik.length;h++){let a=s.ik[h],r=new vi(a.name);r.order=E(a,"order",0),r.skinRequired=E(a,"skin",!1);for(let l=0;l<a.bones.length;l++){let c=i.findBone(a.bones[l]);if(!c)throw new Error(`Couldn't find bone ${a.bones[l]} for IK constraint ${a.name}.`);r.bones.push(c)}let o=i.findBone(a.target);if(!o)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);r.target=o,r.mix=E(a,"mix",1),r.softness=E(a,"softness",0)*t,r.bendDirection=E(a,"bendPositive",!0)?1:-1,r.compress=E(a,"compress",!1),r.stretch=E(a,"stretch",!1),r.uniform=E(a,"uniform",!1),i.ikConstraints.push(r)}if(s.transform)for(let h=0;h<s.transform.length;h++){let a=s.transform[h],r=new Ti(a.name);r.order=E(a,"order",0),r.skinRequired=E(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let f=a.bones[c],d=i.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${a.name}.`);r.bones.push(d)}let o=a.target,l=i.findBone(o);if(!l)throw new Error(`Couldn't find target bone ${o} for transform constraint ${a.name}.`);r.target=l,r.local=E(a,"local",!1),r.relative=E(a,"relative",!1),r.offsetRotation=E(a,"rotation",0),r.offsetX=E(a,"x",0)*t,r.offsetY=E(a,"y",0)*t,r.offsetScaleX=E(a,"scaleX",0),r.offsetScaleY=E(a,"scaleY",0),r.offsetShearY=E(a,"shearY",0),r.mixRotate=E(a,"mixRotate",1),r.mixX=E(a,"mixX",1),r.mixY=E(a,"mixY",r.mixX),r.mixScaleX=E(a,"mixScaleX",1),r.mixScaleY=E(a,"mixScaleY",r.mixScaleX),r.mixShearY=E(a,"mixShearY",1),i.transformConstraints.push(r)}if(s.path)for(let h=0;h<s.path.length;h++){let a=s.path[h],r=new yi(a.name);r.order=E(a,"order",0),r.skinRequired=E(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let f=a.bones[c],d=i.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${a.name}.`);r.bones.push(d)}let o=a.target,l=i.findSlot(o);if(!l)throw new Error(`Couldn't find target slot ${o} for path constraint ${a.name}.`);r.target=l,r.positionMode=P.enumValue(St,E(a,"positionMode","Percent")),r.spacingMode=P.enumValue(Tt,E(a,"spacingMode","Length")),r.rotateMode=P.enumValue(It,E(a,"rotateMode","Tangent")),r.offsetRotation=E(a,"rotation",0),r.position=E(a,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=E(a,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=E(a,"mixRotate",1),r.mixX=E(a,"mixX",1),r.mixY=E(a,"mixY",r.mixX),i.pathConstraints.push(r)}if(s.skins)for(let h=0;h<s.skins.length;h++){let a=s.skins[h],r=new Mt(a.name);if(a.bones)for(let o=0;o<a.bones.length;o++){let l=a.bones[o],c=i.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${a.name}.`);r.bones.push(c)}if(a.ik)for(let o=0;o<a.ik.length;o++){let l=a.ik[o],c=i.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.transform)for(let o=0;o<a.transform.length;o++){let l=a.transform[o],c=i.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.path)for(let o=0;o<a.path.length;o++){let l=a.path[o],c=i.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}for(let o in a.attachments){let l=i.findSlot(o);if(!l)throw new Error(`Couldn't find slot ${o} for skin ${a.name}.`);let c=a.attachments[o];for(let f in c){let d=this.readAttachment(c[f],r,l.index,f,i);d&&r.setAttachment(l.index,f,d)}}i.skins.push(r),r.name=="default"&&(i.defaultSkin=r)}for(let h=0,a=this.linkedMeshes.length;h<a;h++){let r=this.linkedMeshes[h],o=r.skin?i.findSkin(r.skin):i.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let l=o.getAttachment(r.slotIndex,r.parent);if(!l)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?l:r.mesh,r.mesh.setParentMesh(l),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let h in s.events){let a=s.events[h],r=new bi(h);r.intValue=E(a,"int",0),r.floatValue=E(a,"float",0),r.stringValue=E(a,"string",""),r.audioPath=E(a,"audio",null),r.audioPath&&(r.volume=E(a,"volume",1),r.balance=E(a,"balance",0)),i.events.push(r)}if(s.animations)for(let h in s.animations){let a=s.animations[h];this.readAnimation(a,h,i)}return i}readAttachment(e,t,i,s,n){let h=this.scale;switch(s=E(e,"name",s),E(e,"type","region")){case"region":{let a=E(e,"path",s),r=this.readSequence(E(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,s,a,r);if(!o)return null;o.path=a,o.x=E(e,"x",0)*h,o.y=E(e,"y",0)*h,o.scaleX=E(e,"scaleX",1),o.scaleY=E(e,"scaleY",1),o.rotation=E(e,"rotation",0),o.width=e.width*h,o.height=e.height*h,o.sequence=r;let l=E(e,"color",null);return l&&o.color.setFromString(l),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(t,s);if(!a)return null;this.readVertices(e,a,e.vertexCount<<1);let r=E(e,"color",null);return r&&a.color.setFromString(r),a}case"mesh":case"linkedmesh":{let a=E(e,"path",s),r=this.readSequence(E(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,s,a,r);if(!o)return null;o.path=a;let l=E(e,"color",null);l&&o.color.setFromString(l),o.width=E(e,"width",0)*h,o.height=E(e,"height",0)*h,o.sequence=r;let c=E(e,"parent",null);if(c)return this.linkedMeshes.push(new Ir(o,E(e,"skin",null),i,c,E(e,"timelines",!0))),o;let f=e.uvs;return this.readVertices(e,o,f.length),o.triangles=e.triangles,o.regionUVs=f,o.region!=null&&o.updateRegion(),o.edges=E(e,"edges",null),o.hullLength=E(e,"hull",0)*2,o}case"path":{let a=this.attachmentLoader.newPathAttachment(t,s);if(!a)return null;a.closed=E(e,"closed",!1),a.constantSpeed=E(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,a,r<<1);let o=P.newArray(r/3,0);for(let c=0;c<e.lengths.length;c++)o[c]=e.lengths[c]*h;a.lengths=o;let l=E(e,"color",null);return l&&a.color.setFromString(l),a}case"point":{let a=this.attachmentLoader.newPointAttachment(t,s);if(!a)return null;a.x=E(e,"x",0)*h,a.y=E(e,"y",0)*h,a.rotation=E(e,"rotation",0);let r=E(e,"color",null);return r&&a.color.setFromString(r),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(t,s);if(!a)return null;let r=E(e,"end",null);r&&(a.endSlot=n.findSlot(r));let o=e.vertexCount;this.readVertices(e,a,o<<1);let l=E(e,"color",null);return l&&a.color.setFromString(l),a}}return null}readSequence(e){if(e==null)return null;let t=new _t(E(e,"count",0));return t.start=E(e,"start",1),t.digits=E(e,"digits",0),t.setupIndex=E(e,"setup",0),t}readVertices(e,t,i){let s=this.scale;t.worldVerticesLength=i;let n=e.vertices;if(i==n.length){let r=P.toFloatArray(n);if(s!=1)for(let o=0,l=n.length;o<l;o++)r[o]*=s;t.vertices=r;return}let h=new Array,a=new Array;for(let r=0,o=n.length;r<o;){let l=n[r++];a.push(l);for(let c=r+l*4;r<c;r+=4)a.push(n[r]),h.push(n[r+1]*s),h.push(n[r+2]*s),h.push(n[r+3])}t.bones=a,t.vertices=P.toFloatArray(h)}readAnimation(e,t,i){let s=this.scale,n=new Array;if(e.slots)for(let a in e.slots){let r=e.slots[a],o=i.findSlot(a);if(!o)throw new Error("Slot not found: "+a);let l=o.index;for(let c in r){let f=r[c];if(!f)continue;let d=f.length;if(c=="attachment"){let u=new qe(d,l);for(let m=0;m<d;m++){let x=f[m];u.setFrame(m,E(x,"time",0),E(x,"name",null))}n.push(u)}else if(c=="rgba"){let u=new Qt(d,d<<2,l),m=f[0],x=E(m,"time",0),w=V.fromString(m.color);for(let y=0,p=0;;y++){u.setFrame(y,x,w.r,w.g,w.b,w.a);let g=f[y+1];if(!g){u.shrink(p);break}let b=E(g,"time",0),v=V.fromString(g.color),C=m.curve;C&&(p=ce(C,u,p,y,0,x,b,w.r,v.r,1),p=ce(C,u,p,y,1,x,b,w.g,v.g,1),p=ce(C,u,p,y,2,x,b,w.b,v.b,1),p=ce(C,u,p,y,3,x,b,w.a,v.a,1)),x=b,w=v,m=g}n.push(u)}else if(c=="rgb"){let u=new $t(d,d*3,l),m=f[0],x=E(m,"time",0),w=V.fromString(m.color);for(let y=0,p=0;;y++){u.setFrame(y,x,w.r,w.g,w.b);let g=f[y+1];if(!g){u.shrink(p);break}let b=E(g,"time",0),v=V.fromString(g.color),C=m.curve;C&&(p=ce(C,u,p,y,0,x,b,w.r,v.r,1),p=ce(C,u,p,y,1,x,b,w.g,v.g,1),p=ce(C,u,p,y,2,x,b,w.b,v.b,1)),x=b,w=v,m=g}n.push(u)}else if(c=="alpha")n.push(Xe(f,new ei(d,d,l),0,1));else if(c=="rgba2"){let u=new ti(d,d*7,l),m=f[0],x=E(m,"time",0),w=V.fromString(m.light),y=V.fromString(m.dark);for(let p=0,g=0;;p++){u.setFrame(p,x,w.r,w.g,w.b,w.a,y.r,y.g,y.b);let b=f[p+1];if(!b){u.shrink(g);break}let v=E(b,"time",0),C=V.fromString(b.light),A=V.fromString(b.dark),T=m.curve;T&&(g=ce(T,u,g,p,0,x,v,w.r,C.r,1),g=ce(T,u,g,p,1,x,v,w.g,C.g,1),g=ce(T,u,g,p,2,x,v,w.b,C.b,1),g=ce(T,u,g,p,3,x,v,w.a,C.a,1),g=ce(T,u,g,p,4,x,v,y.r,A.r,1),g=ce(T,u,g,p,5,x,v,y.g,A.g,1),g=ce(T,u,g,p,6,x,v,y.b,A.b,1)),x=v,w=C,y=A,m=b}n.push(u)}else if(c=="rgb2"){let u=new ii(d,d*6,l),m=f[0],x=E(m,"time",0),w=V.fromString(m.light),y=V.fromString(m.dark);for(let p=0,g=0;;p++){u.setFrame(p,x,w.r,w.g,w.b,y.r,y.g,y.b);let b=f[p+1];if(!b){u.shrink(g);break}let v=E(b,"time",0),C=V.fromString(b.light),A=V.fromString(b.dark),T=m.curve;T&&(g=ce(T,u,g,p,0,x,v,w.r,C.r,1),g=ce(T,u,g,p,1,x,v,w.g,C.g,1),g=ce(T,u,g,p,2,x,v,w.b,C.b,1),g=ce(T,u,g,p,3,x,v,y.r,A.r,1),g=ce(T,u,g,p,4,x,v,y.g,A.g,1),g=ce(T,u,g,p,5,x,v,y.b,A.b,1)),x=v,w=C,y=A,m=b}n.push(u)}}}if(e.bones)for(let a in e.bones){let r=e.bones[a],o=i.findBone(a);if(!o)throw new Error("Bone not found: "+a);let l=o.index;for(let c in r){let f=r[c],d=f.length;if(d!=0){if(c==="rotate")n.push(Xe(f,new lt(d,d,l),0,1));else if(c==="translate"){let u=new Wt(d,d<<1,l);n.push(Mi(f,u,"x","y",0,s))}else if(c==="translatex"){let u=new zt(d,d,l);n.push(Xe(f,u,0,s))}else if(c==="translatey"){let u=new qt(d,d,l);n.push(Xe(f,u,0,s))}else if(c==="scale"){let u=new Gt(d,d<<1,l);n.push(Mi(f,u,"x","y",1,1))}else if(c==="scalex"){let u=new Ht(d,d,l);n.push(Xe(f,u,1,1))}else if(c==="scaley"){let u=new jt(d,d,l);n.push(Xe(f,u,1,1))}else if(c==="shear"){let u=new Zt(d,d<<1,l);n.push(Mi(f,u,"x","y",0,1))}else if(c==="shearx"){let u=new Kt(d,d,l);n.push(Xe(f,u,0,1))}else if(c==="sheary"){let u=new Jt(d,d,l);n.push(Xe(f,u,0,1))}}}}if(e.ik)for(let a in e.ik){let r=e.ik[a],o=r[0];if(!o)continue;let l=i.findIkConstraint(a);if(!l)throw new Error("IK Constraint not found: "+a);let c=i.ikConstraints.indexOf(l),f=new ri(r.length,r.length<<1,c),d=E(o,"time",0),u=E(o,"mix",1),m=E(o,"softness",0)*s;for(let x=0,w=0;;x++){f.setFrame(x,d,u,m,E(o,"bendPositive",!0)?1:-1,E(o,"compress",!1),E(o,"stretch",!1));let y=r[x+1];if(!y){f.shrink(w);break}let p=E(y,"time",0),g=E(y,"mix",1),b=E(y,"softness",0)*s,v=o.curve;v&&(w=ce(v,f,w,x,0,d,p,u,g,1),w=ce(v,f,w,x,1,d,p,m,b,s)),d=p,u=g,m=b,o=y}n.push(f)}if(e.transform)for(let a in e.transform){let r=e.transform[a],o=r[0];if(!o)continue;let l=i.findTransformConstraint(a);if(!l)throw new Error("Transform constraint not found: "+a);let c=i.transformConstraints.indexOf(l),f=new ni(r.length,r.length*6,c),d=E(o,"time",0),u=E(o,"mixRotate",1),m=E(o,"mixX",1),x=E(o,"mixY",m),w=E(o,"mixScaleX",1),y=E(o,"mixScaleY",w),p=E(o,"mixShearY",1);for(let g=0,b=0;;g++){f.setFrame(g,d,u,m,x,w,y,p);let v=r[g+1];if(!v){f.shrink(b);break}let C=E(v,"time",0),A=E(v,"mixRotate",1),T=E(v,"mixX",1),R=E(v,"mixY",T),Y=E(v,"mixScaleX",1),F=E(v,"mixScaleY",Y),X=E(v,"mixShearY",1),k=o.curve;k&&(b=ce(k,f,b,g,0,d,C,u,A,1),b=ce(k,f,b,g,1,d,C,m,T,1),b=ce(k,f,b,g,2,d,C,x,R,1),b=ce(k,f,b,g,3,d,C,w,Y,1),b=ce(k,f,b,g,4,d,C,y,F,1),b=ce(k,f,b,g,5,d,C,p,X,1)),d=C,u=A,m=T,x=R,w=Y,y=F,w=Y,o=v}n.push(f)}if(e.path)for(let a in e.path){let r=e.path[a],o=i.findPathConstraint(a);if(!o)throw new Error("Path constraint not found: "+a);let l=i.pathConstraints.indexOf(o);for(let c in r){let f=r[c],d=f[0];if(!d)continue;let u=f.length;if(c==="position"){let m=new ai(u,u,l);n.push(Xe(f,m,0,o.positionMode==0?s:1))}else if(c==="spacing"){let m=new li(u,u,l);n.push(Xe(f,m,0,o.spacingMode==0||o.spacingMode==1?s:1))}else if(c==="mix"){let m=new oi(u,u*3,l),x=E(d,"time",0),w=E(d,"mixRotate",1),y=E(d,"mixX",1),p=E(d,"mixY",y);for(let g=0,b=0;;g++){m.setFrame(g,x,w,y,p);let v=f[g+1];if(!v){m.shrink(b);break}let C=E(v,"time",0),A=E(v,"mixRotate",1),T=E(v,"mixX",1),R=E(v,"mixY",T),Y=d.curve;Y&&(b=ce(Y,m,b,g,0,x,C,w,A,1),b=ce(Y,m,b,g,1,x,C,y,T,1),b=ce(Y,m,b,g,2,x,C,p,R,1)),x=C,w=A,y=T,p=R,d=v}n.push(m)}}}if(e.attachments)for(let a in e.attachments){let r=e.attachments[a],o=i.findSkin(a);if(!o)throw new Error("Skin not found: "+a);for(let l in r){let c=r[l],f=i.findSlot(l);if(!f)throw new Error("Slot not found: "+l);let d=f.index;for(let u in c){let m=c[u],x=o.getAttachment(d,u);for(let w in m){let y=m[w],p=y[0];if(p){if(w=="deform"){let g=x.bones,b=x.vertices,v=g?b.length/3*2:b.length,C=new si(y.length,y.length,d,x),A=E(p,"time",0);for(let T=0,R=0;;T++){let Y,F=E(p,"vertices",null);if(!F)Y=g?P.newFloatArray(v):b;else{Y=P.newFloatArray(v);let I=E(p,"offset",0);if(P.arrayCopy(F,0,Y,I,F.length),s!=1)for(let O=I,ie=O+F.length;O<ie;O++)Y[O]*=s;if(!g)for(let O=0;O<v;O++)Y[O]+=b[O]}C.setFrame(T,A,Y);let X=y[T+1];if(!X){C.shrink(R);break}let k=E(X,"time",0),M=p.curve;M&&(R=ce(M,C,R,T,0,A,k,0,1,1)),A=k,p=X}n.push(C)}else if(w=="sequence"){let g=new Qe(y.length,d,x),b=0;for(let v=0;v<y.length;v++){let C=E(p,"delay",b),A=E(p,"time",0),T=Ui[E(p,"mode","hold")],R=E(p,"index",0);g.setFrame(v,A,T,R,C),b=C,p=y[v+1]}n.push(g)}}}}}}if(e.drawOrder){let a=new Ge(e.drawOrder.length),r=i.slots.length,o=0;for(let l=0;l<e.drawOrder.length;l++,o++){let c=e.drawOrder[l],f=null,d=E(c,"offsets",null);if(d){f=P.newArray(r,-1);let u=P.newArray(r-d.length,0),m=0,x=0;for(let w=0;w<d.length;w++){let y=d[w],p=i.findSlot(y.slot);if(!p)throw new Error("Slot not found: "+p);let g=p.index;for(;m!=g;)u[x++]=m++;f[m+y.offset]=m++}for(;m<r;)u[x++]=m++;for(let w=r-1;w>=0;w--)f[w]==-1&&(f[w]=u[--x])}a.setFrame(o,E(c,"time",0),f)}n.push(a)}if(e.events){let a=new ot(e.events.length),r=0;for(let o=0;o<e.events.length;o++,r++){let l=e.events[o],c=i.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let f=new wi(P.toSinglePrecision(E(l,"time",0)),c);f.intValue=E(l,"int",c.intValue),f.floatValue=E(l,"float",c.floatValue),f.stringValue=E(l,"string",c.stringValue),f.data.audioPath&&(f.volume=E(l,"volume",1),f.balance=E(l,"balance",0)),a.setFrame(r,f)}n.push(a)}let h=0;for(let a=0,r=n.length;a<r;a++)h=Math.max(h,n[a].getDuration());i.animations.push(new gt(t,n,h))}},Ir=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,i,s,n){this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}};function Xe(e,t,i,s){let n=e[0],h=E(n,"time",0),a=E(n,"value",i)*s,r=0;for(let o=0;;o++){t.setFrame(o,h,a);let l=e[o+1];if(!l)return t.shrink(r),t;let c=E(l,"time",0),f=E(l,"value",i)*s;n.curve&&(r=ce(n.curve,t,r,o,0,h,c,a,f,s)),h=c,a=f,n=l}}function Mi(e,t,i,s,n,h){let a=e[0],r=E(a,"time",0),o=E(a,i,n)*h,l=E(a,s,n)*h,c=0;for(let f=0;;f++){t.setFrame(f,r,o,l);let d=e[f+1];if(!d)return t.shrink(c),t;let u=E(d,"time",0),m=E(d,i,n)*h,x=E(d,s,n)*h,w=a.curve;w&&(c=ce(w,t,c,f,0,r,u,o,m,h),c=ce(w,t,c,f,1,r,u,l,x,h)),r=u,o=m,l=x,a=d}}function ce(e,t,i,s,n,h,a,r,o,l){if(e=="stepped")return t.setStepped(s),i;let c=n<<2,f=e[c],d=e[c+1]*l,u=e[c+2],m=e[c+3]*l;return t.setBezier(i,s,n,h,r,f,d,u,m,a,o),i+1}function E(e,t,i){return e[t]!==void 0?e[t]:i}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var pe=class{canvas;gl;restorables=new Array;constructor(e,t={alpha:"true"}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{let i=e;this.gl=i.getContext("webgl2",t)||i.getContext("webgl",t),this.canvas=i,i.addEventListener("webglcontextlost",s=>{let n=s;s&&s.preventDefault()}),i.addEventListener("webglcontextrestored",s=>{for(let n=0,h=this.restorables.length;n<h;n++)this.restorables[n].restore()})}}addRestorable(e){this.restorables.push(e)}removeRestorable(e){let t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},Yt=class extends fi{context;texture=null;boundUnit=0;useMipMaps=!1;constructor(e,t,i=!1){super(t),this.context=e instanceof pe?e:new pe(e),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(e,t){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Yt.validateMagFilter(t)),this.useMipMaps=Yt.usesMipMaps(e),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(e){switch(e){case 9987:case 9985:case 9986:case 9984:return 9729;default:return e}}static usesMipMaps(e){switch(e){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(e,t){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t)}update(e){let t=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Yt.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this._image),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e&&t.generateMipmap(t.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(e=0){let t=this.context.gl;this.boundUnit=e,t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,this.texture)}unbind(){let e=this.context.gl;e.activeTexture(e.TEXTURE0+this.boundUnit),e.bindTexture(e.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},ct=Yt;B(ct,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);var ms=class extends ns{constructor(e,t="",i=new pi){super(s=>new ct(e,s),t,i)}},Ce=class{x=0;y=0;z=0;constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,i){return this.x=e,this.y=t,this.z=i,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[D]+this.y*t[q]+this.z*t[G]+t[N],this.x*t[H]+this.y*t[U]+this.z*t[j]+t[_],this.x*t[Z]+this.y*t[K]+this.z*t[W]+t[z])}project(e){let t=e.values,i=1/(this.x*t[Q]+this.y*t[$]+this.z*t[ee]+t[J]);return this.set((this.x*t[D]+this.y*t[q]+this.z*t[G]+t[N])*i,(this.x*t[H]+this.y*t[U]+this.z*t[j]+t[_])*i,(this.x*t[Z]+this.y*t[K]+this.z*t[W]+t[z])*i)}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,i=e.y-this.y,s=e.z-this.z;return Math.sqrt(t*t+i*i+s*s)}},D=0,q=4,G=8,N=12,H=1,U=5,j=9,_=13,Z=2,K=6,W=10,z=14,Q=3,$=7,ee=11,J=15,ke=class{temp=new Float32Array(16);values=new Float32Array(16);constructor(){let e=this.values;e[D]=1,e[U]=1,e[W]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,t=this.values;return e[D]=t[D],e[q]=t[H],e[G]=t[Z],e[N]=t[Q],e[H]=t[q],e[U]=t[U],e[j]=t[K],e[_]=t[$],e[Z]=t[G],e[K]=t[j],e[W]=t[W],e[z]=t[ee],e[Q]=t[N],e[$]=t[_],e[ee]=t[z],e[J]=t[J],this.set(e)}identity(){let e=this.values;return e[D]=1,e[q]=0,e[G]=0,e[N]=0,e[H]=0,e[U]=1,e[j]=0,e[_]=0,e[Z]=0,e[K]=0,e[W]=1,e[z]=0,e[Q]=0,e[$]=0,e[ee]=0,e[J]=1,this}invert(){let e=this.values,t=this.temp,i=e[Q]*e[K]*e[j]*e[N]-e[Z]*e[$]*e[j]*e[N]-e[Q]*e[U]*e[W]*e[N]+e[H]*e[$]*e[W]*e[N]+e[Z]*e[U]*e[ee]*e[N]-e[H]*e[K]*e[ee]*e[N]-e[Q]*e[K]*e[G]*e[_]+e[Z]*e[$]*e[G]*e[_]+e[Q]*e[q]*e[W]*e[_]-e[D]*e[$]*e[W]*e[_]-e[Z]*e[q]*e[ee]*e[_]+e[D]*e[K]*e[ee]*e[_]+e[Q]*e[U]*e[G]*e[z]-e[H]*e[$]*e[G]*e[z]-e[Q]*e[q]*e[j]*e[z]+e[D]*e[$]*e[j]*e[z]+e[H]*e[q]*e[ee]*e[z]-e[D]*e[U]*e[ee]*e[z]-e[Z]*e[U]*e[G]*e[J]+e[H]*e[K]*e[G]*e[J]+e[Z]*e[q]*e[j]*e[J]-e[D]*e[K]*e[j]*e[J]-e[H]*e[q]*e[W]*e[J]+e[D]*e[U]*e[W]*e[J];if(i==0)throw new Error("non-invertible matrix");let s=1/i;return t[D]=e[j]*e[z]*e[$]-e[_]*e[W]*e[$]+e[_]*e[K]*e[ee]-e[U]*e[z]*e[ee]-e[j]*e[K]*e[J]+e[U]*e[W]*e[J],t[q]=e[N]*e[W]*e[$]-e[G]*e[z]*e[$]-e[N]*e[K]*e[ee]+e[q]*e[z]*e[ee]+e[G]*e[K]*e[J]-e[q]*e[W]*e[J],t[G]=e[G]*e[_]*e[$]-e[N]*e[j]*e[$]+e[N]*e[U]*e[ee]-e[q]*e[_]*e[ee]-e[G]*e[U]*e[J]+e[q]*e[j]*e[J],t[N]=e[N]*e[j]*e[K]-e[G]*e[_]*e[K]-e[N]*e[U]*e[W]+e[q]*e[_]*e[W]+e[G]*e[U]*e[z]-e[q]*e[j]*e[z],t[H]=e[_]*e[W]*e[Q]-e[j]*e[z]*e[Q]-e[_]*e[Z]*e[ee]+e[H]*e[z]*e[ee]+e[j]*e[Z]*e[J]-e[H]*e[W]*e[J],t[U]=e[G]*e[z]*e[Q]-e[N]*e[W]*e[Q]+e[N]*e[Z]*e[ee]-e[D]*e[z]*e[ee]-e[G]*e[Z]*e[J]+e[D]*e[W]*e[J],t[j]=e[N]*e[j]*e[Q]-e[G]*e[_]*e[Q]-e[N]*e[H]*e[ee]+e[D]*e[_]*e[ee]+e[G]*e[H]*e[J]-e[D]*e[j]*e[J],t[_]=e[G]*e[_]*e[Z]-e[N]*e[j]*e[Z]+e[N]*e[H]*e[W]-e[D]*e[_]*e[W]-e[G]*e[H]*e[z]+e[D]*e[j]*e[z],t[Z]=e[U]*e[z]*e[Q]-e[_]*e[K]*e[Q]+e[_]*e[Z]*e[$]-e[H]*e[z]*e[$]-e[U]*e[Z]*e[J]+e[H]*e[K]*e[J],t[K]=e[N]*e[K]*e[Q]-e[q]*e[z]*e[Q]-e[N]*e[Z]*e[$]+e[D]*e[z]*e[$]+e[q]*e[Z]*e[J]-e[D]*e[K]*e[J],t[W]=e[q]*e[_]*e[Q]-e[N]*e[U]*e[Q]+e[N]*e[H]*e[$]-e[D]*e[_]*e[$]-e[q]*e[H]*e[J]+e[D]*e[U]*e[J],t[z]=e[N]*e[U]*e[Z]-e[q]*e[_]*e[Z]-e[N]*e[H]*e[K]+e[D]*e[_]*e[K]+e[q]*e[H]*e[z]-e[D]*e[U]*e[z],t[Q]=e[j]*e[K]*e[Q]-e[U]*e[W]*e[Q]-e[j]*e[Z]*e[$]+e[H]*e[W]*e[$]+e[U]*e[Z]*e[ee]-e[H]*e[K]*e[ee],t[$]=e[q]*e[W]*e[Q]-e[G]*e[K]*e[Q]+e[G]*e[Z]*e[$]-e[D]*e[W]*e[$]-e[q]*e[Z]*e[ee]+e[D]*e[K]*e[ee],t[ee]=e[G]*e[U]*e[Q]-e[q]*e[j]*e[Q]-e[G]*e[H]*e[$]+e[D]*e[j]*e[$]+e[q]*e[H]*e[ee]-e[D]*e[U]*e[ee],t[J]=e[q]*e[j]*e[Z]-e[G]*e[U]*e[Z]+e[G]*e[H]*e[K]-e[D]*e[j]*e[K]-e[q]*e[H]*e[W]+e[D]*e[U]*e[W],e[D]=t[D]*s,e[q]=t[q]*s,e[G]=t[G]*s,e[N]=t[N]*s,e[H]=t[H]*s,e[U]=t[U]*s,e[j]=t[j]*s,e[_]=t[_]*s,e[Z]=t[Z]*s,e[K]=t[K]*s,e[W]=t[W]*s,e[z]=t[z]*s,e[Q]=t[Q]*s,e[$]=t[$]*s,e[ee]=t[ee]*s,e[J]=t[J]*s,this}determinant(){let e=this.values;return e[Q]*e[K]*e[j]*e[N]-e[Z]*e[$]*e[j]*e[N]-e[Q]*e[U]*e[W]*e[N]+e[H]*e[$]*e[W]*e[N]+e[Z]*e[U]*e[ee]*e[N]-e[H]*e[K]*e[ee]*e[N]-e[Q]*e[K]*e[G]*e[_]+e[Z]*e[$]*e[G]*e[_]+e[Q]*e[q]*e[W]*e[_]-e[D]*e[$]*e[W]*e[_]-e[Z]*e[q]*e[ee]*e[_]+e[D]*e[K]*e[ee]*e[_]+e[Q]*e[U]*e[G]*e[z]-e[H]*e[$]*e[G]*e[z]-e[Q]*e[q]*e[j]*e[z]+e[D]*e[$]*e[j]*e[z]+e[H]*e[q]*e[ee]*e[z]-e[D]*e[U]*e[ee]*e[z]-e[Z]*e[U]*e[G]*e[J]+e[H]*e[K]*e[G]*e[J]+e[Z]*e[q]*e[j]*e[J]-e[D]*e[K]*e[j]*e[J]-e[H]*e[q]*e[W]*e[J]+e[D]*e[U]*e[W]*e[J]}translate(e,t,i){let s=this.values;return s[N]+=e,s[_]+=t,s[z]+=i,this}copy(){return new ke().set(this.values)}projection(e,t,i,s){this.identity();let n=1/Math.tan(i*(Math.PI/180)/2),h=(t+e)/(e-t),a=2*t*e/(e-t),r=this.values;return r[D]=n/s,r[H]=0,r[Z]=0,r[Q]=0,r[q]=0,r[U]=n,r[K]=0,r[$]=0,r[G]=0,r[j]=0,r[W]=h,r[ee]=-1,r[N]=0,r[_]=0,r[z]=a,r[J]=0,this}ortho2d(e,t,i,s){return this.ortho(e,e+i,t,t+s,0,1)}ortho(e,t,i,s,n,h){this.identity();let a=2/(t-e),r=2/(s-i),o=-2/(h-n),l=-(t+e)/(t-e),c=-(s+i)/(s-i),f=-(h+n)/(h-n),d=this.values;return d[D]=a,d[H]=0,d[Z]=0,d[Q]=0,d[q]=0,d[U]=r,d[K]=0,d[$]=0,d[G]=0,d[j]=0,d[W]=o,d[ee]=0,d[N]=l,d[_]=c,d[z]=f,d[J]=1,this}multiply(e){let t=this.temp,i=this.values,s=e.values;return t[D]=i[D]*s[D]+i[q]*s[H]+i[G]*s[Z]+i[N]*s[Q],t[q]=i[D]*s[q]+i[q]*s[U]+i[G]*s[K]+i[N]*s[$],t[G]=i[D]*s[G]+i[q]*s[j]+i[G]*s[W]+i[N]*s[ee],t[N]=i[D]*s[N]+i[q]*s[_]+i[G]*s[z]+i[N]*s[J],t[H]=i[H]*s[D]+i[U]*s[H]+i[j]*s[Z]+i[_]*s[Q],t[U]=i[H]*s[q]+i[U]*s[U]+i[j]*s[K]+i[_]*s[$],t[j]=i[H]*s[G]+i[U]*s[j]+i[j]*s[W]+i[_]*s[ee],t[_]=i[H]*s[N]+i[U]*s[_]+i[j]*s[z]+i[_]*s[J],t[Z]=i[Z]*s[D]+i[K]*s[H]+i[W]*s[Z]+i[z]*s[Q],t[K]=i[Z]*s[q]+i[K]*s[U]+i[W]*s[K]+i[z]*s[$],t[W]=i[Z]*s[G]+i[K]*s[j]+i[W]*s[W]+i[z]*s[ee],t[z]=i[Z]*s[N]+i[K]*s[_]+i[W]*s[z]+i[z]*s[J],t[Q]=i[Q]*s[D]+i[$]*s[H]+i[ee]*s[Z]+i[J]*s[Q],t[$]=i[Q]*s[q]+i[$]*s[U]+i[ee]*s[K]+i[J]*s[$],t[ee]=i[Q]*s[G]+i[$]*s[j]+i[ee]*s[W]+i[J]*s[ee],t[J]=i[Q]*s[N]+i[$]*s[_]+i[ee]*s[z]+i[J]*s[J],this.set(this.temp)}multiplyLeft(e){let t=this.temp,i=this.values,s=e.values;return t[D]=s[D]*i[D]+s[q]*i[H]+s[G]*i[Z]+s[N]*i[Q],t[q]=s[D]*i[q]+s[q]*i[U]+s[G]*i[K]+s[N]*i[$],t[G]=s[D]*i[G]+s[q]*i[j]+s[G]*i[W]+s[N]*i[ee],t[N]=s[D]*i[N]+s[q]*i[_]+s[G]*i[z]+s[N]*i[J],t[H]=s[H]*i[D]+s[U]*i[H]+s[j]*i[Z]+s[_]*i[Q],t[U]=s[H]*i[q]+s[U]*i[U]+s[j]*i[K]+s[_]*i[$],t[j]=s[H]*i[G]+s[U]*i[j]+s[j]*i[W]+s[_]*i[ee],t[_]=s[H]*i[N]+s[U]*i[_]+s[j]*i[z]+s[_]*i[J],t[Z]=s[Z]*i[D]+s[K]*i[H]+s[W]*i[Z]+s[z]*i[Q],t[K]=s[Z]*i[q]+s[K]*i[U]+s[W]*i[K]+s[z]*i[$],t[W]=s[Z]*i[G]+s[K]*i[j]+s[W]*i[W]+s[z]*i[ee],t[z]=s[Z]*i[N]+s[K]*i[_]+s[W]*i[z]+s[z]*i[J],t[Q]=s[Q]*i[D]+s[$]*i[H]+s[ee]*i[Z]+s[J]*i[Q],t[$]=s[Q]*i[q]+s[$]*i[U]+s[ee]*i[K]+s[J]*i[$],t[ee]=s[Q]*i[G]+s[$]*i[j]+s[ee]*i[W]+s[J]*i[ee],t[J]=s[Q]*i[N]+s[$]*i[_]+s[ee]*i[z]+s[J]*i[J],this.set(this.temp)}lookAt(e,t,i){let s=ke.xAxis,n=ke.yAxis,h=ke.zAxis;h.setFrom(t).normalize(),s.setFrom(t).normalize(),s.cross(i).normalize(),n.setFrom(s).cross(h).normalize(),this.identity();let a=this.values;return a[D]=s.x,a[q]=s.y,a[G]=s.z,a[H]=n.x,a[U]=n.y,a[j]=n.z,a[Z]=-h.x,a[K]=-h.y,a[W]=-h.z,ke.tmpMatrix.identity(),ke.tmpMatrix.values[N]=-e.x,ke.tmpMatrix.values[_]=-e.y,ke.tmpMatrix.values[z]=-e.z,this.multiply(ke.tmpMatrix),this}},Pe=ke;B(Pe,"xAxis",new Ce),B(Pe,"yAxis",new Ce),B(Pe,"zAxis",new Ce),B(Pe,"tmpMatrix",new ke);var gs=class{position=new Ce(0,0,0);direction=new Ce(0,0,-1);up=new Ce(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Pe;inverseProjectionView=new Pe;projection=new Pe;view=new Pe;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){let e=this.projection,t=this.view,i=this.projectionView,s=this.inverseProjectionView,n=this.zoom,h=this.viewportWidth,a=this.viewportHeight;e.ortho(n*(-h/2),n*(h/2),n*(-a/2),n*(a/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),i.set(e.values),i.multiply(t),s.set(i.values).invert()}screenToWorld(e,t,i){let s=e.x,n=i-e.y-1;return e.x=2*s/t-1,e.y=2*n/i-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,i){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=i*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},Ei=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;eventListeners=[];constructor(e){this.element=e,this.setupCallbacks(e)}setupCallbacks(e){let t=a=>{if(a instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=a.clientX-r.left,this.mouseY=a.clientY-r.top,this.buttonDown=!0,this.listeners.map(o=>{o.down&&o.down(this.mouseX,this.mouseY)}),document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}},i=a=>{if(a instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=a.clientX-r.left,this.mouseY=a.clientY-r.top,this.listeners.map(o=>{this.buttonDown?o.dragged&&o.dragged(this.mouseX,this.mouseY):o.moved&&o.moved(this.mouseX,this.mouseY)})}},s=a=>{if(a instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=a.clientX-r.left,this.mouseY=a.clientY-r.top,this.buttonDown=!1,this.listeners.map(o=>{o.up&&o.up(this.mouseX,this.mouseY)}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}},n=a=>{a.preventDefault();let r=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(r*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(r*=24),this.listeners.map(o=>{o.wheel&&o.wheel(a.deltaY)})};e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",i,!0),e.addEventListener("mouseup",s,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",a=>{if(!this.touch0||!this.touch1){var r=a.changedTouches;let o=r.item(0);if(!o)return;let l=e.getBoundingClientRect(),c=o.clientX-l.left,f=o.clientY-l.top,d=new xs(o.identifier,c,f);if(this.mouseX=c,this.mouseY=f,this.buttonDown=!0,!this.touch0)this.touch0=d,this.listeners.map(u=>{u.down&&u.down(d.x,d.y)});else if(!this.touch1){this.touch1=d;let u=this.touch1.x-this.touch0.x,m=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(u*u+m*m),this.listeners.map(x=>{x.zoom&&x.zoom(this.initialPinchDistance,this.initialPinchDistance)})}}a.preventDefault()},!1),e.addEventListener("touchmove",a=>{if(this.touch0){var r=a.changedTouches;let c=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var l=r[o];let f=l.clientX-c.left,d=l.clientY-c.top;this.touch0.identifier===l.identifier&&(this.touch0.x=this.mouseX=f,this.touch0.y=this.mouseY=d,this.listeners.map(u=>{u.dragged&&u.dragged(f,d)})),this.touch1&&this.touch1.identifier===l.identifier&&(this.touch1.x=this.mouseX=f,this.touch1.y=this.mouseY=d)}if(this.touch0&&this.touch1){let f=this.touch1.x-this.touch0.x,d=this.touch1.x-this.touch0.x,u=Math.sqrt(f*f+d*d);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,u)})}}a.preventDefault()},!1);let h=a=>{if(this.touch0){var r=a.changedTouches;let c=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var l=r[o];let f=l.clientX-c.left,d=l.clientY-c.top;if(this.touch0.identifier===l.identifier)if(this.touch0=null,this.mouseX=f,this.mouseY=d,this.listeners.map(u=>{u.up&&u.up(f,d)}),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(u=>{u.down&&u.down(this.touch0.x,this.touch0.y)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}a.preventDefault()};e.addEventListener("touchend",h,!1),e.addEventListener("touchcancel",h)}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},xs=class{constructor(e,t,i){this.identifier=e,this.x=t,this.y=i}},Mr=class{constructor(e,t){this.canvas=e,this.camera=t;let i=0,s=0,n=0,h=0,a=0,r=0,o=0,l=0;new Ei(e).addListener({down:(c,f)=>{i=t.position.x,s=t.position.y,h=r=c,a=o=f,l=t.zoom},dragged:(c,f)=>{let d=c-h,u=f-a,m=t.screenToWorld(new Ce(0,0),e.clientWidth,e.clientHeight),x=t.screenToWorld(new Ce(d,u),e.clientWidth,e.clientHeight).sub(m);t.position.set(i-x.x,s-x.y,0),t.update(),r=c,o=f},wheel:c=>{let f=c/200*t.zoom,d=t.zoom+f;if(d>0){let u=0,m=0;if(c<0)u=r,m=o;else{let y=new Ce(e.clientWidth/2+15,e.clientHeight/2),p=r-y.x,g=e.clientHeight-1-o-y.y;u=y.x-p,m=e.clientHeight-1-y.y+g}let x=t.screenToWorld(new Ce(u,m),e.clientWidth,e.clientHeight);t.zoom=d,t.update();let w=t.screenToWorld(new Ce(u,m),e.clientWidth,e.clientHeight);t.position.add(x.sub(w)),t.update()}},zoom:(c,f)=>{let d=c/f;t.zoom=l*d},up:(c,f)=>{r=c,o=f},moved:(c,f)=>{r=c,o=f}})}},ue=class{constructor(e,t,i){this.vertexShader=t,this.fragmentShader=i,this.vsSource=t,this.fsSource=i,this.context=e instanceof pe?e:new pe(e),this.context.addRestorable(this),this.compile()}context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let e=this.context.gl;try{if(this.vs=this.compileShader(e.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(e.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(t){throw this.dispose(),t}}compileShader(e,t){let i=this.context.gl,s=i.createShader(e);if(!s)throw new Error("Couldn't create shader.");if(i.shaderSource(s,t),i.compileShader(s),!i.getShaderParameter(s,i.COMPILE_STATUS)){let n="Couldn't compile shader: "+i.getShaderInfoLog(s);if(i.deleteShader(s),!i.isContextLost())throw new Error(n)}return s}compileProgram(e,t){let i=this.context.gl,s=i.createProgram();if(!s)throw new Error("Couldn't compile program.");if(i.attachShader(s,e),i.attachShader(s,t),i.linkProgram(s),!i.getProgramParameter(s,i.LINK_STATUS)){let n="Couldn't compile shader program: "+i.getProgramInfoLog(s);if(i.deleteProgram(s),!i.isContextLost())throw new Error(n)}return s}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,t){this.context.gl.uniform1i(this.getUniformLocation(e),t)}setUniformf(e,t){this.context.gl.uniform1f(this.getUniformLocation(e),t)}setUniform2f(e,t,i){this.context.gl.uniform2f(this.getUniformLocation(e),t,i)}setUniform3f(e,t,i,s){this.context.gl.uniform3f(this.getUniformLocation(e),t,i,s)}setUniform4f(e,t,i,s,n){this.context.gl.uniform4f(this.getUniformLocation(e),t,i,s,n)}setUniform2x2f(e,t){let i=this.context.gl;this.tmp2x2.set(t),i.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,t){let i=this.context.gl;this.tmp3x3.set(t),i.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,t){let i=this.context.gl;this.tmp4x4.set(t),i.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=t.getUniformLocation(this.program,e);if(!i&&!t.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return i}getAttributeLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=t.getAttribLocation(this.program,e);if(i==-1&&!t.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return i}dispose(){this.context.removeRestorable(this);let e=this.context.gl;this.vs&&(e.deleteShader(this.vs),this.vs=null),this.fs&&(e.deleteShader(this.fs),this.fs=null),this.program&&(e.deleteProgram(this.program),this.program=null)}static newColoredTextured(e){let t=`
|
|
3
|
+
attribute vec4 ${ue.POSITION};
|
|
4
|
+
attribute vec4 ${ue.COLOR};
|
|
5
|
+
attribute vec2 ${ue.TEXCOORDS};
|
|
6
|
+
uniform mat4 ${ue.MVP_MATRIX};
|
|
7
7
|
varying vec4 v_color;
|
|
8
8
|
varying vec2 v_texCoords;
|
|
9
9
|
|
|
10
10
|
void main () {
|
|
11
|
-
v_color = ${
|
|
12
|
-
v_texCoords = ${
|
|
13
|
-
gl_Position = ${
|
|
11
|
+
v_color = ${ue.COLOR};
|
|
12
|
+
v_texCoords = ${ue.TEXCOORDS};
|
|
13
|
+
gl_Position = ${ue.MVP_MATRIX} * ${ue.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
|
|
30
|
-
attribute vec4 ${
|
|
31
|
-
attribute vec4 ${
|
|
32
|
-
attribute vec4 ${
|
|
33
|
-
attribute vec2 ${
|
|
34
|
-
uniform mat4 ${
|
|
29
|
+
`;return new ue(e,t,i)}static newTwoColoredTextured(e){let t=`
|
|
30
|
+
attribute vec4 ${ue.POSITION};
|
|
31
|
+
attribute vec4 ${ue.COLOR};
|
|
32
|
+
attribute vec4 ${ue.COLOR2};
|
|
33
|
+
attribute vec2 ${ue.TEXCOORDS};
|
|
34
|
+
uniform mat4 ${ue.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 = ${
|
|
41
|
-
v_dark = ${
|
|
42
|
-
v_texCoords = ${
|
|
43
|
-
gl_Position = ${
|
|
40
|
+
v_light = ${ue.COLOR};
|
|
41
|
+
v_dark = ${ue.COLOR2};
|
|
42
|
+
v_texCoords = ${ue.TEXCOORDS};
|
|
43
|
+
gl_Position = ${ue.MVP_MATRIX} * ${ue.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
|
|
63
|
-
attribute vec4 ${
|
|
64
|
-
attribute vec4 ${
|
|
65
|
-
uniform mat4 ${
|
|
62
|
+
`;return new ue(e,t,i)}static newColored(e){let t=`
|
|
63
|
+
attribute vec4 ${ue.POSITION};
|
|
64
|
+
attribute vec4 ${ue.COLOR};
|
|
65
|
+
uniform mat4 ${ue.MVP_MATRIX};
|
|
66
66
|
varying vec4 v_color;
|
|
67
67
|
|
|
68
68
|
void main () {
|
|
69
|
-
v_color = ${
|
|
70
|
-
gl_Position = ${
|
|
69
|
+
v_color = ${ue.COLOR};
|
|
70
|
+
gl_Position = ${ue.MVP_MATRIX} * ${ue.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 ft(t,e,i)}},mt=ft;mt.MVP_MATRIX="u_projTrans",mt.POSITION="a_position",mt.COLOR="a_color",mt.COLOR2="a_color2",mt.TEXCOORDS="a_texCoords",mt.SAMPLER="u_texture";var Yi=class{constructor(t,e,i,s){this.attributes=e,this.verticesBuffer=null,this.verticesLength=0,this.dirtyVertices=!1,this.indicesBuffer=null,this.indicesLength=0,this.dirtyIndices=!1,this.elementsPerVertex=0,this.context=t instanceof xt?t:new xt(t),this.elementsPerVertex=0;for(let n=0;n<e.length;n++)this.elementsPerVertex+=e[n].numElements;this.vertices=new Float32Array(i*this.elementsPerVertex),this.indices=new Uint16Array(s),this.context.addRestorable(this)}getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(t){this.dirtyVertices=!0,this.verticesLength=t}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(t){this.dirtyIndices=!0,this.indicesLength=t}getIndices(){return this.indices}getVertexSizeInFloats(){let t=0;for(var e=0;e<this.attributes.length;e++){let i=this.attributes[e];t+=i.numElements}return t}setVertices(t){if(this.dirtyVertices=!0,t.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(t,0),this.verticesLength=t.length}setIndices(t){if(this.dirtyIndices=!0,t.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(t,0),this.indicesLength=t.length}draw(t,e){this.drawWithOffset(t,e,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(t,e,i,s){let n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(t),this.indicesLength>0?n.drawElements(e,s,n.UNSIGNED_SHORT,i*2):n.drawArrays(e,i,s),this.unbind(t)}bind(t){let e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer);let i=0;for(let s=0;s<this.attributes.length;s++){let n=this.attributes[s],c=t.getAttributeLocation(n.name);e.enableVertexAttribArray(c),e.vertexAttribPointer(c,n.numElements,e.FLOAT,!1,this.elementsPerVertex*4,i*4),i+=n.numElements}this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(t){let e=this.context.gl;for(let i=0;i<this.attributes.length;i++){let s=this.attributes[i],n=t.getAttributeLocation(s.name);e.disableVertexAttribArray(n)}e.bindBuffer(e.ARRAY_BUFFER,null),this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}update(){let t=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),t.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=t.createBuffer()),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),t.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let t=this.context.gl;t.deleteBuffer(this.verticesBuffer),t.deleteBuffer(this.indicesBuffer)}},Qt=class{constructor(t,e,i){this.name=t,this.type=e,this.numElements=i}},Me=class extends Qt{constructor(){super(mt.POSITION,Gt.Float,2)}},mr=class extends Qt{constructor(){super(mt.POSITION,Gt.Float,3)}},Mi=class extends Qt{constructor(t=0){super(mt.TEXCOORDS+(t==0?"":t),Gt.Float,2)}},Ee=class extends Qt{constructor(){super(mt.COLOR,Gt.Float,4)}},fs=class extends Qt{constructor(){super(mt.COLOR2,Gt.Float,4)}},Gt=(t=>(t[t.Float=0]="Float",t))(Gt||{}),Bt=1,gr=769,us=770,ms=771,gs=774,Ht=class{constructor(t,e=!0,i=10920){if(this.drawCalls=0,this.isDrawing=!1,this.shader=null,this.lastTexture=null,this.verticesLength=0,this.indicesLength=0,this.cullWasEnabled=!1,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 s=e?[new Me,new Ee,new Mi,new fs]:[new Me,new Ee,new Mi];this.mesh=new Yi(t,s,i,i*3);let n=this.context.gl;this.srcColorBlend=n.SRC_ALPHA,this.srcAlphaBlend=n.ONE,this.dstBlend=n.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 e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),Ht.disableCulling&&(this.cullWasEnabled=e.isEnabled(e.CULL_FACE),this.cullWasEnabled&&e.disable(e.CULL_FACE))}setBlendMode(t,e){const i=Ht.blendModesGL[t],s=e?i.srcRgbPma:i.srcRgb,n=i.srcAlpha,c=i.dstRgb;if(this.srcColorBlend==s&&this.srcAlphaBlend==n&&this.dstBlend==c)return;this.srcColorBlend=s,this.srcAlphaBlend=n,this.dstBlend=c,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(s,c,n,c)}draw(t,e,i){t!=this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+e.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let s=this.mesh.numVertices();this.mesh.getVertices().set(e,this.verticesLength),this.verticesLength+=e.length,this.mesh.setVerticesLength(this.verticesLength);let n=this.mesh.getIndices();for(let c=this.indicesLength,l=0;l<i.length;c++,l++)n[c]=i[l]+s;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++,Ht.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),Ht.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let t=Ht.globalDrawCalls;return Ht.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},$t=Ht;$t.disableCulling=!1,$t.globalDrawCalls=0,$t.blendModesGL=[{srcRgb:us,srcRgbPma:Bt,dstRgb:ms,srcAlpha:Bt},{srcRgb:us,srcRgbPma:Bt,dstRgb:Bt,srcAlpha:Bt},{srcRgb:gs,srcRgbPma:gs,dstRgb:ms,srcAlpha:Bt},{srcRgb:Bt,srcRgbPma:Bt,dstRgb:gr,srcAlpha:Bt}];var Ei=class{constructor(t,e=10920){if(this.isDrawing=!1,this.shapeType=bt.Filled,this.color=new B(1,1,1,1),this.shader=null,this.vertexIndex=0,this.tmp=new zt,e>10920)throw new Error("Can't have more than 10920 triangles per batch: "+e);this.context=t instanceof xt?t:new xt(t),this.mesh=new Yi(t,[new Me,new Ee],e,0);let i=this.context.gl;this.srcColorBlend=i.SRC_ALPHA,this.srcAlphaBlend=i.ONE,this.dstBlend=i.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=t,this.vertexIndex=0,this.isDrawing=!0;let e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(t,e,i){this.srcColorBlend=t,this.srcAlphaBlend=e,this.dstBlend=i,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(t,i,e,i))}setColor(t){this.color.setFromColor(t)}setColorWith(t,e,i,s){this.color.set(t,e,i,s)}point(t,e,i){this.check(bt.Point,1),i||(i=this.color),this.vertex(t,e,i)}line(t,e,i,s,n){this.check(bt.Line,2);let c=this.mesh.getVertices(),l=this.vertexIndex;n||(n=this.color),this.vertex(t,e,n),this.vertex(i,s,n)}triangle(t,e,i,s,n,c,l,r,o,a){this.check(t?bt.Filled:bt.Line,3);let h=this.mesh.getVertices(),d=this.vertexIndex;r||(r=this.color),o||(o=this.color),a||(a=this.color),t?(this.vertex(e,i,r),this.vertex(s,n,o),this.vertex(c,l,a)):(this.vertex(e,i,r),this.vertex(s,n,o),this.vertex(s,n,r),this.vertex(c,l,o),this.vertex(c,l,r),this.vertex(e,i,o))}quad(t,e,i,s,n,c,l,r,o,a,h,d,f){this.check(t?bt.Filled:bt.Line,3);let u=this.mesh.getVertices(),m=this.vertexIndex;a||(a=this.color),h||(h=this.color),d||(d=this.color),f||(f=this.color),t?(this.vertex(e,i,a),this.vertex(s,n,h),this.vertex(c,l,d),this.vertex(c,l,d),this.vertex(r,o,f),this.vertex(e,i,a)):(this.vertex(e,i,a),this.vertex(s,n,h),this.vertex(s,n,h),this.vertex(c,l,d),this.vertex(c,l,d),this.vertex(r,o,f),this.vertex(r,o,f),this.vertex(e,i,a))}rect(t,e,i,s,n,c){this.quad(t,e,i,e+s,i,e+s,i+n,e,i+n,c,c,c,c)}rectLine(t,e,i,s,n,c,l){this.check(t?bt.Filled:bt.Line,8),l||(l=this.color);let r=this.tmp.set(n-i,e-s);r.normalize(),c*=.5;let o=r.x*c,a=r.y*c;t?(this.vertex(e+o,i+a,l),this.vertex(e-o,i-a,l),this.vertex(s+o,n+a,l),this.vertex(s-o,n-a,l),this.vertex(s+o,n+a,l),this.vertex(e-o,i-a,l)):(this.vertex(e+o,i+a,l),this.vertex(e-o,i-a,l),this.vertex(s+o,n+a,l),this.vertex(s-o,n-a,l),this.vertex(s+o,n+a,l),this.vertex(e+o,i+a,l),this.vertex(s-o,n-a,l),this.vertex(e-o,i-a,l))}x(t,e,i){this.line(t-i,e-i,t+i,e+i),this.line(t-i,e+i,t+i,e-i)}polygon(t,e,i,s){if(i<3)throw new Error("Polygon must contain at least 3 vertices");this.check(bt.Line,i*2),s||(s=this.color);let n=this.mesh.getVertices(),c=this.vertexIndex;e<<=1,i<<=1;let l=t[e],r=t[e+1],o=e+i;for(let a=e,h=e+i-2;a<h;a+=2){let d=t[a],f=t[a+1],u=0,m=0;a+2>=o?(u=l,m=r):(u=t[a+2],m=t[a+3]),this.vertex(d,f,s),this.vertex(u,m,s)}}circle(t,e,i,s,n,c=0){if(c==0&&(c=Math.max(1,6*F.cbrt(s)|0)),c<=0)throw new Error("segments must be > 0.");n||(n=this.color);let l=2*F.PI/c,r=Math.cos(l),o=Math.sin(l),a=s,h=0;if(t){this.check(bt.Filled,c*3+3),c--;for(let f=0;f<c;f++){this.vertex(e,i,n),this.vertex(e+a,i+h,n);let u=a;a=r*a-o*h,h=o*u+r*h,this.vertex(e+a,i+h,n)}this.vertex(e,i,n),this.vertex(e+a,i+h,n)}else{this.check(bt.Line,c*2+2);for(let f=0;f<c;f++){this.vertex(e+a,i+h,n);let u=a;a=r*a-o*h,h=o*u+r*h,this.vertex(e+a,i+h,n)}this.vertex(e+a,i+h,n)}let d=a;a=s,h=0,this.vertex(e+a,i+h,n)}curve(t,e,i,s,n,c,l,r,o,a){this.check(bt.Line,o*2+2),a||(a=this.color);let h=1/o,d=h*h,f=h*h*h,u=3*h,m=3*d,x=6*d,p=6*f,v=t-i*2+n,g=e-s*2+c,w=(i-n)*3-t+l,b=(s-c)*3-e+r,y=t,C=e,A=(i-t)*u+v*m+w*f,T=(s-e)*u+g*m+b*f,E=v*x+w*p,R=g*x+b*p,L=w*p,X=b*p;for(;o-- >0;)this.vertex(y,C,a),y+=A,C+=T,A+=E,T+=R,E+=L,R+=X,this.vertex(y,C,a);this.vertex(y,C,a),this.vertex(l,r,a)}vertex(t,e,i){let s=this.vertexIndex,n=this.mesh.getVertices();n[s++]=t,n[s++]=e,n[s++]=i.r,n[s++]=i.g,n[s++]=i.b,n[s++]=i.a,this.vertexIndex=s}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let t=this.context.gl;t.disable(t.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(t,e){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==t)if(this.mesh.maxVertices()-this.mesh.numVertices()<e)this.flush();else return;else this.flush(),this.shapeType=t}dispose(){this.mesh.dispose()}},bt=(t=>(t[t.Point=0]="Point",t[t.Line=1]="Line",t[t.Filled=4]="Filled",t))(bt||{}),ki=class{constructor(t){this.boneLineColor=new B(1,0,0,1),this.boneOriginColor=new B(0,1,0,1),this.attachmentLineColor=new B(0,0,1,.5),this.triangleLineColor=new B(1,.64,0,.5),this.pathColor=new B().setFromString("FF7F00"),this.clipColor=new B(.8,0,0,2),this.aabbColor=new B(0,1,0,.5),this.drawBones=!0,this.drawRegionAttachments=!0,this.drawBoundingBoxes=!0,this.drawMeshHull=!0,this.drawMeshTriangles=!0,this.drawPaths=!0,this.drawSkeletonXY=!1,this.drawClipping=!0,this.premultipliedAlpha=!1,this.scale=1,this.boneWidth=2,this.bounds=new os,this.temp=new Array,this.vertices=P.newFloatArray(2*1024),this.context=t instanceof xt?t:new xt(t)}draw(t,e,i){let s=e.x,n=e.y,c=this.context.gl,l=this.premultipliedAlpha?c.ONE:c.SRC_ALPHA;t.setBlendMode(l,c.ONE,c.ONE_MINUS_SRC_ALPHA);let r=e.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let o=0,a=r.length;o<a;o++){let h=r[o];if(i&&i.indexOf(h.data.name)>-1||!h.parent)continue;let d=h.data.length*h.a+h.worldX,f=h.data.length*h.c+h.worldY;t.rectLine(!0,h.worldX,h.worldY,d,f,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(s,n,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);let o=e.slots;for(let a=0,h=o.length;a<h;a++){let d=o[a],f=d.getAttachment();if(f instanceof nt){let u=f,m=this.vertices;u.computeWorldVertices(d,m,0,2),t.line(m[0],m[1],m[2],m[3]),t.line(m[2],m[3],m[4],m[5]),t.line(m[4],m[5],m[6],m[7]),t.line(m[6],m[7],m[0],m[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=e.slots;for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof Ot))continue;let u=f,m=this.vertices;u.computeWorldVertices(d,0,u.worldVerticesLength,m,0,2);let x=u.triangles,p=u.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let v=0,g=x.length;v<g;v+=3){let w=x[v]*2,b=x[v+1]*2,y=x[v+2]*2;t.triangle(!1,m[w],m[w+1],m[b],m[b+1],m[y],m[y+1])}}if(this.drawMeshHull&&p>0){t.setColor(this.attachmentLineColor),p=(p>>1)*2;let v=m[p-2],g=m[p-1];for(let w=0,b=p;w<b;w+=2){let y=m[w],C=m[w+1];t.line(y,C,v,g),v=y,g=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(e,!0),t.setColor(this.aabbColor),t.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let a=o.polygons,h=o.boundingBoxes;for(let d=0,f=a.length;d<f;d++){let u=a[d];t.setColor(h[d].color),t.polygon(u,0,u.length)}}if(this.drawPaths){let o=e.slots;for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof qt))continue;let u=f,m=u.worldVerticesLength,x=this.temp=P.setArraySize(this.temp,m,0);u.computeWorldVertices(d,0,m,x,0,2);let p=this.pathColor,v=x[2],g=x[3],w=0,b=0;if(u.closed){t.setColor(p);let y=x[0],C=x[1],A=x[m-2],T=x[m-1];w=x[m-4],b=x[m-3],t.curve(v,g,y,C,A,T,w,b,32),t.setColor(ki.LIGHT_GRAY),t.line(v,g,y,C),t.line(w,b,A,T)}m-=4;for(let y=4;y<m;y+=6){let C=x[y],A=x[y+1],T=x[y+2],E=x[y+3];w=x[y+4],b=x[y+5],t.setColor(p),t.curve(v,g,C,A,T,E,w,b,32),t.setColor(ki.LIGHT_GRAY),t.line(v,g,C,A),t.line(w,b,T,E),v=w,g=b}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let o=0,a=r.length;o<a;o++){let h=r[o];i&&i.indexOf(h.data.name)>-1||t.circle(!0,h.worldX,h.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=e.slots;t.setColor(this.clipColor);for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof le))continue;let u=f,m=u.worldVerticesLength,x=this.temp=P.setArraySize(this.temp,m,0);u.computeWorldVertices(d,0,m,x,0,2);for(let p=0,v=x.length;p<v;p+=2){let g=x[p],w=x[p+1],b=x[(p+2)%x.length],y=x[(p+3)%x.length];t.line(g,w,b,y)}}}}dispose(){}},ke=ki;ke.LIGHT_GRAY=new B(.7529411764705882,.7529411764705882,.7529411764705882,1),ke.GREEN=new B(0,1,0,1);var xr=class{constructor(t,e,i){this.vertices=t,this.numVertices=e,this.numFloats=i}},xs=class{constructor(t,e=!0){this.premultipliedAlpha=!1,this.tempColor=new B,this.tempColor2=new B,this.vertexSize=2+2+4,this.twoColorTint=!1,this.renderable=new xr([],0,0),this.clipper=new Ie,this.temp=new zt,this.temp2=new zt,this.temp3=new B,this.temp4=new B,this.twoColorTint=e,e&&(this.vertexSize+=4),this.vertices=P.newFloatArray(this.vertexSize*1024)}draw(t,e,i=-1,s=-1,n=null){let c=this.clipper,l=this.premultipliedAlpha,r=this.twoColorTint,o=null,a=this.renderable,h,d,f=e.drawOrder,u,m=e.color,x=r?12:8,p=!1;i==-1&&(p=!0);for(let v=0,g=f.length;v<g;v++){let w=c.isClipping()?2:x,b=f[v];if(!b.bone.active){c.clipEndWithSlot(b);continue}if(i>=0&&i==b.data.index&&(p=!0),!p){c.clipEndWithSlot(b);continue}s>=0&&s==b.data.index&&(p=!1);let y=b.getAttachment(),C;if(y instanceof nt){let A=y;a.vertices=this.vertices,a.numVertices=4,a.numFloats=w<<2,A.computeWorldVertices(b,a.vertices,0,w),d=xs.QUAD_TRIANGLES,h=A.uvs,C=A.region.texture,u=A.color}else if(y instanceof Ot){let A=y;a.vertices=this.vertices,a.numVertices=A.worldVerticesLength>>1,a.numFloats=a.numVertices*w,a.numFloats>a.vertices.length&&(a.vertices=this.vertices=P.newFloatArray(a.numFloats)),A.computeWorldVertices(b,0,A.worldVerticesLength,a.vertices,0,w),d=A.triangles,C=A.region.texture,h=A.uvs,u=A.color}else if(y instanceof le){let A=y;c.clipStart(b,A);continue}else{c.clipEndWithSlot(b);continue}if(C){let A=b.color,T=this.tempColor;T.r=m.r*A.r*u.r,T.g=m.g*A.g*u.g,T.b=m.b*A.b*u.b,T.a=m.a*A.a*u.a,l&&(T.r*=T.a,T.g*=T.a,T.b*=T.a);let E=this.tempColor2;b.darkColor?(l?(E.r=b.darkColor.r*T.a,E.g=b.darkColor.g*T.a,E.b=b.darkColor.b*T.a):E.setFromColor(b.darkColor),E.a=l?1:0):E.set(0,0,0,1);let R=b.data.blendMode;if(R!=o&&(o=R,t.setBlendMode(o,l)),c.isClipping()){c.clipTriangles(a.vertices,a.numFloats,d,d.length,h,T,E,r);let L=new Float32Array(c.clippedVertices),X=c.clippedTriangles;n&&n(L,L.length,x),t.draw(C,L,X)}else{let L=a.vertices;if(r)for(let k=2,M=0,I=a.numFloats;k<I;k+=x,M+=2)L[k]=T.r,L[k+1]=T.g,L[k+2]=T.b,L[k+3]=T.a,L[k+4]=h[M],L[k+5]=h[M+1],L[k+6]=E.r,L[k+7]=E.g,L[k+8]=E.b,L[k+9]=E.a;else for(let k=2,M=0,I=a.numFloats;k<I;k+=x,M+=2)L[k]=T.r,L[k+1]=T.g,L[k+2]=T.b,L[k+3]=T.a,L[k+4]=h[M],L[k+5]=h[M+1];let X=a.vertices.subarray(0,a.numFloats);n&&n(a.vertices,a.numFloats,x),t.draw(C,X,d)}}c.clipEndWithSlot(b)}c.clipEnd()}},Ri=xs;Ri.QUAD_TRIANGLES=[0,1,2,2,3,0];var S=[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],Re=[0,1,2,2,3,0],Fe=new B(1,1,1,1),ws=class{constructor(t,e,i=!0){this.twoColorTint=!1,this.activeRenderer=null,this.canvas=t,this.context=e instanceof xt?e:new xt(e),this.twoColorTint=i,this.camera=new cs(t.width,t.height),this.batcherShader=i?mt.newTwoColoredTextured(this.context):mt.newColoredTextured(this.context),this.batcher=new $t(this.context,i),this.shapesShader=mt.newColored(this.context),this.shapes=new Ei(this.context),this.skeletonRenderer=new Ri(this.context,i),this.skeletonDebugRenderer=new ke(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(t,e=!1,i=-1,s=-1,n=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=e,this.skeletonRenderer.draw(this.batcher,t,i,s,n)}drawSkeletonDebug(t,e=!1,i){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=e,this.skeletonDebugRenderer.draw(this.shapes,t,i)}drawTexture(t,e,i,s,n,c){this.enableRenderer(this.batcher),c||(c=Fe);var l=0;S[l++]=e,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=0,S[l++]=1,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=e+s,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=1,S[l++]=1,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=e+s,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=1,S[l++]=0,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=e,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=0,S[l++]=0,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l]=0),this.batcher.draw(t,S,Re)}drawTextureUV(t,e,i,s,n,c,l,r,o,a){this.enableRenderer(this.batcher),a||(a=Fe);var h=0;S[h++]=e,S[h++]=i,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=c,S[h++]=l,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=e+s,S[h++]=i,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=r,S[h++]=l,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=e+s,S[h++]=i+n,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=r,S[h++]=o,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=e,S[h++]=i+n,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=c,S[h++]=o,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h]=0),this.batcher.draw(t,S,Re)}drawTextureRotated(t,e,i,s,n,c,l,r,o){this.enableRenderer(this.batcher),o||(o=Fe);let a=e+c,h=i+l,d=-c,f=-l,u=s-c,m=n-l,x=d,p=f,v=d,g=m,w=u,b=m,y=u,C=f,A=0,T=0,E=0,R=0,L=0,X=0,k=0,M=0;if(r!=0){let W=F.cosDeg(r),it=F.sinDeg(r);A=W*x-it*p,T=it*x+W*p,k=W*v-it*g,M=it*v+W*g,L=W*w-it*b,X=it*w+W*b,E=L+(A-k),R=X+(T-M)}else A=x,T=p,k=v,M=g,L=w,X=b,E=y,R=C;A+=a,T+=h,E+=a,R+=h,L+=a,X+=h,k+=a,M+=h;var I=0;S[I++]=A,S[I++]=T,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=E,S[I++]=R,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=L,S[I++]=X,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=k,S[I++]=M,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I]=0),this.batcher.draw(t,S,Re)}drawRegion(t,e,i,s,n,c){this.enableRenderer(this.batcher),c||(c=Fe);var l=0;S[l++]=e,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=t.u,S[l++]=t.v2,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=e+s,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=t.u2,S[l++]=t.v2,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=e+s,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=t.u2,S[l++]=t.v,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=e,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=t.u,S[l++]=t.v,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l]=0),this.batcher.draw(t.page.texture,S,Re)}line(t,e,i,s,n,c){this.enableRenderer(this.shapes),this.shapes.line(t,e,i,s,n)}triangle(t,e,i,s,n,c,l,r,o,a){this.enableRenderer(this.shapes),this.shapes.triangle(t,e,i,s,n,c,l,r,o,a)}quad(t,e,i,s,n,c,l,r,o,a,h,d,f){this.enableRenderer(this.shapes),this.shapes.quad(t,e,i,s,n,c,l,r,o,a,h,d,f)}rect(t,e,i,s,n,c){this.enableRenderer(this.shapes),this.shapes.rect(t,e,i,s,n,c)}rectLine(t,e,i,s,n,c,l){this.enableRenderer(this.shapes),this.shapes.rectLine(t,e,i,s,n,c,l)}polygon(t,e,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(t,e,i,s)}circle(t,e,i,s,n,c=0){this.enableRenderer(this.shapes),this.shapes.circle(t,e,i,s,n,c)}curve(t,e,i,s,n,c,l,r,o,a){this.enableRenderer(this.shapes),this.shapes.curve(t,e,i,s,n,c,l,r,o,a)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(t){let e=this.canvas;var i=window.devicePixelRatio||1,s=Math.round(e.clientWidth*i),n=Math.round(e.clientHeight*i);if((e.width!=s||e.height!=n)&&(e.width=s,e.height=n),this.context.gl.viewport(0,0,e.width,e.height),t===Xe.Expand)this.camera.setViewport(s,n);else if(t===Xe.Fit){let c=e.width,l=e.height,r=this.camera.viewportWidth,o=this.camera.viewportHeight,a=o/r,h=l/c,d=a<h?r/c:o/l;this.camera.setViewport(c*d,l*d)}this.camera.update()}enableRenderer(t){this.activeRenderer!==t&&(this.end(),t instanceof $t?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(mt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):t instanceof Ei?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(mt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Xe=(t=>(t[t.Stretch=0]="Stretch",t[t.Expand=1]="Expand",t[t.Fit=2]="Fit",t))(Xe||{}),he,te,bs=0,wr=1,Fi=1,ps=165,vs=108,jt=163,br=class{constructor(t){if(this.logo=null,this.spinner=null,this.angle=0,this.fadeOut=0,this.fadeIn=0,this.timeKeeper=new Oe,this.backgroundColor=new B(.135,.135,.135,1),this.tempColor=new B,this.renderer=t,this.timeKeeper.maxDelta=9,!te){let e=navigator.userAgent.indexOf("Safari")>-1,i=()=>bs++;te=new Image,te.src=vr,e||(te.crossOrigin="anonymous"),te.onload=i,he=new Image,he.src=pr,e||(he.crossOrigin="anonymous"),he.onload=i}}dispose(){var t,e;(t=this.logo)==null||t.dispose(),(e=this.spinner)==null||e.dispose()}draw(t=!1){if(bs<2||t&&this.fadeOut>Fi)return;this.timeKeeper.update();let e=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(e,5));let i=this.tempColor,s=this.renderer,n=s.canvas,c=s.context.gl;if(s.resize(1),s.camera.position.set(n.width/2,n.height/2,0),s.batcher.setBlendMode(0,!0),t){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Fi)return;i.setFromColor(this.backgroundColor),e=1-this.fadeOut/Fi,e=1-(e-1)*(e-1),i.a*=e,i.a>0&&(s.camera.zoom=1,s.begin(),s.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,i,i,i,i),s.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(c.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),c.clear(c.COLOR_BUFFER_BIT)),e=1;e*=Math.min(this.fadeIn/wr,1),i.set(e,e,e,e),this.logo||(this.logo=new oe(s.context,te),this.spinner=new oe(s.context,he)),s.camera.zoom=Math.max(1,jt/n.height),s.begin(),s.drawTexture(this.logo,(n.width-ps)/2,(n.height-vs)/2,ps,vs,i),this.spinner&&s.drawTextureRotated(this.spinner,(n.width-jt)/2,(n.height-jt)/2,jt,jt,jt/2,jt/2,this.angle,i),s.end()}},pr="data:image/png;base64,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",vr="data:image/png;base64,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",yr=class{constructor(t,e){this.config=e,this.time=new Oe,this.disposed=!1,e.pathPrefix||(e.pathPrefix=""),e.app||(e.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),e.webglConfig||(e.webglConfig={alpha:!0}),this.htmlCanvas=t,this.context=new xt(t,e.webglConfig),this.renderer=new ws(t,this.context),this.gl=this.context.gl,this.assetManager=new hs(this.context,e.pathPrefix),this.input=new Ii(t),e.app.loadAssets&&e.app.loadAssets(this);let i=()=>{this.disposed||(requestAnimationFrame(i),this.time.update(),e.app.update&&e.app.update(this,this.time.delta),e.app.render&&e.app.render(this))},s=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?e.app.error&&e.app.error(this,this.assetManager.getErrors()):(e.app.initialize&&e.app.initialize(this),i());return}requestAnimationFrame(s)}};requestAnimationFrame(s)}clear(t,e,i,s){this.gl.clearColor(t,e,i,s),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Rs(Pi)})();
|
|
84
|
+
`;return new ue(e,t,i)}},ge=ue;B(ge,"MVP_MATRIX","u_projTrans"),B(ge,"POSITION","a_position"),B(ge,"COLOR","a_color"),B(ge,"COLOR2","a_color2"),B(ge,"TEXCOORDS","a_texCoords"),B(ge,"SAMPLER","u_texture");var Ri=class{constructor(e,t,i,s){this.attributes=t,this.context=e instanceof pe?e:new pe(e),this.elementsPerVertex=0;for(let n=0;n<t.length;n++)this.elementsPerVertex+=t[n].numElements;this.vertices=new Float32Array(i*this.elementsPerVertex),this.indices=new Uint16Array(s),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 i=this.attributes[t];e+=i.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,i,s){let n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?n.drawElements(t,s,n.UNSIGNED_SHORT,i*2):n.drawArrays(t,i,s),this.unbind(e)}bind(e){let t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let i=0;for(let s=0;s<this.attributes.length;s++){let n=this.attributes[s],h=e.getAttributeLocation(n.name);t.enableVertexAttribArray(h),t.vertexAttribPointer(h,n.numElements,t.FLOAT,!1,this.elementsPerVertex*4,i*4),i+=n.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){let t=this.context.gl;for(let i=0;i<this.attributes.length;i++){let s=this.attributes[i],n=e.getAttributeLocation(s.name);t.disableVertexAttribArray(n)}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)}},et=class{constructor(e,t,i){this.name=e,this.type=t,this.numElements=i}},kt=class extends et{constructor(){super(ge.POSITION,je.Float,2)}},Er=class extends et{constructor(){super(ge.POSITION,je.Float,3)}},Yi=class extends et{constructor(e=0){super(ge.TEXCOORDS+(e==0?"":e),je.Float,2)}},Ft=class extends et{constructor(){super(ge.COLOR,je.Float,4)}},ps=class extends et{constructor(){super(ge.COLOR2,je.Float,4)}},je=(e=>(e[e.Float=0]="Float",e))(je||{}),Be=1,Rr=769,ws=770,bs=771,vs=774,Ze=class{context;drawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(e,t=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=e instanceof pe?e:new pe(e);let s=t?[new kt,new Ft,new Yi,new ps]:[new kt,new Ft,new Yi];this.mesh=new Ri(e,s,i,i*3);let n=this.context.gl;this.srcColorBlend=n.SRC_ALPHA,this.srcAlphaBlend=n.ONE,this.dstBlend=n.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=e,this.lastTexture=null,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),Ze.disableCulling&&(this.cullWasEnabled=t.isEnabled(t.CULL_FACE),this.cullWasEnabled&&t.disable(t.CULL_FACE))}setBlendMode(e,t){const i=Ze.blendModesGL[e],s=t?i.srcRgbPma:i.srcRgb,n=i.srcAlpha,h=i.dstRgb;if(this.srcColorBlend==s&&this.srcAlphaBlend==n&&this.dstBlend==h)return;this.srcColorBlend=s,this.srcAlphaBlend=n,this.dstBlend=h,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(s,h,n,h)}draw(e,t,i){e!=this.lastTexture?(this.flush(),this.lastTexture=e):(this.verticesLength+t.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let s=this.mesh.numVertices();this.mesh.getVertices().set(t,this.verticesLength),this.verticesLength+=t.length,this.mesh.setVerticesLength(this.verticesLength);let n=this.mesh.getIndices();for(let h=this.indicesLength,a=0;a<i.length;h++,a++)n[h]=i[a]+s;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++,Ze.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let e=this.context.gl;e.disable(e.BLEND),Ze.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=Ze.globalDrawCalls;return Ze.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},tt=Ze;B(tt,"disableCulling",!1),B(tt,"globalDrawCalls",0),B(tt,"blendModesGL",[{srcRgb:ws,srcRgbPma:Be,dstRgb:bs,srcAlpha:Be},{srcRgb:ws,srcRgbPma:Be,dstRgb:Be,srcAlpha:Be},{srcRgb:vs,srcRgbPma:vs,dstRgb:bs,srcAlpha:Be},{srcRgb:Be,srcRgbPma:Be,dstRgb:Rr,srcAlpha:Be}]);var ki=class{context;isDrawing=!1;mesh;shapeType=be.Filled;color=new V(1,1,1,1);shader=null;vertexIndex=0;tmp=new ze;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 pe?e:new pe(e),this.mesh=new Ri(e,[new kt,new Ft],t,0);let i=this.context.gl;this.srcColorBlend=i.SRC_ALPHA,this.srcAlphaBlend=i.ONE,this.dstBlend=i.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,i){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=i,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,i,t,i))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,i,s){this.color.set(e,t,i,s)}point(e,t,i){this.check(be.Point,1),i||(i=this.color),this.vertex(e,t,i)}line(e,t,i,s,n){this.check(be.Line,2);let h=this.mesh.getVertices(),a=this.vertexIndex;n||(n=this.color),this.vertex(e,t,n),this.vertex(i,s,n)}triangle(e,t,i,s,n,h,a,r,o,l){this.check(e?be.Filled:be.Line,3);let c=this.mesh.getVertices(),f=this.vertexIndex;r||(r=this.color),o||(o=this.color),l||(l=this.color),e?(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(h,a,l)):(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(s,n,r),this.vertex(h,a,o),this.vertex(h,a,r),this.vertex(t,i,o))}quad(e,t,i,s,n,h,a,r,o,l,c,f,d){this.check(e?be.Filled:be.Line,3);let u=this.mesh.getVertices(),m=this.vertexIndex;l||(l=this.color),c||(c=this.color),f||(f=this.color),d||(d=this.color),e?(this.vertex(t,i,l),this.vertex(s,n,c),this.vertex(h,a,f),this.vertex(h,a,f),this.vertex(r,o,d),this.vertex(t,i,l)):(this.vertex(t,i,l),this.vertex(s,n,c),this.vertex(s,n,c),this.vertex(h,a,f),this.vertex(h,a,f),this.vertex(r,o,d),this.vertex(r,o,d),this.vertex(t,i,l))}rect(e,t,i,s,n,h){this.quad(e,t,i,t+s,i,t+s,i+n,t,i+n,h,h,h,h)}rectLine(e,t,i,s,n,h,a){this.check(e?be.Filled:be.Line,8),a||(a=this.color);let r=this.tmp.set(n-i,t-s);r.normalize(),h*=.5;let o=r.x*h,l=r.y*h;e?(this.vertex(t+o,i+l,a),this.vertex(t-o,i-l,a),this.vertex(s+o,n+l,a),this.vertex(s-o,n-l,a),this.vertex(s+o,n+l,a),this.vertex(t-o,i-l,a)):(this.vertex(t+o,i+l,a),this.vertex(t-o,i-l,a),this.vertex(s+o,n+l,a),this.vertex(s-o,n-l,a),this.vertex(s+o,n+l,a),this.vertex(t+o,i+l,a),this.vertex(s-o,n-l,a),this.vertex(t-o,i-l,a))}x(e,t,i){this.line(e-i,t-i,e+i,t+i),this.line(e-i,t+i,e+i,t-i)}polygon(e,t,i,s){if(i<3)throw new Error("Polygon must contain at least 3 vertices");this.check(be.Line,i*2),s||(s=this.color);let n=this.mesh.getVertices(),h=this.vertexIndex;t<<=1,i<<=1;let a=e[t],r=e[t+1],o=t+i;for(let l=t,c=t+i-2;l<c;l+=2){let f=e[l],d=e[l+1],u=0,m=0;l+2>=o?(u=a,m=r):(u=e[l+2],m=e[l+3]),this.vertex(f,d,s),this.vertex(u,m,s)}}circle(e,t,i,s,n,h=0){if(h==0&&(h=Math.max(1,6*L.cbrt(s)|0)),h<=0)throw new Error("segments must be > 0.");n||(n=this.color);let a=2*L.PI/h,r=Math.cos(a),o=Math.sin(a),l=s,c=0;if(e){this.check(be.Filled,h*3+3),h--;for(let d=0;d<h;d++){this.vertex(t,i,n),this.vertex(t+l,i+c,n);let u=l;l=r*l-o*c,c=o*u+r*c,this.vertex(t+l,i+c,n)}this.vertex(t,i,n),this.vertex(t+l,i+c,n)}else{this.check(be.Line,h*2+2);for(let d=0;d<h;d++){this.vertex(t+l,i+c,n);let u=l;l=r*l-o*c,c=o*u+r*c,this.vertex(t+l,i+c,n)}this.vertex(t+l,i+c,n)}let f=l;l=s,c=0,this.vertex(t+l,i+c,n)}curve(e,t,i,s,n,h,a,r,o,l){this.check(be.Line,o*2+2),l||(l=this.color);let c=1/o,f=c*c,d=c*c*c,u=3*c,m=3*f,x=6*f,w=6*d,y=e-i*2+n,p=t-s*2+h,g=(i-n)*3-e+a,b=(s-h)*3-t+r,v=e,C=t,A=(i-e)*u+y*m+g*d,T=(s-t)*u+p*m+b*d,R=y*x+g*w,Y=p*x+b*w,F=g*w,X=b*w;for(;o-- >0;)this.vertex(v,C,l),v+=A,C+=T,A+=R,T+=Y,R+=F,Y+=X,this.vertex(v,C,l);this.vertex(v,C,l),this.vertex(a,r,l)}vertex(e,t,i){let s=this.vertexIndex,n=this.mesh.getVertices();n[s++]=e,n[s++]=t,n[s++]=i.r,n[s++]=i.g,n[s++]=i.b,n[s++]=i.a,this.vertexIndex=s}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()}},be=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(be||{}),Fi=class{boneLineColor=new V(1,0,0,1);boneOriginColor=new V(0,1,0,1);attachmentLineColor=new V(0,0,1,.5);triangleLineColor=new V(1,.64,0,.5);pathColor=new V().setFromString("FF7F00");clipColor=new V(.8,0,0,2);aabbColor=new V(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 us;temp=new Array;vertices=P.newFloatArray(2*1024);constructor(e){this.context=e instanceof pe?e:new pe(e)}draw(e,t,i){let s=t.x,n=t.y,h=this.context.gl,a=this.premultipliedAlpha?h.ONE:h.SRC_ALPHA;e.setBlendMode(a,h.ONE,h.ONE_MINUS_SRC_ALPHA);let r=t.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,l=r.length;o<l;o++){let c=r[o];if(i&&i.indexOf(c.data.name)>-1||!c.parent)continue;let f=c.data.length*c.a+c.worldX,d=c.data.length*c.c+c.worldY;e.rectLine(!0,c.worldX,c.worldY,f,d,this.boneWidth*this.scale)}this.drawSkeletonXY&&e.x(s,n,4*this.scale)}if(this.drawRegionAttachments){e.setColor(this.attachmentLineColor);let o=t.slots;for(let l=0,c=o.length;l<c;l++){let f=o[l],d=f.getAttachment();if(d instanceof le){let u=d,m=this.vertices;u.computeWorldVertices(f,m,0,2),e.line(m[0],m[1],m[2],m[3]),e.line(m[2],m[3],m[4],m[5]),e.line(m[4],m[5],m[6],m[7]),e.line(m[6],m[7],m[0],m[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=t.slots;for(let l=0,c=o.length;l<c;l++){let f=o[l];if(!f.bone.active)continue;let d=f.getAttachment();if(!(d instanceof De))continue;let u=d,m=this.vertices;u.computeWorldVertices(f,0,u.worldVerticesLength,m,0,2);let x=u.triangles,w=u.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let y=0,p=x.length;y<p;y+=3){let g=x[y]*2,b=x[y+1]*2,v=x[y+2]*2;e.triangle(!1,m[g],m[g+1],m[b],m[b+1],m[v],m[v+1])}}if(this.drawMeshHull&&w>0){e.setColor(this.attachmentLineColor),w=(w>>1)*2;let y=m[w-2],p=m[w-1];for(let g=0,b=w;g<b;g+=2){let v=m[g],C=m[g+1];e.line(v,C,y,p),y=v,p=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(t,!0),e.setColor(this.aabbColor),e.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let l=o.polygons,c=o.boundingBoxes;for(let f=0,d=l.length;f<d;f++){let u=l[f];e.setColor(c[f].color),e.polygon(u,0,u.length)}}if(this.drawPaths){let o=t.slots;for(let l=0,c=o.length;l<c;l++){let f=o[l];if(!f.bone.active)continue;let d=f.getAttachment();if(!(d instanceof He))continue;let u=d,m=u.worldVerticesLength,x=this.temp=P.setArraySize(this.temp,m,0);u.computeWorldVertices(f,0,m,x,0,2);let w=this.pathColor,y=x[2],p=x[3],g=0,b=0;if(u.closed){e.setColor(w);let v=x[0],C=x[1],A=x[m-2],T=x[m-1];g=x[m-4],b=x[m-3],e.curve(y,p,v,C,A,T,g,b,32),e.setColor(Fi.LIGHT_GRAY),e.line(y,p,v,C),e.line(g,b,A,T)}m-=4;for(let v=4;v<m;v+=6){let C=x[v],A=x[v+1],T=x[v+2],R=x[v+3];g=x[v+4],b=x[v+5],e.setColor(w),e.curve(y,p,C,A,T,R,g,b,32),e.setColor(Fi.LIGHT_GRAY),e.line(y,p,C,A),e.line(g,b,T,R),y=g,p=b}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,l=r.length;o<l;o++){let c=r[o];i&&i.indexOf(c.data.name)>-1||e.circle(!0,c.worldX,c.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=t.slots;e.setColor(this.clipColor);for(let l=0,c=o.length;l<c;l++){let f=o[l];if(!f.bone.active)continue;let d=f.getAttachment();if(!(d instanceof ht))continue;let u=d,m=u.worldVerticesLength,x=this.temp=P.setArraySize(this.temp,m,0);u.computeWorldVertices(f,0,m,x,0,2);for(let w=0,y=x.length;w<y;w+=2){let p=x[w],g=x[w+1],b=x[(w+2)%x.length],v=x[(w+3)%x.length];e.line(p,g,b,v)}}}}dispose(){}},Xt=Fi;B(Xt,"LIGHT_GRAY",new V(.7529411764705882,.7529411764705882,.7529411764705882,1)),B(Xt,"GREEN",new V(0,1,0,1));var Yr=class{constructor(e,t,i){this.vertices=e,this.numVertices=t,this.numFloats=i}},ys=class{premultipliedAlpha=!1;tempColor=new V;tempColor2=new V;vertices;vertexSize=2+2+4;twoColorTint=!1;renderable=new Yr([],0,0);clipper=new Rt;temp=new ze;temp2=new ze;temp3=new V;temp4=new V;constructor(e,t=!0){this.twoColorTint=t,t&&(this.vertexSize+=4),this.vertices=P.newFloatArray(this.vertexSize*1024)}draw(e,t,i=-1,s=-1,n=null){let h=this.clipper,a=this.premultipliedAlpha,r=this.twoColorTint,o=null,l=this.renderable,c,f,d=t.drawOrder,u,m=t.color,x=r?12:8,w=!1;i==-1&&(w=!0);for(let y=0,p=d.length;y<p;y++){let g=h.isClipping()?2:x,b=d[y];if(!b.bone.active){h.clipEndWithSlot(b);continue}if(i>=0&&i==b.data.index&&(w=!0),!w){h.clipEndWithSlot(b);continue}s>=0&&s==b.data.index&&(w=!1);let v=b.getAttachment(),C;if(v instanceof le){let A=v;l.vertices=this.vertices,l.numVertices=4,l.numFloats=g<<2,A.computeWorldVertices(b,l.vertices,0,g),f=ys.QUAD_TRIANGLES,c=A.uvs,C=A.region.texture,u=A.color}else if(v instanceof De){let A=v;l.vertices=this.vertices,l.numVertices=A.worldVerticesLength>>1,l.numFloats=l.numVertices*g,l.numFloats>l.vertices.length&&(l.vertices=this.vertices=P.newFloatArray(l.numFloats)),A.computeWorldVertices(b,0,A.worldVerticesLength,l.vertices,0,g),f=A.triangles,C=A.region.texture,c=A.uvs,u=A.color}else if(v instanceof ht){let A=v;h.clipStart(b,A);continue}else{h.clipEndWithSlot(b);continue}if(C){let A=b.color,T=this.tempColor;T.r=m.r*A.r*u.r,T.g=m.g*A.g*u.g,T.b=m.b*A.b*u.b,T.a=m.a*A.a*u.a,a&&(T.r*=T.a,T.g*=T.a,T.b*=T.a);let R=this.tempColor2;b.darkColor?(a?(R.r=b.darkColor.r*T.a,R.g=b.darkColor.g*T.a,R.b=b.darkColor.b*T.a):R.setFromColor(b.darkColor),R.a=a?1:0):R.set(0,0,0,1);let Y=b.data.blendMode;if(Y!=o&&(o=Y,e.setBlendMode(o,a)),h.isClipping()){h.clipTriangles(l.vertices,l.numFloats,f,f.length,c,T,R,r);let F=new Float32Array(h.clippedVertices),X=h.clippedTriangles;n&&n(F,F.length,x),e.draw(C,F,X)}else{let F=l.vertices;if(r)for(let k=2,M=0,I=l.numFloats;k<I;k+=x,M+=2)F[k]=T.r,F[k+1]=T.g,F[k+2]=T.b,F[k+3]=T.a,F[k+4]=c[M],F[k+5]=c[M+1],F[k+6]=R.r,F[k+7]=R.g,F[k+8]=R.b,F[k+9]=R.a;else for(let k=2,M=0,I=l.numFloats;k<I;k+=x,M+=2)F[k]=T.r,F[k+1]=T.g,F[k+2]=T.b,F[k+3]=T.a,F[k+4]=c[M],F[k+5]=c[M+1];let X=l.vertices.subarray(0,l.numFloats);n&&n(l.vertices,l.numFloats,x),e.draw(C,X,f)}}h.clipEndWithSlot(b)}h.clipEnd()}},Xi=ys;B(Xi,"QUAD_TRIANGLES",[0,1,2,2,3,0]);var S=[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],Lt=[0,1,2,2,3,0],Pt=new V(1,1,1,1),As=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,i=!0){this.canvas=e,this.context=t instanceof pe?t:new pe(t),this.twoColorTint=i,this.camera=new gs(e.width,e.height),this.batcherShader=i?ge.newTwoColoredTextured(this.context):ge.newColoredTextured(this.context),this.batcher=new tt(this.context,i),this.shapesShader=ge.newColored(this.context),this.shapes=new ki(this.context),this.skeletonRenderer=new Xi(this.context,i),this.skeletonDebugRenderer=new Xt(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,i=-1,s=-1,n=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=t,this.skeletonRenderer.draw(this.batcher,e,i,s,n)}drawSkeletonDebug(e,t=!1,i){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=t,this.skeletonDebugRenderer.draw(this.shapes,e,i)}drawTexture(e,t,i,s,n,h){this.enableRenderer(this.batcher),h||(h=Pt);var a=0;S[a++]=t,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=0,S[a++]=1,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=1,S[a++]=1,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=1,S[a++]=0,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=0,S[a++]=0,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a]=0),this.batcher.draw(e,S,Lt)}drawTextureUV(e,t,i,s,n,h,a,r,o,l){this.enableRenderer(this.batcher),l||(l=Pt);var c=0;S[c++]=t,S[c++]=i,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=h,S[c++]=a,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c++]=0),S[c++]=t+s,S[c++]=i,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=r,S[c++]=a,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c++]=0),S[c++]=t+s,S[c++]=i+n,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=r,S[c++]=o,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c++]=0),S[c++]=t,S[c++]=i+n,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=h,S[c++]=o,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c]=0),this.batcher.draw(e,S,Lt)}drawTextureRotated(e,t,i,s,n,h,a,r,o){this.enableRenderer(this.batcher),o||(o=Pt);let l=t+h,c=i+a,f=-h,d=-a,u=s-h,m=n-a,x=f,w=d,y=f,p=m,g=u,b=m,v=u,C=d,A=0,T=0,R=0,Y=0,F=0,X=0,k=0,M=0;if(r!=0){let O=L.cosDeg(r),ie=L.sinDeg(r);A=O*x-ie*w,T=ie*x+O*w,k=O*y-ie*p,M=ie*y+O*p,F=O*g-ie*b,X=ie*g+O*b,R=F+(A-k),Y=X+(T-M)}else A=x,T=w,k=y,M=p,F=g,X=b,R=v,Y=C;A+=l,T+=c,R+=l,Y+=c,F+=l,X+=c,k+=l,M+=c;var I=0;S[I++]=A,S[I++]=T,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=R,S[I++]=Y,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=F,S[I++]=X,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=k,S[I++]=M,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I]=0),this.batcher.draw(e,S,Lt)}drawRegion(e,t,i,s,n,h){this.enableRenderer(this.batcher),h||(h=Pt);var a=0;S[a++]=t,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u,S[a++]=e.v2,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u2,S[a++]=e.v2,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u2,S[a++]=e.v,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u,S[a++]=e.v,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a]=0),this.batcher.draw(e.page.texture,S,Lt)}line(e,t,i,s,n,h){this.enableRenderer(this.shapes),this.shapes.line(e,t,i,s,n)}triangle(e,t,i,s,n,h,a,r,o,l){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,i,s,n,h,a,r,o,l)}quad(e,t,i,s,n,h,a,r,o,l,c,f,d){this.enableRenderer(this.shapes),this.shapes.quad(e,t,i,s,n,h,a,r,o,l,c,f,d)}rect(e,t,i,s,n,h){this.enableRenderer(this.shapes),this.shapes.rect(e,t,i,s,n,h)}rectLine(e,t,i,s,n,h,a){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,i,s,n,h,a)}polygon(e,t,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,i,s)}circle(e,t,i,s,n,h=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,i,s,n,h)}curve(e,t,i,s,n,h,a,r,o,l){this.enableRenderer(this.shapes),this.shapes.curve(e,t,i,s,n,h,a,r,o,l)}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 i=window.devicePixelRatio||1,s=Math.round(t.clientWidth*i),n=Math.round(t.clientHeight*i);if((t.width!=s||t.height!=n)&&(t.width=s,t.height=n),this.context.gl.viewport(0,0,t.width,t.height),e===Bt.Expand)this.camera.setViewport(s,n);else if(e===Bt.Fit){let h=t.width,a=t.height,r=this.camera.viewportWidth,o=this.camera.viewportHeight,l=o/r,c=a/h,f=l<c?r/h:o/a;this.camera.setViewport(h*f,a*f)}this.camera.update()}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof tt?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(ge.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof ki?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(ge.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Bt=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(Bt||{}),dt,it,Cs=0,kr=1,Li=1,Ss=165,Ts=108,Ke=163,Fr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Nt;backgroundColor=new V(.135,.135,.135,1);tempColor=new V;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!it){let t=navigator.userAgent.indexOf("Safari")>-1,i=()=>Cs++;it=new Image,it.src=Lr,t||(it.crossOrigin="anonymous"),it.onload=i,dt=new Image,dt.src=Xr,t||(dt.crossOrigin="anonymous"),dt.onload=i}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Cs<2||e&&this.fadeOut>Li)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 i=this.tempColor,s=this.renderer,n=s.canvas,h=s.context.gl;if(s.resize(1),s.camera.position.set(n.width/2,n.height/2,0),s.batcher.setBlendMode(0,!0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Li)return;i.setFromColor(this.backgroundColor),t=1-this.fadeOut/Li,t=1-(t-1)*(t-1),i.a*=t,i.a>0&&(s.camera.zoom=1,s.begin(),s.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,i,i,i,i),s.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/kr,1),i.set(t,t,t,t),this.logo||(this.logo=new ct(s.context,it),this.spinner=new ct(s.context,dt)),s.camera.zoom=Math.max(1,Ke/n.height),s.begin(),s.drawTexture(this.logo,(n.width-Ss)/2,(n.height-Ts)/2,Ss,Ts,i),this.spinner&&s.drawTextureRotated(this.spinner,(n.width-Ke)/2,(n.height-Ke)/2,Ke,Ke,Ke/2,Ke/2,this.angle,i),s.end()}},Xr="data:image/png;base64,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",Lr="data:image/png;base64,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",Pr=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 pe(e,t.webglConfig),this.renderer=new As(e,this.context),this.gl=this.context.gl,this.assetManager=new ms(this.context,t.pathPrefix),this.input=new Ei(e),t.app.loadAssets&&t.app.loadAssets(this);let i=()=>{this.disposed||(requestAnimationFrame(i),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},s=()=>{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),i());return}requestAnimationFrame(s)}};requestAnimationFrame(s)}context;time=new Nt;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,i,s){this.gl.clearColor(e,t,i,s),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Os(Oi)})();
|