@galacean/engine-spine 0.0.0-experimental-engine-spine-20241107 → 0.0.0-experimental-engine-spine-20241115
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/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +35 -35
- package/types/loader/SpineResource.d.ts +3 -4
- package/types/util/BufferReader.d.ts +4 -2
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AssetType as t,request as e,TextureFilterMode as s,TextureWrapMode as i,BlendFactor as a,BlendOperation as n,SubPrimitive as r,BoundingBox as o,Vector3 as l,Material as h,Shader as c,CullMode as d,RenderQueueType as u,Renderer as m,VertexElement as f,VertexElementFormat as p,Primitive as g,Buffer as x,BufferBindFlag as w,BufferUsage as b,VertexBufferBinding as y,IndexBufferBinding as k,IndexFormat as v,assignmentClone as S,deepClone as A,ignoreClone as I,ReferResource as M,Entity as C,Loader as F,AssetPromise as T,resourceLoader as E}from"@galacean/engine";function Y(t,e,s,i){var a,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(r=(n<3?a(r):n>3?a(e,s,r):a(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}"function"==typeof SuppressedError&&SuppressedError;class _{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class X{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class R{r;g;b;a;static WHITE=new R(1,1,1,1);static RED=new R(1,0,0,1);static GREEN=new R(0,1,0,1);static BLUE=new R(0,0,1,1);static MAGENTA=new R(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,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=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,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=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new R).setFromString(t)}}class B{static PI=3.1415927;static PI2=2*B.PI;static invPI2=1/B.PI2;static radiansToDegrees=180/B.PI;static radDeg=B.radiansToDegrees;static degreesToRadians=B.PI/180;static degRad=B.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*B.degRad)}static sinDeg(t){return Math.sin(t*B.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*B.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),1/3);return t<0?-e:e}static randomTriangular(t,e){return B.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),a=e-t;return i<=(s-t)/a?t+Math.sqrt(i*a*(s-t)):e-Math.sqrt((1-i)*a*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class P{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class V extends P{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class D extends V{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class O{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,i,a){for(let n=e,r=i;n<e+a;n++,r++)s[r]=t[n]}static arrayFill(t,e,s,i){for(let a=e;a<s;a++)t[a]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let a=i;a<e;a++)t[a]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:O.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(O.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(O.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return O.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return O.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class N{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class L{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class q{x;y;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 0!=t&&(this.x/=t,this.y/=t),this}}class U{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class W{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class z{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class $ extends z{static nextID=0;id=$.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,i,a,n){s=a+(s>>1)*n;let r=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let r=t.bone,h=r.worldX,c=r.worldY,d=r.a,u=r.b,m=r.c,f=r.d;for(let t=e,r=a;r<s;t+=2,r+=n){let e=l[t],s=l[t+1];i[r]=e*d+s*u+h,i[r+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=r.bones;if(0==o.length)for(let t=a,e=3*d;t<s;t+=n){let s=0,a=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],i=l[e],n=l[e+1],r=l[e+2];s+=(i*t.a+n*t.b+t.worldX)*r,a+=(i*t.c+n*t.d+t.worldY)*r}i[t]=s,i[t+1]=a}else{let t=o;for(let e=a,r=3*d,o=d<<1;e<s;e+=n){let s=0,a=0,n=h[c++];for(n+=c;c<n;c++,r+=3,o+=2){let e=u[h[c]],i=l[r]+t[o],n=l[r+1]+t[o+1],d=l[r+2];s+=(i*e.a+n*e.b+e.worldX)*d,a+=(i*e.c+n*e.d+e.worldY)*d}i[e]=s,i[e+1]=a}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),O.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=O.newFloatArray(this.vertices.length),O.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class G{static _nextID=0;id=G.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new G(this.regions.length);return O.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 s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return G._nextID++}}var j;!function(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"}(j||(j={}));const H=[j.hold,j.once,j.loop,j.pingpong,j.onceReverse,j.loopReverse,j.pingpongReverse];class J{name;timelines=[];timelineIds=new X;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,a,n,r,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,a,n,r,o)}}var K,Z;!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(K||(K={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(Z||(Z={}));const Q={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class tt{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=O.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let a=s;a<i;a+=s)if(t[a]>e)return a-s;return i-s}}class et extends tt{curves;constructor(t,e,s){super(t,s),this.curves=O.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=O.newFloatArray(e);O.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,a,n,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*n+o),f=.03*(a-2*r+l),p=.006*(3*(n-o)-i+h),g=.006*(3*(r-l)-a+c),x=2*m+p,w=2*f+g,b=.3*(n-i)+m+.16666667*p,y=.3*(r-a)+f+.16666667*g,k=i+b,v=a+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=p,w+=g,k+=b,v+=y}getBezierValue(t,e,s,i){let a=this.curves;if(a[i]>t){let n=this.frames[e],r=this.frames[e+s];return r+(t-n)/(a[i]-n)*(a[i+1]-r)}let n=i+18;for(i+=2;i<n;i+=2)if(a[i]>=t){let e=a[i-2],s=a[i-1];return s+(t-e)/(a[i]-e)*(a[i+1]-s)}e+=this.getFrameEntries();let r=a[n-2],o=a[n-1];return o+(t-r)/(this.frames[e]-r)*(this.frames[e+s]-o)}}class st extends et{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],a=e[s+1];return a+(t-i)/(e[s+2]-i)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,a){if(t<this.frames[0]){switch(s){case K.setup:return a;case K.first:return i+(a-i)*e}return i}let n=this.getCurveValue(t);switch(s){case K.setup:return a+n*e;case K.first:case K.replace:n+=a-i}return i+n*e}getAbsoluteValue(t,e,s,i,a){if(t<this.frames[0]){switch(s){case K.setup:return a;case K.first:return i+(a-i)*e}return i}let n=this.getCurveValue(t);return s==K.setup?a+(n-a)*e:i+(n-i)*e}getAbsoluteValue2(t,e,s,i,a,n){if(t<this.frames[0]){switch(s){case K.setup:return a;case K.first:return i+(a-i)*e}return i}return s==K.setup?a+(n-a)*e:i+(n-i)*e}getScaleValue(t,e,s,i,a,n){if(t<this.frames[0]){switch(s){case K.setup:return n;case K.first:return a+(n-a)*e}return a}let r=this.getCurveValue(t)*n;if(1==e)return s==K.add?a+r-n:r;if(i==Z.mixOut)switch(s){case K.setup:return n+(Math.abs(r)*B.signum(n)-n)*e;case K.first:case K.replace:return a+(Math.abs(r)*B.signum(a)-a)*e}else{let t=0;switch(s){case K.setup:return t=Math.abs(n)*B.signum(r),t+(r-t)*e;case K.first:case K.replace:return t=Math.abs(a)*B.signum(r),t+(r-t)*e}}return a+(r-n)*e}}class it extends et{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class at extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,a,n,o.rotation,o.data.rotation))}}class nt extends it{boneIndex=0;constructor(t,e,s){super(t,e,Q.x+"|"+s,Q.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case K.setup:return o.x=o.data.x,void(o.y=o.data.y);case K.first:o.x+=(o.data.x-o.x)*a,o.y+=(o.data.y-o.y)*a}return}let h=0,c=0,d=tt.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case K.setup:o.x=o.data.x+h*a,o.y=o.data.y+c*a;break;case K.first:case K.replace:o.x+=(o.data.x+h-o.x)*a,o.y+=(o.data.y+c-o.y)*a;break;case K.add:o.x+=h*a,o.y+=c*a}}}class rt extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,a,n,o.x,o.data.x))}}class ot extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,a,n,o.y,o.data.y))}}class lt extends it{boneIndex=0;constructor(t,e,s){super(t,e,Q.scaleX+"|"+s,Q.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(n){case K.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case K.first:o.scaleX+=(o.data.scaleX-o.scaleX)*a,o.scaleY+=(o.data.scaleY-o.scaleY)*a}return}let d=tt.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==a)n==K.add?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(r==Z.mixOut)switch(n){case K.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*B.signum(t)-t)*a,o.scaleY=e+(Math.abs(h)*B.signum(e)-e)*a;break;case K.first:case K.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*B.signum(t)-t)*a,o.scaleY=e+(Math.abs(h)*B.signum(e)-e)*a;break;case K.add:o.scaleX+=(l-o.data.scaleX)*a,o.scaleY+=(h-o.data.scaleY)*a}else switch(n){case K.setup:t=Math.abs(o.data.scaleX)*B.signum(l),e=Math.abs(o.data.scaleY)*B.signum(h),o.scaleX=t+(l-t)*a,o.scaleY=e+(h-e)*a;break;case K.first:case K.replace:t=Math.abs(o.scaleX)*B.signum(l),e=Math.abs(o.scaleY)*B.signum(h),o.scaleX=t+(l-t)*a,o.scaleY=e+(h-e)*a;break;case K.add:o.scaleX+=(l-o.data.scaleX)*a,o.scaleY+=(h-o.data.scaleY)*a}}}}class ht extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,a,n,r,o.scaleX,o.data.scaleX))}}class ct extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,a,n,r,o.scaleY,o.data.scaleY))}}class dt extends it{boneIndex=0;constructor(t,e,s){super(t,e,Q.shearX+"|"+s,Q.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case K.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case K.first:o.shearX+=(o.data.shearX-o.shearX)*a,o.shearY+=(o.data.shearY-o.shearY)*a}return}let h=0,c=0,d=tt.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case K.setup:o.shearX=o.data.shearX+h*a,o.shearY=o.data.shearY+c*a;break;case K.first:case K.replace:o.shearX+=(o.data.shearX+h-o.shearX)*a,o.shearY+=(o.data.shearY+c-o.shearY)*a;break;case K.add:o.shearX+=h*a,o.shearY+=c*a}}}class ut extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,a,n,o.shearX,o.data.shearX))}}class mt extends st{boneIndex=0;constructor(t,e,s){super(t,e,Q.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,a,n,o.shearY,o.data.shearY))}}class ft extends tt{boneIndex=0;constructor(t,e){super(t,[Q.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,a,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;if(r==Z.mixOut)return void(n==K.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?n!=K.setup&&n!=K.first||(o.inherit=o.data.inherit):o.inherit=this.frames[tt.search(l,s,2)+1]}}class pt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s,Q.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,a,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case K.setup:return void h.setFromColor(t);case K.first:h.add((t.r-h.r)*a,(t.g-h.g)*a,(t.b-h.b)*a,(t.a-h.a)*a)}return}let c=0,d=0,u=0,m=0,f=tt.search(l,s,5),p=this.curves[f/5];switch(p){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+36-2),m=this.getBezierValue(s,f,4,p+54-2)}1==a?h.set(c,d,u,m):(n==K.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*a,(d-h.g)*a,(u-h.b)*a,(m-h.a)*a))}}class gt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,a){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case K.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case K.first:h.r+=(t.r-h.r)*a,h.g+=(t.g-h.g)*a,h.b+=(t.b-h.b)*a}return}let c=0,d=0,u=0,m=tt.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==a)h.r=c,h.g=d,h.b=u;else{if(n==K.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*a,h.g+=(d-h.g)*a,h.b+=(u-h.b)*a}}}class xt extends st{slotIndex=0;constructor(t,e,s){super(t,e,Q.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(n){case K.setup:return void(l.a=t.a);case K.first:l.a+=(t.a-l.a)*a}return}let h=this.getCurveValue(s);1==a?l.a=h:(n==K.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*a)}}class wt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s,Q.alpha+"|"+s,Q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,a,n,r,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n,this.frames[t+5]=r,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case K.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case K.first:h.add((t.r-h.r)*a,(t.g-h.g)*a,(t.b-h.b)*a,(t.a-h.a)*a),c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a}return}let d=0,u=0,m=0,f=0,p=0,g=0,x=0,w=tt.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,p+=(l[w+8+5]-p)*e,g+=(l[w+8+6]-g)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),m=this.getBezierValue(s,w,3,b+36-2),f=this.getBezierValue(s,w,4,b+54-2),p=this.getBezierValue(s,w,5,b+72-2),g=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==a)h.set(d,u,m,f),c.r=p,c.g=g,c.b=x;else{if(n==K.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*a,(u-h.g)*a,(m-h.b)*a,(f-h.a)*a),c.r+=(p-c.r)*a,c.g+=(g-c.g)*a,c.b+=(x-c.b)*a}}}class bt extends et{slotIndex=0;constructor(t,e,s){super(t,e,[Q.rgb+"|"+s,Q.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,a,n,r,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n,this.frames[t+5]=r,this.frames[t+6]=o}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case K.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case K.first:h.r+=(t.r-h.r)*a,h.g+=(t.g-h.g)*a,h.b+=(t.b-h.b)*a,c.r+=(e.r-c.r)*a,c.g+=(e.g-c.g)*a,c.b+=(e.b-c.b)*a}return}let d=0,u=0,m=0,f=0,p=0,g=0,x=tt.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],p=l[x+5],g=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,p+=(l[x+7+5]-p)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],p=l[x+5],g=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+36-2),f=this.getBezierValue(s,x,4,w+54-2),p=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==a)h.r=d,h.g=u,h.b=m,c.r=f,c.g=p,c.b=g;else{if(n==K.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*a,h.g+=(u-h.g)*a,h.b+=(m-h.b)*a,c.r+=(f-c.r)*a,c.g+=(p-c.g)*a,c.b+=(g-c.b)*a}}}class yt extends tt{slotIndex=0;attachmentNames;constructor(t,e){super(t,[Q.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];o.bone.active&&(r!=Z.mixOut?s<this.frames[0]?n!=K.setup&&n!=K.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[tt.search1(this.frames,s)]):n==K.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class kt extends et{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[Q.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,a,n,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*n+o),f=.03*l-.06*r,p=.006*(3*(n-o)-i+h),g=.018*(r-l+.33333333),x=2*m+p,w=2*f+g,b=.3*(n-i)+m+.16666667*p,y=.3*r+f+.16666667*g,k=i+b,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=p,w+=g,k+=b,v+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let a=this.frames[e];return s[i+1]*(t-a)/(s[i]-a)}let a=i+18;for(i+=2;i<a;i+=2)if(s[i]>=t){let e=s[i-2],a=s[i-1];return a+(t-e)/(s[i]-e)*(s[i+1]-a)}let n=s[a-2],r=s[a-1];return r+(1-r)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof $)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(n=K.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(n){case K.setup:return void(h.length=0);case K.first:if(1==a)return void(h.length=0);h.length=d;let t=l;if(t.bones){a=1-a;for(m=0;m<d;m++)h[m]*=a}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*a}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==a)if(n==K.add){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else O.arrayCopy(t,0,h,0,d);else switch(n){case K.setup:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*a;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*a}}break}case K.first:case K.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*a;break;case K.add:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*a;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*a}}return}let f=tt.search1(u,s),p=this.getCurvePercent(s,f),g=c[f],x=c[f+1];if(1==a)if(n==K.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=e+(x[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=s+(x[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=g[t];h[t]=e+(x[t]-e)*p}else switch(n){case K.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]=(e+(x[t]-e)*p)*a}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t],i=e[t];h[t]=i+(s+(x[t]-s)*p-i)*a}}break}case K.first:case K.replace:for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(x[t]-e)*p-h[t])*a}break;case K.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(x[t]-e)*p)*a}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=(s+(x[t]-s)*p-e[t])*a}}}}}class vt extends tt{static propertyIds=[""+Q.event];events;constructor(t){super(t,vt.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,s,i,a,n,r){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,a,n,r),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=tt.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}}class St extends tt{static propertyIds=[""+Q.drawOrder];drawOrders;constructor(t){super(t,St.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,a,n,r){if(r==Z.mixOut)return void(n==K.setup&&O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=K.setup&&n!=K.first||O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=tt.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class At extends et{constraintIndex=0;constructor(t,e,s){super(t,e,[Q.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,a,n,r){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=a,this.frames[t+4]=n?1:0,this.frames[t+5]=r?1:0}apply(t,e,s,i,a,n,r){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case K.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case K.first:o.mix+=(o.data.mix-o.mix)*a,o.softness+=(o.data.softness-o.softness)*a,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=tt.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}n==K.setup?(o.mix=o.data.mix+(h-o.data.mix)*a,o.softness=o.data.softness+(c-o.data.softness)*a,r==Z.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*a,o.softness+=(c-o.softness)*a,r==Z.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class It extends et{constraintIndex=0;constructor(t,e,s){super(t,e,[Q.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,a,n,r,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=a,l[t+4]=n,l[t+5]=r,l[t+6]=o}apply(t,e,s,i,a,n,r){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(n){case K.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case K.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*a,o.mixX+=(t.mixX-o.mixX)*a,o.mixY+=(t.mixY-o.mixY)*a,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*a,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*a,o.mixShearY+=(t.mixShearY-o.mixShearY)*a}return}let p=tt.search(f,s,7),g=this.curves[p/7];switch(g){case 0:let t=f[p];l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];let e=(s-t)/(f[p+7]-t);l+=(f[p+7+1]-l)*e,h+=(f[p+7+2]-h)*e,c+=(f[p+7+3]-c)*e,d+=(f[p+7+4]-d)*e,u+=(f[p+7+5]-u)*e,m+=(f[p+7+6]-m)*e;break;case 1:l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),h=this.getBezierValue(s,p,2,g+18-2),c=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),u=this.getBezierValue(s,p,5,g+72-2),m=this.getBezierValue(s,p,6,g+90-2)}if(n==K.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*a,o.mixX=t.mixX+(h-t.mixX)*a,o.mixY=t.mixY+(c-t.mixY)*a,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*a,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*a,o.mixShearY=t.mixShearY+(m-t.mixShearY)*a}else o.mixRotate+=(l-o.mixRotate)*a,o.mixX+=(h-o.mixX)*a,o.mixY+=(c-o.mixY)*a,o.mixScaleX+=(d-o.mixScaleX)*a,o.mixScaleY+=(u-o.mixScaleY)*a,o.mixShearY+=(m-o.mixShearY)*a}}class Mt extends st{constraintIndex=0;constructor(t,e,s){super(t,e,Q.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,a,n,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,a,n,o.position,o.data.position))}}class Ct extends st{constraintIndex=0;constructor(t,e,s){super(t,e,Q.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,a,n,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,a,n,o.spacing,o.data.spacing))}}class Ft extends et{constraintIndex=0;constructor(t,e,s){super(t,e,[Q.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,a){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=i,n[t+3]=a}apply(t,e,s,i,a,n,r){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case K.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case K.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*a,o.mixX+=(o.data.mixX-o.mixX)*a,o.mixY+=(o.data.mixY-o.mixY)*a}return}let u=tt.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(n==K.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*a,o.mixX=t.mixX+(h-t.mixX)*a,o.mixY=t.mixY+(c-t.mixY)*a}else o.mixRotate+=(l-o.mixRotate)*a,o.mixX+=(h-o.mixX)*a,o.mixY+=(c-o.mixY)*a}}class Tt extends st{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,a,n,r){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,a,n,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,a,n,this.get(o),this.setup(o)))}}class Et extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class Yt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class _t extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Xt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class Rt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class Bt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class Pt extends Tt{constructor(t,e,s){super(t,e,s,Q.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class Vt extends tt{static propertyIds=[Q.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,Vt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,a,n,r){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],a,n,r),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[tt.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class Dt extends tt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[Q.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,a){let n=this.frames;n[t*=Dt.ENTRIES]=e,n[t+Dt.MODE]=s|i<<4,n[t+Dt.DELAY]=a}apply(t,e,s,i,a,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof $&&l.timelineAttachment==h))return;let c=this.frames;if(s<c[0])return void(n!=K.setup&&n!=K.first||(o.sequenceIndex=-1));let d=tt.search(c,s,Dt.ENTRIES),u=c[d],m=c[d+Dt.MODE],f=c[d+Dt.DELAY];if(!this.attachment.sequence)return;let p=m>>4,g=this.attachment.sequence.regions.length,x=H[15&m];if(x!=j.hold)switch(p+=(s-u)/f+1e-5|0,x){case j.once:p=Math.min(g-1,p);break;case j.loop:p%=g;break;case j.pingpong:{let t=(g<<1)-2;p=0==t?0:p%t,p>=g&&(p=t-p);break}case j.onceReverse:p=Math.max(g-1-p,0);break;case j.loopReverse:p=g-1-p%g;break;case j.pingpongReverse:{let t=(g<<1)-2;p=0==t?0:(p+g-1)%t,p>=g&&(p=t-p)}}o.sequenceIndex=p}}class Ot{static _emptyAnimation=new J("<empty>",[],0);static emptyAnimation(){return Ot._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Lt(this);propertyIDs=new X;animationsChanged=!1;trackEntryPool=new L((()=>new Nt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let a=t*i.timeScale;if(i.delay>0){if(i.delay-=a,i.delay>0)continue;a=-i.delay,i.delay=0}let n=i.next;if(n){let e=i.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*n.timeScale,i.trackTime+=a,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let n=0,r=s.length;n<r;n++){let r=s[n];if(!r||r.delay>0)continue;i=!0;let o=0==n?K.first:r.mixBlend,l=r.alpha;r.mixingFrom?l*=this.applyMixingFrom(r,t,o):r.trackTime>=r.trackEnd&&!r.next&&(l=0);let h=l>=r.alphaAttachmentThreshold,c=r.animationLast,d=r.getAnimationTime(),u=d,m=e;r.reverse&&(u=r.animation.duration-u,m=null);let f=r.animation.timelines,p=f.length;if(0==n&&1==l||o==K.add){0==n&&(h=!0);for(let e=0;e<p;e++){O.webkit602BugfixHelper(l,o);var a=f[e];a instanceof yt?this.applyAttachmentTimeline(a,t,u,o,h):a.apply(t,c,u,m,l,o,Z.mixIn)}}else{let e=r.timelineMode,s=r.shortestRotation,i=!s&&r.timelinesRotation.length!=p<<1;i&&(r.timelinesRotation.length=p<<1);for(let a=0;a<p;a++){let n=f[a],d=e[a]==Wt?o:K.setup;!s&&n instanceof at?this.applyRotateTimeline(n,t,u,l,d,r.timelinesRotation,a<<1,i):n instanceof yt?this.applyAttachmentTimeline(n,t,u,o,h):(O.webkit602BugfixHelper(l,o),n.apply(t,c,u,m,l,d,Z.mixIn))}}this.queueEvents(r,d),e.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime}for(var n=this.unkeyedState+Ht,r=t.slots,o=0,l=t.slots.length;o<l;o++){var h=r[o];if(h.attachmentState==n){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let a=0;0==t.mixDuration?(a=1,s==K.first&&(s=K.setup)):(a=t.mixTime/t.mixDuration,a>1&&(a=1),s!=K.first&&(s=i.mixBlend));let n=a<i.mixAttachmentThreshold,r=a<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-a),d=i.animationLast,u=i.getAnimationTime(),m=u,f=null;if(i.reverse?m=i.animation.duration-m:a<i.eventThreshold&&(f=this.events),s==K.add)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,Z.mixOut);else{let t=i.timelineMode,a=i.timelineHoldMix,u=i.shortestRotation,p=!u&&i.timelinesRotation.length!=l<<1;p&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let g=0;g<l;g++){let l,x=o[g],w=Z.mixOut,b=0;switch(t[g]){case Wt:if(!r&&x instanceof St)continue;l=s,b=c;break;case zt:l=K.setup,b=c;break;case $t:l=s,b=h;break;case Gt:l=K.setup,b=h;break;default:l=K.setup;let t=a[g];b=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=b,!u&&x instanceof at?this.applyRotateTimeline(x,e,m,b,l,i.timelinesRotation,g<<1,p):x instanceof yt?this.applyAttachmentTimeline(x,e,m,l,n&&b>=i.alphaAttachmentThreshold):(O.webkit602BugfixHelper(b,s),r&&x instanceof St&&l==K.setup&&(w=Z.mixIn),x.apply(e,d,m,f,b,l,w))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,a}applyAttachmentTimeline(t,e,s,i,a){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?i!=K.setup&&i!=K.first||this.setAttachment(e,n,n.data.attachmentName,a):this.setAttachment(e,n,t.attachmentNames[tt.search1(t.frames,s)],a),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Ht))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Jt)}applyRotateTimeline(t,e,s,i,a,n,r,o){if(o&&(n[r]=0),1==i)return void t.apply(e,0,s,null,1,a,Z.mixIn);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(a){case K.setup:l.rotation=l.data.rotation;default:return;case K.first:h=l.rotation,c=l.data.rotation}else h=a==K.setup?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=n[r];else{let t=0,e=0;o?(t=0,e=u):(t=n[r],e=n[r+1]);let s=t-t%360;d=u+s;let i=u>=0,a=t>=0;Math.abs(e)<=90&&B.signum(e)!=B.signum(u)&&(Math.abs(t-s)>180?(d+=360*B.signum(t),a=i):0!=s?d-=360*B.signum(t):a=i),a!=i&&(d+=360*B.signum(t)),n[r]=d}n[r+1]=u,l.rotation=h+d*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,a=i-s,n=t.trackLast%a,r=this.events,o=0,l=r.length;for(;o<l;o++){let e=r[o];if(e.time<n)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==a)h=!0;else{const e=Math.floor(t.trackTime/a);h=e>0&&e>Math.floor(t.trackLast/a)}else h=e>=i&&t.animationLast<i;for(h&&this.queue.complete(t);o<l;o++){let e=r[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);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 s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,a=this.expandToIndex(t);a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,i=!1):this.clearNext(a));let n=this.trackEntry(t,e,s,a);return this.setCurrent(t,n,i),this.queue.drain(),n}addAnimation(t,e,s=!1,i=0){let a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let a=this.expandToIndex(t);if(a)for(;a.next;)a=a.next;let n=this.trackEntry(t,e,s,a);return a?(a.next=n,n.previous=a,i<=0&&(i+=a.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=i,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Ot.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,Ot.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(O.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let a=this.trackEntryPool.obtain();return a.reset(),a.trackIndex=t,a.animation=e,a.loop=s,a.holdPrevious=!1,a.reverse=!1,a.shortestRotation=!1,a.eventThreshold=0,a.alphaAttachmentThreshold=0,a.mixAttachmentThreshold=0,a.mixDrawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.mixTime=0,a.mixDuration=i?this.data.getMix(i.animation,e):0,a.interruptAlpha=1,a.totalAlpha=0,a.mixBlend=K.replace,a}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,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==K.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,a=t.timelineMode;a.length=i;let n=t.timelineHoldMix;n.length=0;let r=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)a[t]=r.addAll(s[t].getPropertyIds())?Gt:$t;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(r.addAll(l))if(!e||i instanceof yt||i instanceof St||i instanceof vt||!e.animation.hasTimeline(l))a[o]=zt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){a[o]=jt,n[o]=s;continue t}break}a[o]=Gt}else a[o]=Wt}}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()}}class Nt{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=K.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?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(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class Lt{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(qt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(qt.interrupt),this.objects.push(t)}end(t){this.objects.push(qt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(qt.dispose),this.objects.push(t)}complete(t){this.objects.push(qt.complete),this.objects.push(t)}event(t,e){this.objects.push(qt.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 s=0;s<t.length;s+=2){let i=t[s],a=t[s+1];switch(i){case qt.start:a.listener&&a.listener.start&&a.listener.start(a);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(a)}break;case qt.interrupt:a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(a)}break;case qt.end:a.listener&&a.listener.end&&a.listener.end(a);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(a)}case qt.dispose:a.listener&&a.listener.dispose&&a.listener.dispose(a);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(a)}this.animState.trackEntryPool.free(a);break;case qt.complete:a.listener&&a.listener.complete&&a.listener.complete(a);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(a)}break;case qt.event:let i=t[2+s++];a.listener&&a.listener.event&&a.listener.event(a,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(a,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var qt;!function(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"}(qt||(qt={}));class Ut{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Wt=0,zt=1,$t=2,Gt=3,jt=4,Ht=1,Jt=2;class Kt{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let a=this.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);this.setMixWith(i,a,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}}class Zt extends ${color=new R(1,1,1,1);constructor(t){super(t)}copy(){let t=new Zt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Qt extends ${endSlot=null;color=new R(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Qt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class te{_image;constructor(t){this._image=t}getImage(){return this._image}}var ee,se,ie,ae,ne,re,oe,le,he;!function(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"}(ee||(ee={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(se||(se={}));class ce{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class de extends te{setFilters(t,e){}setWraps(t,e){}dispose(){}}class ue{pages=new Array;regions=new Array;constructor(t){let e=new me(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=O.enumValue(ee,s[1]),t.magFilter=O.enumValue(ee,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=se.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=se.Repeat)},pma:t=>{t.pma="true"==s[1]}};var a={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let n=e.readLine();for(;n&&0==n.trim().length;)n=e.readLine();for(;n&&0!=n.trim().length&&0!=e.readEntry(s,n);)n=e.readLine();let r=null,o=null,l=null;for(;null!==n;)if(0==n.trim().length)r=null,n=e.readLine();else if(r){let t=new pe(r,n);for(;;){let i=e.readEntry(s,n=e.readLine());if(0==i)break;let r=a[s[0]];if(r)r(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/r.width,t.v=t.y/r.height,90==t.degrees?(t.u2=(t.x+t.height)/r.width,t.v2=(t.y+t.width)/r.height):(t.u2=(t.x+t.width)/r.width,t.v2=(t.y+t.height)/r.height),this.regions.push(t)}else{for(r=new fe(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=i[s[0]];t&&t(r)}this.pages.push(r)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class me{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,a=s+1;;i++){let s=e.indexOf(",",a);if(-1==s)return t[i]=e.substr(a).trim(),i;if(t[i]=e.substr(a,s-a).trim(),a=s+1,4==i)return 4}}}class fe{name;minFilter=ee.Nearest;magFilter=ee.Nearest;uWrap=se.ClampToEdge;vWrap=se.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class pe extends ce{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class ge extends ${region=null;path;regionUVs=[];uvs=[];triangles=[];color=new R(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new R(0,0,0,0);constructor(t,e){super(t),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=O.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,a=this.region.v,n=0,r=0;if(this.region instanceof pe){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*n,e[o+1]=a+(1-t[o])*r;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,a-=o.offsetY/c,n=o.originalWidth/h,r=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*n,e[o+1]=a+(1-t[o+1])*r;return;case 270:i-=o.offsetY/h,a-=o.offsetX/c,n=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*n,e[o+1]=a+t[o]*r;return}i-=o.offsetX/h,a-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,r=o.originalHeight/c}else this.region?(n=this.region.u2-i,r=this.region.v2-a):(i=a=0,n=r=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*n,e[o+1]=a+t[o+1]*r}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 ge(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),O.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),O.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),O.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),O.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,a,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,a,n)}newLinkedMesh(){let t=new ge(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),null!=t.region&&t.updateRegion(),t}}class xe extends ${lengths=[];closed=!1;constantSpeed=!1;color=new R(1,1,1,1);constructor(t){super(t)}copy(){let t=new xe(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),O.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class we extends ${x=0;y=0;rotation=0;color=new R(.38,.94,0,1);constructor(t){super(t)}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){const e=this.rotation*B.degRad,s=Math.cos(e),i=Math.sin(e),a=s*t.a+i*t.b,n=s*t.c+i*t.d;return B.atan2Deg(n,a)}copy(){let t=new we(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class be extends z{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new R(1,1,1,1);path;region=null;sequence=null;offset=O.newFloatArray(8);uvs=O.newFloatArray(8);tempColor=new R(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,n=-this.height/2*this.scaleY+this.region.offsetY*i,r=a+this.region.width*s,o=n+this.region.height*i,l=this.rotation*B.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=a*h+d,f=a*c,p=n*h+u,g=n*c,x=r*h+d,w=r*c,b=o*h+u,y=o*c,k=this.offset;k[0]=m-g,k[1]=p+f,k[2]=m-y,k[3]=b+f,k[4]=x-y,k[5]=b+w,k[6]=x-g,k[7]=p+w,90==t.degrees?(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,s,i){null!=this.sequence&&this.sequence.apply(t,this);let a=t.bone,n=this.offset,r=a.worldX,o=a.worldY,l=a.a,h=a.b,c=a.c,d=a.d,u=0,m=0;u=n[0],m=n[1],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=n[2],m=n[3],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=n[4],m=n[5],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=i,u=n[6],m=n[7],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o}copy(){let t=new be(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,O.arrayCopy(this.uvs,0,t.uvs,0,8),O.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class ye{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let a=0,n=i.length;a<n;a++){let n=s.getPath(e,a),r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");i[a]=r}}newRegionAttachment(t,e,s,i){let a=new be(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");a.region=t}return a}newMeshAttachment(t,e,s,i){let a=new ge(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");a.region=t}return a}newBoundingBoxAttachment(t,e){return new Zt(e)}newPathAttachment(t,e){return new xe(e)}newPointAttachment(t,e){return new we(e)}newClippingAttachment(t,e){return new Qt(e)}}class ke{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=ie.Normal;skinRequired=!1;color=new R;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}!function(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"}(ie||(ie={}));class ve{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=ie.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,a,n,r){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=a,this.ashearX=n,this.ashearY=r;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+n)*B.degRad,d=(s+90+r)*B.degRad;return this.a=Math.cos(c)*i*l,this.b=Math.cos(d)*a*l,this.c=Math.sin(c)*i*h,this.d=Math.sin(d)*a*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case ie.Normal:{const t=(s+n)*B.degRad,e=(s+90+r)*B.degRad,o=Math.cos(t)*i,u=Math.cos(e)*a,m=Math.sin(t)*i,f=Math.sin(e)*a;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case ie.OnlyTranslation:{const t=(s+n)*B.degRad,e=(s+90+r)*B.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*a,this.c=Math.sin(t)*i,this.d=Math.sin(e)*a;break}case ie.NoRotationOrReflection:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*B.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*B.radDeg);const m=(s+n-u)*B.degRad,f=(s+r-u+90)*B.degRad,p=Math.cos(m)*i,g=Math.cos(f)*a,x=Math.sin(m)*i,w=Math.sin(f)*a;this.a=l*p-h*x,this.b=l*g-h*w,this.c=c*p+d*x,this.d=c*g+d*w;break}case ie.NoScale:case ie.NoScaleOrReflection:{s*=B.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),this.inherit==ie.NoScale&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,p=Math.sin(s)*m;n*=B.degRad,r=(90+r)*B.degRad;const g=Math.cos(n)*i,x=Math.cos(r)*a,w=Math.sin(n)*i,b=Math.sin(r)*a;this.a=o*g+f*w,this.b=o*x+f*b,this.c=u*g+p*w,this.d=u*x+p*b;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.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,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg);let e,s,i,a,n=t.a,r=t.b,o=t.c,l=t.d,h=1/(n*l-r*o),c=l*h,d=r*h,u=o*h,m=n*h,f=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=f*c-p*d,this.ay=p*m-f*u,this.inherit==ie.OnlyTranslation)e=this.a,s=this.b,i=this.c,a=this.d;else{switch(this.inherit){case ie.NoRotationOrReflection:{let t=Math.abs(n*l-r*o)/(n*n+o*o);r=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=n*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(n*l-r*o),c=l*h,d=r*h;break}case ie.NoScale:case ie.NoScaleOrReflection:let t=B.cosDeg(this.rotation),e=B.sinDeg(this.rotation);n=(n*t+r*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(n*n+o*o);s>1e-5&&(s=1/s),n*=s,o*=s,s=Math.sqrt(n*n+o*o),this.inherit==ie.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=B.PI/2+Math.atan2(o,n);r=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(n*l-r*o),c=l*h,d=r*h,u=o*h,m=n*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,i=m*this.c-u*this.a,a=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*a-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*a,t)*B.radDeg,this.arotation=Math.atan2(i,e)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+a*a),this.ashearY=0,this.arotation=90-Math.atan2(a,s)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,a=this.b;this.a=s*i-e*this.c,this.b=s*a-e*this.d,this.c=e*i+s*this.c,this.d=e*a+s*this.d}}class Se{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Ae{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Ie){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let a=t.lastIndexOf("/"),n=a>=0?t.substring(0,a+1):"";t=this.start(t),this.downloader.downloadText(t,(a=>{try{let r=new ue(a),o=r.pages.length,l=!1;for(let a of r.pages)this.loadTexture(i?i[a.name]:n+a.name,((s,i)=>{l||(a.setTexture(i),0==--o&&this.success(e,t,r))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}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 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}}class Ie{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),a=0;a<s;a++)i[a]=e.charCodeAt(a);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let a=()=>{this.finish(t,i.status,i.responseText)};i.onload=a,i.onerror=a,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let a=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):a()},i.onerror=a,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let a=200==e||0==e?[s]:[e,s];for(let t=a.length-1,e=i.length;t<e;t+=2)i[t].apply(null,a)}}class Me{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class Ce{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Fe{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,i,a,n,r){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case ie.OnlyTranslation:m=(e-t.worldX)*B.signum(t.skeleton.scaleX),f=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case ie.NoRotationOrReflection:let i=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),a=l/t.skeleton.scaleX,n=c/t.skeleton.scaleY;h=-n*i*t.skeleton.scaleX,d=a*i*t.skeleton.scaleY,u+=Math.atan2(n,a)*B.radDeg;default:let r=e-o.worldX,p=s-o.worldY,g=l*d-h*c;Math.abs(g)<=1e-4?(m=0,f=0):(m=(r*d-p*h)/g-t.ax,f=(p*l-r*c)/g-t.ay)}u+=Math.atan2(f,m)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,g=t.ascaleY;if(i||a){switch(t.inherit){case ie.NoScale:case ie.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=m*m+f*f;if(i&&t<o*o||a&&t>o*o){const e=(Math.sqrt(t)/o-1)*r+1;p*=e,n&&(g*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*r,p,g,t.ashearX,t.ashearY)}apply2(t,e,s,i,a,n,r,o,l){if(t.inherit!=ie.Normal||e.inherit!=ie.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,g=0,x=0,w=0;d<0?(d=-d,g=180,w=-1):(g=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,x=180):x=0;let b=e.ax,y=0,k=0,v=0,S=t.a,A=t.b,I=t.c,M=t.d,C=Math.abs(d-u)<=1e-4;!C||n?(y=0,k=S*b+t.worldX,v=I*b+t.worldY):(y=e.ay,k=S*b+A*y+t.worldX,v=I*b+M*y+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,A=F.b,I=F.c,M=F.d;let T=S*M-A*I,E=k-F.worldX,Y=v-F.worldY;T=Math.abs(T)<=1e-4?0:1/T;let _,X,R=(E*M-Y*A)*T-h,P=(Y*S-E*I)*T-c,V=Math.sqrt(R*R+P*P),D=e.data.length*p;if(V<1e-4)return this.apply1(t,s,i,!1,n,!1,l),void e.updateWorldTransformWith(b,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-F.worldX,Y=i-F.worldY;let O=(E*M-Y*A)*T-h,N=(Y*S-E*I)*T-c,L=O*O+N*N;if(0!=o){o*=d*(p+1)*.5;let t=Math.sqrt(L),e=t-V-D*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(C){D*=d;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,X=Math.PI*a):t>1?(t=1,X=0,n&&(S=(Math.sqrt(L)/(V+D)-1)*l+1,m*=S,r&&(f*=S))):X=Math.acos(t)*a,S=V+D*t,A=D*Math.sin(X),_=Math.atan2(N*S-O*A,O*S+N*A)}else{S=d*D,A=u*D;let t=S*S,e=A*A,s=Math.atan2(N,O);I=e*V*V+t*L-t*e;let i=-2*e*V,n=e-t;if(M=i*i-4*n*I,M>=0){let t=Math.sqrt(M);i<0&&(t=-t),t=.5*-(i+t);let e=t/n,r=I/t,o=Math.abs(e)<Math.abs(r)?e:r;if(e=L-o*o,e>=0){Y=Math.sqrt(e)*a,_=s-Math.atan2(Y,o),X=Math.atan2(Y/u,(o-V)/d);break t}}let r=B.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,p=0;I=-S*V/(t-e),I>=-1&&I<=1&&(I=Math.acos(I),E=S*Math.cos(I)+V,Y=A*Math.sin(I),M=E*E+Y*Y,M<l&&(r=I,l=M,o=E,h=Y),M>f&&(c=I,f=M,m=E,p=Y)),L<=.5*(l+f)?(_=s-Math.atan2(h*a,o),X=r*a):(_=s-Math.atan2(p*a,m),X=c*a)}let q=Math.atan2(y,b)*w,U=t.arotation;_=(_-q)*B.radDeg+g-U,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(h,c,U+_*l,m,f,0,0),U=e.arotation,X=((X+q)*B.radDeg-e.ashearX)*w+x-U,X>180?X-=360:X<-180&&(X+=360),e.updateWorldTransformWith(b,y,U+X*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Te extends Se{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class Ee extends Se{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=ae.Fixed;spacingMode=ne.Fixed;rotateMode=re.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ae||(ae={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(ne||(ne={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(re||(re={}));class Ye{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof xe))return;let s=this.mixRotate,i=this.mixX,a=this.mixY;if(0==s&&0==i&&0==a)return;let n=this.data,r=n.rotateMode==re.Tangent,o=n.rotateMode==re.ChainScale,l=this.bones,h=l.length,c=r?h:h+1,d=O.setArraySize(this.spaces,c),u=o?this.lengths=O.setArraySize(this.lengths,h):[],m=this.spacing;switch(n.spacingMode){case ne.Percent:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,a=s*e.c;u[t]=Math.sqrt(i*i+a*a)}O.arrayFill(d,1,c,m);break;case ne.Proportional:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],i=s.data.length;if(i<Ye.epsilon)o&&(u[e]=0),d[++e]=m;else{let a=i*s.a,n=i*s.c,r=Math.sqrt(a*a+n*n);o&&(u[e]=r),d[++e]=r,t+=r}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=n.spacingMode==ne.Length;for(let t=0,s=c-1;t<s;){let s=l[t],i=s.data.length;if(i<Ye.epsilon)o&&(u[t]=0),d[++t]=m;else{let a=i*s.a,n=i*s.c,r=Math.sqrt(a*a+n*n);o&&(u[t]=r),d[++t]=(e?i+m:m)*r/i}}}let f=this.computeWorldPositions(e,c,r),p=f[0],g=f[1],x=n.offsetRotation,w=!1;if(0==x)w=n.rotateMode==re.Chain;else{w=!1;let t=this.target.bone;x*=t.a*t.d-t.b*t.c>0?B.degRad:-B.degRad}for(let t=0,e=3;t<h;t++,e+=3){let n=l[t];n.worldX+=(p-n.worldX)*i,n.worldY+=(g-n.worldY)*a;let h=f[e],c=f[e+1],m=h-p,b=c-g;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+b*b)/e-1)*s+1;n.a*=t,n.c*=t}}if(p=h,g=c,s>0){let i=n.a,a=n.b,o=n.c,l=n.d,h=0,c=0,u=0;if(h=r?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(b,m),h-=Math.atan2(o,i),w){c=Math.cos(h),u=Math.sin(h);let t=n.data.length;p+=(t*(c*i-u*o)-m)*s,g+=(t*(u*i+c*o)-b)*s}else h+=x;h>B.PI?h-=B.PI2:h<-B.PI&&(h+=B.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),n.a=c*i-u*o,n.b=c*a-u*l,n.c=u*i+c*o,n.d=u*a+c*l}n.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,a=this.position,n=this.spaces,r=O.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=Ye.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(this.data.positionMode==ae.Percent&&(a*=f),this.data.spacingMode){case ne.Percent:m=f;break;case ne.Proportional:m=f/e;break;default:m=1}o=O.setArraySize(this.world,8);for(let p=0,g=0,x=0;p<e;p++,g+=3){let e=n[p]*m;a+=e;let w=a;if(l)w%=f,w<0&&(w+=f),x=0;else{if(w<0){d!=Ye.BEFORE&&(d=Ye.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(w,o,0,r,g);continue}if(w>f){d!=Ye.AFTER&&(d=Ye.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,r,g);continue}}for(;;x++){let t=u[x];if(!(w>t)){if(0==x)w/=t;else{let e=u[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],r,g,s||p>0&&0==e)}return r}l?(h+=2,o=O.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=O.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=O.setArraySize(this.curves,c),f=0,p=o[0],g=o[1],x=0,w=0,b=0,y=0,k=0,v=0,S=0,A=0,I=0,M=0,C=0,F=0,T=0,E=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],w=o[e+1],b=o[e+2],y=o[e+3],k=o[e+4],v=o[e+5],S=.1875*(p-2*x+b),A=.1875*(g-2*w+y),I=.09375*(3*(x-b)-p+k),M=.09375*(3*(w-y)-g+v),C=2*S+I,F=2*A+M,T=.75*(x-p)+S+.16666667*I,E=.75*(w-g)+A+.16666667*M,f+=Math.sqrt(T*T+E*E),T+=C,E+=F,C+=I,F+=M,f+=Math.sqrt(T*T+E*E),T+=C,E+=F,f+=Math.sqrt(T*T+E*E),T+=C+I,E+=F+M,f+=Math.sqrt(T*T+E*E),m[t]=f,p=k,g=v;switch(this.data.positionMode==ae.Percent&&(a*=f),this.data.spacingMode){case ne.Percent:u=f;break;case ne.Proportional:u=f/e;break;default:u=1}let Y=this.segments,_=0;for(let t=0,i=0,c=0,X=0;t<e;t++,i+=3){let e=n[t]*u;a+=e;let R=a;if(l)R%=f,R<0&&(R+=f),c=0;else{if(R<0){this.addBeforePosition(R,o,0,r,i);continue}if(R>f){this.addAfterPosition(R-f,o,h-4,r,i);continue}}for(;;c++){let t=m[c];if(!(R>t)){if(0==c)R/=t;else{let e=m[c-1];R=(R-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],g=o[t+1],x=o[t+2],w=o[t+3],b=o[t+4],y=o[t+5],k=o[t+6],v=o[t+7],S=.03*(p-2*x+b),A=.03*(g-2*w+y),I=.006*(3*(x-b)-p+k),M=.006*(3*(w-y)-g+v),C=2*S+I,F=2*A+M,T=.3*(x-p)+S+.16666667*I,E=.3*(w-g)+A+.16666667*M,_=Math.sqrt(T*T+E*E),Y[0]=_,t=1;t<8;t++)T+=C,E+=F,C+=I,F+=M,_+=Math.sqrt(T*T+E*E),Y[t]=_;T+=C,E+=F,_+=Math.sqrt(T*T+E*E),Y[8]=_,T+=C+I,E+=F+M,_+=Math.sqrt(T*T+E*E),Y[9]=_,X=0}for(R*=_;;X++){let t=Y[X];if(!(R>t)){if(0==X)R/=t;else{let e=Y[X-1];R=X+(R-e)/(t-e)}break}}this.addCurvePosition(.1*R,p,g,x,w,b,y,k,v,r,i,s||t>0&&0==e)}return r}addBeforePosition(t,e,s,i,a){let n=e[s],r=e[s+1],o=e[s+2]-n,l=e[s+3]-r,h=Math.atan2(l,o);i[a]=n+t*Math.cos(h),i[a+1]=r+t*Math.sin(h),i[a+2]=h}addAfterPosition(t,e,s,i,a){let n=e[s+2],r=e[s+3],o=n-e[s],l=r-e[s+1],h=Math.atan2(l,o);i[a]=n+t*Math.cos(h),i[a+1]=r+t*Math.sin(h),i[a+2]=h}addCurvePosition(t,e,s,i,a,n,r,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(a-s,i-e));let u=t*t,m=u*t,f=1-t,p=f*f,g=p*f,x=f*t,w=3*x,b=f*w,y=w*t,k=e*g+i*b+n*y+o*m,v=s*g+a*b+r*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(a-s,i-e):Math.atan2(v-(s*p+a*x*2+r*u),k-(e*p+i*x*2+n*u)))}}class _e{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,i=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,n=this.data.scaleX>0,r=this.bone,o=r.data.length;switch(t){case oe.none:return;case oe.reset:this.reset();case oe.update:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=r.worldX,c=r.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,p=-1,g=this.data.limit*l,x=g*Math.abs(t.scaleY);if(g*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*u;this.xOffset+=t>g?g:t<-g?-g:t,this.ux=h}if(i){const t=(this.uy-c)*u;this.yOffset+=t>x?x:t<-x?-x:t,this.uy=c}if(d>=m){p=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,a=this.wind*f,n=(Be.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(a-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),i&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m}while(d>=m)}s&&(r.worldX+=this.xOffset*e*this.data.x),i&&(r.worldY+=this.yOffset*e*this.data.y)}if(a||n){let t=Math.atan2(r.c,r.a),s=0,i=0,l=0,h=this.cx-r.worldX,c=this.cy-r.worldY;if(h>g?h=g:h<-g&&(h=-g),c>x?c=x:c<-x&&(c=-x),a){l=(this.data.rotate+this.data.shearX)*e;let a=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(a-Math.ceil(a*B.invPI2-.5)*B.PI2)*u,a=this.rotateOffset*l+t,s=Math.cos(a),i=Math.sin(a),n&&(a=o*r.getWorldScaleX(),a>0&&(this.scaleOffset+=(h*s+c*i)*u/a))}else{s=Math.cos(t),i=Math.sin(t);const e=o*r.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*i)*u/e)}if(d=this.remaining,d>=m){-1==p&&(p=Math.pow(this.damping,60*m));const e=this.massInverse*m,r=this.strength,h=this.wind,c=Be.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,n&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*r)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),a){if(this.rotateVelocity-=((h*i+c*s)*u+this.rotateOffset*r)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const a=this.rotateOffset*l+t;s=Math.cos(a),i=Math.sin(a)}else if(d<m)break}}this.remaining=d}this.cx=r.worldX,this.cy=r.worldY;break;case oe.pose:s&&(r.worldX+=this.xOffset*e*this.data.x),i&&(r.worldY+=this.yOffset*e*this.data.y)}if(a){let t=this.rotateOffset*e,s=0,i=0,a=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),a=r.b,r.b=i*a-s*r.d,r.d=s*a+i*r.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),a=r.a,r.a=i*a-s*r.c,r.c=s*a+i*r.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),a=r.a,r.a=i*a-s*r.c,r.c=s*a+i*r.c,a=r.b,r.b=i*a-s*r.d,r.d=s*a+i*r.d}if(n){const t=1+this.scaleOffset*e*this.data.scaleX;r.a*=t,r.c*=t}t!=oe.pose&&(this.tx=o*r.a,this.ty=o*r.c),r.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,a=Math.cos(i),n=Math.sin(i),r=this.cx-t,o=this.cy-e;this.translate(r*a-o*n-r,r*n+o*a-o)}}class Xe{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new R,this.darkColor=t.darkColor?new R:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof $&&this.attachment instanceof $&&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}}class Re{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new q;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,i=g.c,a=g.d,n=Math.atan2(c,l)-Math.atan2(i,e)+m;n>B.PI?n-=B.PI2:n<-B.PI&&(n+=B.PI2),n*=t;let r=Math.cos(n),o=Math.sin(n);g.a=r*e-o*i,g.b=r*s-o*a,g.c=o*e+r*i,g.d=o*s+r*a}if(r){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(t.x-g.worldX)*e,g.worldY+=(t.y-g.worldY)*s}if(0!=i){let t=Math.sqrt(g.a*g.a+g.c*g.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*i)/t),g.a*=t,g.c*=t}if(0!=a){let t=Math.sqrt(g.b*g.b+g.d*g.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*a)/t),g.b*=t,g.d*=t}if(n>0){let t=g.b,e=g.d,s=Math.atan2(e,t),i=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(g.c,g.a));i>B.PI?i-=B.PI2:i<-B.PI&&(i+=B.PI2),i=s+(i+f)*n;let a=Math.sqrt(t*t+e*e);g.b=Math.cos(i)*a,g.d=Math.sin(i)*a}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,i=g.c,a=g.d,n=Math.atan2(c,l)+m;n>B.PI?n-=B.PI2:n<-B.PI&&(n+=B.PI2),n*=t;let r=Math.cos(n),o=Math.sin(n);g.a=r*e-o*i,g.b=r*s-o*a,g.c=o*e+r*i,g.d=o*s+r*a}if(r){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=t.x*e,g.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=t,g.c*=t}if(0!=a){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*a+1;g.b*=t,g.d*=t}if(n>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>B.PI?t-=B.PI2:t<-B.PI&&(t+=B.PI2);let e=g.b,s=g.d;t=Math.atan2(s,e)+(t-B.PI/2+f)*n;let i=Math.sqrt(e*e+s*s);g.b=Math.cos(t)*i,g.d=Math.sin(t)*i}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(r.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(r.ax-d+this.data.offsetX)*e,u+=(r.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(r.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=a&&0!=f&&(f=(f+(r.ascaleY-f+this.data.offsetScaleY)*a)/f);let p=h.ashearY;0!=n&&(p+=(r.ashearY-p+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,a=this.mixScaleY,n=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(r.arotation+this.data.offsetRotation)*t,d=h.ax+(r.ax+this.data.offsetX)*e,u=h.ay+(r.ay+this.data.offsetY)*s,m=h.ascaleX*((r.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((r.ascaleY-1+this.data.offsetScaleY)*a+1),p=h.ashearY+(r.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}}class Be{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Be.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new ve(i,this,t),t.children.push(s)}else s=new ve(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],a=new Xe(s,i);this.slots.push(a),this.drawOrder.push(a)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Fe(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Re(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Ye(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new _e(s,this))}this.color=new R(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,a=this.physicsConstraints,n=e.length,r=s.length,o=i.length,l=this.physicsConstraints.length,h=n+r+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<r;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=a[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let a=e.getAttachment();a instanceof xe&&this.sortPathConstraintAttachmentWith(a,i);let n=t.bones,r=n.length;for(let t=0;t<r;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<r;t++)this.sortReset(n[t].children);for(let t=0;t<r;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&O.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof xe))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&O.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=e.a,a=e.b,n=e.c,r=e.d;s.worldX=i*this.x+a*this.y+e.worldX,s.worldY=n*this.x+r*this.y+e.worldY;const o=(s.rotation+s.shearX)*B.degRad,l=(s.rotation+90+s.shearY)*B.degRad,h=Math.cos(o)*s.scaleX,c=Math.cos(l)*s.scaleY,d=Math.sin(o)*s.scaleX,u=Math.sin(l)*s.scaleY;s.a=(i*h+a*d)*this.scaleX,s.b=(i*c+a*u)*this.scaleX,s.c=(n*h+r*d)*this.scaleY,s.d=(n*c+r*u)*this.scaleY;let m=this._updateCache;for(let e=0,i=m.length;e<i;e++){let i=m[e];i!=s&&i.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;O.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}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 s=0,i=e.length;s<i;s++){let i=e[s],a=i.data.attachmentName;if(a){let e=t.getAttachment(s,a);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,a=s.length;i<a;i++){let a=s[i];if(a.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void a.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new q,e=new q;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let a=this.drawOrder,n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=a.length;t<e;t++){let e=a[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof be)h=8,c=O.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Be.quadTriangles;else if(u instanceof ge){let t=u;h=t.worldVerticesLength,c=O.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Qt&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];n=Math.min(n,e),r=Math.min(r,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(n,r),e.set(o-n,l-r)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,a=s.length;i<a;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let a=0,n=i.length;a<n;a++)i[a].rotate(t,e,s)}}!function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"}(oe||(oe={}));class Pe extends Se{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class Ve{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}}class De{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class Oe{name;attachments=new Array;bones=Array();constraints=new Array;color=new R(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof ge?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let a=s[i];a&&t.push(new De(e,i,a))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let a=s[i];a&&e.push(new De(t,i,a))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let a=t.slots[i],n=a.getAttachment();if(n&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(n==t[e]){let t=this.getAttachment(s,e);t&&a.setAttachment(t);break}}}s++}}}class Ne{index=0;name;boneData;color=new R(1,1,1,1);darkColor=null;attachmentName=null;blendMode=le.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(le||(le={}));class Le extends Se{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class qe{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ve;s.name="";let i=new Ue(t),a=i.readInt32(),n=i.readInt32();s.hash=0==n&&0==a?null:n.toString(16)+a.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let r=i.readBoolean();r&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let o=0;o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("String in string table must not be null.");i.strings.push(t)}o=i.readInt(!0);for(let t=0;t<o;t++){let a=i.readString();if(!a)throw new Error("Bone name must not be null.");let n=0==t?null:s.bones[i.readInt(!0)],o=new ke(t,a,n);o.rotation=i.readFloat(),o.x=i.readFloat()*e,o.y=i.readFloat()*e,o.scaleX=i.readFloat(),o.scaleY=i.readFloat(),o.shearX=i.readFloat(),o.shearY=i.readFloat(),o.length=i.readFloat()*e,o.inherit=i.readByte(),o.skinRequired=i.readBoolean(),r&&(R.rgba8888ToColor(o.color,i.readInt32()),o.icon=i.readString()??void 0,o.visible=i.readBoolean()),s.bones.push(o)}o=i.readInt(!0);for(let t=0;t<o;t++){let e=i.readString();if(!e)throw new Error("Slot name must not be null.");let a=s.bones[i.readInt(!0)],n=new Ne(t,e,a);R.rgba8888ToColor(n.color,i.readInt32());let o=i.readInt32();-1!=o&&R.rgb888ToColor(n.darkColor=new R,o),n.attachmentName=i.readStringRef(),n.blendMode=i.readInt(!0),r&&(n.visible=i.readBoolean()),s.slots.push(n)}o=i.readInt(!0);for(let t,a=0;a<o;a++){let a=i.readString();if(!a)throw new Error("IK constraint data name must not be null.");let n=new Te(a);n.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[i.readInt(!0)]);n.target=s.bones[i.readInt(!0)];let r=i.readByte();n.skinRequired=!!(1&r),n.bendDirection=2&r?1:-1,n.compress=!!(4&r),n.stretch=!!(8&r),n.uniform=!!(16&r),32&r&&(n.mix=64&r?i.readFloat():1),128&r&&(n.softness=i.readFloat()*e),s.ikConstraints.push(n)}o=i.readInt(!0);for(let t,a=0;a<o;a++){let a=i.readString();if(!a)throw new Error("Transform constraint data name must not be null.");let n=new Le(a);n.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[i.readInt(!0)]);n.target=s.bones[i.readInt(!0)];let r=i.readByte();n.skinRequired=!!(1&r),n.local=!!(2&r),n.relative=!!(4&r),8&r&&(n.offsetRotation=i.readFloat()),16&r&&(n.offsetX=i.readFloat()*e),32&r&&(n.offsetY=i.readFloat()*e),64&r&&(n.offsetScaleX=i.readFloat()),128&r&&(n.offsetScaleY=i.readFloat()),r=i.readByte(),1&r&&(n.offsetShearY=i.readFloat()),2&r&&(n.mixRotate=i.readFloat()),4&r&&(n.mixX=i.readFloat()),8&r&&(n.mixY=i.readFloat()),16&r&&(n.mixScaleX=i.readFloat()),32&r&&(n.mixScaleY=i.readFloat()),64&r&&(n.mixShearY=i.readFloat()),s.transformConstraints.push(n)}o=i.readInt(!0);for(let t,a=0;a<o;a++){let a=i.readString();if(!a)throw new Error("Path constraint data name must not be null.");let n=new Ee(a);n.order=i.readInt(!0),n.skinRequired=i.readBoolean(),t=i.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[i.readInt(!0)]);n.target=s.slots[i.readInt(!0)];const r=i.readByte();n.positionMode=1&r,n.spacingMode=r>>1&3,n.rotateMode=r>>3&3,128&r&&(n.offsetRotation=i.readFloat()),n.position=i.readFloat(),n.positionMode==ae.Fixed&&(n.position*=e),n.spacing=i.readFloat(),n.spacingMode!=ne.Length&&n.spacingMode!=ne.Fixed||(n.spacing*=e),n.mixRotate=i.readFloat(),n.mixX=i.readFloat(),n.mixY=i.readFloat(),s.pathConstraints.push(n)}o=i.readInt(!0);for(let t=0;t<o;t++){const t=i.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const a=new Pe(t);a.order=i.readInt(!0),a.bone=s.bones[i.readInt(!0)];let n=i.readByte();a.skinRequired=!!(1&n),2&n&&(a.x=i.readFloat()),4&n&&(a.y=i.readFloat()),8&n&&(a.rotate=i.readFloat()),16&n&&(a.scaleX=i.readFloat()),32&n&&(a.shearX=i.readFloat()),a.limit=(64&n?i.readFloat():5e3)*e,a.step=1/i.readUnsignedByte(),a.inertia=i.readFloat(),a.strength=i.readFloat(),a.damping=i.readFloat(),a.massInverse=128&n?i.readFloat():1,a.wind=i.readFloat(),a.gravity=i.readFloat(),n=i.readByte(),1&n&&(a.inertiaGlobal=!0),2&n&&(a.strengthGlobal=!0),4&n&&(a.dampingGlobal=!0),8&n&&(a.massGlobal=!0),16&n&&(a.windGlobal=!0),32&n&&(a.gravityGlobal=!0),64&n&&(a.mixGlobal=!0),a.mix=128&n?i.readFloat():1,s.physicsConstraints.push(a)}let l=this.readSkin(i,s,!0,r);l&&(s.defaultSkin=l,s.skins.push(l));{let t=s.skins.length;for(O.setArraySize(s.skins,o=t+i.readInt(!0));t<o;t++){let e=this.readSkin(i,s,!1,r);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const i=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let a=i.getAttachment(e.slotIndex,e.parent);if(!a)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?a:e.mesh,e.mesh.setParentMesh(a),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ce(t);e.intValue=i.readInt(!1),e.floatValue=i.readFloat(),e.stringValue=i.readString(),e.audioPath=i.readString(),e.audioPath&&(e.volume=i.readFloat(),e.balance=i.readFloat()),s.events.push(e)}o=i.readInt(!0);for(let t=0;t<o;t++){let t=i.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,t,s))}return s}readSkin(t,e,s,i){let a=null,n=0;if(s){if(n=t.readInt(!0),0==n)return null;a=new Oe("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");a=new Oe(s),i&&R.rgba8888ToColor(a.color,t.readInt32()),a.bones.length=t.readInt(!0);for(let s=0,i=a.bones.length;s<i;s++)a.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)a.constraints.push(e.physicsConstraints[t.readInt(!0)]);n=t.readInt(!0)}for(let s=0;s<n;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("Attachment name must not be null");let r=this.readAttachment(t,e,a,s,n,i);r&&a.setAttachment(s,n,r)}}return a}readAttachment(t,e,s,i,a,n){let r=this.scale,o=t.readByte();const l=8&o?t.readStringRef():a;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case he.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,a=64&o?this.readSequence(t):null;let n=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,a);return p?(p.path=e,p.x=h*r,p.y=c*r,p.scaleX=d,p.scaleY=u,p.rotation=n,p.width=m*r,p.height=f*r,R.rgba8888ToColor(p.color,i),p.sequence=a,null==a&&p.updateRegion(),p):null}case he.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=n?t.readInt32():0,a=this.attachmentLoader.newBoundingBoxAttachment(s,l);return a?(a.worldVerticesLength=e.length,a.vertices=e.vertices,a.bones=e.bones,n&&R.rgba8888ToColor(a.color,i),a):null}case he.Mesh:{let e=16&o?t.readStringRef():l;const i=32&o?t.readInt32():4294967295,a=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,p=0;n&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),p=t.readFloat()),e||(e=l);let g=this.attachmentLoader.newMeshAttachment(s,l,e,a);return g?(g.path=e,R.rgba8888ToColor(g.color,i),g.bones=c.bones,g.vertices=c.vertices,g.worldVerticesLength=c.length,g.triangles=u,g.regionUVs=d,null==a&&g.updateRegion(),g.hullLength=h<<1,g.sequence=a,n&&(g.edges=m,g.width=f*r,g.height=p*r),g):null}case he.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const a=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;n&&(m=t.readFloat(),f=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,R.rgba8888ToColor(p.color,a),p.sequence=h,n&&(p.width=m*r,p.height=f*r),this.linkedMeshes.push(new We(p,d,i,u,c)),p):null}case he.Path:{const e=!!(16&o),i=!!(32&o),a=this.readVertices(t,!!(64&o)),h=O.newArray(a.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*r;const c=n?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=i,d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,d.lengths=h,n&&R.rgba8888ToColor(d.color,c),d):null}case he.Point:{const e=t.readFloat(),i=t.readFloat(),a=t.readFloat(),o=n?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=i*r,h.y=a*r,h.rotation=e,n&&R.rgba8888ToColor(h.color,o),h):null}case he.Clipping:{const i=t.readInt(!0),a=this.readVertices(t,!!(16&o));let r=n?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[i],h.worldVerticesLength=a.length,h.vertices=a.vertices,h.bones=a.bones,n&&R.rgba8888ToColor(h.color,r),h):null}}return null}readSequence(t){let e=new G(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),a=new ze;if(a.length=i<<1,!e)return a.vertices=this.readFloatArray(t,a.length,s),a;let n=new Array,r=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);r.push(e);for(let i=0;i<e;i++)r.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return a.vertices=O.toFloatArray(n),a.bones=r,a}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let a=0;a<e;a++)i[a]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,a=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readByte(),a=t.readInt(!0),n=a-1;switch(s){case rs:{let s=new yt(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case os:{let s=t.readInt(!0),r=new pt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,u,1),je(t,r,s++,e,3,o,i,d,m,1)}o=i,l=a,h=n,c=u,d=m}i.push(r);break}case ls:{let s=t.readInt(!0),r=new gt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,d,1)}o=i,l=a,h=n,c=d}i.push(r);break}case hs:{let s=t.readInt(!0),r=new wt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d,u,m,f),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,p,1),je(t,r,s++,e,3,o,i,d,g,1),je(t,r,s++,e,4,o,i,u,x,1),je(t,r,s++,e,5,o,i,m,w,1),je(t,r,s++,e,6,o,i,f,b,1)}o=i,l=a,h=n,c=p,d=g,u=x,m=w,f=b}i.push(r);break}case cs:{let s=t.readInt(!0),r=new bt(a,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d,u,m),e!=n;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Is:r.setStepped(e);break;case Ms:je(t,r,s++,e,0,o,i,l,a,1),je(t,r,s++,e,1,o,i,h,n,1),je(t,r,s++,e,2,o,i,c,f,1),je(t,r,s++,e,3,o,i,d,p,1),je(t,r,s++,e,4,o,i,u,g,1),je(t,r,s++,e,5,o,i,m,x,1)}o=i,l=a,h=n,c=f,d=p,u=g,m=x}i.push(r);break}case ds:{let s=new xt(a,t.readInt(!0),e),r=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,r,o),e!=n;e++){let a=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case Is:s.setStepped(e);break;case Ms:je(t,s,i++,e,0,r,a,o,n,1)}r=a,o=n}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0);if(s==ns){let s=new ft(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let r=t.readInt(!0);switch(s){case He:i.push($e(t,new at(n,r,e),1));break;case Je:i.push(Ge(t,new nt(n,r,e),a));break;case Ke:i.push($e(t,new rt(n,r,e),a));break;case Ze:i.push($e(t,new ot(n,r,e),a));break;case Qe:i.push(Ge(t,new lt(n,r,e),1));break;case ts:i.push($e(t,new ht(n,r,e),1));break;case es:i.push($e(t,new ct(n,r,e),1));break;case ss:i.push(Ge(t,new dt(n,r,e),1));break;case is:i.push($e(t,new ut(n,r,e),1));break;case as:i.push($e(t,new mt(n,r,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new At(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*a:0;for(let e=0,s=0;r.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const i=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*a:0;64&o?r.setStepped(e):128&o&&(je(t,r,s++,e,0,l,i,h,n,1),je(t,r,s++,e,1,l,i,c,d,a)),l=i,h=n,c=d}i.push(r)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),a=s-1,n=new It(s,t.readInt(!0),e),r=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;n.setFrame(e,r,o,l,h,c,d,u),e!=a;e++){let i=t.readFloat(),a=t.readFloat(),m=t.readFloat(),f=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Is:n.setStepped(e);break;case Ms:je(t,n,s++,e,0,r,i,o,a,1),je(t,n,s++,e,1,r,i,l,m,1),je(t,n,s++,e,2,r,i,h,f,1),je(t,n,s++,e,3,r,i,c,p,1),je(t,n,s++,e,4,r,i,d,g,1),je(t,n,s++,e,5,r,i,u,x,1)}r=i,o=a,l=m,h=f,c=p,d=g,u=x}i.push(n)}for(let e=0,n=t.readInt(!0);e<n;e++){let e=t.readInt(!0),n=s.pathConstraints[e];for(let s=0,r=t.readInt(!0);s<r;s++){const s=t.readByte(),r=t.readInt(!0),o=t.readInt(!0);switch(s){case fs:i.push($e(t,new Mt(r,o,e),n.positionMode==ae.Fixed?a:1));break;case ps:i.push($e(t,new Ct(r,o,e),n.spacingMode==ne.Length||n.spacingMode==ne.Fixed?a:1));break;case gs:let s=new Ft(r,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,a=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=a;e++){let a=t.readFloat(),n=t.readFloat(),r=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Is:s.setStepped(e);break;case Ms:je(t,s,i++,e,0,l,a,h,n,1),je(t,s,i++,e,1,l,a,c,r,1),je(t,s,i++,e,2,l,a,d,o,1)}l=a,h=n,c=r,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0);if(s==As){const s=new Vt(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const n=t.readInt(!0);switch(s){case xs:i.push($e(t,new Et(a,n,e),1));break;case ws:i.push($e(t,new Yt(a,n,e),1));break;case bs:i.push($e(t,new _t(a,n,e),1));break;case ys:i.push($e(t,new Xt(a,n,e),1));break;case ks:i.push($e(t,new Rt(a,n,e),1));break;case vs:i.push($e(t,new Bt(a,n,e),1));break;case Ss:i.push($e(t,new Pt(a,n,e),1))}}}for(let e=0,n=t.readInt(!0);e<n;e++){let e=s.skins[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let r=e.getAttachment(s,n),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case us:{let e=r,n=e.bones,o=e.vertices,c=n?o.length/3*2:o.length,d=t.readInt(!0),u=new kt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,r=t.readInt(!0);if(0==r)i=n?O.newFloatArray(c):o;else{i=O.newFloatArray(c);let e=t.readInt(!0);if(r+=e,1==a)for(let s=e;s<r;s++)i[s]=t.readFloat();else for(let s=e;s<r;s++)i[s]=t.readFloat()*a;if(!n)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case Is:u.setStepped(e);break;case Ms:je(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case ms:{let e=new Dt(l,s,r);for(let s=0;s<l;s++){let i=t.readFloat(),a=t.readInt32();e.setFrame(s,i,H[15&a],a>>4,t.readFloat())}i.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new St(n),a=s.slots.length;for(let s=0;s<n;s++){let i=t.readFloat(),n=t.readInt(!0),r=O.newArray(a,0);for(let t=a-1;t>=0;t--)r[t]=-1;let o=O.newArray(a-n,0),l=0,h=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;r[l+t.readInt(!0)]=l++}for(;l<a;)o[h++]=l++;for(let t=a-1;t>=0;t--)-1==r[t]&&(r[t]=o[--h]);e.setFrame(s,i,r)}i.push(e)}let r=t.readInt(!0);if(r>0){let e=new vt(r);for(let i=0;i<r;i++){let a=t.readFloat(),n=s.events[t.readInt(!0)],r=new Me(a,n);r.intValue=t.readInt(!1),r.floatValue=t.readFloat(),r.stringValue=t.readString(),null==r.stringValue&&(r.stringValue=n.stringValue),r.data.audioPath&&(r.volume=t.readFloat(),r.balance=t.readFloat()),e.setFrame(i,r)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new J(e,i,o)}}class Ue{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class We{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,a){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}}class ze{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function $e(t,e,s){let i=t.readFloat(),a=t.readFloat()*s;for(let n=0,r=0,o=e.getFrameCount()-1;e.setFrame(n,i,a),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Is:e.setStepped(n);break;case Ms:je(t,e,r++,n,0,i,o,a,l,s)}i=o,a=l}return e}function Ge(t,e,s){let i=t.readFloat(),a=t.readFloat()*s,n=t.readFloat()*s;for(let r=0,o=0,l=e.getFrameCount()-1;e.setFrame(r,i,a,n),r!=l;r++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Is:e.setStepped(r);break;case Ms:je(t,e,o++,r,0,i,l,a,h,s),je(t,e,o++,r,1,i,l,n,c,s)}i=l,a=h,n=c}return e}function je(t,e,s,i,a,n,r,o,l,h){e.setBezier(s,i,a,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,r,l)}!function(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"}(he||(he={}));const He=0,Je=1,Ke=2,Ze=3,Qe=4,ts=5,es=6,ss=7,is=8,as=9,ns=10,rs=0,os=1,ls=2,hs=3,cs=4,ds=5,us=0,ms=1,fs=0,ps=1,gs=2,xs=0,ws=1,bs=2,ys=4,ks=5,vs=6,Ss=7,As=8,Is=1,Ms=2;class Cs{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new L((()=>O.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,a=this.polygonPool,n=t.slots,r=n.length;s.length=0,a.freeAll(i),i.length=0;for(let t=0;t<r;t++){let e=n[t];if(!e.bone.active)continue;let r=e.getAttachment();if(r instanceof Zt){let t=r;s.push(t);let n=a.obtain();n.length!=t.worldVerticesLength&&(n=O.newFloatArray(t.worldVerticesLength)),i.push(n),t.computeWorldVertices(e,0,t.worldVerticesLength,n,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=this.polygons;for(let n=0,r=a.length;n<r;n++){let r=a[n],o=r;for(let a=0,n=r.length;a<n;a+=2){let n=o[a],r=o[a+1];t=Math.min(t,n),e=Math.min(e,r),s=Math.max(s,n),i=Math.max(i,r)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let a=this.minX,n=this.minY,r=this.maxX,o=this.maxY;if(t<=a&&s<=a||e<=n&&i<=n||t>=r&&s>=r||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(a-t)+e;if(h>n&&h<o)return!0;if(h=l*(r-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>a&&c<r||(c=(o-e)/l+t,c>a&&c<r)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,a=s.length;i<a;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,a=t.length,n=a-2,r=!1;for(let t=0;t<a;t+=2){let a=i[t+1],o=i[n+1];if(a<s&&o>=s||o<s&&a>=s){let l=i[t];l+(s-a)/(o-a)*(i[n]-l)<e&&(r=!r)}n=t}return r}intersectsSegment(t,e,s,i){let a=this.polygons;for(let n=0,r=a.length;n<r;n++)if(this.intersectsSegmentPolygon(a[n],t,e,s,i))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,i,a){let n=t,r=t.length,o=e-i,l=s-a,h=e*a-s*i,c=n[r-2],d=n[r-1];for(let t=0;t<r;t+=2){let r=n[t],u=n[t+1],m=c*u-d*r,f=c-r,p=d-u,g=o*p-l*f,x=(h*f-o*m)/g;if((x>=c&&x<=r||x>=r&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*p-l*m)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=a||t>=a&&t<=s))return!0}c=r,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class Fs{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new L((()=>new Array));polygonIndicesPool=new L((()=>new Array));triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let a=this.isConcaveArray;a.length=0;for(let t=0,n=s;t<n;++t)a[t]=Fs.isConcave(t,s,e,i);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,r=0,o=1;for(;;){t:if(!a[r]){let n=i[t]<<1,l=i[r]<<1,h=i[o]<<1,c=e[n],d=e[n+1],u=e[l],m=e[l+1],f=e[h],p=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!a[n])continue;let t=i[n]<<1,s=e[t],r=e[t+1];if(Fs.positiveArea(f,p,c,d,s,r)&&Fs.positiveArea(c,d,u,m,s,r)&&Fs.positiveArea(u,m,f,p,s,r))break t}break}if(0==o){do{if(!a[r])break;r--}while(r>0);break}t=r,r=o,o=(o+1)%s}n.push(i[(s+r-1)%s]),n.push(i[r]),n.push(i[(r+1)%s]),i.splice(r,1),a.splice(r,1),s--;let l=(s+r-1)%s,h=r==s?0:r;a[l]=Fs.isConcave(l,s,e,i),a[h]=Fs.isConcave(h,s,e,i)}return 3==s&&(n.push(i[2]),n.push(i[0]),n.push(i[1])),n}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let r=this.polygonPool.obtain();r.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],p=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=r.length-4,e=Fs.winding(r[t],r[t+1],r[t+2],r[t+3],g,x),s=Fs.winding(g,x,r[0],r[1],r[2],r[3]);e==l&&s==l&&(r.push(g),r.push(x),n.push(d),w=!0)}w||(r.length>0?(i.push(r),a.push(n)):(this.polygonPool.free(r),this.polygonIndicesPool.free(n)),r=this.polygonPool.obtain(),r.length=0,r.push(u),r.push(m),r.push(f),r.push(p),r.push(g),r.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Fs.winding(u,m,f,p,g,x),o=h)}r.length>0&&(i.push(r),a.push(n));for(let t=0,e=i.length;t<e;t++){if(n=a[t],0==n.length)continue;let s=n[0],o=n[n.length-1];r=i[t];let l=r.length-4,h=r[l],c=r[l+1],d=r[l+2],u=r[l+3],m=r[0],f=r[1],p=r[2],g=r[3],x=Fs.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=a[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],k=i[l],v=k[k.length-2],S=k[k.length-1];if(w!=s||b!=o)continue;let A=Fs.winding(h,c,d,u,v,S),I=Fs.winding(v,S,m,f,p,g);A==x&&I==x&&(k.length=0,e.length=0,r.push(v),r.push(S),n.push(y),h=d,c=u,d=v,u=S,l=0)}}for(let t=i.length-1;t>=0;t--)r=i[t],0==r.length&&(i.splice(t,1),this.polygonPool.free(r),n=a[t],a.splice(t,1),this.polygonIndicesPool.free(n));return i}static isConcave(t,e,s,i){let a=i[(e+t-1)%e]<<1,n=i[t]<<1,r=i[(t+1)%e]<<1;return!this.positiveArea(s[a],s[a+1],s[n],s[n+1],s[r],s[r+1])}static positiveArea(t,e,s,i,a,n){return t*(n-i)+s*(e-n)+a*(i-e)>=0}static winding(t,e,s,i,a,n){let r=s-t,o=i-e;return a*o-n*r+r*e-t*o>=0?1:-1}}class Ts{triangulator=new Fs;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=O.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let a=this.clippingPolygon;Ts.makeClockwise(a);let n=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let t=0,e=n.length;t<e;t++){let e=n[t];Ts.makeClockwise(e),e.push(e[0]),e.push(e[1])}return n.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 null!=this.clipAttachment}clipTriangles(t,e,s,i,a,n,r,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=a,d=n,u=r,m=o):(l=e,h=s,c=i,d=a,u=n,m=r),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,a=this.clippedVertices,n=this.clippedTriangles,r=this.clippingPolygons,o=r.length,l=0;a.length=0,n.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=a.length;if(!this.clip(c,d,u,m,f,p,r[t],i)){let t=O.setArraySize(a,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=p,e=n.length;let s=O.setArraySize(n,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,r=this.clipOutput,o=O.setArraySize(a,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=r[s],i=r[s+1];o[e]=t,o[e+1]=i}e=n.length;let h=O.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,a,n,r){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=r?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,p=t[s],g=t[s+1],x=i[s],w=i[s+1];s=e[f+1]<<1;let b=t[s],y=t[s+1],k=i[s],v=i[s+1];s=e[f+2]<<1;let S=t[s],A=t[s+1],I=i[s],M=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,g,b,y,S,A,c[t],o)){let t=O.setArraySize(l,e+3*u);t[e]=p,t[e+1]=g,t[e+2]=a.r,t[e+3]=a.g,t[e+4]=a.b,t[e+5]=a.a,r?(t[e+6]=x,t[e+7]=w,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=b,t[e+13]=y,t[e+14]=a.r,t[e+15]=a.g,t[e+16]=a.b,t[e+17]=a.a,t[e+18]=k,t[e+19]=v,t[e+20]=n.r,t[e+21]=n.g,t[e+22]=n.b,t[e+23]=n.a,t[e+24]=S,t[e+25]=A,t[e+26]=a.r,t[e+27]=a.g,t[e+28]=a.b,t[e+29]=a.a,t[e+30]=I,t[e+31]=M,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=x,t[e+7]=w,t[e+8]=b,t[e+9]=y,t[e+10]=a.r,t[e+11]=a.g,t[e+12]=a.b,t[e+13]=a.a,t[e+14]=k,t[e+15]=v,t[e+16]=S,t[e+17]=A,t[e+18]=a.r,t[e+19]=a.g,t[e+20]=a.b,t[e+21]=a.a,t[e+22]=I,t[e+23]=M),e=h.length;let s=O.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-A,i=S-b,c=p-S,d=A-g,f=1/(s*c+i*(g-A)),C=t>>1,F=this.clipOutput,T=O.setArraySize(l,e+C*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];T[e]=t,T[e+1]=l,T[e+2]=a.r,T[e+3]=a.g,T[e+4]=a.b,T[e+5]=a.a;let h=t-S,u=l-A,m=(s*h+i*u)*f,p=(d*h+c*u)*f,g=1-m-p;T[e+6]=x*m+k*p+I*g,T[e+7]=w*m+v*p+M*g,r&&(T[e+8]=n.r,T[e+9]=n.g,T[e+10]=n.b,T[e+11]=n.a)}e=h.length;let E=O.setArraySize(h,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=C+1}}}}clipTrianglesUnpacked(t,e,s,i){let a=this.clipOutput,n=this.clippedVertices,r=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;n.length=0,r.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=i[s],p=i[s+1];s=e[d+1]<<1;let g=t[s],x=t[s+1],w=i[s],b=i[s+1];s=e[d+2]<<1;let y=t[s],k=t[s+1],v=i[s],S=i[s+1];for(let t=0;t<h;t++){let e=n.length;if(!this.clip(u,m,g,x,y,k,l[t],a)){let t=O.setArraySize(n,e+6);t[e]=u,t[e+1]=m,t[e+2]=g,t[e+3]=x,t[e+4]=y,t[e+5]=k;let s=O.setArraySize(r,e+6);s[e]=f,s[e+1]=p,s[e+2]=w,s[e+3]=b,s[e+4]=v,s[e+5]=S,e=o.length;let i=O.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=a.length;if(0==t)continue;let s=x-k,i=y-g,l=u-y,h=k-m,d=1/(s*l+i*(m-k)),A=t>>1,I=this.clipOutput,M=O.setArraySize(n,e+2*A),C=O.setArraySize(r,e+2*A);for(let a=0;a<t;a+=2,e+=2){let t=I[a],n=I[a+1];M[e]=t,M[e+1]=n;let r=t-y,o=n-k,c=(s*r+i*o)*d,u=(h*r+l*o)*d,m=1-c-u;C[e]=f*c+w*u+v*m,C[e+1]=p*c+b*u+S*m}e=o.length;let F=O.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,i,a,n,r,o){let l,h=o,c=!1;r.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(i),l.push(a),l.push(n),l.push(t),l.push(e),o.length=0;let d=r.length-4,u=r;for(let t=0;;t+=2){let e=u[t],s=u[t+1],i=e-u[t+2],a=s-u[t+3],n=o.length,r=l;for(let t=0,n=l.length-2;t<n;){let n=r[t],l=r[t+1];t+=2;let h=r[t],d=r[t+1],u=a*(e-h)>i*(s-d),m=a*(e-n)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=m/(t*a-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s)}else if(u){let t=h-n,e=d-l,s=m/(t*a-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(n==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],a=0,n=0,r=0,o=0;for(let t=0,l=s-3;t<l;t+=2)a=e[t],n=e[t+1],r=e[t+2],o=e[t+3],i+=a*o-r*n;if(!(i<0))for(let t=0,i=s-2,a=s>>1;t<a;t+=2){let s=e[t],a=e[t+1],n=i-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=a}}}class Es{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ve,i="string"==typeof t?JSON.parse(t):t,a=i.skeleton;if(a&&(s.hash=a.hash,s.version=a.spine,s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,s.referenceScale=Bs(a,"referenceScale",100)*e,s.fps=a.fps,s.imagesPath=a.images??null,s.audioPath=a.audio??null),i.bones)for(let t=0;t<i.bones.length;t++){let a=i.bones[t],n=null,r=Bs(a,"parent",null);r&&(n=s.findBone(r));let o=new ke(s.bones.length,a.name,n);o.length=Bs(a,"length",0)*e,o.x=Bs(a,"x",0)*e,o.y=Bs(a,"y",0)*e,o.rotation=Bs(a,"rotation",0),o.scaleX=Bs(a,"scaleX",1),o.scaleY=Bs(a,"scaleY",1),o.shearX=Bs(a,"shearX",0),o.shearY=Bs(a,"shearY",0),o.inherit=O.enumValue(ie,Bs(a,"inherit","Normal")),o.skinRequired=Bs(a,"skin",!1);let l=Bs(a,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(i.slots)for(let t=0;t<i.slots.length;t++){let e=i.slots[t],a=e.name,n=s.findBone(e.bone);if(!n)throw new Error(`Couldn't find bone ${e.bone} for slot ${a}`);let r=new Ne(s.slots.length,a,n),o=Bs(e,"color",null);o&&r.color.setFromString(o);let l=Bs(e,"dark",null);l&&(r.darkColor=R.fromString(l)),r.attachmentName=Bs(e,"attachment",null),r.blendMode=O.enumValue(le,Bs(e,"blend","normal")),r.visible=Bs(e,"visible",!0),s.slots.push(r)}if(i.ik)for(let t=0;t<i.ik.length;t++){let a=i.ik[t],n=new Te(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);for(let t=0;t<a.bones.length;t++){let e=s.findBone(a.bones[t]);if(!e)throw new Error(`Couldn't find bone ${a.bones[t]} for IK constraint ${a.name}.`);n.bones.push(e)}let r=s.findBone(a.target);if(!r)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);n.target=r,n.mix=Bs(a,"mix",1),n.softness=Bs(a,"softness",0)*e,n.bendDirection=Bs(a,"bendPositive",!0)?1:-1,n.compress=Bs(a,"compress",!1),n.stretch=Bs(a,"stretch",!1),n.uniform=Bs(a,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let t=0;t<i.transform.length;t++){let a=i.transform[t],n=new Le(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);for(let t=0;t<a.bones.length;t++){let e=a.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for transform constraint ${a.name}.`);n.bones.push(i)}let r=a.target,o=s.findBone(r);if(!o)throw new Error(`Couldn't find target bone ${r} for transform constraint ${a.name}.`);n.target=o,n.local=Bs(a,"local",!1),n.relative=Bs(a,"relative",!1),n.offsetRotation=Bs(a,"rotation",0),n.offsetX=Bs(a,"x",0)*e,n.offsetY=Bs(a,"y",0)*e,n.offsetScaleX=Bs(a,"scaleX",0),n.offsetScaleY=Bs(a,"scaleY",0),n.offsetShearY=Bs(a,"shearY",0),n.mixRotate=Bs(a,"mixRotate",1),n.mixX=Bs(a,"mixX",1),n.mixY=Bs(a,"mixY",n.mixX),n.mixScaleX=Bs(a,"mixScaleX",1),n.mixScaleY=Bs(a,"mixScaleY",n.mixScaleX),n.mixShearY=Bs(a,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let t=0;t<i.path.length;t++){let a=i.path[t],n=new Ee(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);for(let t=0;t<a.bones.length;t++){let e=a.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for path constraint ${a.name}.`);n.bones.push(i)}let r=a.target,o=s.findSlot(r);if(!o)throw new Error(`Couldn't find target slot ${r} for path constraint ${a.name}.`);n.target=o,n.positionMode=O.enumValue(ae,Bs(a,"positionMode","Percent")),n.spacingMode=O.enumValue(ne,Bs(a,"spacingMode","Length")),n.rotateMode=O.enumValue(re,Bs(a,"rotateMode","Tangent")),n.offsetRotation=Bs(a,"rotation",0),n.position=Bs(a,"position",0),n.positionMode==ae.Fixed&&(n.position*=e),n.spacing=Bs(a,"spacing",0),n.spacingMode!=ne.Length&&n.spacingMode!=ne.Fixed||(n.spacing*=e),n.mixRotate=Bs(a,"mixRotate",1),n.mixX=Bs(a,"mixX",1),n.mixY=Bs(a,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let t=0;t<i.physics.length;t++){const a=i.physics[t],n=new Pe(a.name);n.order=Bs(a,"order",0),n.skinRequired=Bs(a,"skin",!1);const r=a.bone,o=s.findBone(r);if(null==o)throw new Error("Physics bone not found: "+r);n.bone=o,n.x=Bs(a,"x",0),n.y=Bs(a,"y",0),n.rotate=Bs(a,"rotate",0),n.scaleX=Bs(a,"scaleX",0),n.shearX=Bs(a,"shearX",0),n.limit=Bs(a,"limit",5e3)*e,n.step=1/Bs(a,"fps",60),n.inertia=Bs(a,"inertia",1),n.strength=Bs(a,"strength",100),n.damping=Bs(a,"damping",1),n.massInverse=1/Bs(a,"mass",1),n.wind=Bs(a,"wind",0),n.gravity=Bs(a,"gravity",0),n.mix=Bs(a,"mix",1),n.inertiaGlobal=Bs(a,"inertiaGlobal",!1),n.strengthGlobal=Bs(a,"strengthGlobal",!1),n.dampingGlobal=Bs(a,"dampingGlobal",!1),n.massGlobal=Bs(a,"massGlobal",!1),n.windGlobal=Bs(a,"windGlobal",!1),n.gravityGlobal=Bs(a,"gravityGlobal",!1),n.mixGlobal=Bs(a,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let t=0;t<i.skins.length;t++){let e=i.skins[t],a=new Oe(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],n=s.findBone(i);if(!n)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);a.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],n=s.findIkConstraint(i);if(!n)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],n=s.findTransformConstraint(i);if(!n)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],n=s.findPathConstraint(i);if(!n)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],n=s.findPhysicsConstraint(i);if(!n)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);a.constraints.push(n)}for(let t in e.attachments){let i=s.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let n=e.attachments[t];for(let t in n){let e=this.readAttachment(n[t],a,i.index,t,s);e&&a.setAttachment(i.index,t,e)}}s.skins.push(a),"default"==a.name&&(s.defaultSkin=a)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],i=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!i)throw new Error(`Skin not found: ${e.skin}`);let a=i.getAttachment(e.slotIndex,e.parent);if(!a)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?a:e.mesh,e.mesh.setParentMesh(a),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let t in i.events){let e=i.events[t],a=new Ce(t);a.intValue=Bs(e,"int",0),a.floatValue=Bs(e,"float",0),a.stringValue=Bs(e,"string",""),a.audioPath=Bs(e,"audio",null),a.audioPath&&(a.volume=Bs(e,"volume",1),a.balance=Bs(e,"balance",0)),s.events.push(a)}if(i.animations)for(let t in i.animations){let e=i.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,i,a){let n=this.scale;switch(i=Bs(t,"name",i),Bs(t,"type","region")){case"region":{let s=Bs(t,"path",i),a=this.readSequence(Bs(t,"sequence",null)),r=this.attachmentLoader.newRegionAttachment(e,i,s,a);if(!r)return null;r.path=s,r.x=Bs(t,"x",0)*n,r.y=Bs(t,"y",0)*n,r.scaleX=Bs(t,"scaleX",1),r.scaleY=Bs(t,"scaleY",1),r.rotation=Bs(t,"rotation",0),r.width=t.width*n,r.height=t.height*n,r.sequence=a;let o=Bs(t,"color",null);return o&&r.color.setFromString(o),null!=r.region&&r.updateRegion(),r}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let a=Bs(t,"color",null);return a&&s.color.setFromString(a),s}case"mesh":case"linkedmesh":{let a=Bs(t,"path",i),r=this.readSequence(Bs(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,a,r);if(!o)return null;o.path=a;let l=Bs(t,"color",null);l&&o.color.setFromString(l),o.width=Bs(t,"width",0)*n,o.height=Bs(t,"height",0)*n,o.sequence=r;let h=Bs(t,"parent",null);if(h)return this.linkedMeshes.push(new Ys(o,Bs(t,"skin",null),s,h,Bs(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Bs(t,"edges",null),o.hullLength=2*Bs(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=Bs(t,"closed",!1),s.constantSpeed=Bs(t,"constantSpeed",!0);let a=t.vertexCount;this.readVertices(t,s,a<<1);let r=O.newArray(a/3,0);for(let e=0;e<t.lengths.length;e++)r[e]=t.lengths[e]*n;s.lengths=r;let o=Bs(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=Bs(t,"x",0)*n,s.y=Bs(t,"y",0)*n,s.rotation=Bs(t,"rotation",0);let a=Bs(t,"color",null);return a&&s.color.setFromString(a),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let n=Bs(t,"end",null);n&&(s.endSlot=a.findSlot(n));let r=t.vertexCount;this.readVertices(t,s,r<<1);let o=Bs(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new G(Bs(t,"count",0));return e.start=Bs(t,"start",1),e.digits=Bs(t,"digits",0),e.setupIndex=Bs(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let a=t.vertices;if(s==a.length){let t=O.toFloatArray(a);if(1!=i)for(let e=0,s=a.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let n=new Array,r=new Array;for(let t=0,e=a.length;t<e;){let e=a[t++];r.push(e);for(let s=t+4*e;t<s;t+=4)r.push(a[t]),n.push(a[t+1]*i),n.push(a[t+2]*i),n.push(a[t+3])}e.bones=r,e.vertices=O.toFloatArray(n)}readAnimation(t,e,s){let i=this.scale,a=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],n=s.findSlot(e);if(!n)throw new Error("Slot not found: "+e);let r=n.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new yt(s,r);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,Bs(s,"time",0),Bs(s,"name",null))}a.push(t)}else if("rgba"==t){let t=new pt(s,s<<2,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.color);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,o.a);let r=e[s+1];if(!r){t.shrink(a);break}let l=Bs(r,"time",0),h=R.fromString(r.color),c=i.curve;c&&(a=Rs(c,t,a,s,0,n,l,o.r,h.r,1),a=Rs(c,t,a,s,1,n,l,o.g,h.g,1),a=Rs(c,t,a,s,2,n,l,o.b,h.b,1),a=Rs(c,t,a,s,3,n,l,o.a,h.a,1)),n=l,o=h,i=r}a.push(t)}else if("rgb"==t){let t=new gt(s,3*s,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.color);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b);let r=e[s+1];if(!r){t.shrink(a);break}let l=Bs(r,"time",0),h=R.fromString(r.color),c=i.curve;c&&(a=Rs(c,t,a,s,0,n,l,o.r,h.r,1),a=Rs(c,t,a,s,1,n,l,o.g,h.g,1),a=Rs(c,t,a,s,2,n,l,o.b,h.b,1)),n=l,o=h,i=r}a.push(t)}else if("alpha"==t)a.push(_s(e,new xt(s,s,r),0,1));else if("rgba2"==t){let t=new wt(s,7*s,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.light),l=R.fromString(i.dark);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let r=e[s+1];if(!r){t.shrink(a);break}let h=Bs(r,"time",0),c=R.fromString(r.light),d=R.fromString(r.dark),u=i.curve;u&&(a=Rs(u,t,a,s,0,n,h,o.r,c.r,1),a=Rs(u,t,a,s,1,n,h,o.g,c.g,1),a=Rs(u,t,a,s,2,n,h,o.b,c.b,1),a=Rs(u,t,a,s,3,n,h,o.a,c.a,1),a=Rs(u,t,a,s,4,n,h,l.r,d.r,1),a=Rs(u,t,a,s,5,n,h,l.g,d.g,1),a=Rs(u,t,a,s,6,n,h,l.b,d.b,1)),n=h,o=c,l=d,i=r}a.push(t)}else if("rgb2"==t){let t=new bt(s,6*s,r),i=e[0],n=Bs(i,"time",0),o=R.fromString(i.light),l=R.fromString(i.dark);for(let s=0,a=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,l.r,l.g,l.b);let r=e[s+1];if(!r){t.shrink(a);break}let h=Bs(r,"time",0),c=R.fromString(r.light),d=R.fromString(r.dark),u=i.curve;u&&(a=Rs(u,t,a,s,0,n,h,o.r,c.r,1),a=Rs(u,t,a,s,1,n,h,o.g,c.g,1),a=Rs(u,t,a,s,2,n,h,o.b,c.b,1),a=Rs(u,t,a,s,3,n,h,l.r,d.r,1),a=Rs(u,t,a,s,4,n,h,l.g,d.g,1),a=Rs(u,t,a,s,5,n,h,l.b,d.b,1)),n=h,o=c,l=d,i=r}a.push(t)}}}if(t.bones)for(let e in t.bones){let n=t.bones[e],r=s.findBone(e);if(!r)throw new Error("Bone not found: "+e);let o=r.index;for(let t in n){let e=n[t],s=e.length;if(0!=s)if("rotate"===t)a.push(_s(e,new at(s,s,o),0,1));else if("translate"===t){let t=new nt(s,s<<1,o);a.push(Xs(e,t,"x","y",0,i))}else if("translatex"===t){let t=new rt(s,s,o);a.push(_s(e,t,0,i))}else if("translatey"===t){let t=new ot(s,s,o);a.push(_s(e,t,0,i))}else if("scale"===t){let t=new lt(s,s<<1,o);a.push(Xs(e,t,"x","y",1,1))}else if("scalex"===t){let t=new ht(s,s,o);a.push(_s(e,t,1,1))}else if("scaley"===t){let t=new ct(s,s,o);a.push(_s(e,t,1,1))}else if("shear"===t){let t=new dt(s,s<<1,o);a.push(Xs(e,t,"x","y",0,1))}else if("shearx"===t){let t=new ut(s,s,o);a.push(_s(e,t,0,1))}else if("sheary"===t){let t=new mt(s,s,o);a.push(_s(e,t,0,1))}else if("inherit"===t){let t=new ft(s,r.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,Bs(i,"time",0),O.enumValue(ie,Bs(i,"inherit","Normal")))}a.push(t)}}}if(t.ik)for(let e in t.ik){let n=t.ik[e],r=n[0];if(!r)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new At(n.length,n.length<<1,l),c=Bs(r,"time",0),d=Bs(r,"mix",1),u=Bs(r,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Bs(r,"bendPositive",!0)?1:-1,Bs(r,"compress",!1),Bs(r,"stretch",!1));let s=n[t+1];if(!s){h.shrink(e);break}let a=Bs(s,"time",0),o=Bs(s,"mix",1),l=Bs(s,"softness",0)*i,m=r.curve;m&&(e=Rs(m,h,e,t,0,c,a,d,o,1),e=Rs(m,h,e,t,1,c,a,u,l,i)),c=a,d=o,u=l,r=s}a.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],n=i[0];if(!n)continue;let r=s.findTransformConstraint(e);if(!r)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(r),l=new It(i.length,6*i.length,o),h=Bs(n,"time",0),c=Bs(n,"mixRotate",1),d=Bs(n,"mixX",1),u=Bs(n,"mixY",d),m=Bs(n,"mixScaleX",1),f=Bs(n,"mixScaleY",m),p=Bs(n,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,p);let s=i[t+1];if(!s){l.shrink(e);break}let a=Bs(s,"time",0),r=Bs(s,"mixRotate",1),o=Bs(s,"mixX",1),g=Bs(s,"mixY",o),x=Bs(s,"mixScaleX",1),w=Bs(s,"mixScaleY",x),b=Bs(s,"mixShearY",1),y=n.curve;y&&(e=Rs(y,l,e,t,0,h,a,c,r,1),e=Rs(y,l,e,t,1,h,a,d,o,1),e=Rs(y,l,e,t,2,h,a,u,g,1),e=Rs(y,l,e,t,3,h,a,m,x,1),e=Rs(y,l,e,t,4,h,a,f,w,1),e=Rs(y,l,e,t,5,h,a,p,b,1)),h=a,c=r,d=o,u=g,m=x,f=w,m=x,n=s}a.push(l)}if(t.path)for(let e in t.path){let n=t.path[e],r=s.findPathConstraint(e);if(!r)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(r);for(let t in n){let e=n[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new Mt(l,l,o);a.push(_s(e,t,0,r.positionMode==ae.Fixed?i:1))}else if("spacing"===t){let t=new Ct(l,l,o);a.push(_s(e,t,0,r.spacingMode==ne.Length||r.spacingMode==ne.Fixed?i:1))}else if("mix"===t){let t=new Ft(l,3*l,o),i=Bs(s,"time",0),n=Bs(s,"mixRotate",1),r=Bs(s,"mixX",1),h=Bs(s,"mixY",r);for(let a=0,o=0;;a++){t.setFrame(a,i,n,r,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Bs(l,"time",0),d=Bs(l,"mixRotate",1),u=Bs(l,"mixX",1),m=Bs(l,"mixY",u),f=s.curve;f&&(o=Rs(f,t,o,a,0,i,c,n,d,1),o=Rs(f,t,o,a,1,i,c,r,u,1),o=Rs(f,t,o,a,2,i,c,h,m,1)),i=c,n=d,r=u,h=m,s=l}a.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],n=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);n=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let r,o=e.length;if("reset"!=t){if("inertia"==t)r=new Et(o,o,n);else if("strength"==t)r=new Yt(o,o,n);else if("damping"==t)r=new _t(o,o,n);else if("mass"==t)r=new Xt(o,o,n);else if("wind"==t)r=new Rt(o,o,n);else if("gravity"==t)r=new Bt(o,o,n);else{if("mix"!=t)continue;r=new Pt(o,o,n)}a.push(_s(e,r,0,1))}else{const t=new Vt(o,n);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,Bs(s,"time",0));a.push(t)}}}if(t.attachments)for(let e in t.attachments){let n=t.attachments[e],r=s.findSkin(e);if(!r)throw new Error("Skin not found: "+e);for(let t in n){let e=n[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],n=r.getAttachment(l,t);for(let t in s){let e=s[t],r=e[0];if(r)if("deform"==t){let t=n.bones,s=n.vertices,o=t?s.length/3*2:s.length,h=new kt(e.length,e.length,l,n),c=Bs(r,"time",0);for(let a=0,n=0;;a++){let l,d=Bs(r,"vertices",null);if(d){l=O.newFloatArray(o);let e=Bs(r,"offset",0);if(O.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?O.newFloatArray(o):s;h.setFrame(a,c,l);let u=e[a+1];if(!u){h.shrink(n);break}let m=Bs(u,"time",0),f=r.curve;f&&(n=Rs(f,h,n,a,0,c,m,0,1,1)),c=m,r=u}a.push(h)}else if("sequence"==t){let t=new Dt(e.length,l,n),s=0;for(let i=0;i<e.length;i++){let a=Bs(r,"delay",s),n=Bs(r,"time",0),o=j[Bs(r,"mode","hold")],l=Bs(r,"index",0);t.setFrame(i,n,o,l,a),s=a,r=e[i+1]}a.push(t)}}}}}if(t.drawOrder){let e=new St(t.drawOrder.length),i=s.slots.length,n=0;for(let a=0;a<t.drawOrder.length;a++,n++){let r=t.drawOrder[a],o=null,l=Bs(r,"offsets",null);if(l){o=O.newArray(i,-1);let t=O.newArray(i-l.length,0),e=0,a=0;for(let i=0;i<l.length;i++){let n=l[i],r=s.findSlot(n.slot);if(!r)throw new Error("Slot not found: "+r);let h=r.index;for(;e!=h;)t[a++]=e++;o[e+n.offset]=e++}for(;e<i;)t[a++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--a])}e.setFrame(n,Bs(r,"time",0),o)}a.push(e)}if(t.events){let e=new vt(t.events.length),i=0;for(let a=0;a<t.events.length;a++,i++){let n=t.events[a],r=s.findEvent(n.name);if(!r)throw new Error("Event not found: "+n.name);let o=new Me(O.toSinglePrecision(Bs(n,"time",0)),r);o.intValue=Bs(n,"int",r.intValue),o.floatValue=Bs(n,"float",r.floatValue),o.stringValue=Bs(n,"string",r.stringValue),o.data.audioPath&&(o.volume=Bs(n,"volume",1),o.balance=Bs(n,"balance",0)),e.setFrame(i,o)}a.push(e)}let n=0;for(let t=0,e=a.length;t<e;t++)n=Math.max(n,a[t].getDuration());s.animations.push(new J(e,a,n))}}class Ys{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,a){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=a}}function _s(t,e,s,i){let a=t[0],n=Bs(a,"time",0),r=Bs(a,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,n,r);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Bs(h,"time",0),d=Bs(h,"value",s)*i;a.curve&&(o=Rs(a.curve,e,o,l,0,n,c,r,d,i)),n=c,r=d,a=h}}function Xs(t,e,s,i,a,n){let r=t[0],o=Bs(r,"time",0),l=Bs(r,s,a)*n,h=Bs(r,i,a)*n,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Bs(u,"time",0),f=Bs(u,s,a)*n,p=Bs(u,i,a)*n,g=r.curve;g&&(c=Rs(g,e,c,d,0,o,m,l,f,n),c=Rs(g,e,c,d,1,o,m,h,p,n)),o=m,l=f,h=p,r=u}}function Rs(t,e,s,i,a,n,r,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=a<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,a,n,o,d,u,m,f,r,l),s+1}function Bs(t,e,s){return void 0!==t[e]?t[e]:s}var Ps;function Vs(t,e,s){const i=new ye(t);return"json"===s?new Es(i).readSkeletonData(e):new qe(i).readSkeletonData(new Uint8Array(e))}async function Ds(e,s,i){let a;const n=e.map(((e,a)=>{const n=s[a];let r=t.Texture2D;return"ktx"===n?r=t.KTX:"ktx2"===n&&(r=t.KTX2),Ls(e,i,r)}));try{a=await Promise.all(n)}catch(t){throw t}return a}async function Os(t,s){const i=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let a,n;try{a=await e(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let r=new ue(a);const o=[];for(let t of r.pages){const e=i+t.name;o.push(Ls(e,s))}try{n=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return r=Ns(a,n),r}function Ns(t,e){const s=new ue(t);return s.pages.forEach(((t,s)=>{const i=function(t){return new qs(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(i)})),s}function Ls(e,s,i=t.Texture2D){return s.resourceManager.load({url:e,type:i})}void 0===Math.fround&&(Math.fround=(Ps=new Float32Array(1),function(t){return Ps[0]=t,Ps[0]}));class qs extends te{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,e){t===ee.Nearest?this.texture.filterMode=s.Point:e===ee.MipMapLinearLinear?this.texture.filterMode=s.Trilinear:this.texture.filterMode=s.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case se.ClampToEdge:return i.Clamp;case se.Repeat:return i.Repeat;case se.MirroredRepeat:return i.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class Us{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let i=0;i<e;++i)s[i]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class Ws{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:zs,One:$s,DestinationColor:Gs,Zero:js,OneMinusSourceColor:Hs,OneMinusSourceAlpha:Js}=a,{Add:Ks}=n;function Zs(t,e,s){const i=t.renderState.blendState.targetBlendState;switch(e){case le.Additive:i.sourceColorBlendFactor=s?$s:zs,i.destinationColorBlendFactor=$s,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=$s,i.colorBlendOperation=i.alphaBlendOperation=Ks;break;case le.Multiply:i.sourceColorBlendFactor=Gs,i.destinationColorBlendFactor=Js,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=Js,i.colorBlendOperation=i.alphaBlendOperation=Ks;break;case le.Screen:i.sourceColorBlendFactor=$s,i.destinationColorBlendFactor=Hs,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=Hs,i.colorBlendOperation=i.alphaBlendOperation=Ks;break;default:i.sourceColorBlendFactor=s?$s:zs,i.destinationColorBlendFactor=Js,i.sourceAlphaBlendFactor=$s,i.destinationAlphaBlendFactor=Js,i.colorBlendOperation=i.alphaBlendOperation=Ks}}class Qs{}const ti=1/0,ei=-1/0;class si{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new R}static{this.tempColor=new R}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new Us(r)}static{this.subRenderItemPool=new Ws(Qs)}static{this.bounds=new o(new l(ti,ti,ti),new l(ei,ei,ei))}buildPrimitive(t,e){const{_clipper:s,_separateSlots:i,_subRenderItems:a,_separateSlotTextureMap:n}=this,{bounds:r}=si;r.min.set(ti,ti,ti),r.max.set(ei,ei,ei);let o=0,l=0;const h=t.drawOrder,c=h.length,{engine:d,_indices:u,_vertices:m,_vertexCount:f,_subPrimitives:p,zSpacing:g,premultipliedAlpha:x}=e;let{tempVerts:w,tempTexture:b,tempBlendMode:y,subRenderItemPool:k,subPrimitivePool:v}=si;a.length=0,k.clear();let S,A,I=e._vertices,M=0,C=0,F=le.Normal,T=null,E=0;si.tempBlendMode=null,si.tempTexture=null;for(let t=0;t<c;++t){const e=h[t];if(!e.bone.active){s.clipEndWithSlot(e);continue}const r=e.getAttachment();let c=null;const d=g*t;let f=0;const Y=s.isClipping();let _=Y?2:si.VERTEX_SIZE;if(r){switch(r.constructor){case be:const t=r;c=t.color,f=4*_,t.computeWorldVertices(e,w,0,_),S=si.QUAD_TRIANGLES,A=t.uvs,T=t.region.texture;break;case ge:const i=r;c=i.color,f=(i.worldVerticesLength>>1)*_,f>I.length&&(si.tempVerts=new Array(f)),i.computeWorldVertices(e,0,i.worldVerticesLength,w,0,_),S=i.triangles,A=i.uvs,T=i.region.texture;break;case Qt:let a=r;s.clipStart(e,a);continue;default:s.clipEndWithSlot(e);continue}if(null!=T){let t,r,h,g,I=e.bone.skeleton.color,X=e.color,R=si.tempColor,B=si.tempDark;if(R.r=I.r*X.r*c.r,R.g=I.g*X.g*c.g,R.b=I.b*X.b*c.b,R.a=I.a*X.a*c.a,x&&(R.r*=R.a,R.g*=R.a,R.b*=R.a),Y)s.clipTriangles(w,S,S.length,A,R,B,!1),t=s.clippedVertices,r=t.length,h=s.clippedTriangles,g=h.length;else{let e=w;const{r:s,g:i,b:a,a:n}=R;for(let t=2,r=0,o=f;t<o;t+=_,r+=2)e[t]=s,e[t+1]=i,e[t+2]=a,e[t+3]=n,e[t+4]=A[r],e[t+5]=A[r+1];t=w,r=f,h=S,g=S.length}if(0==r||0==g){s.clipEndWithSlot(e);continue}let P=o/si.VERTEX_STRIDE,V=m,D=o,O=0;for(;O<r;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=d,V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],this._expandByPoint(e,s,d)}o=D;let N=u;for(D=l,O=0;O<g;D++,O++)N[D]=h[O]+P;l+=g;const L=e.data,q=L.name;F=L.blendMode;const U=null!==y&&y!==L.blendMode,W=null!==b&&b!==T,z=i.get(q);if(z||U||W){if(C>0){const t=p[E];t&&E++;const e=t||v.get();e.start=M,e.count=C;const s=k.get();s.subPrimitive=e,s.texture=b,s.blendMode=y,a.push(s),M+=C,C=0}if(z){const t=n.get(q);if(t){const e=T.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=p[E];e&&E++;const s=e||v.get();s.start=M,s.count=g;const i=k.get();i.blendMode=F,i.subPrimitive=s,i.texture=T,i.slotName=q,a.push(i),M+=g,C=0}else C+=g}else C+=g;b=T,y=F}s.clipEndWithSlot(e)}else s.clipEndWithSlot(e)}if(C>0){const t=p[E];t&&E++;const e=t||v.get();e.start=M,e.count=C;const s=k.get();s.blendMode=F,s.subPrimitive=e,s.texture=T,a.push(s),C=0}s.clipEnd();const Y=p.length,_=a.length;if(_<Y)for(let t=_;t<Y;t++){const e=p[t];v.return(e)}e._clearSubPrimitives();for(let t=0,s=_;t<s;++t){const s=a[t],{slotName:i,blendMode:r,texture:o}=s;e._addSubPrimitive(s.subPrimitive);let l=o.texture;n.has(i)&&(l=n.get(i));const h=`${l.instanceId}_${r}`;let c=ai._materialCache.get(h);c||(c=this._createMaterialForTexture(l,d,r,x),ai._materialCache.set(h,c)),e.setMaterial(t,c)}if(l>f)return e._createAndBindBuffer(l),void this.buildPrimitive(t,e);e._vertexBuffer.setData(m),e._indexBuffer.setData(u)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s,i){const a=ai._getDefaultMaterial(e);return a.shaderData.setTexture("material_SpineTexture",t),Zs(a,s,i),a}_expandByPoint(t,e,s){const{bounds:{min:i,max:a}}=si,n=Math.min(i.x,t),r=Math.min(i.y,e),o=Math.min(i.z,s),l=Math.max(a.x,t),h=Math.max(a.y,e),c=Math.max(a.z,s);i.set(n,r,o),a.set(l,h,c)}constructor(){this._clipper=new Ts,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ii extends h{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,c.find("galacean-spine-shader")||c.create("galacean-spine-shader",ii._spineVS,ii._spineFS));const e=this.renderState;e.blendState.targetBlendState.enabled=!0,Zs(this,le.Normal,!1),e.depthState.writeEnabled=!1,e.rasterState.cullMode=d.Off,e.renderQueueType=u.Transparent}}class ai extends m{static{this._spineGenerator=new si}static{this._positionVertexElement=new f("POSITION",0,p.Vector3,0)}static{this._colorVertexElement=new f("COLOR_0",12,p.Vector4,0)}static{this._uvVertexElement=new f("TEXCOORD_0",28,p.Vector2,0)}static{this._materialCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new ii(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.zSpacing=.01,this.premultipliedAlpha=!1,this.defaultConfig=new ni,this._subPrimitives=[],this._vertices=new Float32Array,this._indices=new Uint16Array,this._needResizeBuffer=!1,this._vertexCount=0,this._needsInitialize=!1;const e=new g(this._engine);this._primitive=e,e.addVertexElement(ai._positionVertexElement),e.addVertexElement(ai._colorVertexElement),e.addVertexElement(ai._uvVertexElement)}_onEnable(){this._applyDefaultConfig()}update(t){this._needsInitialize&&(this._initialize(),this._needsInitialize=!1);const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(oe.update),ai._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:i,_engine:a}=this,n=a._renderElementPool.get();n.set(this.priority,this._distanceForSort);const r=a._subRenderElementPool;if(s){for(let t=0,a=s.length;t<a;t++){let a=i[t];if(!a)continue;(a.destroyed||a.shader.destroyed)&&(a=this.engine._meshMagentaMaterial);const o=r.get();o.set(this,a,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:e}=si;o.transform(e,this.entity.transform.worldMatrix,t)}_setSkeleton(t){this._skeleton!==t&&(this._skeleton=t,this._needsInitialize=!!t)}_setState(t){this._state!==t&&(this._state=t,this._needsInitialize=!!t)}_cloneTo(t){const e=this._skeleton.data,s=new Kt(e),i=new Be(e),a=new Ot(s);t._setSkeleton(i),t._setState(a)}_onDestroy(){const{_primitive:t,_subPrimitives:e}=this;e.length=0,t&&t.destroy(),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,super._onDestroy()}_createAndBindBuffer(t){const{_engine:e,_primitive:s}=this;this._vertexCount=t,this._vertices=new Float32Array(t*si.VERTEX_STRIDE),this._indices=new Uint16Array(t);const i=4*si.VERTEX_STRIDE,a=new x(e,w.VertexBuffer,this._vertices,b.Dynamic),n=new x(e,w.IndexBuffer,this._indices,b.Dynamic);this._indexBuffer=n,this._vertexBuffer=a;const r=new y(a,i);this._primitive.setVertexBufferBinding(0,r);const o=new k(n,v.UInt16);s.setIndexBufferBinding(o)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_initialize(){this._applyDefaultConfig(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===zs&&e.destinationColorBlendFactor===$s&&e.sourceAlphaBlendFactor===$s&&e.destinationAlphaBlendFactor===$s&&e.colorBlendOperation===Ks&&e.alphaBlendOperation===Ks?le.Additive:e.sourceColorBlendFactor===Gs&&e.destinationColorBlendFactor===js&&e.sourceAlphaBlendFactor===$s&&e.destinationAlphaBlendFactor===js&&e.colorBlendOperation===Ks&&e.alphaBlendOperation===Ks?le.Multiply:e.sourceColorBlendFactor===$s&&e.destinationColorBlendFactor===Hs&&e.sourceAlphaBlendFactor===$s&&e.destinationAlphaBlendFactor===Hs&&e.colorBlendOperation===Ks&&e.alphaBlendOperation===Ks?le.Screen:le.Normal}(t),i=`${e.instanceId}_${s}`;ai._materialCache.delete(i)}))}_applyDefaultConfig(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:i,loop:a}=this.defaultConfig;"default"!==i&&(t.setSkinByName(i),t.setToSetupPose()),s&&e.setAnimation(0,s,a)}}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t;const{skeletonData:e,stateData:s}=t,i=new Be(e),a=new Ot(s);this._setSkeleton(i),this._setState(a)}}Y([S],ai.prototype,"zSpacing",void 0),Y([S],ai.prototype,"premultipliedAlpha",void 0),Y([A],ai.prototype,"defaultConfig",void 0),Y([I],ai.prototype,"_primitive",void 0),Y([I],ai.prototype,"_subPrimitives",void 0),Y([I],ai.prototype,"_indexBuffer",void 0),Y([I],ai.prototype,"_vertexBuffer",void 0),Y([I],ai.prototype,"_vertices",void 0),Y([I],ai.prototype,"_indices",void 0),Y([I],ai.prototype,"_needResizeBuffer",void 0),Y([I],ai.prototype,"_vertexCount",void 0),Y([I],ai.prototype,"_resource",void 0),Y([I],ai.prototype,"_skeleton",void 0),Y([I],ai.prototype,"_state",void 0),Y([I],ai.prototype,"_needsInitialize",void 0);class ni{constructor(t=!0,e=null,s="default"){this.loop=t,this.animationName=e,this.skinName=s}}class ri extends M{constructor(t,e,s){super(t),this._texturesInSpineAtlas=[],this.url=s,this._skeletonData=e,this._stateData=new Kt(e),this._associationTextureInSkeletonData(e),this._createTemplate()}get skeletonData(){return this._skeletonData}get stateData(){return this._stateData}instantiate(){return this._template.clone()}_onDestroy(){super._onDestroy(),this._disassociationSuperResource(),this._skeletonData=null,this._stateData=null}_createTemplate(){const t=this._extractFileName(this.url),e=new C(this.engine,t),s=e.addComponent(ai),i=new Be(this._skeletonData),a=new Ot(this._stateData);s._setSkeleton(i),s._setState(a),e._markAsTemplate(this),this._template=e}_associationTextureInSkeletonData(t){const{skins:e,slots:s}=t,i=this._texturesInSpineAtlas;for(let t=0,a=e.length;t<a;t++)for(let a=0,n=s.length;a<n;a++){const n=s[a],r=e[t].getAttachment(n.index,n.name),o=r?.region?.texture.texture;o&&(i.includes(o)||(i.push(o),o._associationSuperResource(this)))}}_disassociationSuperResource(){const t=this._texturesInSpineAtlas;for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}_extractFileName(t){if(!t)return"Spine Entity";const e=t.match(/\/([^\/]+?)(\.[^\/]*)?$/);return e?e[1]:"Spine Entity"}}class oi{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,i=t.length;s<i;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class li extends F{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:i,skeletonExtensions:a}=li,n=li.getUrlExtension(t,e);n&&(a.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),i.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const i=li.getUrlExtension(t,e);if(!i)return;s.skeletonPath=t,s.skeletonExtension=i;const a=/(\.(json|bin|skel))$/;let n;if(a.test(t)&&(n=t.replace(a,"")),n){const t=n+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,e){return new T((async s=>{let i;if(t.urls)i=await this._handleOriginAsset(t,e);else{const s=await this.request(t.url,{type:"arraybuffer"}),a=new oi(new Uint8Array(s)),n=a.nextStr();i=n.startsWith("spine")?await this._handleEditorAsset(t,s,a,n,e):await this._handleOriginAsset(t,e,s)}s(i)}))}async _handleEditorAsset(t,e,s,i,a){let n,r;const o=i.startsWith("spine:skel")?"skel":"json",{engine:l}=a;if("skel"===o)r=s.nextStr(),n=s.nextImageData();else{const t=new TextDecoder("utf-8").decode(new Uint8Array(e)),{data:s,atlas:i}=JSON.parse(t);r=i.refId,n=s}const h=Vs(await a.getResourceByRef({refId:r}),n,o);return new ri(l,h,t.url)}async _handleOriginAsset(t,e,s){let{fileExtensions:i}=t.params||{},a={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=li.verifyFileExtensions(i,!1);li.deriveAndAssignSpineAsset(t.url,e,a);const{skeletonPath:r,atlasPath:o}=a;if(!r||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await Os(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Vs(l,h,c);return new ri(n,d,r)}{i=li.verifyFileExtensions(i,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=i&&i[e]||null;li.parseAndAssignSpineAsset(s,n,a)}const{skeletonPath:e,atlasPath:s,imagePaths:r,skeletonExtension:o,imageExtensions:l}=a;if(!e||!s)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const h="json"===o?"json":"skel";let c,d,u=["json"===o?this.request(e,{type:"text"}):this.request(e,{type:"arraybuffer"})];if(r.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),Ds(r,l,n)]),[d,t,e]=await Promise.all(u),c=Ns(t,e)}else u.push(Os(s,n)),[d,c]=await Promise.all(u);const m=Vs(c,d,h);return new ri(n,m,e)}}_determineSkeletonDataType(t){let e,s;try{const i=new TextDecoder("utf-8").decode(t);JSON.parse(i),e=i,s="json"}catch(i){e=t,s="skel"}return{data:e,type:s}}}li=Y([E("spine",["json","bin","skel"])],li);class hi extends F{load(t,e){return new T((async s=>{const i=await this.request(t.url,{type:"text"}),{data:a,textures:n}=JSON.parse(i),r=n.map((t=>e.getResourceByRef({refId:t.refId})));s(Ns(a,await Promise.all(r)))}))}}hi=Y([E("EditorSpineAtlas",["atlas"])],hi);const ci="0.0.0-experimental-engine-spine-20241107";F.registerClass("SpineAnimationRenderer",ai),console.log(`Galacean spine version: ${ci}`);export{xt as AlphaTimeline,J as Animation,Ot as AnimationState,Ut as AnimationStateAdapter,Kt as AnimationStateData,Ae as AssetManagerBase,ye as AtlasAttachmentLoader,z as Attachment,yt as AttachmentTimeline,Ue as BinaryInput,le as BlendMode,ve as Bone,ke as BoneData,Zt as BoundingBoxAttachment,Jt as CURRENT,Qt as ClippingAttachment,R as Color,Se as ConstraintData,et as CurveTimeline,st as CurveTimeline1,it as CurveTimeline2,N as DebugUtils,kt as DeformTimeline,Ie as Downloader,St as DrawOrderTimeline,Me as Event,Ce as EventData,Lt as EventQueue,vt as EventTimeline,qt as EventType,zt as FIRST,de as FakeTexture,Gt as HOLD_FIRST,jt as HOLD_MIX,$t as HOLD_SUBSEQUENT,Fe as IkConstraint,Te as IkConstraintData,At as IkConstraintTimeline,ie as Inherit,ft as InheritTimeline,_ as IntSet,P as Interpolation,B as MathUtils,ge as MeshAttachment,K as MixBlend,Z as MixDirection,xe as PathAttachment,Ye as PathConstraint,Ee as PathConstraintData,Ft as PathConstraintMixTimeline,Mt as PathConstraintPositionTimeline,Ct as PathConstraintSpacingTimeline,oe as Physics,_t as PhysicsConstraintDampingTimeline,Bt as PhysicsConstraintGravityTimeline,Et as PhysicsConstraintInertiaTimeline,Xt as PhysicsConstraintMassTimeline,Pt as PhysicsConstraintMixTimeline,Vt as PhysicsConstraintResetTimeline,Yt as PhysicsConstraintStrengthTimeline,Tt as PhysicsConstraintTimeline,Rt as PhysicsConstraintWindTimeline,we as PointAttachment,L as Pool,ae as PositionMode,V as Pow,D as PowOut,bt as RGB2Timeline,wt as RGBA2Timeline,pt as RGBATimeline,gt as RGBTimeline,be as RegionAttachment,re as RotateMode,at as RotateTimeline,Ht as SETUP,Wt as SUBSEQUENT,lt as ScaleTimeline,ht as ScaleXTimeline,ct as ScaleYTimeline,Dt as SequenceTimeline,dt as ShearTimeline,ut as ShearXTimeline,mt as ShearYTimeline,Be as Skeleton,qe as SkeletonBinary,Cs as SkeletonBounds,Ts as SkeletonClipping,Ve as SkeletonData,Es as SkeletonJson,Oe as Skin,De as SkinEntry,Xe as Slot,Ne as SlotData,ne as SpacingMode,ai as SpineAnimationRenderer,ri as SpineResource,X as StringSet,te as Texture,ue as TextureAtlas,fe as TextureAtlasPage,pe as TextureAtlasRegion,ee as TextureFilter,ce as TextureRegion,se as TextureWrap,U as TimeKeeper,tt as Timeline,Nt as TrackEntry,Re as TransformConstraint,Le as TransformConstraintData,It as TransformConstraintTimeline,nt as TranslateTimeline,rt as TranslateXTimeline,ot as TranslateYTimeline,Fs as Triangulator,O as Utils,q as Vector2,$ as VertexAttachment,W as WindowedMean,Ns as createTextureAtlas,ci as version};
|
|
1
|
+
import{AssetType as t,request as e,TextureFilterMode as s,TextureWrapMode as a,BlendFactor as i,BlendOperation as n,SubPrimitive as r,BoundingBox as o,Vector3 as l,Material as h,Shader as c,CullMode as d,RenderQueueType as u,Renderer as m,VertexElement as f,VertexElementFormat as p,Primitive as g,Buffer as x,BufferBindFlag as w,BufferUsage as b,VertexBufferBinding as y,IndexBufferBinding as k,IndexFormat as v,assignmentClone as S,deepClone as A,ignoreClone as I,ReferResource as M,Entity as F,Loader as C,AssetPromise as T,BufferReader as E,resourceLoader as Y}from"@galacean/engine";function _(t,e,s,a){var i,n=arguments.length,r=n<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,a);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(r=(n<3?i(r):n>3?i(e,s,r):i(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}"function"==typeof SuppressedError&&SuppressedError;class X{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class R{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,a=t.length;s<a;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class B{r;g;b;a;static WHITE=new B(1,1,1,1);static RED=new B(1,0,0,1);static GREEN=new B(0,1,0,1);static BLUE=new B(0,0,1,1);static MAGENTA=new B(1,0,1,1);constructor(t=0,e=0,s=0,a=0){this.r=t,this.g=e,this.b=s,this.a=a}set(t,e,s,a){return this.r=t,this.g=e,this.b=s,this.a=a,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=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,a){return this.r+=t,this.g+=e,this.b+=s,this.a+=a,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=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new B).setFromString(t)}}class P{static PI=3.1415927;static PI2=2*P.PI;static invPI2=1/P.PI2;static radiansToDegrees=180/P.PI;static radDeg=P.radiansToDegrees;static degreesToRadians=P.PI/180;static degRad=P.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*P.degRad)}static sinDeg(t){return Math.sin(t*P.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*P.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),1/3);return t<0?-e:e}static randomTriangular(t,e){return P.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let a=Math.random(),i=e-t;return a<=(s-t)/i?t+Math.sqrt(a*i*(s-t)):e-Math.sqrt((1-a)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class V{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class D extends V{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class O extends D{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class N{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,a,i){for(let n=e,r=a;n<e+i;n++,r++)s[r]=t[n]}static arrayFill(t,e,s,a){for(let i=e;i<s;i++)t[i]=a}static setArraySize(t,e,s=0){let a=t.length;if(a==e)return t;if(t.length=e,a<e)for(let i=a;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:N.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let a=0;a<t;a++)s[a]=e;return s}static newFloatArray(t){if(N.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(N.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return N.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return N.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var a=0;a<t.length;a++)if(t[a]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class L{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class q{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class W{x;y;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 0!=t&&(this.x/=t,this.y/=t),this}}class U{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class z{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class ${name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class G extends ${static nextID=0;id=G.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,a,i,n){s=i+(s>>1)*n;let r=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let r=t.bone,h=r.worldX,c=r.worldY,d=r.a,u=r.b,m=r.c,f=r.d;for(let t=e,r=i;r<s;t+=2,r+=n){let e=l[t],s=l[t+1];a[r]=e*d+s*u+h,a[r+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=r.bones;if(0==o.length)for(let t=i,e=3*d;t<s;t+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],a=l[e],n=l[e+1],r=l[e+2];s+=(a*t.a+n*t.b+t.worldX)*r,i+=(a*t.c+n*t.d+t.worldY)*r}a[t]=s,a[t+1]=i}else{let t=o;for(let e=i,r=3*d,o=d<<1;e<s;e+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,r+=3,o+=2){let e=u[h[c]],a=l[r]+t[o],n=l[r+1]+t[o+1],d=l[r+2];s+=(a*e.a+n*e.b+e.worldX)*d,i+=(a*e.c+n*e.d+e.worldY)*d}a[e]=s,a[e+1]=i}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),N.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=N.newFloatArray(this.vertices.length),N.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class j{static _nextID=0;id=j.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new j(this.regions.length);return N.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 s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let a=this.regions[s];e.region!=a&&(e.region=a,e.updateRegion())}getPath(t,e){let s=t,a=(this.start+e).toString();for(let t=this.digits-a.length;t>0;t--)s+="0";return s+=a,s}static nextID(){return j._nextID++}}var H;!function(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"}(H||(H={}));const J=[H.hold,H.once,H.loop,H.pingpong,H.onceReverse,H.loopReverse,H.pingpongReverse];class K{name;timelines=[];timelineIds=new R;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,a,i,n,r,o){if(!t)throw new Error("skeleton cannot be null.");a&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let a=0,h=l.length;a<h;a++)l[a].apply(t,e,s,i,n,r,o)}}var Z,Q;!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(Z||(Z={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(Q||(Q={}));const tt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class et{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=N.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let a=1;a<s;a++)if(t[a]>e)return a-1;return s-1}static search(t,e,s){let a=t.length;for(let i=s;i<a;i+=s)if(t[i]>e)return i-s;return a-s}}class st extends et{curves;constructor(t,e,s){super(t,s),this.curves=N.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=N.newFloatArray(e);N.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,a,i,n,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(a-2*n+o),f=.03*(i-2*r+l),p=.006*(3*(n-o)-a+h),g=.006*(3*(r-l)-i+c),x=2*m+p,w=2*f+g,b=.3*(n-a)+m+.16666667*p,y=.3*(r-i)+f+.16666667*g,k=a+b,v=i+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=p,w+=g,k+=b,v+=y}getBezierValue(t,e,s,a){let i=this.curves;if(i[a]>t){let n=this.frames[e],r=this.frames[e+s];return r+(t-n)/(i[a]-n)*(i[a+1]-r)}let n=a+18;for(a+=2;a<n;a+=2)if(i[a]>=t){let e=i[a-2],s=i[a-1];return s+(t-e)/(i[a]-e)*(i[a+1]-s)}e+=this.getFrameEntries();let r=i[n-2],o=i[n-1];return o+(t-r)/(this.frames[e]-r)*(this.frames[e+s]-o)}}class at extends st{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let a=2;a<=s;a+=2)if(e[a]>t){s=a-2;break}let a=this.curves[s>>1];switch(a){case 0:let a=e[s],i=e[s+1];return i+(t-a)/(e[s+2]-a)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,a-2)}getRelativeValue(t,e,s,a,i){if(t<this.frames[0]){switch(s){case Z.setup:return i;case Z.first:return a+(i-a)*e}return a}let n=this.getCurveValue(t);switch(s){case Z.setup:return i+n*e;case Z.first:case Z.replace:n+=i-a}return a+n*e}getAbsoluteValue(t,e,s,a,i){if(t<this.frames[0]){switch(s){case Z.setup:return i;case Z.first:return a+(i-a)*e}return a}let n=this.getCurveValue(t);return s==Z.setup?i+(n-i)*e:a+(n-a)*e}getAbsoluteValue2(t,e,s,a,i,n){if(t<this.frames[0]){switch(s){case Z.setup:return i;case Z.first:return a+(i-a)*e}return a}return s==Z.setup?i+(n-i)*e:a+(n-a)*e}getScaleValue(t,e,s,a,i,n){if(t<this.frames[0]){switch(s){case Z.setup:return n;case Z.first:return i+(n-i)*e}return i}let r=this.getCurveValue(t)*n;if(1==e)return s==Z.add?i+r-n:r;if(a==Q.mixOut)switch(s){case Z.setup:return n+(Math.abs(r)*P.signum(n)-n)*e;case Z.first:case Z.replace:return i+(Math.abs(r)*P.signum(i)-i)*e}else{let t=0;switch(s){case Z.setup:return t=Math.abs(n)*P.signum(r),t+(r-t)*e;case Z.first:case Z.replace:return t=Math.abs(i)*P.signum(r),t+(r-t)*e}}return i+(r-n)*e}}class it extends st{constructor(t,e,s,a){super(t,e,[s,a])}getFrameEntries(){return 3}setFrame(t,e,s,a){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a}}class nt extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,n,o.rotation,o.data.rotation))}}class rt extends it{boneIndex=0;constructor(t,e,s){super(t,e,tt.x+"|"+s,tt.y+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case Z.setup:return o.x=o.data.x,void(o.y=o.data.y);case Z.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=et.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case Z.setup:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case Z.first:case Z.replace:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case Z.add:o.x+=h*i,o.y+=c*i}}}class ot extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.x+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,n,o.x,o.data.x))}}class lt extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.y+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,n,o.y,o.data.y))}}class ht extends it{boneIndex=0;constructor(t,e,s){super(t,e,tt.scaleX+"|"+s,tt.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(n){case Z.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case Z.first:o.scaleX+=(o.data.scaleX-o.scaleX)*i,o.scaleY+=(o.data.scaleY-o.scaleY)*i}return}let d=et.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==i)n==Z.add?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(r==Q.mixOut)switch(n){case Z.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*P.signum(t)-t)*i,o.scaleY=e+(Math.abs(h)*P.signum(e)-e)*i;break;case Z.first:case Z.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*P.signum(t)-t)*i,o.scaleY=e+(Math.abs(h)*P.signum(e)-e)*i;break;case Z.add:o.scaleX+=(l-o.data.scaleX)*i,o.scaleY+=(h-o.data.scaleY)*i}else switch(n){case Z.setup:t=Math.abs(o.data.scaleX)*P.signum(l),e=Math.abs(o.data.scaleY)*P.signum(h),o.scaleX=t+(l-t)*i,o.scaleY=e+(h-e)*i;break;case Z.first:case Z.replace:t=Math.abs(o.scaleX)*P.signum(l),e=Math.abs(o.scaleY)*P.signum(h),o.scaleX=t+(l-t)*i,o.scaleY=e+(h-e)*i;break;case Z.add:o.scaleX+=(l-o.data.scaleX)*i,o.scaleY+=(h-o.data.scaleY)*i}}}}class ct extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,n,r,o.scaleX,o.data.scaleX))}}class dt extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,n,r,o.scaleY,o.data.scaleY))}}class ut extends it{boneIndex=0;constructor(t,e,s){super(t,e,tt.shearX+"|"+s,tt.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case Z.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case Z.first:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=et.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case Z.setup:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case Z.first:case Z.replace:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case Z.add:o.shearX+=h*i,o.shearY+=c*i}}}class mt extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,n,o.shearX,o.data.shearX))}}class ft extends at{boneIndex=0;constructor(t,e,s){super(t,e,tt.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,n,o.shearY,o.data.shearY))}}class pt extends et{boneIndex=0;constructor(t,e){super(t,[tt.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,a,i,n,r){let o=t.bones[this.boneIndex];if(!o.active)return;if(r==Q.mixOut)return void(n==Z.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?n!=Z.setup&&n!=Z.first||(o.inherit=o.data.inherit):o.inherit=this.frames[et.search(l,s,2)+1]}}class gt extends st{slotIndex=0;constructor(t,e,s){super(t,e,[tt.rgb+"|"+s,tt.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,a,i,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=i,this.frames[t+4]=n}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case Z.setup:return void h.setFromColor(t);case Z.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i)}return}let c=0,d=0,u=0,m=0,f=et.search(l,s,5),p=this.curves[f/5];switch(p){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+36-2),m=this.getBezierValue(s,f,4,p+54-2)}1==i?h.set(c,d,u,m):(n==Z.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(m-h.a)*i))}}class xt extends st{slotIndex=0;constructor(t,e,s){super(t,e,[tt.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,a,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=i}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case Z.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case Z.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i}return}let c=0,d=0,u=0,m=et.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==i)h.r=c,h.g=d,h.b=u;else{if(n==Z.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*i,h.g+=(d-h.g)*i,h.b+=(u-h.b)*i}}}class wt extends at{slotIndex=0;constructor(t,e,s){super(t,e,tt.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(n){case Z.setup:return void(l.a=t.a);case Z.first:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(n==Z.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}}class bt extends st{slotIndex=0;constructor(t,e,s){super(t,e,[tt.rgb+"|"+s,tt.alpha+"|"+s,tt.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,a,i,n,r,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=r,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case Z.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case Z.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i),c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,m=0,f=0,p=0,g=0,x=0,w=et.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,p+=(l[w+8+5]-p)*e,g+=(l[w+8+6]-g)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],p=l[w+5],g=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),m=this.getBezierValue(s,w,3,b+36-2),f=this.getBezierValue(s,w,4,b+54-2),p=this.getBezierValue(s,w,5,b+72-2),g=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==i)h.set(d,u,m,f),c.r=p,c.g=g,c.b=x;else{if(n==Z.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*i,(u-h.g)*i,(m-h.b)*i,(f-h.a)*i),c.r+=(p-c.r)*i,c.g+=(g-c.g)*i,c.b+=(x-c.b)*i}}}class yt extends st{slotIndex=0;constructor(t,e,s){super(t,e,[tt.rgb+"|"+s,tt.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,a,i,n,r,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=r,this.frames[t+6]=o}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case Z.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case Z.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i,c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,m=0,f=0,p=0,g=0,x=et.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],p=l[x+5],g=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,p+=(l[x+7+5]-p)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],p=l[x+5],g=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+36-2),f=this.getBezierValue(s,x,4,w+54-2),p=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==i)h.r=d,h.g=u,h.b=m,c.r=f,c.g=p,c.b=g;else{if(n==Z.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*i,h.g+=(u-h.g)*i,h.b+=(m-h.b)*i,c.r+=(f-c.r)*i,c.g+=(p-c.g)*i,c.b+=(g-c.b)*i}}}class kt extends et{slotIndex=0;attachmentNames;constructor(t,e){super(t,[tt.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];o.bone.active&&(r!=Q.mixOut?s<this.frames[0]?n!=Z.setup&&n!=Z.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[et.search1(this.frames,s)]):n==Z.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class vt extends st{slotIndex=0;attachment;vertices;constructor(t,e,s,a){super(t,e,[tt.deform+"|"+s+"|"+a.id]),this.slotIndex=s,this.attachment=a,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,a,i,n,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(a-2*n+o),f=.03*l-.06*r,p=.006*(3*(n-o)-a+h),g=.018*(r-l+.33333333),x=2*m+p,w=2*f+g,b=.3*(n-a)+m+.16666667*p,y=.3*r+f+.16666667*g,k=a+b,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=p,w+=g,k+=b,v+=y}getCurvePercent(t,e){let s=this.curves,a=s[e];switch(a){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(a-=2,s[a]>t){let i=this.frames[e];return s[a+1]*(t-i)/(s[a]-i)}let i=a+18;for(a+=2;a<i;a+=2)if(s[a]>=t){let e=s[a-2],i=s[a-1];return i+(t-e)/(s[a]-e)*(s[a+1]-i)}let n=s[i-2],r=s[i-1];return r+(1-r)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof G)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(n=Z.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(n){case Z.setup:return void(h.length=0);case Z.first:if(1==i)return void(h.length=0);h.length=d;let t=l;if(t.bones){i=1-i;for(m=0;m<d;m++)h[m]*=i}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*i}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==i)if(n==Z.add){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else N.arrayCopy(t,0,h,0,d);else switch(n){case Z.setup:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<d;e++){let a=s[e];h[e]=a+(t[e]-a)*i}}break}case Z.first:case Z.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*i;break;case Z.add:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*i}}return}let f=et.search1(u,s),p=this.getCurvePercent(s,f),g=c[f],x=c[f+1];if(1==i)if(n==Z.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=e+(x[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=s+(x[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=g[t];h[t]=e+(x[t]-e)*p}else switch(n){case Z.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]=(e+(x[t]-e)*p)*i}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t],a=e[t];h[t]=a+(s+(x[t]-s)*p-a)*i}}break}case Z.first:case Z.replace:for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(x[t]-e)*p-h[t])*i}break;case Z.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=g[t];h[t]+=(e+(x[t]-e)*p)*i}else{let e=t.vertices;for(let t=0;t<d;t++){let s=g[t];h[t]+=(s+(x[t]-s)*p-e[t])*i}}}}}class St extends et{static propertyIds=[""+tt.event];events;constructor(t){super(t,St.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,s,a,i,n,r){if(!a)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,a,i,n,r),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=et.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)a.push(this.events[h])}}class At extends et{static propertyIds=[""+tt.drawOrder];drawOrders;constructor(t){super(t,At.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,a,i,n,r){if(r==Q.mixOut)return void(n==Z.setup&&N.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=Z.setup&&n!=Z.first||N.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=et.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,a=l.length;t<a;t++)e[t]=s[l[t]]}else N.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class It extends st{constraintIndex=0;constructor(t,e,s){super(t,e,[tt.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,a,i,n,r){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=a,this.frames[t+3]=i,this.frames[t+4]=n?1:0,this.frames[t+5]=r?1:0}apply(t,e,s,a,i,n,r){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case Z.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case Z.first:o.mix+=(o.data.mix-o.mix)*i,o.softness+=(o.data.softness-o.softness)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=et.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}n==Z.setup?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,r==Q.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*i,o.softness+=(c-o.softness)*i,r==Q.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class Mt extends st{constraintIndex=0;constructor(t,e,s){super(t,e,[tt.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,a,i,n,r,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=a,l[t+3]=i,l[t+4]=n,l[t+5]=r,l[t+6]=o}apply(t,e,s,a,i,n,r){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(n){case Z.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case Z.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*i,o.mixX+=(t.mixX-o.mixX)*i,o.mixY+=(t.mixY-o.mixY)*i,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*i,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*i,o.mixShearY+=(t.mixShearY-o.mixShearY)*i}return}let p=et.search(f,s,7),g=this.curves[p/7];switch(g){case 0:let t=f[p];l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];let e=(s-t)/(f[p+7]-t);l+=(f[p+7+1]-l)*e,h+=(f[p+7+2]-h)*e,c+=(f[p+7+3]-c)*e,d+=(f[p+7+4]-d)*e,u+=(f[p+7+5]-u)*e,m+=(f[p+7+6]-m)*e;break;case 1:l=f[p+1],h=f[p+2],c=f[p+3],d=f[p+4],u=f[p+5],m=f[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),h=this.getBezierValue(s,p,2,g+18-2),c=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),u=this.getBezierValue(s,p,5,g+72-2),m=this.getBezierValue(s,p,6,g+90-2)}if(n==Z.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*i,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*i,o.mixShearY=t.mixShearY+(m-t.mixShearY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i,o.mixScaleX+=(d-o.mixScaleX)*i,o.mixScaleY+=(u-o.mixScaleY)*i,o.mixShearY+=(m-o.mixShearY)*i}}class Ft extends at{constraintIndex=0;constructor(t,e,s){super(t,e,tt.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,a,i,n,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,n,o.position,o.data.position))}}class Ct extends at{constraintIndex=0;constructor(t,e,s){super(t,e,tt.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,a,i,n,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,n,o.spacing,o.data.spacing))}}class Tt extends st{constraintIndex=0;constructor(t,e,s){super(t,e,[tt.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,a,i){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=a,n[t+3]=i}apply(t,e,s,a,i,n,r){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case Z.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case Z.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*i,o.mixX+=(o.data.mixX-o.mixX)*i,o.mixY+=(o.data.mixY-o.mixY)*i}return}let u=et.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(n==Z.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i}}class Et extends at{constraintIndex=0;constructor(t,e,s,a){super(t,e,a+"|"+s),this.constraintIndex=s}apply(t,e,s,a,i,n,r){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const a of t.physicsConstraints)a.active&&this.global(a.data)&&this.set(a,this.getAbsoluteValue2(s,i,n,this.get(a),this.setup(a),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,n,this.get(o),this.setup(o)))}}class Yt extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class _t extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class Xt extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Rt extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class Bt extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class Pt extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class Vt extends Et{constructor(t,e,s){super(t,e,s,tt.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class Dt extends et{static propertyIds=[tt.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,Dt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,a,i,n,r){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],i,n,r),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[et.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class Ot extends et{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[tt.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Ot.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,a,i){let n=this.frames;n[t*=Ot.ENTRIES]=e,n[t+Ot.MODE]=s|a<<4,n[t+Ot.DELAY]=i}apply(t,e,s,a,i,n,r){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof G&&l.timelineAttachment==h))return;let c=this.frames;if(s<c[0])return void(n!=Z.setup&&n!=Z.first||(o.sequenceIndex=-1));let d=et.search(c,s,Ot.ENTRIES),u=c[d],m=c[d+Ot.MODE],f=c[d+Ot.DELAY];if(!this.attachment.sequence)return;let p=m>>4,g=this.attachment.sequence.regions.length,x=J[15&m];if(x!=H.hold)switch(p+=(s-u)/f+1e-5|0,x){case H.once:p=Math.min(g-1,p);break;case H.loop:p%=g;break;case H.pingpong:{let t=(g<<1)-2;p=0==t?0:p%t,p>=g&&(p=t-p);break}case H.onceReverse:p=Math.max(g-1-p,0);break;case H.loopReverse:p=g-1-p%g;break;case H.pingpongReverse:{let t=(g<<1)-2;p=0==t?0:(p+g-1)%t,p>=g&&(p=t-p)}}o.sequenceIndex=p}}class Nt{static _emptyAnimation=new K("<empty>",[],0);static emptyAnimation(){return Nt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new qt(this);propertyIDs=new R;animationsChanged=!1;trackEntryPool=new q((()=>new Lt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(!a)continue;a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;let i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}let n=a.next;if(n){let e=a.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==a.timeScale?0:(e/a.timeScale+t)*n.timeScale,a.trackTime+=i,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){e[s]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,t)){let t=a.mixingFrom;for(a.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}a.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let a=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),a):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,a=!1;for(let n=0,r=s.length;n<r;n++){let r=s[n];if(!r||r.delay>0)continue;a=!0;let o=0==n?Z.first:r.mixBlend,l=r.alpha;r.mixingFrom?l*=this.applyMixingFrom(r,t,o):r.trackTime>=r.trackEnd&&!r.next&&(l=0);let h=l>=r.alphaAttachmentThreshold,c=r.animationLast,d=r.getAnimationTime(),u=d,m=e;r.reverse&&(u=r.animation.duration-u,m=null);let f=r.animation.timelines,p=f.length;if(0==n&&1==l||o==Z.add){0==n&&(h=!0);for(let e=0;e<p;e++){N.webkit602BugfixHelper(l,o);var i=f[e];i instanceof kt?this.applyAttachmentTimeline(i,t,u,o,h):i.apply(t,c,u,m,l,o,Q.mixIn)}}else{let e=r.timelineMode,s=r.shortestRotation,a=!s&&r.timelinesRotation.length!=p<<1;a&&(r.timelinesRotation.length=p<<1);for(let i=0;i<p;i++){let n=f[i],d=e[i]==zt?o:Z.setup;!s&&n instanceof nt?this.applyRotateTimeline(n,t,u,l,d,r.timelinesRotation,i<<1,a):n instanceof kt?this.applyAttachmentTimeline(n,t,u,o,h):(N.webkit602BugfixHelper(l,o),n.apply(t,c,u,m,l,d,Q.mixIn))}}this.queueEvents(r,d),e.length=0,r.nextAnimationLast=d,r.nextTrackLast=r.trackTime}for(var n=this.unkeyedState+Jt,r=t.slots,o=0,l=t.slots.length;o<l;o++){var h=r[o];if(h.attachmentState==n){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),a}applyMixingFrom(t,e,s){let a=t.mixingFrom;a.mixingFrom&&this.applyMixingFrom(a,e,s);let i=0;0==t.mixDuration?(i=1,s==Z.first&&(s=Z.setup)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),s!=Z.first&&(s=a.mixBlend));let n=i<a.mixAttachmentThreshold,r=i<a.mixDrawOrderThreshold,o=a.animation.timelines,l=o.length,h=a.alpha*t.interruptAlpha,c=h*(1-i),d=a.animationLast,u=a.getAnimationTime(),m=u,f=null;if(a.reverse?m=a.animation.duration-m:i<a.eventThreshold&&(f=this.events),s==Z.add)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,Q.mixOut);else{let t=a.timelineMode,i=a.timelineHoldMix,u=a.shortestRotation,p=!u&&a.timelinesRotation.length!=l<<1;p&&(a.timelinesRotation.length=l<<1),a.totalAlpha=0;for(let g=0;g<l;g++){let l,x=o[g],w=Q.mixOut,b=0;switch(t[g]){case zt:if(!r&&x instanceof At)continue;l=s,b=c;break;case $t:l=Z.setup,b=c;break;case Gt:l=s,b=h;break;case jt:l=Z.setup,b=h;break;default:l=Z.setup;let t=i[g];b=h*Math.max(0,1-t.mixTime/t.mixDuration)}a.totalAlpha+=b,!u&&x instanceof nt?this.applyRotateTimeline(x,e,m,b,l,a.timelinesRotation,g<<1,p):x instanceof kt?this.applyAttachmentTimeline(x,e,m,l,n&&b>=a.alphaAttachmentThreshold):(N.webkit602BugfixHelper(b,s),r&&x instanceof At&&l==Z.setup&&(w=Q.mixIn),x.apply(e,d,m,f,b,l,w))}}return t.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i}applyAttachmentTimeline(t,e,s,a,i){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?a!=Z.setup&&a!=Z.first||this.setAttachment(e,n,n.data.attachmentName,i):this.setAttachment(e,n,t.attachmentNames[et.search1(t.frames,s)],i),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Jt))}setAttachment(t,e,s,a){e.setAttachment(s?t.getAttachment(e.data.index,s):null),a&&(e.attachmentState=this.unkeyedState+Kt)}applyRotateTimeline(t,e,s,a,i,n,r,o){if(o&&(n[r]=0),1==a)return void t.apply(e,0,s,null,1,i,Q.mixIn);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(i){case Z.setup:l.rotation=l.data.rotation;default:return;case Z.first:h=l.rotation,c=l.data.rotation}else h=i==Z.setup?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=n[r];else{let t=0,e=0;o?(t=0,e=u):(t=n[r],e=n[r+1]);let s=t-t%360;d=u+s;let a=u>=0,i=t>=0;Math.abs(e)<=90&&P.signum(e)!=P.signum(u)&&(Math.abs(t-s)>180?(d+=360*P.signum(t),i=a):0!=s?d-=360*P.signum(t):i=a),i!=a&&(d+=360*P.signum(t)),n[r]=d}n[r+1]=u,l.rotation=h+d*a}queueEvents(t,e){let s=t.animationStart,a=t.animationEnd,i=a-s,n=t.trackLast%i,r=this.events,o=0,l=r.length;for(;o<l;o++){let e=r[o];if(e.time<n)break;e.time>a||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==i)h=!0;else{const e=Math.floor(t.trackTime/i);h=e>0&&e>Math.floor(t.trackLast/i)}else h=e>=a&&t.animationLast<a;for(h&&this.queue.complete(t);o<l;o++){let e=r[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);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 s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let a=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,a&&(s&&this.queue.interrupt(a),e.mixingFrom=a,a.mixingTo=e,e.mixTime=0,a.mixingFrom&&a.mixDuration>0&&(e.interruptAlpha*=Math.min(1,a.mixTime/a.mixDuration)),a.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,a,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let a=!0,i=this.expandToIndex(t);i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,a=!1):this.clearNext(i));let n=this.trackEntry(t,e,s,i);return this.setCurrent(t,n,a),this.queue.drain(),n}addAnimation(t,e,s=!1,a=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,a)}addAnimationWith(t,e,s=!1,a=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let n=this.trackEntry(t,e,s,i);return i?(i.next=n,n.previous=i,a<=0&&(a+=i.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=a,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Nt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let a=this.addAnimationWith(t,Nt.emptyAnimation(),!1,s);return s<=0&&(a.delay+=a.mixDuration-e),a.mixDuration=e,a.trackEnd=e,a}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(N.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,a){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=t,i.animation=e,i.loop=s,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.alphaAttachmentThreshold=0,i.mixAttachmentThreshold=0,i.mixDrawOrderThreshold=0,i.animationStart=0,i.animationEnd=e.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=a?this.data.getMix(a.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=Z.replace,i}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,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==Z.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,a=t.animation.timelines.length,i=t.timelineMode;i.length=a;let n=t.timelineHoldMix;n.length=0;let r=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<a;t++)i[t]=r.addAll(s[t].getPropertyIds())?jt:Gt;else t:for(let o=0;o<a;o++){let a=s[o],l=a.getPropertyIds();if(r.addAll(l))if(!e||a instanceof kt||a instanceof At||a instanceof St||!e.animation.hasTimeline(l))i[o]=$t;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=Ht,n[o]=s;continue t}break}i[o]=jt}else i[o]=zt}}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()}}class Lt{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=Z.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?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(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class qt{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(Wt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Wt.interrupt),this.objects.push(t)}end(t){this.objects.push(Wt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Wt.dispose),this.objects.push(t)}complete(t){this.objects.push(Wt.complete),this.objects.push(t)}event(t,e){this.objects.push(Wt.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 s=0;s<t.length;s+=2){let a=t[s],i=t[s+1];switch(a){case Wt.start:i.listener&&i.listener.start&&i.listener.start(i);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(i)}break;case Wt.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(i)}break;case Wt.end:i.listener&&i.listener.end&&i.listener.end(i);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(i)}case Wt.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(i)}this.animState.trackEntryPool.free(i);break;case Wt.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(i)}break;case Wt.event:let a=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,a);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,a)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var Wt;!function(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"}(Wt||(Wt={}));class Ut{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const zt=0,$t=1,Gt=2,jt=3,Ht=4,Jt=1,Kt=2;class Zt{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let a=this.skeletonData.findAnimation(t);if(!a)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(a,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let a=t.name+"."+e.name;this.animationToMixTime[a]=s}getMix(t,e){let s=t.name+"."+e.name,a=this.animationToMixTime[s];return void 0===a?this.defaultMix:a}}class Qt extends G{color=new B(1,1,1,1);constructor(t){super(t)}copy(){let t=new Qt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class te extends G{endSlot=null;color=new B(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new te(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class ee{_image;constructor(t){this._image=t}getImage(){return this._image}}var se,ae,ie,ne,re,oe,le,he,ce;!function(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"}(se||(se={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(ae||(ae={}));class de{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class ue extends ee{setFilters(t,e){}setWraps(t,e){}dispose(){}}class me{pages=new Array;regions=new Array;constructor(t){let e=new fe(t),s=new Array(4),a={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=N.enumValue(se,s[1]),t.magFilter=N.enumValue(se,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=ae.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=ae.Repeat)},pma:t=>{t.pma="true"==s[1]}};var i={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let n=e.readLine();for(;n&&0==n.trim().length;)n=e.readLine();for(;n&&0!=n.trim().length&&0!=e.readEntry(s,n);)n=e.readLine();let r=null,o=null,l=null;for(;null!==n;)if(0==n.trim().length)r=null,n=e.readLine();else if(r){let t=new ge(r,n);for(;;){let a=e.readEntry(s,n=e.readLine());if(0==a)break;let r=i[s[0]];if(r)r(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<a;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/r.width,t.v=t.y/r.height,90==t.degrees?(t.u2=(t.x+t.height)/r.width,t.v2=(t.y+t.width)/r.height):(t.u2=(t.x+t.width)/r.width,t.v2=(t.y+t.height)/r.height),this.regions.push(t)}else{for(r=new pe(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=a[s[0]];t&&t(r)}this.pages.push(r)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class fe{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let a=1,i=s+1;;a++){let s=e.indexOf(",",i);if(-1==s)return t[a]=e.substr(i).trim(),a;if(t[a]=e.substr(i,s-i).trim(),i=s+1,4==a)return 4}}}class pe{name;minFilter=se.Nearest;magFilter=se.Nearest;uWrap=ae.ClampToEdge;vWrap=ae.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class ge extends de{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class xe extends G{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new B(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new B(0,0,0,0);constructor(t,e){super(t),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=N.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,a=this.region.u,i=this.region.v,n=0,r=0;if(this.region instanceof ge){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:a-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=a+t[o+1]*n,e[o+1]=i+(1-t[o])*r;return;case 180:a-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,n=o.originalWidth/h,r=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=a+(1-t[o])*n,e[o+1]=i+(1-t[o+1])*r;return;case 270:a-=o.offsetY/h,i-=o.offsetX/c,n=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=a+(1-t[o+1])*n,e[o+1]=i+t[o]*r;return}a-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,r=o.originalHeight/c}else this.region?(n=this.region.u2-a,r=this.region.v2-i):(a=i=0,n=r=1);for(let o=0;o<s;o+=2)e[o]=a+t[o]*n,e[o+1]=i+t[o+1]*r}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 xe(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),N.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),N.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),N.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),N.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,a,i,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,a,i,n)}newLinkedMesh(){let t=new xe(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),null!=t.region&&t.updateRegion(),t}}class we extends G{lengths=[];closed=!1;constantSpeed=!1;color=new B(1,1,1,1);constructor(t){super(t)}copy(){let t=new we(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),N.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class be extends G{x=0;y=0;rotation=0;color=new B(.38,.94,0,1);constructor(t){super(t)}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){const e=this.rotation*P.degRad,s=Math.cos(e),a=Math.sin(e),i=s*t.a+a*t.b,n=s*t.c+a*t.d;return P.atan2Deg(n,i)}copy(){let t=new be(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class ye extends ${x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new B(1,1,1,1);path;region=null;sequence=null;offset=N.newFloatArray(8);uvs=N.newFloatArray(8);tempColor=new B(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,a=this.height/this.region.originalHeight*this.scaleY,i=-this.width/2*this.scaleX+this.region.offsetX*s,n=-this.height/2*this.scaleY+this.region.offsetY*a,r=i+this.region.width*s,o=n+this.region.height*a,l=this.rotation*P.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=i*h+d,f=i*c,p=n*h+u,g=n*c,x=r*h+d,w=r*c,b=o*h+u,y=o*c,k=this.offset;k[0]=m-g,k[1]=p+f,k[2]=m-y,k[3]=b+f,k[4]=x-y,k[5]=b+w,k[6]=x-g,k[7]=p+w,90==t.degrees?(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,s,a){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,n=this.offset,r=i.worldX,o=i.worldY,l=i.a,h=i.b,c=i.c,d=i.d,u=0,m=0;u=n[0],m=n[1],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=a,u=n[2],m=n[3],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=a,u=n[4],m=n[5],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=a,u=n[6],m=n[7],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o}copy(){let t=new ye(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,N.arrayCopy(this.uvs,0,t.uvs,0,8),N.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class ke{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let a=s.regions;for(let i=0,n=a.length;i<n;i++){let n=s.getPath(e,i),r=this.atlas.findRegion(n);if(null==r)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");a[i]=r}}newRegionAttachment(t,e,s,a){let i=new ye(e,s);if(null!=a)this.loadSequence(e,s,a);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=t}return i}newMeshAttachment(t,e,s,a){let i=new xe(e,s);if(null!=a)this.loadSequence(e,s,a);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=t}return i}newBoundingBoxAttachment(t,e){return new Qt(e)}newPathAttachment(t,e){return new we(e)}newPointAttachment(t,e){return new be(e)}newClippingAttachment(t,e){return new te(e)}}class ve{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=ie.Normal;skinRequired=!1;color=new B;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}!function(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"}(ie||(ie={}));class Se{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=ie.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,a,i,n,r){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=a,this.ascaleY=i,this.ashearX=n,this.ashearY=r;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+n)*P.degRad,d=(s+90+r)*P.degRad;return this.a=Math.cos(c)*a*l,this.b=Math.cos(d)*i*l,this.c=Math.sin(c)*a*h,this.d=Math.sin(d)*i*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case ie.Normal:{const t=(s+n)*P.degRad,e=(s+90+r)*P.degRad,o=Math.cos(t)*a,u=Math.cos(e)*i,m=Math.sin(t)*a,f=Math.sin(e)*i;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case ie.OnlyTranslation:{const t=(s+n)*P.degRad,e=(s+90+r)*P.degRad;this.a=Math.cos(t)*a,this.b=Math.cos(e)*i,this.c=Math.sin(t)*a,this.d=Math.sin(e)*i;break}case ie.NoRotationOrReflection:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*P.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*P.radDeg);const m=(s+n-u)*P.degRad,f=(s+r-u+90)*P.degRad,p=Math.cos(m)*a,g=Math.cos(f)*i,x=Math.sin(m)*a,w=Math.sin(f)*i;this.a=l*p-h*x,this.b=l*g-h*w,this.c=c*p+d*x,this.d=c*g+d*w;break}case ie.NoScale:case ie.NoScaleOrReflection:{s*=P.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),this.inherit==ie.NoScale&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,p=Math.sin(s)*m;n*=P.degRad,r=(90+r)*P.degRad;const g=Math.cos(n)*a,x=Math.cos(r)*i,w=Math.sin(n)*a,b=Math.sin(r)*i;this.a=o*g+f*w,this.b=o*x+f*b,this.c=u*g+p*w,this.d=u*x+p*b;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*P.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*P.radDeg);let e,s,a,i,n=t.a,r=t.b,o=t.c,l=t.d,h=1/(n*l-r*o),c=l*h,d=r*h,u=o*h,m=n*h,f=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=f*c-p*d,this.ay=p*m-f*u,this.inherit==ie.OnlyTranslation)e=this.a,s=this.b,a=this.c,i=this.d;else{switch(this.inherit){case ie.NoRotationOrReflection:{let t=Math.abs(n*l-r*o)/(n*n+o*o);r=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=n*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(n*l-r*o),c=l*h,d=r*h;break}case ie.NoScale:case ie.NoScaleOrReflection:let t=P.cosDeg(this.rotation),e=P.sinDeg(this.rotation);n=(n*t+r*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(n*n+o*o);s>1e-5&&(s=1/s),n*=s,o*=s,s=Math.sqrt(n*n+o*o),this.inherit==ie.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let a=P.PI/2+Math.atan2(o,n);r=Math.cos(a)*s,l=Math.sin(a)*s,h=1/(n*l-r*o),c=l*h,d=r*h,u=o*h,m=n*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,a=m*this.c-u*this.a,i=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+a*a),this.ascaleX>1e-4){let t=e*i-s*a;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+a*i,t)*P.radDeg,this.arotation=Math.atan2(a,e)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+i*i),this.ashearY=0,this.arotation=90-Math.atan2(i,s)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,a=t.y-this.worldY;return t.x=s*this.d*e-a*this.b*e,t.y=a*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=P.sinDeg(t),s=P.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=P.sinDeg(t),s=P.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*P.radDeg}rotateWorld(t){t*=P.degRad;const e=Math.sin(t),s=Math.cos(t),a=this.a,i=this.b;this.a=s*a-e*this.c,this.b=s*i-e*this.d,this.c=e*a+s*this.c,this.d=e*i+s*this.d}}class Ae{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Ie{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Me){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,a)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${a}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,a)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${a}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,a)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${a}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{this.success(e,t,this.textureLoader(a))},a.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},a){let i=t.lastIndexOf("/"),n=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let r=new me(i),o=r.pages.length,l=!1;for(let i of r.pages)this.loadTexture(a?a[i.name]:n+i.name,((s,a)=>{l||(i.setTexture(a),0==--o&&this.success(e,t,r))}),((e,a)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,a)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${a}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}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 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}}class Me{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,a=new Uint8Array(s),i=0;i<s;i++)a[i]=e.charCodeAt(i);return a}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let a=new XMLHttpRequest;a.overrideMimeType("text/html"),a.open("GET",t,!0);let i=()=>{this.finish(t,a.status,a.responseText)};a.onload=i,a.onerror=i,a.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType="arraybuffer";let i=()=>{this.finish(t,a.status,a.response)};a.onload=()=>{200==a.status||0==a.status?this.finish(t,200,new Uint8Array(a.response)):i()},a.onerror=i,a.send()}start(t,e,s){let a=this.callbacks[t];try{if(a)return!0;this.callbacks[t]=a=[]}finally{a.push(e,s)}}finish(t,e,s){let a=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=a.length;t<e;t+=2)a[t].apply(null,i)}}class Fe{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class Ce{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Te{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let a=e.findBone(t.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(a)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,a,i,n,r){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case ie.OnlyTranslation:m=(e-t.worldX)*P.signum(t.skeleton.scaleX),f=(s-t.worldY)*P.signum(t.skeleton.scaleY);break;case ie.NoRotationOrReflection:let a=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),i=l/t.skeleton.scaleX,n=c/t.skeleton.scaleY;h=-n*a*t.skeleton.scaleX,d=i*a*t.skeleton.scaleY,u+=Math.atan2(n,i)*P.radDeg;default:let r=e-o.worldX,p=s-o.worldY,g=l*d-h*c;Math.abs(g)<=1e-4?(m=0,f=0):(m=(r*d-p*h)/g-t.ax,f=(p*l-r*c)/g-t.ay)}u+=Math.atan2(f,m)*P.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,g=t.ascaleY;if(a||i){switch(t.inherit){case ie.NoScale:case ie.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=m*m+f*f;if(a&&t<o*o||i&&t>o*o){const e=(Math.sqrt(t)/o-1)*r+1;p*=e,n&&(g*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*r,p,g,t.ashearX,t.ashearY)}apply2(t,e,s,a,i,n,r,o,l){if(t.inherit!=ie.Normal||e.inherit!=ie.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,g=0,x=0,w=0;d<0?(d=-d,g=180,w=-1):(g=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,x=180):x=0;let b=e.ax,y=0,k=0,v=0,S=t.a,A=t.b,I=t.c,M=t.d,F=Math.abs(d-u)<=1e-4;!F||n?(y=0,k=S*b+t.worldX,v=I*b+t.worldY):(y=e.ay,k=S*b+A*y+t.worldX,v=I*b+M*y+t.worldY);let C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");S=C.a,A=C.b,I=C.c,M=C.d;let T=S*M-A*I,E=k-C.worldX,Y=v-C.worldY;T=Math.abs(T)<=1e-4?0:1/T;let _,X,R=(E*M-Y*A)*T-h,B=(Y*S-E*I)*T-c,V=Math.sqrt(R*R+B*B),D=e.data.length*p;if(V<1e-4)return this.apply1(t,s,a,!1,n,!1,l),void e.updateWorldTransformWith(b,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-C.worldX,Y=a-C.worldY;let O=(E*M-Y*A)*T-h,N=(Y*S-E*I)*T-c,L=O*O+N*N;if(0!=o){o*=d*(p+1)*.5;let t=Math.sqrt(L),e=t-V-D*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(F){D*=d;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,X=Math.PI*i):t>1?(t=1,X=0,n&&(S=(Math.sqrt(L)/(V+D)-1)*l+1,m*=S,r&&(f*=S))):X=Math.acos(t)*i,S=V+D*t,A=D*Math.sin(X),_=Math.atan2(N*S-O*A,O*S+N*A)}else{S=d*D,A=u*D;let t=S*S,e=A*A,s=Math.atan2(N,O);I=e*V*V+t*L-t*e;let a=-2*e*V,n=e-t;if(M=a*a-4*n*I,M>=0){let t=Math.sqrt(M);a<0&&(t=-t),t=.5*-(a+t);let e=t/n,r=I/t,o=Math.abs(e)<Math.abs(r)?e:r;if(e=L-o*o,e>=0){Y=Math.sqrt(e)*i,_=s-Math.atan2(Y,o),X=Math.atan2(Y/u,(o-V)/d);break t}}let r=P.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,p=0;I=-S*V/(t-e),I>=-1&&I<=1&&(I=Math.acos(I),E=S*Math.cos(I)+V,Y=A*Math.sin(I),M=E*E+Y*Y,M<l&&(r=I,l=M,o=E,h=Y),M>f&&(c=I,f=M,m=E,p=Y)),L<=.5*(l+f)?(_=s-Math.atan2(h*i,o),X=r*i):(_=s-Math.atan2(p*i,m),X=c*i)}let q=Math.atan2(y,b)*w,W=t.arotation;_=(_-q)*P.radDeg+g-W,_>180?_-=360:_<-180&&(_+=360),t.updateWorldTransformWith(h,c,W+_*l,m,f,0,0),W=e.arotation,X=((X+q)*P.radDeg-e.ashearX)*w+x-W,X>180?X-=360:X<-180&&(X+=360),e.updateWorldTransformWith(b,y,W+X*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Ee extends Ae{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class Ye extends Ae{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=ne.Fixed;spacingMode=re.Fixed;rotateMode=oe.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ne||(ne={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(re||(re={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(oe||(oe={}));class _e{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,a=t.bones.length;s<a;s++){let a=e.findBone(t.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(a)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof we))return;let s=this.mixRotate,a=this.mixX,i=this.mixY;if(0==s&&0==a&&0==i)return;let n=this.data,r=n.rotateMode==oe.Tangent,o=n.rotateMode==oe.ChainScale,l=this.bones,h=l.length,c=r?h:h+1,d=N.setArraySize(this.spaces,c),u=o?this.lengths=N.setArraySize(this.lengths,h):[],m=this.spacing;switch(n.spacingMode){case re.Percent:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,a=s*e.a,i=s*e.c;u[t]=Math.sqrt(a*a+i*i)}N.arrayFill(d,1,c,m);break;case re.Proportional:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],a=s.data.length;if(a<_e.epsilon)o&&(u[e]=0),d[++e]=m;else{let i=a*s.a,n=a*s.c,r=Math.sqrt(i*i+n*n);o&&(u[e]=r),d[++e]=r,t+=r}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=n.spacingMode==re.Length;for(let t=0,s=c-1;t<s;){let s=l[t],a=s.data.length;if(a<_e.epsilon)o&&(u[t]=0),d[++t]=m;else{let i=a*s.a,n=a*s.c,r=Math.sqrt(i*i+n*n);o&&(u[t]=r),d[++t]=(e?a+m:m)*r/a}}}let f=this.computeWorldPositions(e,c,r),p=f[0],g=f[1],x=n.offsetRotation,w=!1;if(0==x)w=n.rotateMode==oe.Chain;else{w=!1;let t=this.target.bone;x*=t.a*t.d-t.b*t.c>0?P.degRad:-P.degRad}for(let t=0,e=3;t<h;t++,e+=3){let n=l[t];n.worldX+=(p-n.worldX)*a,n.worldY+=(g-n.worldY)*i;let h=f[e],c=f[e+1],m=h-p,b=c-g;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+b*b)/e-1)*s+1;n.a*=t,n.c*=t}}if(p=h,g=c,s>0){let a=n.a,i=n.b,o=n.c,l=n.d,h=0,c=0,u=0;if(h=r?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(b,m),h-=Math.atan2(o,a),w){c=Math.cos(h),u=Math.sin(h);let t=n.data.length;p+=(t*(c*a-u*o)-m)*s,g+=(t*(u*a+c*o)-b)*s}else h+=x;h>P.PI?h-=P.PI2:h<-P.PI&&(h+=P.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),n.a=c*a-u*o,n.b=c*i-u*l,n.c=u*a+c*o,n.d=u*i+c*l}n.updateAppliedTransform()}}computeWorldPositions(t,e,s){let a=this.target,i=this.position,n=this.spaces,r=N.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=_e.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(this.data.positionMode==ne.Percent&&(i*=f),this.data.spacingMode){case re.Percent:m=f;break;case re.Proportional:m=f/e;break;default:m=1}o=N.setArraySize(this.world,8);for(let p=0,g=0,x=0;p<e;p++,g+=3){let e=n[p]*m;i+=e;let w=i;if(l)w%=f,w<0&&(w+=f),x=0;else{if(w<0){d!=_e.BEFORE&&(d=_e.BEFORE,t.computeWorldVertices(a,2,4,o,0,2)),this.addBeforePosition(w,o,0,r,g);continue}if(w>f){d!=_e.AFTER&&(d=_e.AFTER,t.computeWorldVertices(a,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,r,g);continue}}for(;;x++){let t=u[x];if(!(w>t)){if(0==x)w/=t;else{let e=u[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(a,h-4,4,o,0,2),t.computeWorldVertices(a,0,4,o,4,2)):t.computeWorldVertices(a,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],r,g,s||p>0&&0==e)}return r}l?(h+=2,o=N.setArraySize(this.world,h),t.computeWorldVertices(a,2,h-4,o,0,2),t.computeWorldVertices(a,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=N.setArraySize(this.world,h),t.computeWorldVertices(a,2,h,o,0,2));let u,m=N.setArraySize(this.curves,c),f=0,p=o[0],g=o[1],x=0,w=0,b=0,y=0,k=0,v=0,S=0,A=0,I=0,M=0,F=0,C=0,T=0,E=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],w=o[e+1],b=o[e+2],y=o[e+3],k=o[e+4],v=o[e+5],S=.1875*(p-2*x+b),A=.1875*(g-2*w+y),I=.09375*(3*(x-b)-p+k),M=.09375*(3*(w-y)-g+v),F=2*S+I,C=2*A+M,T=.75*(x-p)+S+.16666667*I,E=.75*(w-g)+A+.16666667*M,f+=Math.sqrt(T*T+E*E),T+=F,E+=C,F+=I,C+=M,f+=Math.sqrt(T*T+E*E),T+=F,E+=C,f+=Math.sqrt(T*T+E*E),T+=F+I,E+=C+M,f+=Math.sqrt(T*T+E*E),m[t]=f,p=k,g=v;switch(this.data.positionMode==ne.Percent&&(i*=f),this.data.spacingMode){case re.Percent:u=f;break;case re.Proportional:u=f/e;break;default:u=1}let Y=this.segments,_=0;for(let t=0,a=0,c=0,X=0;t<e;t++,a+=3){let e=n[t]*u;i+=e;let R=i;if(l)R%=f,R<0&&(R+=f),c=0;else{if(R<0){this.addBeforePosition(R,o,0,r,a);continue}if(R>f){this.addAfterPosition(R-f,o,h-4,r,a);continue}}for(;;c++){let t=m[c];if(!(R>t)){if(0==c)R/=t;else{let e=m[c-1];R=(R-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],g=o[t+1],x=o[t+2],w=o[t+3],b=o[t+4],y=o[t+5],k=o[t+6],v=o[t+7],S=.03*(p-2*x+b),A=.03*(g-2*w+y),I=.006*(3*(x-b)-p+k),M=.006*(3*(w-y)-g+v),F=2*S+I,C=2*A+M,T=.3*(x-p)+S+.16666667*I,E=.3*(w-g)+A+.16666667*M,_=Math.sqrt(T*T+E*E),Y[0]=_,t=1;t<8;t++)T+=F,E+=C,F+=I,C+=M,_+=Math.sqrt(T*T+E*E),Y[t]=_;T+=F,E+=C,_+=Math.sqrt(T*T+E*E),Y[8]=_,T+=F+I,E+=C+M,_+=Math.sqrt(T*T+E*E),Y[9]=_,X=0}for(R*=_;;X++){let t=Y[X];if(!(R>t)){if(0==X)R/=t;else{let e=Y[X-1];R=X+(R-e)/(t-e)}break}}this.addCurvePosition(.1*R,p,g,x,w,b,y,k,v,r,a,s||t>0&&0==e)}return r}addBeforePosition(t,e,s,a,i){let n=e[s],r=e[s+1],o=e[s+2]-n,l=e[s+3]-r,h=Math.atan2(l,o);a[i]=n+t*Math.cos(h),a[i+1]=r+t*Math.sin(h),a[i+2]=h}addAfterPosition(t,e,s,a,i){let n=e[s+2],r=e[s+3],o=n-e[s],l=r-e[s+1],h=Math.atan2(l,o);a[i]=n+t*Math.cos(h),a[i+1]=r+t*Math.sin(h),a[i+2]=h}addCurvePosition(t,e,s,a,i,n,r,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(i-s,a-e));let u=t*t,m=u*t,f=1-t,p=f*f,g=p*f,x=f*t,w=3*x,b=f*w,y=w*t,k=e*g+a*b+n*y+o*m,v=s*g+i*b+r*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(i-s,a-e):Math.atan2(v-(s*p+i*x*2+r*u),k-(e*p+a*x*2+n*u)))}}class Xe{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,a=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,n=this.data.scaleX>0,r=this.bone,o=r.data.length;switch(t){case le.none:return;case le.reset:this.reset();case le.update:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=r.worldX,c=r.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,p=-1,g=this.data.limit*l,x=g*Math.abs(t.scaleY);if(g*=Math.abs(t.scaleX),s||a){if(s){const t=(this.ux-h)*u;this.xOffset+=t>g?g:t<-g?-g:t,this.ux=h}if(a){const t=(this.uy-c)*u;this.yOffset+=t>x?x:t<-x?-x:t,this.uy=c}if(d>=m){p=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,i=this.wind*f,n=(Pe.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(i-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),a&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m}while(d>=m)}s&&(r.worldX+=this.xOffset*e*this.data.x),a&&(r.worldY+=this.yOffset*e*this.data.y)}if(i||n){let t=Math.atan2(r.c,r.a),s=0,a=0,l=0,h=this.cx-r.worldX,c=this.cy-r.worldY;if(h>g?h=g:h<-g&&(h=-g),c>x?c=x:c<-x&&(c=-x),i){l=(this.data.rotate+this.data.shearX)*e;let i=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(i-Math.ceil(i*P.invPI2-.5)*P.PI2)*u,i=this.rotateOffset*l+t,s=Math.cos(i),a=Math.sin(i),n&&(i=o*r.getWorldScaleX(),i>0&&(this.scaleOffset+=(h*s+c*a)*u/i))}else{s=Math.cos(t),a=Math.sin(t);const e=o*r.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*a)*u/e)}if(d=this.remaining,d>=m){-1==p&&(p=Math.pow(this.damping,60*m));const e=this.massInverse*m,r=this.strength,h=this.wind,c=Pe.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,n&&(this.scaleVelocity+=(h*s-c*a-this.scaleOffset*r)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),i){if(this.rotateVelocity-=((h*a+c*s)*u+this.rotateOffset*r)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const i=this.rotateOffset*l+t;s=Math.cos(i),a=Math.sin(i)}else if(d<m)break}}this.remaining=d}this.cx=r.worldX,this.cy=r.worldY;break;case le.pose:s&&(r.worldX+=this.xOffset*e*this.data.x),a&&(r.worldY+=this.yOffset*e*this.data.y)}if(i){let t=this.rotateOffset*e,s=0,a=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),a=Math.cos(e),i=r.b,r.b=a*i-s*r.d,r.d=s*i+a*r.d),e+=t*this.data.shearX,s=Math.sin(e),a=Math.cos(e),i=r.a,r.a=a*i-s*r.c,r.c=s*i+a*r.c}else t*=this.data.rotate,s=Math.sin(t),a=Math.cos(t),i=r.a,r.a=a*i-s*r.c,r.c=s*i+a*r.c,i=r.b,r.b=a*i-s*r.d,r.d=s*i+a*r.d}if(n){const t=1+this.scaleOffset*e*this.data.scaleX;r.a*=t,r.c*=t}t!=le.pose&&(this.tx=o*r.a,this.ty=o*r.c),r.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const a=s*P.degRad,i=Math.cos(a),n=Math.sin(a),r=this.cx-t,o=this.cy-e;this.translate(r*i-o*n-r,r*n+o*i-o)}}class Re{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new 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 G&&this.attachment instanceof G&&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}}class Be{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new W;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let a=e.findBone(t.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(a)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,r=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,a=g.c,i=g.d,n=Math.atan2(c,l)-Math.atan2(a,e)+m;n>P.PI?n-=P.PI2:n<-P.PI&&(n+=P.PI2),n*=t;let r=Math.cos(n),o=Math.sin(n);g.a=r*e-o*a,g.b=r*s-o*i,g.c=o*e+r*a,g.d=o*s+r*i}if(r){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(t.x-g.worldX)*e,g.worldY+=(t.y-g.worldY)*s}if(0!=a){let t=Math.sqrt(g.a*g.a+g.c*g.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*a)/t),g.a*=t,g.c*=t}if(0!=i){let t=Math.sqrt(g.b*g.b+g.d*g.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*i)/t),g.b*=t,g.d*=t}if(n>0){let t=g.b,e=g.d,s=Math.atan2(e,t),a=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(g.c,g.a));a>P.PI?a-=P.PI2:a<-P.PI&&(a+=P.PI2),a=s+(a+f)*n;let i=Math.sqrt(t*t+e*e);g.b=Math.cos(a)*i,g.d=Math.sin(a)*i}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,r=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,g=p.length;u<g;u++){let g=p[u];if(0!=t){let e=g.a,s=g.b,a=g.c,i=g.d,n=Math.atan2(c,l)+m;n>P.PI?n-=P.PI2:n<-P.PI&&(n+=P.PI2),n*=t;let r=Math.cos(n),o=Math.sin(n);g.a=r*e-o*a,g.b=r*s-o*i,g.c=o*e+r*a,g.d=o*s+r*i}if(r){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.worldX+=t.x*e,g.worldY+=t.y*s}if(0!=a){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*a+1;g.a*=t,g.c*=t}if(0!=i){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*i+1;g.b*=t,g.d*=t}if(n>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>P.PI?t-=P.PI2:t<-P.PI&&(t+=P.PI2);let e=g.b,s=g.d;t=Math.atan2(s,e)+(t-P.PI/2+f)*n;let a=Math.sqrt(e*e+s*s);g.b=Math.cos(t)*a,g.d=Math.sin(t)*a}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(r.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(r.ax-d+this.data.offsetX)*e,u+=(r.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=a&&0!=m&&(m=(m+(r.ascaleX-m+this.data.offsetScaleX)*a)/m),0!=i&&0!=f&&(f=(f+(r.ascaleY-f+this.data.offsetScaleY)*i)/f);let p=h.ashearY;0!=n&&(p+=(r.ashearY-p+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,a=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,r=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(r.arotation+this.data.offsetRotation)*t,d=h.ax+(r.ax+this.data.offsetX)*e,u=h.ay+(r.ay+this.data.offsetY)*s,m=h.ascaleX*((r.ascaleX-1+this.data.offsetScaleX)*a+1),f=h.ascaleY*((r.ascaleY-1+this.data.offsetScaleY)*i+1),p=h.ashearY+(r.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,p)}}}class Pe{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Pe.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,a=t.bones[e];if(a.parent){let t=this.bones[a.parent.index];s=new Se(a,this,t),t.children.push(s)}else s=new Se(a,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],a=this.bones[s.boneData.index],i=new Re(s,a);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Te(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Be(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new _e(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Xe(s,this))}this.color=new B(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,a=this.pathConstraints,i=this.physicsConstraints,n=e.length,r=s.length,o=a.length,l=this.physicsConstraints.length,h=n+r+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let a=e[s];if(a.data.order==t){this.sortIkConstraint(a);continue t}}for(let e=0;e<r;e++){let a=s[e];if(a.data.order==t){this.sortTransformConstraint(a);continue t}}for(let e=0;e<o;e++){let s=a[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=i[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&N.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,a=s[0];if(this.sortBone(a),1==s.length)this._updateCache.push(t),this.sortReset(a.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(a.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&N.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,a=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,a),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,a);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,a);let i=e.getAttachment();i instanceof we&&this.sortPathConstraintAttachmentWith(i,a);let n=t.bones,r=n.length;for(let t=0;t<r;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<r;t++)this.sortReset(n[t].children);for(let t=0;t<r;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&N.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let a=t.attachments[e];if(a)for(let t in a)this.sortPathConstraintAttachmentWith(a[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof we))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,a=s.length;e<a;){let a=s[e++];for(a+=e;e<a;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&N.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,a=s.length;e<a;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let a=e.a,i=e.b,n=e.c,r=e.d;s.worldX=a*this.x+i*this.y+e.worldX,s.worldY=n*this.x+r*this.y+e.worldY;const o=(s.rotation+s.shearX)*P.degRad,l=(s.rotation+90+s.shearY)*P.degRad,h=Math.cos(o)*s.scaleX,c=Math.cos(l)*s.scaleY,d=Math.sin(o)*s.scaleX,u=Math.sin(l)*s.scaleY;s.a=(a*h+i*d)*this.scaleX,s.b=(a*c+i*u)*this.scaleX,s.c=(n*h+r*d)*this.scaleY,s.d=(n*c+r*u)*this.scaleY;let m=this._updateCache;for(let e=0,a=m.length;e<a;e++){let a=m[e];a!=s&&a.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;N.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.data.name==t)return a}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.data.name==t)return a}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 s=0,a=e.length;s<a;s++){let a=e[s],i=a.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&a.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let a=0,i=s.length;a<i;a++){let i=s[a];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(a,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new W,e=new W;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),a=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let i=this.drawOrder,n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=i.length;t<e;t++){let e=i[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof ye)h=8,c=N.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Pe.quadTriangles;else if(u instanceof xe){let t=u;h=t.worldVerticesLength,c=N.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof te&&null!=a){a.clipStart(e,u);continue}if(c&&d){null!=a&&a.isClipping()&&(a.clipTriangles(c,d,d.length),c=a.clippedVertices,h=a.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];n=Math.min(n,e),r=Math.min(r,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=a&&a.clipEndWithSlot(e)}null!=a&&a.clipEnd(),t.set(n,r),e.set(o-n,l-r)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let a=0,i=s.length;a<i;a++)s[a].translate(t,e)}physicsRotate(t,e,s){const a=this.physicsConstraints;for(let i=0,n=a.length;i<n;i++)a[i].rotate(t,e,s)}}!function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"}(le||(le={}));class Ve extends Ae{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class De{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,a=e.length;s<a;s++){let a=e[s];if(a.name==t)return a}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,a=e.length;s<a;s++){const a=e[s];if(a.name==t)return a}return null}}class Oe{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class Ne{name;attachments=new Array;bones=Array();constraints=new Array;color=new B(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let a=this.attachments;t>=a.length&&(a.length=t+1),a[t]||(a[t]={}),a[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],a=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){a=!0;break}a||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],a=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){a=!0;break}a||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],a=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){a=!0;break}a||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],a=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){a=!0;break}a||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof xe?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let a in s){let i=s[a];i&&t.push(new Oe(e,a,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let a in s){let i=s[a];i&&e.push(new Oe(t,a,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let a=0;a<t.slots.length;a++){let i=t.slots[a],n=i.getAttachment();if(n&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(n==t[e]){let t=this.getAttachment(s,e);t&&i.setAttachment(t);break}}}s++}}}class Le{index=0;name;boneData;color=new B(1,1,1,1);darkColor=null;attachmentName=null;blendMode=he.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(he||(he={}));class qe extends Ae{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class We{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new De;s.name="";let a=new Ue(t),i=a.readInt32(),n=a.readInt32();s.hash=0==n&&0==i?null:n.toString(16)+i.toString(16),s.version=a.readString(),s.x=a.readFloat(),s.y=a.readFloat(),s.width=a.readFloat(),s.height=a.readFloat(),s.referenceScale=a.readFloat()*e;let r=a.readBoolean();r&&(s.fps=a.readFloat(),s.imagesPath=a.readString(),s.audioPath=a.readString());let o=0;o=a.readInt(!0);for(let t=0;t<o;t++){let t=a.readString();if(!t)throw new Error("String in string table must not be null.");a.strings.push(t)}o=a.readInt(!0);for(let t=0;t<o;t++){let i=a.readString();if(!i)throw new Error("Bone name must not be null.");let n=0==t?null:s.bones[a.readInt(!0)],o=new ve(t,i,n);o.rotation=a.readFloat(),o.x=a.readFloat()*e,o.y=a.readFloat()*e,o.scaleX=a.readFloat(),o.scaleY=a.readFloat(),o.shearX=a.readFloat(),o.shearY=a.readFloat(),o.length=a.readFloat()*e,o.inherit=a.readByte(),o.skinRequired=a.readBoolean(),r&&(B.rgba8888ToColor(o.color,a.readInt32()),o.icon=a.readString()??void 0,o.visible=a.readBoolean()),s.bones.push(o)}o=a.readInt(!0);for(let t=0;t<o;t++){let e=a.readString();if(!e)throw new Error("Slot name must not be null.");let i=s.bones[a.readInt(!0)],n=new Le(t,e,i);B.rgba8888ToColor(n.color,a.readInt32());let o=a.readInt32();-1!=o&&B.rgb888ToColor(n.darkColor=new B,o),n.attachmentName=a.readStringRef(),n.blendMode=a.readInt(!0),r&&(n.visible=a.readBoolean()),s.slots.push(n)}o=a.readInt(!0);for(let t,i=0;i<o;i++){let i=a.readString();if(!i)throw new Error("IK constraint data name must not be null.");let n=new Ee(i);n.order=a.readInt(!0),t=a.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[a.readInt(!0)]);n.target=s.bones[a.readInt(!0)];let r=a.readByte();n.skinRequired=!!(1&r),n.bendDirection=2&r?1:-1,n.compress=!!(4&r),n.stretch=!!(8&r),n.uniform=!!(16&r),32&r&&(n.mix=64&r?a.readFloat():1),128&r&&(n.softness=a.readFloat()*e),s.ikConstraints.push(n)}o=a.readInt(!0);for(let t,i=0;i<o;i++){let i=a.readString();if(!i)throw new Error("Transform constraint data name must not be null.");let n=new qe(i);n.order=a.readInt(!0),t=a.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[a.readInt(!0)]);n.target=s.bones[a.readInt(!0)];let r=a.readByte();n.skinRequired=!!(1&r),n.local=!!(2&r),n.relative=!!(4&r),8&r&&(n.offsetRotation=a.readFloat()),16&r&&(n.offsetX=a.readFloat()*e),32&r&&(n.offsetY=a.readFloat()*e),64&r&&(n.offsetScaleX=a.readFloat()),128&r&&(n.offsetScaleY=a.readFloat()),r=a.readByte(),1&r&&(n.offsetShearY=a.readFloat()),2&r&&(n.mixRotate=a.readFloat()),4&r&&(n.mixX=a.readFloat()),8&r&&(n.mixY=a.readFloat()),16&r&&(n.mixScaleX=a.readFloat()),32&r&&(n.mixScaleY=a.readFloat()),64&r&&(n.mixShearY=a.readFloat()),s.transformConstraints.push(n)}o=a.readInt(!0);for(let t,i=0;i<o;i++){let i=a.readString();if(!i)throw new Error("Path constraint data name must not be null.");let n=new Ye(i);n.order=a.readInt(!0),n.skinRequired=a.readBoolean(),t=a.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[a.readInt(!0)]);n.target=s.slots[a.readInt(!0)];const r=a.readByte();n.positionMode=1&r,n.spacingMode=r>>1&3,n.rotateMode=r>>3&3,128&r&&(n.offsetRotation=a.readFloat()),n.position=a.readFloat(),n.positionMode==ne.Fixed&&(n.position*=e),n.spacing=a.readFloat(),n.spacingMode!=re.Length&&n.spacingMode!=re.Fixed||(n.spacing*=e),n.mixRotate=a.readFloat(),n.mixX=a.readFloat(),n.mixY=a.readFloat(),s.pathConstraints.push(n)}o=a.readInt(!0);for(let t=0;t<o;t++){const t=a.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const i=new Ve(t);i.order=a.readInt(!0),i.bone=s.bones[a.readInt(!0)];let n=a.readByte();i.skinRequired=!!(1&n),2&n&&(i.x=a.readFloat()),4&n&&(i.y=a.readFloat()),8&n&&(i.rotate=a.readFloat()),16&n&&(i.scaleX=a.readFloat()),32&n&&(i.shearX=a.readFloat()),i.limit=(64&n?a.readFloat():5e3)*e,i.step=1/a.readUnsignedByte(),i.inertia=a.readFloat(),i.strength=a.readFloat(),i.damping=a.readFloat(),i.massInverse=128&n?a.readFloat():1,i.wind=a.readFloat(),i.gravity=a.readFloat(),n=a.readByte(),1&n&&(i.inertiaGlobal=!0),2&n&&(i.strengthGlobal=!0),4&n&&(i.dampingGlobal=!0),8&n&&(i.massGlobal=!0),16&n&&(i.windGlobal=!0),32&n&&(i.gravityGlobal=!0),64&n&&(i.mixGlobal=!0),i.mix=128&n?a.readFloat():1,s.physicsConstraints.push(i)}let l=this.readSkin(a,s,!0,r);l&&(s.defaultSkin=l,s.skins.push(l));{let t=s.skins.length;for(N.setArraySize(s.skins,o=t+a.readInt(!0));t<o;t++){let e=this.readSkin(a,s,!1,r);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}o=this.linkedMeshes.length;for(let t=0;t<o;t++){let e=this.linkedMeshes[t];const a=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=a.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,o=a.readInt(!0);for(let t=0;t<o;t++){let t=a.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ce(t);e.intValue=a.readInt(!1),e.floatValue=a.readFloat(),e.stringValue=a.readString(),e.audioPath=a.readString(),e.audioPath&&(e.volume=a.readFloat(),e.balance=a.readFloat()),s.events.push(e)}o=a.readInt(!0);for(let t=0;t<o;t++){let t=a.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(a,t,s))}return s}readSkin(t,e,s,a){let i=null,n=0;if(s){if(n=t.readInt(!0),0==n)return null;i=new Ne("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");i=new Ne(s),a&&B.rgba8888ToColor(i.color,t.readInt32()),i.bones.length=t.readInt(!0);for(let s=0,a=i.bones.length;s<a;s++)i.bones[s]=e.bones[t.readInt(!0)];for(let s=0,a=t.readInt(!0);s<a;s++)i.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,a=t.readInt(!0);s<a;s++)i.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,a=t.readInt(!0);s<a;s++)i.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,a=t.readInt(!0);s<a;s++)i.constraints.push(e.physicsConstraints[t.readInt(!0)]);n=t.readInt(!0)}for(let s=0;s<n;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("Attachment name must not be null");let r=this.readAttachment(t,e,i,s,n,a);r&&i.setAttachment(s,n,r)}}return i}readAttachment(t,e,s,a,i,n){let r=this.scale,o=t.readByte();const l=8&o?t.readStringRef():i;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case ce.Region:{let e=16&o?t.readStringRef():null;const a=32&o?t.readInt32():4294967295,i=64&o?this.readSequence(t):null;let n=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,i);return p?(p.path=e,p.x=h*r,p.y=c*r,p.scaleX=d,p.scaleY=u,p.rotation=n,p.width=m*r,p.height=f*r,B.rgba8888ToColor(p.color,a),p.sequence=i,null==i&&p.updateRegion(),p):null}case ce.BoundingBox:{let e=this.readVertices(t,!!(16&o)),a=n?t.readInt32():0,i=this.attachmentLoader.newBoundingBoxAttachment(s,l);return i?(i.worldVerticesLength=e.length,i.vertices=e.vertices,i.bones=e.bones,n&&B.rgba8888ToColor(i.color,a),i):null}case ce.Mesh:{let e=16&o?t.readStringRef():l;const a=32&o?t.readInt32():4294967295,i=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,p=0;n&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),p=t.readFloat()),e||(e=l);let g=this.attachmentLoader.newMeshAttachment(s,l,e,i);return g?(g.path=e,B.rgba8888ToColor(g.color,a),g.bones=c.bones,g.vertices=c.vertices,g.worldVerticesLength=c.length,g.triangles=u,g.regionUVs=d,null==i&&g.updateRegion(),g.hullLength=h<<1,g.sequence=i,n&&(g.edges=m,g.width=f*r,g.height=p*r),g):null}case ce.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const i=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;n&&(m=t.readFloat(),f=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,B.rgba8888ToColor(p.color,i),p.sequence=h,n&&(p.width=m*r,p.height=f*r),this.linkedMeshes.push(new ze(p,d,a,u,c)),p):null}case ce.Path:{const e=!!(16&o),a=!!(32&o),i=this.readVertices(t,!!(64&o)),h=N.newArray(i.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*r;const c=n?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=a,d.worldVerticesLength=i.length,d.vertices=i.vertices,d.bones=i.bones,d.lengths=h,n&&B.rgba8888ToColor(d.color,c),d):null}case ce.Point:{const e=t.readFloat(),a=t.readFloat(),i=t.readFloat(),o=n?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=a*r,h.y=i*r,h.rotation=e,n&&B.rgba8888ToColor(h.color,o),h):null}case ce.Clipping:{const a=t.readInt(!0),i=this.readVertices(t,!!(16&o));let r=n?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[a],h.worldVerticesLength=i.length,h.vertices=i.vertices,h.bones=i.bones,n&&B.rgba8888ToColor(h.color,r),h):null}}return null}readSequence(t){let e=new j(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,a=t.readInt(!0),i=new $e;if(i.length=a<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let n=new Array,r=new Array;for(let e=0;e<a;e++){let e=t.readInt(!0);r.push(e);for(let a=0;a<e;a++)r.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return i.vertices=N.toFloatArray(n),i.bones=r,i}readFloatArray(t,e,s){let a=new Array(e);if(1==s)for(let s=0;s<e;s++)a[s]=t.readFloat();else for(let i=0;i<e;i++)a[i]=t.readFloat()*s;return a}readShortArray(t,e){let s=new Array(e);for(let a=0;a<e;a++)s[a]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let a=new Array,i=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0),n=i-1;switch(s){case os:{let s=new kt(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());a.push(s);break}case ls:{let s=t.readInt(!0),r=new gt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d),e!=n;e++){let a=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:r.setStepped(e);break;case Fs:He(t,r,s++,e,0,o,a,l,i,1),He(t,r,s++,e,1,o,a,h,n,1),He(t,r,s++,e,2,o,a,c,u,1),He(t,r,s++,e,3,o,a,d,m,1)}o=a,l=i,h=n,c=u,d=m}a.push(r);break}case hs:{let s=t.readInt(!0),r=new xt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c),e!=n;e++){let a=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:r.setStepped(e);break;case Fs:He(t,r,s++,e,0,o,a,l,i,1),He(t,r,s++,e,1,o,a,h,n,1),He(t,r,s++,e,2,o,a,c,d,1)}o=a,l=i,h=n,c=d}a.push(r);break}case cs:{let s=t.readInt(!0),r=new bt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d,u,m,f),e!=n;e++){let a=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:r.setStepped(e);break;case Fs:He(t,r,s++,e,0,o,a,l,i,1),He(t,r,s++,e,1,o,a,h,n,1),He(t,r,s++,e,2,o,a,c,p,1),He(t,r,s++,e,3,o,a,d,g,1),He(t,r,s++,e,4,o,a,u,x,1),He(t,r,s++,e,5,o,a,m,w,1),He(t,r,s++,e,6,o,a,f,b,1)}o=a,l=i,h=n,c=p,d=g,u=x,m=w,f=b}a.push(r);break}case ds:{let s=t.readInt(!0),r=new yt(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;r.setFrame(e,o,l,h,c,d,u,m),e!=n;e++){let a=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:r.setStepped(e);break;case Fs:He(t,r,s++,e,0,o,a,l,i,1),He(t,r,s++,e,1,o,a,h,n,1),He(t,r,s++,e,2,o,a,c,f,1),He(t,r,s++,e,3,o,a,d,p,1),He(t,r,s++,e,4,o,a,u,g,1),He(t,r,s++,e,5,o,a,m,x,1)}o=a,l=i,h=n,c=f,d=p,u=g,m=x}a.push(r);break}case us:{let s=new wt(i,t.readInt(!0),e),r=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,a=0;s.setFrame(e,r,o),e!=n;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:s.setStepped(e);break;case Fs:He(t,s,a++,e,0,r,i,o,n,1)}r=i,o=n}a.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0);if(s==rs){let s=new pt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());a.push(s);continue}let r=t.readInt(!0);switch(s){case Je:a.push(Ge(t,new nt(n,r,e),1));break;case Ke:a.push(je(t,new rt(n,r,e),i));break;case Ze:a.push(Ge(t,new ot(n,r,e),i));break;case Qe:a.push(Ge(t,new lt(n,r,e),i));break;case ts:a.push(je(t,new ht(n,r,e),1));break;case es:a.push(Ge(t,new ct(n,r,e),1));break;case ss:a.push(Ge(t,new dt(n,r,e),1));break;case as:a.push(je(t,new ut(n,r,e),1));break;case is:a.push(Ge(t,new mt(n,r,e),1));break;case ns:a.push(Ge(t,new ft(n,r,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new It(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*i:0;for(let e=0,s=0;r.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const a=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*i:0;64&o?r.setStepped(e):128&o&&(He(t,r,s++,e,0,l,a,h,n,1),He(t,r,s++,e,1,l,a,c,d,i)),l=a,h=n,c=d}a.push(r)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,n=new Mt(s,t.readInt(!0),e),r=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;n.setFrame(e,r,o,l,h,c,d,u),e!=i;e++){let a=t.readFloat(),i=t.readFloat(),m=t.readFloat(),f=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Ms:n.setStepped(e);break;case Fs:He(t,n,s++,e,0,r,a,o,i,1),He(t,n,s++,e,1,r,a,l,m,1),He(t,n,s++,e,2,r,a,h,f,1),He(t,n,s++,e,3,r,a,c,p,1),He(t,n,s++,e,4,r,a,d,g,1),He(t,n,s++,e,5,r,a,u,x,1)}r=a,o=i,l=m,h=f,c=p,d=g,u=x}a.push(n)}for(let e=0,n=t.readInt(!0);e<n;e++){let e=t.readInt(!0),n=s.pathConstraints[e];for(let s=0,r=t.readInt(!0);s<r;s++){const s=t.readByte(),r=t.readInt(!0),o=t.readInt(!0);switch(s){case ps:a.push(Ge(t,new Ft(r,o,e),n.positionMode==ne.Fixed?i:1));break;case gs:a.push(Ge(t,new Ct(r,o,e),n.spacingMode==re.Length||n.spacingMode==re.Fixed?i:1));break;case xs:let s=new Tt(r,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,a=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),n=t.readFloat(),r=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Ms:s.setStepped(e);break;case Fs:He(t,s,a++,e,0,l,i,h,n,1),He(t,s,a++,e,1,l,i,c,r,1),He(t,s,a++,e,2,l,i,d,o,1)}l=i,h=n,c=r,d=o}a.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0);if(s==Is){const s=new Dt(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());a.push(s);continue}const n=t.readInt(!0);switch(s){case ws:a.push(Ge(t,new Yt(i,n,e),1));break;case bs:a.push(Ge(t,new _t(i,n,e),1));break;case ys:a.push(Ge(t,new Xt(i,n,e),1));break;case ks:a.push(Ge(t,new Rt(i,n,e),1));break;case vs:a.push(Ge(t,new Bt(i,n,e),1));break;case Ss:a.push(Ge(t,new Pt(i,n,e),1));break;case As:a.push(Ge(t,new Vt(i,n,e),1))}}}for(let e=0,n=t.readInt(!0);e<n;e++){let e=s.skins[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readInt(!0);for(let n=0,r=t.readInt(!0);n<r;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let r=e.getAttachment(s,n),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case ms:{let e=r,n=e.bones,o=e.vertices,c=n?o.length/3*2:o.length,d=t.readInt(!0),u=new vt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let a,r=t.readInt(!0);if(0==r)a=n?N.newFloatArray(c):o;else{a=N.newFloatArray(c);let e=t.readInt(!0);if(r+=e,1==i)for(let s=e;s<r;s++)a[s]=t.readFloat();else for(let s=e;s<r;s++)a[s]=t.readFloat()*i;if(!n)for(let t=0,e=a.length;t<e;t++)a[t]+=o[t]}if(u.setFrame(e,m,a),e==h)break;let l=t.readFloat();switch(t.readByte()){case Ms:u.setStepped(e);break;case Fs:He(t,u,s++,e,0,m,l,0,1,1)}m=l}a.push(u);break}case fs:{let e=new Ot(l,s,r);for(let s=0;s<l;s++){let a=t.readFloat(),i=t.readInt32();e.setFrame(s,a,J[15&i],i>>4,t.readFloat())}a.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new At(n),i=s.slots.length;for(let s=0;s<n;s++){let a=t.readFloat(),n=t.readInt(!0),r=N.newArray(i,0);for(let t=i-1;t>=0;t--)r[t]=-1;let o=N.newArray(i-n,0),l=0,h=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;r[l+t.readInt(!0)]=l++}for(;l<i;)o[h++]=l++;for(let t=i-1;t>=0;t--)-1==r[t]&&(r[t]=o[--h]);e.setFrame(s,a,r)}a.push(e)}let r=t.readInt(!0);if(r>0){let e=new St(r);for(let a=0;a<r;a++){let i=t.readFloat(),n=s.events[t.readInt(!0)],r=new Fe(i,n);r.intValue=t.readInt(!1),r.floatValue=t.readFloat(),r.stringValue=t.readString(),null==r.stringValue&&(r.stringValue=n.stringValue),r.data.audioPath&&(r.volume=t.readFloat(),r.balance=t.readFloat()),e.setFrame(a,r)}a.push(e)}let o=0;for(let t=0,e=a.length;t<e;t++)o=Math.max(o,a[t].getDuration());return new K(e,a,o)}}class Ue{strings;index;buffer;constructor(t,e=new Array,s=0,a=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=a}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class ze{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,a,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=a,this.inheritTimeline=i}}class $e{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function Ge(t,e,s){let a=t.readFloat(),i=t.readFloat()*s;for(let n=0,r=0,o=e.getFrameCount()-1;e.setFrame(n,a,i),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Ms:e.setStepped(n);break;case Fs:He(t,e,r++,n,0,a,o,i,l,s)}a=o,i=l}return e}function je(t,e,s){let a=t.readFloat(),i=t.readFloat()*s,n=t.readFloat()*s;for(let r=0,o=0,l=e.getFrameCount()-1;e.setFrame(r,a,i,n),r!=l;r++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Ms:e.setStepped(r);break;case Fs:He(t,e,o++,r,0,a,l,i,h,s),He(t,e,o++,r,1,a,l,n,c,s)}a=l,i=h,n=c}return e}function He(t,e,s,a,i,n,r,o,l,h){e.setBezier(s,a,i,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,r,l)}!function(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"}(ce||(ce={}));const Je=0,Ke=1,Ze=2,Qe=3,ts=4,es=5,ss=6,as=7,is=8,ns=9,rs=10,os=0,ls=1,hs=2,cs=3,ds=4,us=5,ms=0,fs=1,ps=0,gs=1,xs=2,ws=0,bs=1,ys=2,ks=4,vs=5,Ss=6,As=7,Is=8,Ms=1,Fs=2;class Cs{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new q((()=>N.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,a=this.polygons,i=this.polygonPool,n=t.slots,r=n.length;s.length=0,i.freeAll(a),a.length=0;for(let t=0;t<r;t++){let e=n[t];if(!e.bone.active)continue;let r=e.getAttachment();if(r instanceof Qt){let t=r;s.push(t);let n=i.obtain();n.length!=t.worldVerticesLength&&(n=N.newFloatArray(t.worldVerticesLength)),a.push(n),t.computeWorldVertices(e,0,t.worldVerticesLength,n,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=this.polygons;for(let n=0,r=i.length;n<r;n++){let r=i[n],o=r;for(let i=0,n=r.length;i<n;i+=2){let n=o[i],r=o[i+1];t=Math.min(t,n),e=Math.min(e,r),s=Math.max(s,n),a=Math.max(a,r)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=a}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,a){let i=this.minX,n=this.minY,r=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=n&&a<=n||t>=r&&s>=r||e>=o&&a>=o)return!1;let l=(a-e)/(s-t),h=l*(i-t)+e;if(h>n&&h<o)return!0;if(h=l*(r-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>i&&c<r||(c=(o-e)/l+t,c>i&&c<r)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let a=0,i=s.length;a<i;a++)if(this.containsPointPolygon(s[a],t,e))return this.boundingBoxes[a];return null}containsPointPolygon(t,e,s){let a=t,i=t.length,n=i-2,r=!1;for(let t=0;t<i;t+=2){let i=a[t+1],o=a[n+1];if(i<s&&o>=s||o<s&&i>=s){let l=a[t];l+(s-i)/(o-i)*(a[n]-l)<e&&(r=!r)}n=t}return r}intersectsSegment(t,e,s,a){let i=this.polygons;for(let n=0,r=i.length;n<r;n++)if(this.intersectsSegmentPolygon(i[n],t,e,s,a))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,a,i){let n=t,r=t.length,o=e-a,l=s-i,h=e*i-s*a,c=n[r-2],d=n[r-1];for(let t=0;t<r;t+=2){let r=n[t],u=n[t+1],m=c*u-d*r,f=c-r,p=d-u,g=o*p-l*f,x=(h*f-o*m)/g;if((x>=c&&x<=r||x>=r&&x<=c)&&(x>=e&&x<=a||x>=a&&x<=e)){let t=(h*p-l*m)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=i||t>=i&&t<=s))return!0}c=r,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class Ts{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new q((()=>new Array));polygonIndicesPool=new q((()=>new Array));triangulate(t){let e=t,s=t.length>>1,a=this.indicesArray;a.length=0;for(let t=0;t<s;t++)a[t]=t;let i=this.isConcaveArray;i.length=0;for(let t=0,n=s;t<n;++t)i[t]=Ts.isConcave(t,s,e,a);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,r=0,o=1;for(;;){t:if(!i[r]){let n=a[t]<<1,l=a[r]<<1,h=a[o]<<1,c=e[n],d=e[n+1],u=e[l],m=e[l+1],f=e[h],p=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!i[n])continue;let t=a[n]<<1,s=e[t],r=e[t+1];if(Ts.positiveArea(f,p,c,d,s,r)&&Ts.positiveArea(c,d,u,m,s,r)&&Ts.positiveArea(u,m,f,p,s,r))break t}break}if(0==o){do{if(!i[r])break;r--}while(r>0);break}t=r,r=o,o=(o+1)%s}n.push(a[(s+r-1)%s]),n.push(a[r]),n.push(a[(r+1)%s]),a.splice(r,1),i.splice(r,1),s--;let l=(s+r-1)%s,h=r==s?0:r;i[l]=Ts.isConcave(l,s,e,a),i[h]=Ts.isConcave(h,s,e,a)}return 3==s&&(n.push(a[2]),n.push(a[0]),n.push(a[1])),n}decompose(t,e){let s=t,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let r=this.polygonPool.obtain();r.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],p=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=r.length-4,e=Ts.winding(r[t],r[t+1],r[t+2],r[t+3],g,x),s=Ts.winding(g,x,r[0],r[1],r[2],r[3]);e==l&&s==l&&(r.push(g),r.push(x),n.push(d),w=!0)}w||(r.length>0?(a.push(r),i.push(n)):(this.polygonPool.free(r),this.polygonIndicesPool.free(n)),r=this.polygonPool.obtain(),r.length=0,r.push(u),r.push(m),r.push(f),r.push(p),r.push(g),r.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Ts.winding(u,m,f,p,g,x),o=h)}r.length>0&&(a.push(r),i.push(n));for(let t=0,e=a.length;t<e;t++){if(n=i[t],0==n.length)continue;let s=n[0],o=n[n.length-1];r=a[t];let l=r.length-4,h=r[l],c=r[l+1],d=r[l+2],u=r[l+3],m=r[0],f=r[1],p=r[2],g=r[3],x=Ts.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=i[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],k=a[l],v=k[k.length-2],S=k[k.length-1];if(w!=s||b!=o)continue;let A=Ts.winding(h,c,d,u,v,S),I=Ts.winding(v,S,m,f,p,g);A==x&&I==x&&(k.length=0,e.length=0,r.push(v),r.push(S),n.push(y),h=d,c=u,d=v,u=S,l=0)}}for(let t=a.length-1;t>=0;t--)r=a[t],0==r.length&&(a.splice(t,1),this.polygonPool.free(r),n=i[t],i.splice(t,1),this.polygonIndicesPool.free(n));return a}static isConcave(t,e,s,a){let i=a[(e+t-1)%e]<<1,n=a[t]<<1,r=a[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[n],s[n+1],s[r],s[r+1])}static positiveArea(t,e,s,a,i,n){return t*(n-a)+s*(e-n)+i*(a-e)>=0}static winding(t,e,s,a,i,n){let r=s-t,o=a-e;return i*o-n*r+r*e-t*o>=0?1:-1}}class Es{triangulator=new Ts;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,a=N.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,a,0,2);let i=this.clippingPolygon;Es.makeClockwise(i);let n=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let t=0,e=n.length;t<e;t++){let e=n[t];Es.makeClockwise(e),e.push(e[0]),e.push(e[1])}return n.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 null!=this.clipAttachment}clipTriangles(t,e,s,a,i,n,r,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=a,c=i,d=n,u=r,m=o):(l=e,h=s,c=a,d=i,u=n,m=r),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let a=this.clipOutput,i=this.clippedVertices,n=this.clippedTriangles,r=this.clippingPolygons,o=r.length,l=0;i.length=0,n.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=i.length;if(!this.clip(c,d,u,m,f,p,r[t],a)){let t=N.setArraySize(i,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=p,e=n.length;let s=N.setArraySize(n,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=a.length;if(0==t)continue;let s=t>>1,r=this.clipOutput,o=N.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=r[s],a=r[s+1];o[e]=t,o[e+1]=a}e=n.length;let h=N.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,a,i,n,r){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=r?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,p=t[s],g=t[s+1],x=a[s],w=a[s+1];s=e[f+1]<<1;let b=t[s],y=t[s+1],k=a[s],v=a[s+1];s=e[f+2]<<1;let S=t[s],A=t[s+1],I=a[s],M=a[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,g,b,y,S,A,c[t],o)){let t=N.setArraySize(l,e+3*u);t[e]=p,t[e+1]=g,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,r?(t[e+6]=x,t[e+7]=w,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=b,t[e+13]=y,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=k,t[e+19]=v,t[e+20]=n.r,t[e+21]=n.g,t[e+22]=n.b,t[e+23]=n.a,t[e+24]=S,t[e+25]=A,t[e+26]=i.r,t[e+27]=i.g,t[e+28]=i.b,t[e+29]=i.a,t[e+30]=I,t[e+31]=M,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=x,t[e+7]=w,t[e+8]=b,t[e+9]=y,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=k,t[e+15]=v,t[e+16]=S,t[e+17]=A,t[e+18]=i.r,t[e+19]=i.g,t[e+20]=i.b,t[e+21]=i.a,t[e+22]=I,t[e+23]=M),e=h.length;let s=N.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-A,a=S-b,c=p-S,d=A-g,f=1/(s*c+a*(g-A)),F=t>>1,C=this.clipOutput,T=N.setArraySize(l,e+F*u);for(let o=0;o<t;o+=2,e+=u){let t=C[o],l=C[o+1];T[e]=t,T[e+1]=l,T[e+2]=i.r,T[e+3]=i.g,T[e+4]=i.b,T[e+5]=i.a;let h=t-S,u=l-A,m=(s*h+a*u)*f,p=(d*h+c*u)*f,g=1-m-p;T[e+6]=x*m+k*p+I*g,T[e+7]=w*m+v*p+M*g,r&&(T[e+8]=n.r,T[e+9]=n.g,T[e+10]=n.b,T[e+11]=n.a)}e=h.length;let E=N.setArraySize(h,e+3*(F-2));F--;for(let t=1;t<F;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=F+1}}}}clipTrianglesUnpacked(t,e,s,a){let i=this.clipOutput,n=this.clippedVertices,r=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;n.length=0,r.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=a[s],p=a[s+1];s=e[d+1]<<1;let g=t[s],x=t[s+1],w=a[s],b=a[s+1];s=e[d+2]<<1;let y=t[s],k=t[s+1],v=a[s],S=a[s+1];for(let t=0;t<h;t++){let e=n.length;if(!this.clip(u,m,g,x,y,k,l[t],i)){let t=N.setArraySize(n,e+6);t[e]=u,t[e+1]=m,t[e+2]=g,t[e+3]=x,t[e+4]=y,t[e+5]=k;let s=N.setArraySize(r,e+6);s[e]=f,s[e+1]=p,s[e+2]=w,s[e+3]=b,s[e+4]=v,s[e+5]=S,e=o.length;let a=N.setArraySize(o,e+3);a[e]=c,a[e+1]=c+1,a[e+2]=c+2,c+=3;break}{let t=i.length;if(0==t)continue;let s=x-k,a=y-g,l=u-y,h=k-m,d=1/(s*l+a*(m-k)),A=t>>1,I=this.clipOutput,M=N.setArraySize(n,e+2*A),F=N.setArraySize(r,e+2*A);for(let i=0;i<t;i+=2,e+=2){let t=I[i],n=I[i+1];M[e]=t,M[e+1]=n;let r=t-y,o=n-k,c=(s*r+a*o)*d,u=(h*r+l*o)*d,m=1-c-u;F[e]=f*c+w*u+v*m,F[e+1]=p*c+b*u+S*m}e=o.length;let C=N.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)C[e]=c,C[e+1]=c+t,C[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,a,i,n,r,o){let l,h=o,c=!1;r.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(a),l.push(i),l.push(n),l.push(t),l.push(e),o.length=0;let d=r.length-4,u=r;for(let t=0;;t+=2){let e=u[t],s=u[t+1],a=e-u[t+2],i=s-u[t+3],n=o.length,r=l;for(let t=0,n=l.length-2;t<n;){let n=r[t],l=r[t+1];t+=2;let h=r[t],d=r[t+1],u=i*(e-h)>a*(s-d),m=i*(e-n)-a*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=m/(t*i-e*a);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s)}else if(u){let t=h-n,e=d-l,s=m/(t*i-e*a);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(n==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,a=e[s-2]*e[1]-e[0]*e[s-1],i=0,n=0,r=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],n=e[t+1],r=e[t+2],o=e[t+3],a+=i*o-r*n;if(!(a<0))for(let t=0,a=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],n=a-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=i}}}class Ys{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new De,a="string"==typeof t?JSON.parse(t):t,i=a.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=Ps(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),a.bones)for(let t=0;t<a.bones.length;t++){let i=a.bones[t],n=null,r=Ps(i,"parent",null);r&&(n=s.findBone(r));let o=new ve(s.bones.length,i.name,n);o.length=Ps(i,"length",0)*e,o.x=Ps(i,"x",0)*e,o.y=Ps(i,"y",0)*e,o.rotation=Ps(i,"rotation",0),o.scaleX=Ps(i,"scaleX",1),o.scaleY=Ps(i,"scaleY",1),o.shearX=Ps(i,"shearX",0),o.shearY=Ps(i,"shearY",0),o.inherit=N.enumValue(ie,Ps(i,"inherit","Normal")),o.skinRequired=Ps(i,"skin",!1);let l=Ps(i,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(a.slots)for(let t=0;t<a.slots.length;t++){let e=a.slots[t],i=e.name,n=s.findBone(e.bone);if(!n)throw new Error(`Couldn't find bone ${e.bone} for slot ${i}`);let r=new Le(s.slots.length,i,n),o=Ps(e,"color",null);o&&r.color.setFromString(o);let l=Ps(e,"dark",null);l&&(r.darkColor=B.fromString(l)),r.attachmentName=Ps(e,"attachment",null),r.blendMode=N.enumValue(he,Ps(e,"blend","normal")),r.visible=Ps(e,"visible",!0),s.slots.push(r)}if(a.ik)for(let t=0;t<a.ik.length;t++){let i=a.ik[t],n=new Ee(i.name);n.order=Ps(i,"order",0),n.skinRequired=Ps(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=s.findBone(i.bones[t]);if(!e)throw new Error(`Couldn't find bone ${i.bones[t]} for IK constraint ${i.name}.`);n.bones.push(e)}let r=s.findBone(i.target);if(!r)throw new Error(`Couldn't find target bone ${i.target} for IK constraint ${i.name}.`);n.target=r,n.mix=Ps(i,"mix",1),n.softness=Ps(i,"softness",0)*e,n.bendDirection=Ps(i,"bendPositive",!0)?1:-1,n.compress=Ps(i,"compress",!1),n.stretch=Ps(i,"stretch",!1),n.uniform=Ps(i,"uniform",!1),s.ikConstraints.push(n)}if(a.transform)for(let t=0;t<a.transform.length;t++){let i=a.transform[t],n=new qe(i.name);n.order=Ps(i,"order",0),n.skinRequired=Ps(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],a=s.findBone(e);if(!a)throw new Error(`Couldn't find bone ${e} for transform constraint ${i.name}.`);n.bones.push(a)}let r=i.target,o=s.findBone(r);if(!o)throw new Error(`Couldn't find target bone ${r} for transform constraint ${i.name}.`);n.target=o,n.local=Ps(i,"local",!1),n.relative=Ps(i,"relative",!1),n.offsetRotation=Ps(i,"rotation",0),n.offsetX=Ps(i,"x",0)*e,n.offsetY=Ps(i,"y",0)*e,n.offsetScaleX=Ps(i,"scaleX",0),n.offsetScaleY=Ps(i,"scaleY",0),n.offsetShearY=Ps(i,"shearY",0),n.mixRotate=Ps(i,"mixRotate",1),n.mixX=Ps(i,"mixX",1),n.mixY=Ps(i,"mixY",n.mixX),n.mixScaleX=Ps(i,"mixScaleX",1),n.mixScaleY=Ps(i,"mixScaleY",n.mixScaleX),n.mixShearY=Ps(i,"mixShearY",1),s.transformConstraints.push(n)}if(a.path)for(let t=0;t<a.path.length;t++){let i=a.path[t],n=new Ye(i.name);n.order=Ps(i,"order",0),n.skinRequired=Ps(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],a=s.findBone(e);if(!a)throw new Error(`Couldn't find bone ${e} for path constraint ${i.name}.`);n.bones.push(a)}let r=i.target,o=s.findSlot(r);if(!o)throw new Error(`Couldn't find target slot ${r} for path constraint ${i.name}.`);n.target=o,n.positionMode=N.enumValue(ne,Ps(i,"positionMode","Percent")),n.spacingMode=N.enumValue(re,Ps(i,"spacingMode","Length")),n.rotateMode=N.enumValue(oe,Ps(i,"rotateMode","Tangent")),n.offsetRotation=Ps(i,"rotation",0),n.position=Ps(i,"position",0),n.positionMode==ne.Fixed&&(n.position*=e),n.spacing=Ps(i,"spacing",0),n.spacingMode!=re.Length&&n.spacingMode!=re.Fixed||(n.spacing*=e),n.mixRotate=Ps(i,"mixRotate",1),n.mixX=Ps(i,"mixX",1),n.mixY=Ps(i,"mixY",n.mixX),s.pathConstraints.push(n)}if(a.physics)for(let t=0;t<a.physics.length;t++){const i=a.physics[t],n=new Ve(i.name);n.order=Ps(i,"order",0),n.skinRequired=Ps(i,"skin",!1);const r=i.bone,o=s.findBone(r);if(null==o)throw new Error("Physics bone not found: "+r);n.bone=o,n.x=Ps(i,"x",0),n.y=Ps(i,"y",0),n.rotate=Ps(i,"rotate",0),n.scaleX=Ps(i,"scaleX",0),n.shearX=Ps(i,"shearX",0),n.limit=Ps(i,"limit",5e3)*e,n.step=1/Ps(i,"fps",60),n.inertia=Ps(i,"inertia",1),n.strength=Ps(i,"strength",100),n.damping=Ps(i,"damping",1),n.massInverse=1/Ps(i,"mass",1),n.wind=Ps(i,"wind",0),n.gravity=Ps(i,"gravity",0),n.mix=Ps(i,"mix",1),n.inertiaGlobal=Ps(i,"inertiaGlobal",!1),n.strengthGlobal=Ps(i,"strengthGlobal",!1),n.dampingGlobal=Ps(i,"dampingGlobal",!1),n.massGlobal=Ps(i,"massGlobal",!1),n.windGlobal=Ps(i,"windGlobal",!1),n.gravityGlobal=Ps(i,"gravityGlobal",!1),n.mixGlobal=Ps(i,"mixGlobal",!1),s.physicsConstraints.push(n)}if(a.skins)for(let t=0;t<a.skins.length;t++){let e=a.skins[t],i=new Ne(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let a=e.bones[t],n=s.findBone(a);if(!n)throw new Error(`Couldn't find bone ${a} for skin ${e.name}.`);i.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let a=e.ik[t],n=s.findIkConstraint(a);if(!n)throw new Error(`Couldn't find IK constraint ${a} for skin ${e.name}.`);i.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let a=e.transform[t],n=s.findTransformConstraint(a);if(!n)throw new Error(`Couldn't find transform constraint ${a} for skin ${e.name}.`);i.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let a=e.path[t],n=s.findPathConstraint(a);if(!n)throw new Error(`Couldn't find path constraint ${a} for skin ${e.name}.`);i.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let a=e.physics[t],n=s.findPhysicsConstraint(a);if(!n)throw new Error(`Couldn't find physics constraint ${a} for skin ${e.name}.`);i.constraints.push(n)}for(let t in e.attachments){let a=s.findSlot(t);if(!a)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let n=e.attachments[t];for(let t in n){let e=this.readAttachment(n[t],i,a.index,t,s);e&&i.setAttachment(a.index,t,e)}}s.skins.push(i),"default"==i.name&&(s.defaultSkin=i)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],a=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${e.skin}`);let i=a.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,a.events)for(let t in a.events){let e=a.events[t],i=new Ce(t);i.intValue=Ps(e,"int",0),i.floatValue=Ps(e,"float",0),i.stringValue=Ps(e,"string",""),i.audioPath=Ps(e,"audio",null),i.audioPath&&(i.volume=Ps(e,"volume",1),i.balance=Ps(e,"balance",0)),s.events.push(i)}if(a.animations)for(let t in a.animations){let e=a.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,a,i){let n=this.scale;switch(a=Ps(t,"name",a),Ps(t,"type","region")){case"region":{let s=Ps(t,"path",a),i=this.readSequence(Ps(t,"sequence",null)),r=this.attachmentLoader.newRegionAttachment(e,a,s,i);if(!r)return null;r.path=s,r.x=Ps(t,"x",0)*n,r.y=Ps(t,"y",0)*n,r.scaleX=Ps(t,"scaleX",1),r.scaleY=Ps(t,"scaleY",1),r.rotation=Ps(t,"rotation",0),r.width=t.width*n,r.height=t.height*n,r.sequence=i;let o=Ps(t,"color",null);return o&&r.color.setFromString(o),null!=r.region&&r.updateRegion(),r}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,a);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Ps(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Ps(t,"path",a),r=this.readSequence(Ps(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,a,i,r);if(!o)return null;o.path=i;let l=Ps(t,"color",null);l&&o.color.setFromString(l),o.width=Ps(t,"width",0)*n,o.height=Ps(t,"height",0)*n,o.sequence=r;let h=Ps(t,"parent",null);if(h)return this.linkedMeshes.push(new _s(o,Ps(t,"skin",null),s,h,Ps(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Ps(t,"edges",null),o.hullLength=2*Ps(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,a);if(!s)return null;s.closed=Ps(t,"closed",!1),s.constantSpeed=Ps(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let r=N.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)r[e]=t.lengths[e]*n;s.lengths=r;let o=Ps(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,a);if(!s)return null;s.x=Ps(t,"x",0)*n,s.y=Ps(t,"y",0)*n,s.rotation=Ps(t,"rotation",0);let i=Ps(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,a);if(!s)return null;let n=Ps(t,"end",null);n&&(s.endSlot=i.findSlot(n));let r=t.vertexCount;this.readVertices(t,s,r<<1);let o=Ps(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new j(Ps(t,"count",0));return e.start=Ps(t,"start",1),e.digits=Ps(t,"digits",0),e.setupIndex=Ps(t,"setup",0),e}readVertices(t,e,s){let a=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=N.toFloatArray(i);if(1!=a)for(let e=0,s=i.length;e<s;e++)t[e]*=a;return void(e.vertices=t)}let n=new Array,r=new Array;for(let t=0,e=i.length;t<e;){let e=i[t++];r.push(e);for(let s=t+4*e;t<s;t+=4)r.push(i[t]),n.push(i[t+1]*a),n.push(i[t+2]*a),n.push(i[t+3])}e.bones=r,e.vertices=N.toFloatArray(n)}readAnimation(t,e,s){let a=this.scale,i=new Array;if(t.slots)for(let e in t.slots){let a=t.slots[e],n=s.findSlot(e);if(!n)throw new Error("Slot not found: "+e);let r=n.index;for(let t in a){let e=a[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new kt(s,r);for(let a=0;a<s;a++){let s=e[a];t.setFrame(a,Ps(s,"time",0),Ps(s,"name",null))}i.push(t)}else if("rgba"==t){let t=new gt(s,s<<2,r),a=e[0],n=Ps(a,"time",0),o=B.fromString(a.color);for(let s=0,i=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,o.a);let r=e[s+1];if(!r){t.shrink(i);break}let l=Ps(r,"time",0),h=B.fromString(r.color),c=a.curve;c&&(i=Bs(c,t,i,s,0,n,l,o.r,h.r,1),i=Bs(c,t,i,s,1,n,l,o.g,h.g,1),i=Bs(c,t,i,s,2,n,l,o.b,h.b,1),i=Bs(c,t,i,s,3,n,l,o.a,h.a,1)),n=l,o=h,a=r}i.push(t)}else if("rgb"==t){let t=new xt(s,3*s,r),a=e[0],n=Ps(a,"time",0),o=B.fromString(a.color);for(let s=0,i=0;;s++){t.setFrame(s,n,o.r,o.g,o.b);let r=e[s+1];if(!r){t.shrink(i);break}let l=Ps(r,"time",0),h=B.fromString(r.color),c=a.curve;c&&(i=Bs(c,t,i,s,0,n,l,o.r,h.r,1),i=Bs(c,t,i,s,1,n,l,o.g,h.g,1),i=Bs(c,t,i,s,2,n,l,o.b,h.b,1)),n=l,o=h,a=r}i.push(t)}else if("alpha"==t)i.push(Xs(e,new wt(s,s,r),0,1));else if("rgba2"==t){let t=new bt(s,7*s,r),a=e[0],n=Ps(a,"time",0),o=B.fromString(a.light),l=B.fromString(a.dark);for(let s=0,i=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let r=e[s+1];if(!r){t.shrink(i);break}let h=Ps(r,"time",0),c=B.fromString(r.light),d=B.fromString(r.dark),u=a.curve;u&&(i=Bs(u,t,i,s,0,n,h,o.r,c.r,1),i=Bs(u,t,i,s,1,n,h,o.g,c.g,1),i=Bs(u,t,i,s,2,n,h,o.b,c.b,1),i=Bs(u,t,i,s,3,n,h,o.a,c.a,1),i=Bs(u,t,i,s,4,n,h,l.r,d.r,1),i=Bs(u,t,i,s,5,n,h,l.g,d.g,1),i=Bs(u,t,i,s,6,n,h,l.b,d.b,1)),n=h,o=c,l=d,a=r}i.push(t)}else if("rgb2"==t){let t=new yt(s,6*s,r),a=e[0],n=Ps(a,"time",0),o=B.fromString(a.light),l=B.fromString(a.dark);for(let s=0,i=0;;s++){t.setFrame(s,n,o.r,o.g,o.b,l.r,l.g,l.b);let r=e[s+1];if(!r){t.shrink(i);break}let h=Ps(r,"time",0),c=B.fromString(r.light),d=B.fromString(r.dark),u=a.curve;u&&(i=Bs(u,t,i,s,0,n,h,o.r,c.r,1),i=Bs(u,t,i,s,1,n,h,o.g,c.g,1),i=Bs(u,t,i,s,2,n,h,o.b,c.b,1),i=Bs(u,t,i,s,3,n,h,l.r,d.r,1),i=Bs(u,t,i,s,4,n,h,l.g,d.g,1),i=Bs(u,t,i,s,5,n,h,l.b,d.b,1)),n=h,o=c,l=d,a=r}i.push(t)}}}if(t.bones)for(let e in t.bones){let n=t.bones[e],r=s.findBone(e);if(!r)throw new Error("Bone not found: "+e);let o=r.index;for(let t in n){let e=n[t],s=e.length;if(0!=s)if("rotate"===t)i.push(Xs(e,new nt(s,s,o),0,1));else if("translate"===t){let t=new rt(s,s<<1,o);i.push(Rs(e,t,"x","y",0,a))}else if("translatex"===t){let t=new ot(s,s,o);i.push(Xs(e,t,0,a))}else if("translatey"===t){let t=new lt(s,s,o);i.push(Xs(e,t,0,a))}else if("scale"===t){let t=new ht(s,s<<1,o);i.push(Rs(e,t,"x","y",1,1))}else if("scalex"===t){let t=new ct(s,s,o);i.push(Xs(e,t,1,1))}else if("scaley"===t){let t=new dt(s,s,o);i.push(Xs(e,t,1,1))}else if("shear"===t){let t=new ut(s,s<<1,o);i.push(Rs(e,t,"x","y",0,1))}else if("shearx"===t){let t=new mt(s,s,o);i.push(Xs(e,t,0,1))}else if("sheary"===t){let t=new ft(s,s,o);i.push(Xs(e,t,0,1))}else if("inherit"===t){let t=new pt(s,r.index);for(let s=0;s<e.length;s++){let a=e[s];t.setFrame(s,Ps(a,"time",0),N.enumValue(ie,Ps(a,"inherit","Normal")))}i.push(t)}}}if(t.ik)for(let e in t.ik){let n=t.ik[e],r=n[0];if(!r)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new It(n.length,n.length<<1,l),c=Ps(r,"time",0),d=Ps(r,"mix",1),u=Ps(r,"softness",0)*a;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Ps(r,"bendPositive",!0)?1:-1,Ps(r,"compress",!1),Ps(r,"stretch",!1));let s=n[t+1];if(!s){h.shrink(e);break}let i=Ps(s,"time",0),o=Ps(s,"mix",1),l=Ps(s,"softness",0)*a,m=r.curve;m&&(e=Bs(m,h,e,t,0,c,i,d,o,1),e=Bs(m,h,e,t,1,c,i,u,l,a)),c=i,d=o,u=l,r=s}i.push(h)}if(t.transform)for(let e in t.transform){let a=t.transform[e],n=a[0];if(!n)continue;let r=s.findTransformConstraint(e);if(!r)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(r),l=new Mt(a.length,6*a.length,o),h=Ps(n,"time",0),c=Ps(n,"mixRotate",1),d=Ps(n,"mixX",1),u=Ps(n,"mixY",d),m=Ps(n,"mixScaleX",1),f=Ps(n,"mixScaleY",m),p=Ps(n,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,p);let s=a[t+1];if(!s){l.shrink(e);break}let i=Ps(s,"time",0),r=Ps(s,"mixRotate",1),o=Ps(s,"mixX",1),g=Ps(s,"mixY",o),x=Ps(s,"mixScaleX",1),w=Ps(s,"mixScaleY",x),b=Ps(s,"mixShearY",1),y=n.curve;y&&(e=Bs(y,l,e,t,0,h,i,c,r,1),e=Bs(y,l,e,t,1,h,i,d,o,1),e=Bs(y,l,e,t,2,h,i,u,g,1),e=Bs(y,l,e,t,3,h,i,m,x,1),e=Bs(y,l,e,t,4,h,i,f,w,1),e=Bs(y,l,e,t,5,h,i,p,b,1)),h=i,c=r,d=o,u=g,m=x,f=w,m=x,n=s}i.push(l)}if(t.path)for(let e in t.path){let n=t.path[e],r=s.findPathConstraint(e);if(!r)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(r);for(let t in n){let e=n[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new Ft(l,l,o);i.push(Xs(e,t,0,r.positionMode==ne.Fixed?a:1))}else if("spacing"===t){let t=new Ct(l,l,o);i.push(Xs(e,t,0,r.spacingMode==re.Length||r.spacingMode==re.Fixed?a:1))}else if("mix"===t){let t=new Tt(l,3*l,o),a=Ps(s,"time",0),n=Ps(s,"mixRotate",1),r=Ps(s,"mixX",1),h=Ps(s,"mixY",r);for(let i=0,o=0;;i++){t.setFrame(i,a,n,r,h);let l=e[i+1];if(!l){t.shrink(o);break}let c=Ps(l,"time",0),d=Ps(l,"mixRotate",1),u=Ps(l,"mixX",1),m=Ps(l,"mixY",u),f=s.curve;f&&(o=Bs(f,t,o,i,0,a,c,n,d,1),o=Bs(f,t,o,i,1,a,c,r,u,1),o=Bs(f,t,o,i,2,a,c,h,m,1)),a=c,n=d,r=u,h=m,s=l}i.push(t)}}}if(t.physics)for(let e in t.physics){let a=t.physics[e],n=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);n=s.physicsConstraints.indexOf(t)}for(let t in a){let e=a[t],s=e[0];if(!s)continue;let r,o=e.length;if("reset"!=t){if("inertia"==t)r=new Yt(o,o,n);else if("strength"==t)r=new _t(o,o,n);else if("damping"==t)r=new Xt(o,o,n);else if("mass"==t)r=new Rt(o,o,n);else if("wind"==t)r=new Bt(o,o,n);else if("gravity"==t)r=new Pt(o,o,n);else{if("mix"!=t)continue;r=new Vt(o,o,n)}i.push(Xs(e,r,0,1))}else{const t=new Dt(o,n);for(let a=0;null!=s;s=e[a+1],a++)t.setFrame(a,Ps(s,"time",0));i.push(t)}}}if(t.attachments)for(let e in t.attachments){let n=t.attachments[e],r=s.findSkin(e);if(!r)throw new Error("Skin not found: "+e);for(let t in n){let e=n[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],n=r.getAttachment(l,t);for(let t in s){let e=s[t],r=e[0];if(r)if("deform"==t){let t=n.bones,s=n.vertices,o=t?s.length/3*2:s.length,h=new vt(e.length,e.length,l,n),c=Ps(r,"time",0);for(let i=0,n=0;;i++){let l,d=Ps(r,"vertices",null);if(d){l=N.newFloatArray(o);let e=Ps(r,"offset",0);if(N.arrayCopy(d,0,l,e,d.length),1!=a)for(let t=e,s=t+d.length;t<s;t++)l[t]*=a;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?N.newFloatArray(o):s;h.setFrame(i,c,l);let u=e[i+1];if(!u){h.shrink(n);break}let m=Ps(u,"time",0),f=r.curve;f&&(n=Bs(f,h,n,i,0,c,m,0,1,1)),c=m,r=u}i.push(h)}else if("sequence"==t){let t=new Ot(e.length,l,n),s=0;for(let a=0;a<e.length;a++){let i=Ps(r,"delay",s),n=Ps(r,"time",0),o=H[Ps(r,"mode","hold")],l=Ps(r,"index",0);t.setFrame(a,n,o,l,i),s=i,r=e[a+1]}i.push(t)}}}}}if(t.drawOrder){let e=new At(t.drawOrder.length),a=s.slots.length,n=0;for(let i=0;i<t.drawOrder.length;i++,n++){let r=t.drawOrder[i],o=null,l=Ps(r,"offsets",null);if(l){o=N.newArray(a,-1);let t=N.newArray(a-l.length,0),e=0,i=0;for(let a=0;a<l.length;a++){let n=l[a],r=s.findSlot(n.slot);if(!r)throw new Error("Slot not found: "+r);let h=r.index;for(;e!=h;)t[i++]=e++;o[e+n.offset]=e++}for(;e<a;)t[i++]=e++;for(let e=a-1;e>=0;e--)-1==o[e]&&(o[e]=t[--i])}e.setFrame(n,Ps(r,"time",0),o)}i.push(e)}if(t.events){let e=new St(t.events.length),a=0;for(let i=0;i<t.events.length;i++,a++){let n=t.events[i],r=s.findEvent(n.name);if(!r)throw new Error("Event not found: "+n.name);let o=new Fe(N.toSinglePrecision(Ps(n,"time",0)),r);o.intValue=Ps(n,"int",r.intValue),o.floatValue=Ps(n,"float",r.floatValue),o.stringValue=Ps(n,"string",r.stringValue),o.data.audioPath&&(o.volume=Ps(n,"volume",1),o.balance=Ps(n,"balance",0)),e.setFrame(a,o)}i.push(e)}let n=0;for(let t=0,e=i.length;t<e;t++)n=Math.max(n,i[t].getDuration());s.animations.push(new K(e,i,n))}}class _s{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,a,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=a,this.inheritTimeline=i}}function Xs(t,e,s,a){let i=t[0],n=Ps(i,"time",0),r=Ps(i,"value",s)*a,o=0;for(let l=0;;l++){e.setFrame(l,n,r);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Ps(h,"time",0),d=Ps(h,"value",s)*a;i.curve&&(o=Bs(i.curve,e,o,l,0,n,c,r,d,a)),n=c,r=d,i=h}}function Rs(t,e,s,a,i,n){let r=t[0],o=Ps(r,"time",0),l=Ps(r,s,i)*n,h=Ps(r,a,i)*n,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Ps(u,"time",0),f=Ps(u,s,i)*n,p=Ps(u,a,i)*n,g=r.curve;g&&(c=Bs(g,e,c,d,0,o,m,l,f,n),c=Bs(g,e,c,d,1,o,m,h,p,n)),o=m,l=f,h=p,r=u}}function Bs(t,e,s,a,i,n,r,o,l,h){if("stepped"==t)return e.setStepped(a),s;let c=i<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,a,i,n,o,d,u,m,f,r,l),s+1}function Ps(t,e,s){return void 0!==t[e]?t[e]:s}var Vs;function Ds(t,e,s){const a=new ke(t);return"json"===s?new Ys(a).readSkeletonData(e):new We(a).readSkeletonData(new Uint8Array(e))}async function Os(e,s,a){let i;const n=e.map(((e,i)=>{const n=s[i];let r=t.Texture2D;return"ktx"===n?r=t.KTX:"ktx2"===n&&(r=t.KTX2),qs(e,a,r)}));try{i=await Promise.all(n)}catch(t){throw t}return i}async function Ns(t,s){const a=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let i,n;try{i=await e(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let r=new me(i);const o=[];for(let t of r.pages){const e=a+t.name;o.push(qs(e,s))}try{n=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return r=Ls(i,n),r}function Ls(t,e){const s=new me(t);return s.pages.forEach(((t,s)=>{const a=function(t){return new Ws(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(a)})),s}function qs(e,s,a=t.Texture2D){return s.resourceManager.load({url:e,type:a})}void 0===Math.fround&&(Math.fround=(Vs=new Float32Array(1),function(t){return Vs[0]=t,Vs[0]}));class Ws extends ee{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,e){t===se.Nearest?this.texture.filterMode=s.Point:e===se.MipMapLinearLinear?this.texture.filterMode=s.Trilinear:this.texture.filterMode=s.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case ae.ClampToEdge:return a.Clamp;case ae.Repeat:return a.Repeat;case ae.MirroredRepeat:return a.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class Us{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let a=0;a<e;++a)s[a]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class zs{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:$s,One:Gs,DestinationColor:js,Zero:Hs,OneMinusSourceColor:Js,OneMinusSourceAlpha:Ks}=i,{Add:Zs}=n;function Qs(t,e,s){const a=t.renderState.blendState.targetBlendState;switch(e){case he.Additive:a.sourceColorBlendFactor=s?Gs:$s,a.destinationColorBlendFactor=Gs,a.sourceAlphaBlendFactor=Gs,a.destinationAlphaBlendFactor=Gs,a.colorBlendOperation=a.alphaBlendOperation=Zs;break;case he.Multiply:a.sourceColorBlendFactor=js,a.destinationColorBlendFactor=Ks,a.sourceAlphaBlendFactor=Gs,a.destinationAlphaBlendFactor=Ks,a.colorBlendOperation=a.alphaBlendOperation=Zs;break;case he.Screen:a.sourceColorBlendFactor=Gs,a.destinationColorBlendFactor=Js,a.sourceAlphaBlendFactor=Gs,a.destinationAlphaBlendFactor=Js,a.colorBlendOperation=a.alphaBlendOperation=Zs;break;default:a.sourceColorBlendFactor=s?Gs:$s,a.destinationColorBlendFactor=Ks,a.sourceAlphaBlendFactor=Gs,a.destinationAlphaBlendFactor=Ks,a.colorBlendOperation=a.alphaBlendOperation=Zs}}class ta{}const ea=1/0,sa=-1/0;class aa{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new B}static{this.tempColor=new B}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new Us(r)}static{this.subRenderItemPool=new zs(ta)}static{this.bounds=new o(new l(ea,ea,ea),new l(sa,sa,sa))}buildPrimitive(t,e){const{_clipper:s,_separateSlots:a,_subRenderItems:i,_separateSlotTextureMap:n}=this,{bounds:r}=aa;r.min.set(ea,ea,ea),r.max.set(sa,sa,sa);let o=0,l=0;const h=t.drawOrder,c=h.length,{engine:d,_indices:u,_vertices:m,_vertexCount:f,_subPrimitives:p,zSpacing:g,premultipliedAlpha:x}=e;let{tempVerts:w,tempTexture:b,tempBlendMode:y,subRenderItemPool:k,subPrimitivePool:v}=aa;i.length=0,k.clear();let S,A,I=e._vertices,M=0,F=0,C=he.Normal,T=null,E=0;aa.tempBlendMode=null,aa.tempTexture=null;for(let t=0;t<c;++t){const e=h[t];if(!e.bone.active){s.clipEndWithSlot(e);continue}const r=e.getAttachment();let c=null;const d=g*t;let f=0;const Y=s.isClipping();let _=Y?2:aa.VERTEX_SIZE;if(r){switch(r.constructor){case ye:const t=r;c=t.color,f=4*_,t.computeWorldVertices(e,w,0,_),S=aa.QUAD_TRIANGLES,A=t.uvs,T=t.region.texture;break;case xe:const a=r;c=a.color,f=(a.worldVerticesLength>>1)*_,f>I.length&&(aa.tempVerts=new Array(f)),a.computeWorldVertices(e,0,a.worldVerticesLength,w,0,_),S=a.triangles,A=a.uvs,T=a.region.texture;break;case te:let i=r;s.clipStart(e,i);continue;default:s.clipEndWithSlot(e);continue}if(null!=T){let t,r,h,g,I=e.bone.skeleton.color,X=e.color,R=aa.tempColor,B=aa.tempDark;if(R.r=I.r*X.r*c.r,R.g=I.g*X.g*c.g,R.b=I.b*X.b*c.b,R.a=I.a*X.a*c.a,x&&(R.r*=R.a,R.g*=R.a,R.b*=R.a),Y)s.clipTriangles(w,S,S.length,A,R,B,!1),t=s.clippedVertices,r=t.length,h=s.clippedTriangles,g=h.length;else{let e=w;const{r:s,g:a,b:i,a:n}=R;for(let t=2,r=0,o=f;t<o;t+=_,r+=2)e[t]=s,e[t+1]=a,e[t+2]=i,e[t+3]=n,e[t+4]=A[r],e[t+5]=A[r+1];t=w,r=f,h=S,g=S.length}if(0==r||0==g){s.clipEndWithSlot(e);continue}let P=o/aa.VERTEX_STRIDE,V=m,D=o,O=0;for(;O<r;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=d,V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],this._expandByPoint(e,s,d)}o=D;let N=u;for(D=l,O=0;O<g;D++,O++)N[D]=h[O]+P;l+=g;const L=e.data,q=L.name;C=L.blendMode;const W=null!==y&&y!==L.blendMode,U=null!==b&&b!==T,z=a.get(q);if(z||W||U){if(F>0){const t=p[E];t&&E++;const e=t||v.get();e.start=M,e.count=F;const s=k.get();s.subPrimitive=e,s.texture=b,s.blendMode=y,i.push(s),M+=F,F=0}if(z){const t=n.get(q);if(t){const e=T.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=p[E];e&&E++;const s=e||v.get();s.start=M,s.count=g;const a=k.get();a.blendMode=C,a.subPrimitive=s,a.texture=T,a.slotName=q,i.push(a),M+=g,F=0}else F+=g}else F+=g;b=T,y=C}s.clipEndWithSlot(e)}else s.clipEndWithSlot(e)}if(F>0){const t=p[E];t&&E++;const e=t||v.get();e.start=M,e.count=F;const s=k.get();s.blendMode=C,s.subPrimitive=e,s.texture=T,i.push(s),F=0}s.clipEnd();const Y=p.length,_=i.length;if(_<Y)for(let t=_;t<Y;t++){const e=p[t];v.return(e)}e._clearSubPrimitives();for(let t=0,s=_;t<s;++t){const s=i[t],{slotName:a,blendMode:r,texture:o}=s;e._addSubPrimitive(s.subPrimitive);let l=o.texture;n.has(a)&&(l=n.get(a));const h=`${l.instanceId}_${r}`;let c=na._materialCache.get(h);c||(c=this._createMaterialForTexture(l,d,r,x),na._materialCache.set(h,c)),e.setMaterial(t,c)}if(l>f)return e._createAndBindBuffer(l),void this.buildPrimitive(t,e);e._vertexBuffer.setData(m),e._indexBuffer.setData(u)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s,a){const i=na._getDefaultMaterial(e);return i.shaderData.setTexture("material_SpineTexture",t),Qs(i,s,a),i}_expandByPoint(t,e,s){const{bounds:{min:a,max:i}}=aa,n=Math.min(a.x,t),r=Math.min(a.y,e),o=Math.min(a.z,s),l=Math.max(i.x,t),h=Math.max(i.y,e),c=Math.max(i.z,s);a.set(n,r,o),i.set(l,h,c)}constructor(){this._clipper=new Es,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ia extends h{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,c.find("galacean-spine-shader")||c.create("galacean-spine-shader",ia._spineVS,ia._spineFS));const e=this.renderState;e.blendState.targetBlendState.enabled=!0,Qs(this,he.Normal,!1),e.depthState.writeEnabled=!1,e.rasterState.cullMode=d.Off,e.renderQueueType=u.Transparent}}class na extends m{static{this._spineGenerator=new aa}static{this._positionVertexElement=new f("POSITION",0,p.Vector3,0)}static{this._colorVertexElement=new f("COLOR_0",12,p.Vector4,0)}static{this._uvVertexElement=new f("TEXCOORD_0",28,p.Vector2,0)}static{this._materialCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new ia(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.zSpacing=.01,this.premultipliedAlpha=!1,this.defaultConfig=new ra,this._subPrimitives=[],this._vertices=new Float32Array,this._indices=new Uint16Array,this._needResizeBuffer=!1,this._vertexCount=0,this._needsInitialize=!1;const e=new g(this._engine);this._primitive=e,e.addVertexElement(na._positionVertexElement),e.addVertexElement(na._colorVertexElement),e.addVertexElement(na._uvVertexElement)}_onEnable(){this._applyDefaultConfig()}update(t){this._needsInitialize&&(this._initialize(),this._needsInitialize=!1);const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(le.update),na._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:a,_engine:i}=this,n=i._renderElementPool.get();n.set(this.priority,this._distanceForSort);const r=i._subRenderElementPool;if(s){for(let t=0,i=s.length;t<i;t++){let i=a[t];if(!i)continue;(i.destroyed||i.shader.destroyed)&&(i=this.engine._meshMagentaMaterial);const o=r.get();o.set(this,i,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:e}=aa;o.transform(e,this.entity.transform.worldMatrix,t)}_setSkeleton(t){this._skeleton!==t&&(this._skeleton=t,this._needsInitialize=!!t)}_setState(t){this._state!==t&&(this._state=t,this._needsInitialize=!!t)}_cloneTo(t){const e=this._skeleton.data,s=new Zt(e),a=new Pe(e),i=new Nt(s);t._setSkeleton(a),t._setState(i)}_onDestroy(){const{_primitive:t,_subPrimitives:e}=this;e.length=0,t&&t.destroy(),this._clearMaterialCache(),this._resource.destroy(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,super._onDestroy()}_createAndBindBuffer(t){const{_engine:e,_primitive:s}=this;this._vertexCount=t,this._vertices=new Float32Array(t*aa.VERTEX_STRIDE),this._indices=new Uint16Array(t);const a=4*aa.VERTEX_STRIDE,i=new x(e,w.VertexBuffer,this._vertices,b.Dynamic),n=new x(e,w.IndexBuffer,this._indices,b.Dynamic);this._indexBuffer=n,this._vertexBuffer=i;const r=new y(i,a);this._primitive.setVertexBufferBinding(0,r);const o=new k(n,v.UInt16);s.setIndexBufferBinding(o)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_initialize(){this._applyDefaultConfig(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===$s&&e.destinationColorBlendFactor===Gs&&e.sourceAlphaBlendFactor===Gs&&e.destinationAlphaBlendFactor===Gs&&e.colorBlendOperation===Zs&&e.alphaBlendOperation===Zs?he.Additive:e.sourceColorBlendFactor===js&&e.destinationColorBlendFactor===Hs&&e.sourceAlphaBlendFactor===Gs&&e.destinationAlphaBlendFactor===Hs&&e.colorBlendOperation===Zs&&e.alphaBlendOperation===Zs?he.Multiply:e.sourceColorBlendFactor===Gs&&e.destinationColorBlendFactor===Js&&e.sourceAlphaBlendFactor===Gs&&e.destinationAlphaBlendFactor===Js&&e.colorBlendOperation===Zs&&e.alphaBlendOperation===Zs?he.Screen:he.Normal}(t),a=`${e.instanceId}_${s}`;na._materialCache.delete(a)}))}_applyDefaultConfig(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:a,loop:i}=this.defaultConfig;"default"!==a&&(t.setSkinByName(a),t.setToSetupPose()),s&&e.setAnimation(0,s,i)}}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t;const{skeletonData:e,stateData:s}=t,a=new Pe(e),i=new Nt(s);this._setSkeleton(a),this._setState(i)}}_([S],na.prototype,"zSpacing",void 0),_([S],na.prototype,"premultipliedAlpha",void 0),_([A],na.prototype,"defaultConfig",void 0),_([I],na.prototype,"_primitive",void 0),_([I],na.prototype,"_subPrimitives",void 0),_([I],na.prototype,"_indexBuffer",void 0),_([I],na.prototype,"_vertexBuffer",void 0),_([I],na.prototype,"_vertices",void 0),_([I],na.prototype,"_indices",void 0),_([I],na.prototype,"_needResizeBuffer",void 0),_([I],na.prototype,"_vertexCount",void 0),_([I],na.prototype,"_resource",void 0),_([I],na.prototype,"_skeleton",void 0),_([I],na.prototype,"_state",void 0),_([I],na.prototype,"_needsInitialize",void 0);class ra{constructor(t=!0,e=null,s="default"){this.loop=t,this.animationName=e,this.skinName=s}}class oa extends M{constructor(t,e,s){super(t),this.name="Spine Entity",this._texturesInSpineAtlas=[],this.name=s,this._skeletonData=e,this._stateData=new Zt(e),this._associationTextureInSkeletonData(e),this._createTemplate()}get skeletonData(){return this._skeletonData}get stateData(){return this._stateData}instantiate(){return this._template.clone()}_onDestroy(){super._onDestroy(),this._disassociationSuperResource(),this._skeletonData=null,this._stateData=null}_createTemplate(){const t=this.name,e=new F(this.engine,t),s=e.addComponent(na),a=new Pe(this._skeletonData),i=new Nt(this._stateData);s._setSkeleton(a),s._setState(i),e._markAsTemplate(this),this._template=e}_associationTextureInSkeletonData(t){const{skins:e,slots:s}=t,a=this._texturesInSpineAtlas;for(let t=0,i=e.length;t<i;t++)for(let i=0,n=s.length;i<n;i++){const n=s[i],r=e[t].getAttachment(n.index,n.name),o=r?.region?.texture.texture;o&&(a.includes(o)||(a.push(o),o._associationSuperResource(this)))}}_disassociationSuperResource(){const t=this._texturesInSpineAtlas;for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}}class la extends C{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:a,skeletonExtensions:i}=la,n=la.getUrlExtension(t,e);n&&(i.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),a.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const a=la.getUrlExtension(t,e);if(!a)return;s.skeletonPath=t,s.skeletonExtension=a;const i=/(\.(json|bin|skel))$/;let n;if(i.test(t)&&(n=t.replace(i,"")),n){const t=n+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,e){return new T((async s=>{let a;if(t.urls)a=await this._handleOriginAsset(t,e);else{const s=await e._request(t.url,{type:"arraybuffer"}),i=new E(new Uint8Array(s)),n=i.nextStr();a=n.startsWith("spine")?await this._handleEditorAsset(t,s,i,n,e):await this._handleOriginAsset(t,e,s)}s(a)}))}async _handleEditorAsset(t,e,s,a,i){let n,r;const o=a.startsWith("spine:skel")?"skel":"json",{engine:l}=i;if("skel"===o)r=s.nextStr(),n=s.nextImageData();else{const t=new TextDecoder("utf-8").decode(new Uint8Array(e)),{data:s,atlas:a}=JSON.parse(t);r=a.refId,n=s}const h=Ds(await i.getResourceByRef({refId:r}),n,o);return new oa(l,h,t.url)}async _handleOriginAsset(t,e,s){let{fileExtensions:a}=t.params||{},i={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=la.verifyFileExtensions(a,!1);la.deriveAndAssignSpineAsset(t.url,e,i);const{skeletonPath:r,atlasPath:o}=i;if(!r||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await Ns(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Ds(l,h,c);return new oa(n,d,r)}{a=la.verifyFileExtensions(a,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=a&&a[e]||null;la.parseAndAssignSpineAsset(s,n,i)}const{skeletonPath:s,atlasPath:r,imagePaths:o,skeletonExtension:l,imageExtensions:h}=i;if(!s||!r)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const c="json"===l?"json":"skel";let d,u,m=["json"===l?e._request(s,{type:"text"}):e._request(s,{type:"arraybuffer"})];if(o.length>0){let t,s;m=m.concat([e._request(r,{type:"text"}),Os(o,h,n)]),[u,t,s]=await Promise.all(m),d=Ls(t,s)}else m.push(Ns(r,n)),[u,d]=await Promise.all(m);const f=Ds(d,u,c);return new oa(n,f,s)}}_determineSkeletonDataType(t){let e,s;try{const a=new TextDecoder("utf-8").decode(t);JSON.parse(a),e=a,s="json"}catch(a){e=t,s="skel"}return{data:e,type:s}}}la=_([Y("spine",["json","bin","skel"])],la);class ha extends C{load(t,e){return new T((async s=>{const a=await e._request(t.url,{type:"text"}),{data:i,textures:n}=JSON.parse(a),r=n.map((t=>e.getResourceByRef({refId:t.refId})));s(Ls(i,await Promise.all(r)))}))}}ha=_([Y("EditorSpineAtlas",["atlas"])],ha);const ca="0.0.0-experimental-engine-spine-20241115";C.registerClass("SpineAnimationRenderer",na),console.log(`Galacean spine version: ${ca}`);export{wt as AlphaTimeline,K as Animation,Nt as AnimationState,Ut as AnimationStateAdapter,Zt as AnimationStateData,Ie as AssetManagerBase,ke as AtlasAttachmentLoader,$ as Attachment,kt as AttachmentTimeline,Ue as BinaryInput,he as BlendMode,Se as Bone,ve as BoneData,Qt as BoundingBoxAttachment,Kt as CURRENT,te as ClippingAttachment,B as Color,Ae as ConstraintData,st as CurveTimeline,at as CurveTimeline1,it as CurveTimeline2,L as DebugUtils,vt as DeformTimeline,Me as Downloader,At as DrawOrderTimeline,Fe as Event,Ce as EventData,qt as EventQueue,St as EventTimeline,Wt as EventType,$t as FIRST,ue as FakeTexture,jt as HOLD_FIRST,Ht as HOLD_MIX,Gt as HOLD_SUBSEQUENT,Te as IkConstraint,Ee as IkConstraintData,It as IkConstraintTimeline,ie as Inherit,pt as InheritTimeline,X as IntSet,V as Interpolation,P as MathUtils,xe as MeshAttachment,Z as MixBlend,Q as MixDirection,we as PathAttachment,_e as PathConstraint,Ye as PathConstraintData,Tt as PathConstraintMixTimeline,Ft as PathConstraintPositionTimeline,Ct as PathConstraintSpacingTimeline,le as Physics,Xt as PhysicsConstraintDampingTimeline,Pt as PhysicsConstraintGravityTimeline,Yt as PhysicsConstraintInertiaTimeline,Rt as PhysicsConstraintMassTimeline,Vt as PhysicsConstraintMixTimeline,Dt as PhysicsConstraintResetTimeline,_t as PhysicsConstraintStrengthTimeline,Et as PhysicsConstraintTimeline,Bt as PhysicsConstraintWindTimeline,be as PointAttachment,q as Pool,ne as PositionMode,D as Pow,O as PowOut,yt as RGB2Timeline,bt as RGBA2Timeline,gt as RGBATimeline,xt as RGBTimeline,ye as RegionAttachment,oe as RotateMode,nt as RotateTimeline,Jt as SETUP,zt as SUBSEQUENT,ht as ScaleTimeline,ct as ScaleXTimeline,dt as ScaleYTimeline,Ot as SequenceTimeline,ut as ShearTimeline,mt as ShearXTimeline,ft as ShearYTimeline,Pe as Skeleton,We as SkeletonBinary,Cs as SkeletonBounds,Es as SkeletonClipping,De as SkeletonData,Ys as SkeletonJson,Ne as Skin,Oe as SkinEntry,Re as Slot,Le as SlotData,re as SpacingMode,na as SpineAnimationRenderer,oa as SpineResource,R as StringSet,ee as Texture,me as TextureAtlas,pe as TextureAtlasPage,ge as TextureAtlasRegion,se as TextureFilter,de as TextureRegion,ae as TextureWrap,U as TimeKeeper,et as Timeline,Lt as TrackEntry,Be as TransformConstraint,qe as TransformConstraintData,Mt as TransformConstraintTimeline,rt as TranslateTimeline,ot as TranslateXTimeline,lt as TranslateYTimeline,Ts as Triangulator,N as Utils,W as Vector2,G as VertexAttachment,z as WindowedMean,Ls as createTextureAtlas,ca as version};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|