@eva/plugin-renderer-spine 2.0.1-beta.32 → 2.0.1-beta.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/spine-base");if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var s=class{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,n=t.length;s<n;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},n=class t{constructor(t=0,e=0,s=0,n=0){this.r=t,this.g=e,this.b=s,this.a=n}static WHITE=new t(1,1,1,1);static RED=new t(1,0,0,1);static GREEN=new t(0,1,0,1);static BLUE=new t(0,0,1,1);static MAGENTA=new t(1,0,1,1);set(t,e,s,n){return this.r=t,this.g=e,this.b=s,this.a=n,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,n){return this.r+=t,this.g+=e,this.b+=s,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,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(e){return(new t).setFromString(e)}},i=class t{static PI=3.1415927;static PI2=2*t.PI;static invPI2=1/t.PI2;static radiansToDegrees=180/t.PI;static radDeg=t.radiansToDegrees;static degreesToRadians=t.PI/180;static degRad=t.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(e){return Math.cos(e*t.degRad)}static sinDeg(e){return Math.sin(e*t.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*t.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(e,s){return t.randomTriangularWith(e,s,.5*(e+s))}static randomTriangularWith(t,e,s){let n=Math.random(),i=e-t;return n<=(s-t)/i?t+Math.sqrt(n*i*(s-t)):e-Math.sqrt((1-n)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},a=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},r=class extends a{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}},o=class t{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,n,i){for(let a=e,r=n;a<e+i;a++,r++)s[r]=t[a]}static arrayFill(t,e,s,n){for(let i=e;i<s;i++)t[i]=n}static setArraySize(t,e,s=0){let n=t.length;if(n==e)return t;if(t.length=e,n<e)for(let i=n;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:t.setArraySize(e,s,n)}static newArray(t,e){let s=new Array(t);for(let n=0;n<t;n++)s[n]=e;return s}static newFloatArray(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let e=0;e<t.length;e++)t[e]=0;return t}}static newShortArray(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let e=0;e<t.length;e++)t[e]=0;return t}}static toFloatArray(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},l=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},h=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}},c=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},d=class t extends c{static nextID=0;id=t.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,n,i,a){s=i+(s>>1)*a;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+=a){let e=l[t],s=l[t+1];n[r]=e*d+s*u+h,n[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+=a){let s=0,i=0,a=h[c++];for(a+=c;c<a;c++,e+=3){let t=u[h[c]],n=l[e],a=l[e+1],r=l[e+2];s+=(n*t.a+a*t.b+t.worldX)*r,i+=(n*t.c+a*t.d+t.worldY)*r}n[t]=s,n[t+1]=i}else{let t=o;for(let e=i,r=3*d,o=d<<1;e<s;e+=a){let s=0,i=0,a=h[c++];for(a+=c;c<a;c++,r+=3,o+=2){let e=u[h[c]],n=l[r]+t[o],a=l[r+1]+t[o+1],d=l[r+2];s+=(n*e.a+a*e.b+e.worldX)*d,i+=(n*e.c+a*e.d+e.worldY)*d}n[e]=s,n[e+1]=i}}}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}},u=class t{static _nextID=0;id=t.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let e=new t(this.regions.length);return o.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let n=this.regions[s];e.region!=n&&(e.region=n,e.updateRegion())}getPath(t,e){let s=t,n=(this.start+e).toString();for(let t=this.digits-n.length;t>0;t--)s+="0";return s+=n,s}static nextID(){return t._nextID++}},m=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(m||{}),f=[0,1,2,3,4,5,6],g=class{name;timelines=[];timelineIds=new s;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,n,i,a,r,o){if(!t)throw new Error("skeleton cannot be null.");n&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(t,e,s,i,a,r,o)}},p=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(p||{}),x=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(x||{}),w={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},b=class{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 n=1;n<s;n++)if(t[n]>e)return n-1;return s-1}static search(t,e,s){let n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}},y=class extends b{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,n,i,a,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(n-2*a+o),f=.03*(i-2*r+l),g=.006*(3*(a-o)-n+h),p=.006*(3*(r-l)-i+c),x=2*m+g,w=2*f+p,b=.3*(a-n)+m+.16666667*g,y=.3*(r-i)+f+.16666667*p,k=n+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+=g,w+=p,k+=b,v+=y}getBezierValue(t,e,s,n){let i=this.curves;if(i[n]>t){let a=this.frames[e],r=this.frames[e+s];return r+(t-a)/(i[n]-a)*(i[n+1]-r)}let a=n+18;for(n+=2;n<a;n+=2)if(i[n]>=t){let e=i[n-2],s=i[n-1];return s+(t-e)/(i[n]-e)*(i[n+1]-s)}e+=this.getFrameEntries();let r=i[a-2],o=i[a-1];return o+(t-r)/(this.frames[e]-r)*(this.frames[e+s]-o)}},k=class extends y{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 n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}let n=this.curves[s>>1];switch(n){case 0:let n=e[s],i=e[s+1];return i+(t-n)/(e[s+2]-n)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return n+(i-n)*e}return n}let a=this.getCurveValue(t);switch(s){case 0:return i+a*e;case 1:case 2:a+=i-n}return n+a*e}getAbsoluteValue(t,e,s,n,i){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return n+(i-n)*e}return n}let a=this.getCurveValue(t);return 0==s?i+(a-i)*e:n+(a-n)*e}getAbsoluteValue2(t,e,s,n,i,a){if(t<this.frames[0]){switch(s){case 0:return i;case 1:return n+(i-n)*e}return n}return 0==s?i+(a-i)*e:n+(a-n)*e}getScaleValue(t,e,s,n,a,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return a+(r-a)*e}return a}let o=this.getCurveValue(t)*r;if(1==e)return 3==s?a+o-r:o;if(1==n)switch(s){case 0:return r+(Math.abs(o)*i.signum(r)-r)*e;case 1:case 2:return a+(Math.abs(o)*i.signum(a)-a)*e}else{let t=0;switch(s){case 0:return t=Math.abs(r)*i.signum(o),t+(o-t)*e;case 1:case 2:return t=Math.abs(a)*i.signum(o),t+(o-t)*e}}return a+(o-r)*e}},v=class extends y{constructor(t,e,s,n){super(t,e,[s,n])}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}},S=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,a,o.rotation,o.data.rotation))}},C=class extends v{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=b.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(a){case 0:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case 3:o.x+=h*i,o.y+=c*i}}},A=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,a,o.x,o.data.x))}},I=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,a,o.y,o.data.y))}},T=class extends v{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,n,a,r,o){let l=t.bones[this.boneIndex];if(!l.active)return;let h,c,d=this.frames;if(s<d[0]){switch(r){case 0:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case 1:l.scaleX+=(l.data.scaleX-l.scaleX)*a,l.scaleY+=(l.data.scaleY-l.scaleY)*a}return}let u=b.search(d,s,3),m=this.curves[u/3];switch(m){case 0:let t=d[u];h=d[u+1],c=d[u+2];let e=(s-t)/(d[u+3]-t);h+=(d[u+3+1]-h)*e,c+=(d[u+3+2]-c)*e;break;case 1:h=d[u+1],c=d[u+2];break;default:h=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2)}if(h*=l.data.scaleX,c*=l.data.scaleY,1==a)3==r?(l.scaleX+=h-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=h,l.scaleY=c);else{let t=0,e=0;if(1==o)switch(r){case 0:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(h)*i.signum(t)-t)*a,l.scaleY=e+(Math.abs(c)*i.signum(e)-e)*a;break;case 1:case 2:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(h)*i.signum(t)-t)*a,l.scaleY=e+(Math.abs(c)*i.signum(e)-e)*a;break;case 3:l.scaleX+=(h-l.data.scaleX)*a,l.scaleY+=(c-l.data.scaleY)*a}else switch(r){case 0:t=Math.abs(l.data.scaleX)*i.signum(h),e=Math.abs(l.data.scaleY)*i.signum(c),l.scaleX=t+(h-t)*a,l.scaleY=e+(c-e)*a;break;case 1:case 2:t=Math.abs(l.scaleX)*i.signum(h),e=Math.abs(l.scaleY)*i.signum(c),l.scaleX=t+(h-t)*a,l.scaleY=e+(c-e)*a;break;case 3:l.scaleX+=(h-l.data.scaleX)*a,l.scaleY+=(c-l.data.scaleY)*a}}}},M=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,a,r,o.scaleX,o.data.scaleX))}},F=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,a,r,o.scaleY,o.data.scaleY))}},Y=class extends v{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=b.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(a){case 0:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case 3:o.shearX+=h*i,o.shearY+=c*i}}},P=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,a,o.shearX,o.data.shearX))}},X=class extends k{boneIndex=0;constructor(t,e,s){super(t,e,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,n,i,a,r){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,a,o.shearY,o.data.shearY))}},B=class extends b{boneIndex=0;constructor(t,e){super(t,[w.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,n,i,a,r){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==r)return void(0==a&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=a&&1!=a||(o.inherit=o.data.inherit):o.inherit=this.frames[b.search(l,s,2)+1]}},E=class extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,n,i,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=a}apply(t,e,s,n,i,a,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(a){case 0:return void h.setFromColor(t);case 1: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=b.search(l,s,5),g=this.curves[f/5];switch(g){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,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==i?h.set(c,d,u,m):(0==a&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(m-h.a)*i))}},R=class extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i}apply(t,e,s,n,i,a,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(a){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1: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=b.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(0==a){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}}},D=class extends k{slotIndex=0;constructor(t,e,s){super(t,e,w.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,n,i,a,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(a){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(0==a&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}},V=class extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,n,i,a,r,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=a,this.frames[t+5]=r,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,n,i,a,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(a){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1: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,g=0,p=0,x=0,w=b.search(l,s,8),y=this.curves[w>>3];switch(y){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=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,g+=(l[w+8+5]-g)*e,p+=(l[w+8+6]-p)*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],g=l[w+5],p=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,y-2),u=this.getBezierValue(s,w,2,y+18-2),m=this.getBezierValue(s,w,3,y+36-2),f=this.getBezierValue(s,w,4,y+54-2),g=this.getBezierValue(s,w,5,y+72-2),p=this.getBezierValue(s,w,6,y+90-2),x=this.getBezierValue(s,w,7,y+108-2)}if(1==i)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(0==a){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+=(g-c.r)*i,c.g+=(p-c.g)*i,c.b+=(x-c.b)*i}}},L=class extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,n,i,a,r,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=a,this.frames[t+5]=r,this.frames[t+6]=o}apply(t,e,s,n,i,a,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(a){case 0: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 1: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,g=0,p=0,x=b.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],g=l[x+5],p=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,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=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),g=this.getBezierValue(s,x,5,w+72-2),p=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=g,c.b=p;else{if(0==a){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+=(g-c.g)*i,c.b+=(p-c.b)*i}}},_=class extends b{slotIndex=0;attachmentNames;constructor(t,e){super(t,[w.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,n,i,a,r){let o=t.slots[this.slotIndex];o.bone.active&&(1!=r?s<this.frames[0]?0!=a&&1!=a||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[b.search1(this.frames,s)]):0==a&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},N=class extends y{slotIndex=0;attachment;vertices;constructor(t,e,s,n){super(t,e,[w.deform+"|"+s+"|"+n.id]),this.slotIndex=s,this.attachment=n,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,n,i,a,r,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(n-2*a+o),f=.03*l-.06*r,g=.006*(3*(a-o)-n+h),p=.018*(r-l+.33333333),x=2*m+g,w=2*f+p,b=.3*(a-n)+m+.16666667*g,y=.3*r+f+.16666667*p,k=n+b,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=g,w+=p,k+=b,v+=y}getCurvePercent(t,e){let s=this.curves,n=s[e];switch(n){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(n-=2,s[n]>t){let i=this.frames[e];return s[n+1]*(t-i)/(s[n]-i)}let i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){let e=s[n-2],i=s[n-1];return i+(t-e)/(s[n]-e)*(s[n+1]-i)}let a=s[i-2],r=s[i-1];return r+(1-r)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,n,i,a,r){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=l.getAttachment();if(!h)return;if(!(h instanceof d)||h.timelineAttachment!=this.attachment)return;let c=l.deform;0==c.length&&(a=0);let u=this.vertices,m=u[0].length,f=this.frames;if(s<f[0]){switch(a){case 0:return void(c.length=0);case 1:if(1==i)return void(c.length=0);c.length=m;let t=h;if(t.bones){i=1-i;for(g=0;g<m;g++)c[g]*=i}else{let e=t.vertices;for(var g=0;g<m;g++)c[g]+=(e[g]-c[g])*i}}return}if(c.length=m,s>=f[f.length-1]){let t=u[f.length-1];if(1==i)if(3==a){let e=h;if(e.bones)for(let e=0;e<m;e++)c[e]+=t[e];else{let s=e.vertices;for(let e=0;e<m;e++)c[e]+=t[e]-s[e]}}else o.arrayCopy(t,0,c,0,m);else switch(a){case 0:{let e=h;if(e.bones)for(let e=0;e<m;e++)c[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<m;e++){let n=s[e];c[e]=n+(t[e]-n)*i}}break}case 1:case 2:for(let e=0;e<m;e++)c[e]+=(t[e]-c[e])*i;break;case 3:let e=h;if(e.bones)for(let e=0;e<m;e++)c[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<m;e++)c[e]+=(t[e]-s[e])*i}}return}let p=b.search1(f,s),x=this.getCurvePercent(s,p),w=u[p],y=u[p+1];if(1==i)if(3==a){let t=h;if(t.bones)for(let t=0;t<m;t++){let e=w[t];c[t]+=e+(y[t]-e)*x}else{let e=t.vertices;for(let t=0;t<m;t++){let s=w[t];c[t]+=s+(y[t]-s)*x-e[t]}}}else for(let t=0;t<m;t++){let e=w[t];c[t]=e+(y[t]-e)*x}else switch(a){case 0:{let t=h;if(t.bones)for(let t=0;t<m;t++){let e=w[t];c[t]=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<m;t++){let s=w[t],n=e[t];c[t]=n+(s+(y[t]-s)*x-n)*i}}break}case 1:case 2:for(let t=0;t<m;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x-c[t])*i}break;case 3:let t=h;if(t.bones)for(let t=0;t<m;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<m;t++){let s=w[t];c[t]+=(s+(y[t]-s)*x-e[t])*i}}}}},O=class t extends b{static propertyIds=[""+w.event];events;constructor(e){super(e,t.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,n,i,a,r){if(!n)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,n,i,a,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=b.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)n.push(this.events[h])}},U=class t extends b{static propertyIds=[""+w.drawOrder];drawOrders;constructor(e){super(e,t.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,n,i,a,r){if(1==r)return void(0==a&&o.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=a&&1!=a||o.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let l=b.search1(this.frames,s),h=this.drawOrders[l];if(h){let e=t.drawOrder,s=t.slots;for(let t=0,n=h.length;t<n;t++)e[t]=s[h[t]]}else o.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},q=class extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,a,r){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=a?1:0,this.frames[t+5]=r?1:0}apply(t,e,s,n,i,a,r){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case 0: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 1: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=b.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)}0==a?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,1==r?(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,0==r&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},W=class extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,n,i,a,r,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=n,l[t+3]=i,l[t+4]=a,l[t+5]=r,l[t+6]=o}apply(t,e,s,n,i,a,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(a){case 0: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 1: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 g=b.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(0==a){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}},z=class extends k{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,n,i,a,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,a,o.position,o.data.position))}},G=class extends k{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,n,i,a,r){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,a,o.spacing,o.data.spacing))}},$=class extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){let a=this.frames;a[t<<=2]=e,a[t+1]=s,a[t+2]=n,a[t+3]=i}apply(t,e,s,n,i,a,r){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(a){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1: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=b.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(0==a){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}},j=class extends k{constraintIndex=0;constructor(t,e,s,n){super(t,e,n+"|"+s),this.constraintIndex=s}apply(t,e,s,n,i,a,r){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of t.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,i,a,this.get(n),this.setup(n),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,a,this.get(o),this.setup(o)))}},H=class extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},J=class extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},K=class extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},Q=class extends j{constructor(t,e,s){super(t,e,s,w.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}},Z=class extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},tt=class extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},et=class extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},st=class t extends b{static propertyIds=[w.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,t.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,n,i,a,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,a,r),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[b.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},nt=class t extends b{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[w.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return t.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,a){let r=this.frames;r[e*=t.ENTRIES]=s,r[e+t.MODE]=n|i<<4,r[e+t.DELAY]=a}apply(e,s,n,i,a,r,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,c=this.attachment;if(!(h==c||h instanceof d&&h.timelineAttachment==c))return;if(1==o)return void(0==r&&(l.sequenceIndex=-1));let u=this.frames;if(n<u[0])return void(0!=r&&1!=r||(l.sequenceIndex=-1));let m=b.search(u,n,t.ENTRIES),g=u[m],p=u[m+t.MODE],x=u[m+t.DELAY];if(!this.attachment.sequence)return;let w=p>>4,y=this.attachment.sequence.regions.length,k=f[15&p];if(0!=k)switch(w+=(n-g)/x+1e-5|0,k){case 1:w=Math.min(y-1,w);break;case 2:w%=y;break;case 3:{let t=(y<<1)-2;w=0==t?0:w%t,w>=y&&(w=t-w);break}case 4:w=Math.max(y-1-w,0);break;case 5:w=y-1-w%y;break;case 6:{let t=(y<<1)-2;w=0==t?0:(w+y-1)%t,w>=y&&(w=t-w)}}l.sequenceIndex=w}},it=class t{static _emptyAnimation=new g("<empty>",[],0);static emptyAnimation(){return t._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new rt(this);propertyIDs=new s;animationsChanged=!1;trackEntryPool=new l((()=>new at));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let i=t*n.timeScale;if(n.delay>0){if(n.delay-=i,n.delay>0)continue;i=-n.delay,n.delay=0}let a=n.next;if(a){let e=n.trackLast-a.delay;if(e>=0){for(a.delay=0,a.trackTime+=0==n.timeScale?0:(e/n.timeScale+t)*a.timeScale,n.trackTime+=i,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let t=n.mixingFrom;for(n.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}n.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let n=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n}return 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,n=!1;for(let a=0,r=s.length;a<r;a++){let r=s[a];if(!r||r.delay>0)continue;n=!0;let l=0==a?1:r.mixBlend,h=r.alpha;r.mixingFrom?h*=this.applyMixingFrom(r,t,l):r.trackTime>=r.trackEnd&&!r.next&&(h=0);let c=h>=r.alphaAttachmentThreshold,d=r.animationLast,u=r.getAnimationTime(),m=u,f=e;r.reverse&&(m=r.animation.duration-m,f=null);let g=r.animation.timelines,p=g.length;if(0==a&&1==h||3==l){0==a&&(c=!0);for(let e=0;e<p;e++){o.webkit602BugfixHelper(h,l);var i=g[e];i instanceof _?this.applyAttachmentTimeline(i,t,m,l,c):i.apply(t,d,m,f,h,l,0)}}else{let e=r.timelineMode,s=r.shortestRotation,n=!s&&r.timelinesRotation.length!=p<<1;n&&(r.timelinesRotation.length=p<<1);for(let i=0;i<p;i++){let a=g[i],u=e[i]==lt?l:0;!s&&a instanceof S?this.applyRotateTimeline(a,t,m,h,u,r.timelinesRotation,i<<1,n):a instanceof _?this.applyAttachmentTimeline(a,t,m,l,c):(o.webkit602BugfixHelper(h,l),a.apply(t,d,m,f,h,u,0))}}this.queueEvents(r,u),e.length=0,r.nextAnimationLast=u,r.nextTrackLast=r.trackTime}for(var a=this.unkeyedState+mt,r=t.slots,l=0,h=t.slots.length;l<h;l++){var c=r[l];if(c.attachmentState==a){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(t,e,s){let n=t.mixingFrom;n.mixingFrom&&this.applyMixingFrom(n,e,s);let i=0;0==t.mixDuration?(i=1,1==s&&(s=0)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),1!=s&&(s=n.mixBlend));let a=i<n.mixAttachmentThreshold,r=i<n.mixDrawOrderThreshold,l=n.animation.timelines,h=l.length,c=n.alpha*t.interruptAlpha,d=c*(1-i),u=n.animationLast,m=n.getAnimationTime(),f=m,g=null;if(n.reverse?f=n.animation.duration-f:i<n.eventThreshold&&(g=this.events),3==s)for(let t=0;t<h;t++)l[t].apply(e,u,f,g,d,s,1);else{let t=n.timelineMode,i=n.timelineHoldMix,m=n.shortestRotation,p=!m&&n.timelinesRotation.length!=h<<1;p&&(n.timelinesRotation.length=h<<1),n.totalAlpha=0;for(let x=0;x<h;x++){let h,w=l[x],b=1,y=0;switch(t[x]){case lt:if(!r&&w instanceof U)continue;h=s,y=d;break;case ht:h=0,y=d;break;case ct:h=s,y=c;break;case dt:h=0,y=c;break;default:h=0;let t=i[x];y=c*Math.max(0,1-t.mixTime/t.mixDuration)}n.totalAlpha+=y,!m&&w instanceof S?this.applyRotateTimeline(w,e,f,y,h,n.timelinesRotation,x<<1,p):w instanceof _?this.applyAttachmentTimeline(w,e,f,h,a&&y>=n.alphaAttachmentThreshold):(o.webkit602BugfixHelper(y,s),r&&w instanceof U&&0==h&&(b=0),w.apply(e,u,f,g,y,h,b))}}return t.mixDuration>0&&this.queueEvents(n,m),this.events.length=0,n.nextAnimationLast=m,n.nextTrackLast=n.trackTime,i}applyAttachmentTimeline(t,e,s,n,i){var a=e.slots[t.slotIndex];a.bone.active&&(s<t.frames[0]?0!=n&&1!=n||this.setAttachment(e,a,a.data.attachmentName,i):this.setAttachment(e,a,t.attachmentNames[b.search1(t.frames,s)],i),a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+mt))}setAttachment(t,e,s,n){e.setAttachment(s?t.getAttachment(e.data.index,s):null),n&&(e.attachmentState=this.unkeyedState+ft)}applyRotateTimeline(t,e,s,n,a,r,o,l){if(l&&(r[o]=0),1==n)return void t.apply(e,0,s,null,1,a,0);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(a){case 0:h.rotation=h.data.rotation;default:return;case 1:c=h.rotation,d=h.data.rotation}else c=0==a?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,m=d-c;if(m-=360*Math.ceil(m/360-.5),0==m)u=r[o];else{let t=0,e=0;l?(t=0,e=m):(t=r[o],e=r[o+1]);let s=t-t%360;u=m+s;let n=m>=0,a=t>=0;Math.abs(e)<=90&&i.signum(e)!=i.signum(m)&&(Math.abs(t-s)>180?(u+=360*i.signum(t),a=n):0!=s?u-=360*i.signum(t):a=n),a!=n&&(u+=360*i.signum(t)),r[o]=u}r[o+1]=m,h.rotation=c+u*n}queueEvents(t,e){let s=t.animationStart,n=t.animationEnd,i=n-s,a=t.trackLast%i,r=this.events,o=0,l=r.length;for(;o<l;o++){let e=r[o];if(e.time<a)break;e.time>n||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>=n&&t.animationLast<n;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 n=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,n&&(s&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let n=!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,n=!1):this.clearNext(i));let a=this.trackEntry(t,e,s,i);return this.setCurrent(t,a,n),this.queue.drain(),a}addAnimation(t,e,s=!1,n=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,n)}addAnimationWith(t,e,s=!1,n=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let a=this.trackEntry(t,e,s,i);return i?(i.next=a,a.previous=i,n<=0&&(n+=i.getTrackComplete()-a.mixDuration)):(this.setCurrent(t,a,!0),this.queue.drain()),a.delay=n,a}setEmptyAnimation(e,s=0){let n=this.setAnimationWith(e,t.emptyAnimation(),!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){let i=this.addAnimationWith(e,t.emptyAnimation(),!1,n);return n<=0&&(i.delay+=i.mixDuration-s),i.mixDuration=s,i.trackEnd=s,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,n){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=n?this.data.getMix(n.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=2,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&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,n=t.animation.timelines.length,i=t.timelineMode;i.length=n;let a=t.timelineHoldMix;a.length=0;let r=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<n;t++)i[t]=r.addAll(s[t].getPropertyIds())?dt:ct;else t:for(let o=0;o<n;o++){let n=s[o],l=n.getPropertyIds();if(r.addAll(l))if(!e||n instanceof _||n instanceof U||n instanceof O||!e.animation.hasTimeline(l))i[o]=ht;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=ut,a[o]=s;continue t}break}i[o]=dt}else i[o]=lt}}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()}},at=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 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}},rt=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let n=t[s],i=t[s+1];switch(n){case 0: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 1: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 2: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 3: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 4: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 5:let n=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,n);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,n)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ot=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(ot||{}),lt=0,ht=1,ct=2,dt=3,ut=4,mt=1,ft=2,gt=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(n,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 n=t.name+"."+e.name;this.animationToMixTime[n]=s}getMix(t,e){let s=t.name+"."+e.name,n=this.animationToMixTime[s];return void 0===n?this.defaultMix:n}},pt=class t extends d{color=new n(1,1,1,1);constructor(t){super(t)}copy(){let e=new t(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},xt=class t extends d{endSlot=null;color=new n(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let e=new t(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},wt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},bt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(bt||{}),yt=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(yt||{}),kt=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},vt=class{pages=new Array;regions=new Array;constructor(t){let e=new St(t),s=new Array(4),n={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=o.enumValue(bt,s[1]),t.magFilter=o.enumValue(bt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},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 a=e.readLine();for(;a&&0==a.trim().length;)a=e.readLine();for(;a&&0!=a.trim().length&&0!=e.readEntry(s,a);)a=e.readLine();let r=null,l=null,h=null;for(;null!==a;)if(0==a.trim().length)r=null,a=e.readLine();else if(r){let t=new At(r,a);for(;;){let n=e.readEntry(s,a=e.readLine());if(0==n)break;let r=i[s[0]];if(r)r(t);else{l||(l=[]),h||(h=[]),l.push(s[0]);let t=[];for(let e=0;e<n;e++)t.push(parseInt(s[e+1]));h.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),l&&l.length>0&&h&&h.length>0&&(t.names=l,t.values=h,l=null,h=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 Ct(a.trim());0!=e.readEntry(s,a=e.readLine());){let t=n[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()}},St=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)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 n=1,i=s+1;;n++){let s=e.indexOf(",",i);if(-1==s)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,s-i).trim(),i=s+1,4==n)return 4}}},Ct=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},At=class extends kt{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)}},It=class t extends d{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new n(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new n(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,n=this.region.u,i=this.region.v,a=0,r=0;if(this.region instanceof At){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,a=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=n+t[o+1]*a,e[o+1]=i+(1-t[o])*r;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,a=o.originalWidth/h,r=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=n+(1-t[o])*a,e[o+1]=i+(1-t[o+1])*r;return;case 270:n-=o.offsetY/h,i-=o.offsetX/c,a=o.originalHeight/h,r=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=n+(1-t[o+1])*a,e[o+1]=i+t[o]*r;return}n-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,a=o.originalWidth/h,r=o.originalHeight/c}else this.region?(a=this.region.u2-n,r=this.region.v2-i):(n=i=0,a=r=1);for(let o=0;o<s;o+=2)e[o]=n+t[o]*a,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 e=new t(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),o.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),o.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),o.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),o.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(t,e,s,n,i,a){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,n,i,a)}newLinkedMesh(){let e=new t(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),null!=e.region&&e.updateRegion(),e}},Tt=class t extends d{lengths=[];closed=!1;constantSpeed=!1;color=new n(1,1,1,1);constructor(t){super(t)}copy(){let e=new t(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),o.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Mt=class t extends d{x=0;y=0;rotation=0;color=new n(.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*i.degRad,s=Math.cos(e),n=Math.sin(e),a=s*t.a+n*t.b,r=s*t.c+n*t.d;return i.atan2Deg(r,a)}copy(){let e=new t(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Ft=class t extends c{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new n(1,1,1,1);path;region=null;sequence=null;offset=o.newFloatArray(8);uvs=o.newFloatArray(8);tempColor=new n(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,n=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*n,o=a+this.region.width*s,l=r+this.region.height*n,h=this.rotation*i.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=a*c+u,g=a*d,p=r*c+m,x=r*d,w=o*c+u,b=o*d,y=l*c+m,k=l*d,v=this.offset;v[0]=f-x,v[1]=p+g,v[2]=f-k,v[3]=y+g,v[4]=w-k,v[5]=y+b,v[6]=w-x,v[7]=p+b,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,n){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,a=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=a[0],m=a[1],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=n,u=a[2],m=a[3],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=n,u=a[4],m=a[5],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o,s+=n,u=a[6],m=a[7],e[s]=u*l+m*h+r,e[s+1]=u*c+m*d+o}copy(){let e=new t(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,o.arrayCopy(this.uvs,0,e.uvs,0,8),o.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=null!=this.sequence?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Yt=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let n=s.regions;for(let i=0,a=n.length;i<a;i++){let a=s.getPath(e,i),r=this.atlas.findRegion(a);if(null==r)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");n[i]=r}}newRegionAttachment(t,e,s,n){let i=new Ft(e,s);if(null!=n)this.loadSequence(e,s,n);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,n){let i=new It(e,s);if(null!=n)this.loadSequence(e,s,n);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 pt(e)}newPathAttachment(t,e){return new Tt(e)}newPointAttachment(t,e){return new Mt(e)}newClippingAttachment(t,e){return new xt(e)}},Pt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new n;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}},Xt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Xt||{}),Bt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,n,a,r,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=n,this.ascaleY=a,this.ashearX=r,this.ashearY=o;let l=this.parent;if(!l){let l=this.skeleton;const h=l.scaleX,c=l.scaleY,d=(s+r)*i.degRad,u=(s+90+o)*i.degRad;return this.a=Math.cos(d)*n*h,this.b=Math.cos(u)*a*h,this.c=Math.sin(d)*n*c,this.d=Math.sin(u)*a*c,this.worldX=t*h+l.x,void(this.worldY=e*c+l.y)}let h=l.a,c=l.b,d=l.c,u=l.d;switch(this.worldX=h*t+c*e+l.worldX,this.worldY=d*t+u*e+l.worldY,this.inherit){case 0:{const t=(s+r)*i.degRad,e=(s+90+o)*i.degRad,l=Math.cos(t)*n,m=Math.cos(e)*a,f=Math.sin(t)*n,g=Math.sin(e)*a;return this.a=h*l+c*f,this.b=h*m+c*g,this.c=d*l+u*f,void(this.d=d*m+u*g)}case 1:{const t=(s+r)*i.degRad,e=(s+90+o)*i.degRad;this.a=Math.cos(t)*n,this.b=Math.cos(e)*a,this.c=Math.sin(t)*n,this.d=Math.sin(e)*a;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;h*=t,d*=e;let l=h*h+d*d,m=0;l>1e-4?(l=Math.abs(h*u*e-c*t*d)/l,c=d*l,u=h*l,m=Math.atan2(d,h)*i.radDeg):(h=0,d=0,m=90-Math.atan2(u,c)*i.radDeg);const f=(s+r-m)*i.degRad,g=(s+o-m+90)*i.degRad,p=Math.cos(f)*n,x=Math.cos(g)*a,w=Math.sin(f)*n,b=Math.sin(g)*a;this.a=h*p-c*w,this.b=h*x-c*b,this.c=d*p+u*w,this.d=d*x+u*b;break}case 3:case 4:{s*=i.degRad;const t=Math.cos(s),e=Math.sin(s);let l=(h*t+c*e)/this.skeleton.scaleX,m=(d*t+u*e)/this.skeleton.scaleY,f=Math.sqrt(l*l+m*m);f>1e-5&&(f=1/f),l*=f,m*=f,f=Math.sqrt(l*l+m*m),3==this.inherit&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(f=-f),s=Math.PI/2+Math.atan2(m,l);const g=Math.cos(s)*f,p=Math.sin(s)*f;r*=i.degRad,o=(90+o)*i.degRad;const x=Math.cos(r)*n,w=Math.cos(o)*a,b=Math.sin(r)*n,y=Math.sin(o)*a;this.a=l*x+g*b,this.b=l*w+g*y,this.c=m*x+p*b,this.d=m*w+p*y;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)*i.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)*i.radDeg);let e,s,n,a,r=t.a,o=t.b,l=t.c,h=t.d,c=1/(r*h-o*l),d=h*c,u=o*c,m=l*c,f=r*c,g=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=g*d-p*u,this.ay=p*f-g*m,1==this.inherit)e=this.a,s=this.b,n=this.c,a=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(r*h-o*l)/(r*r+l*l);o=-l*this.skeleton.scaleX*t/this.skeleton.scaleY,h=r*this.skeleton.scaleY*t/this.skeleton.scaleX,c=1/(r*h-o*l),d=h*c,u=o*c;break}case 3:case 4:let t=i.cosDeg(this.rotation),e=i.sinDeg(this.rotation);r=(r*t+o*e)/this.skeleton.scaleX,l=(l*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+l*l);s>1e-5&&(s=1/s),r*=s,l*=s,s=Math.sqrt(r*r+l*l),3==this.inherit&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let n=i.PI/2+Math.atan2(l,r);o=Math.cos(n)*s,h=Math.sin(n)*s,c=1/(r*h-o*l),d=h*c,u=o*c,m=l*c,f=r*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,n=f*this.c-m*this.a,a=f*this.d-m*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+n*n),this.ascaleX>1e-4){let t=e*a-s*n;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+n*a,t)*i.radDeg,this.arotation=Math.atan2(n,e)*i.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+a*a),this.ashearY=0,this.arotation=90-Math.atan2(a,s)*i.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*i.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*i.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,n=t.y-this.worldY;return t.x=s*this.d*e-n*this.b*e,t.y=n*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=i.sinDeg(t),s=i.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*i.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=i.sinDeg(t),s=i.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*i.radDeg}rotateWorld(t){t*=i.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,a=this.b;this.a=s*n-e*this.c,this.b=s*a-e*this.d,this.c=e*n+s*this.c,this.d=e*a+s*this.d}},Et=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Rt=class{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,n=new Uint8Array(s),i=0;i<s;i++)n[i]=e.charCodeAt(i);return n}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 n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",t,!0);let i=()=>{this.finish(t,n.status,n.responseText)};n.onload=i,n.onerror=i,n.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 n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer";let i=()=>{this.finish(t,n.status,n.response)};n.onload=()=>{200==n.status||0==n.status?this.finish(t,200,new Uint8Array(n.response)):i()},n.onerror=i,n.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){let n=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=n.length;t<e;t+=2)n[t].apply(null,i)}},Dt=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Vt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Lt=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(n)}let 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,n,a,r,o){let l=t.parent;if(!l)throw new Error("IK bone must have parent.");let h=l.a,c=l.b,d=l.c,u=l.d,m=-t.ashearX-t.arotation,f=0,g=0;switch(t.inherit){case 1:f=(e-t.worldX)*i.signum(t.skeleton.scaleX),g=(s-t.worldY)*i.signum(t.skeleton.scaleY);break;case 2:let n=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),a=h/t.skeleton.scaleX,r=d/t.skeleton.scaleY;c=-r*n*t.skeleton.scaleX,u=a*n*t.skeleton.scaleY,m+=Math.atan2(r,a)*i.radDeg;default:let o=e-l.worldX,p=s-l.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(f=0,g=0):(f=(o*u-p*c)/x-t.ax,g=(p*h-o*d)/x-t.ay)}m+=Math.atan2(g,f)*i.radDeg,t.ascaleX<0&&(m+=180),m>180?m-=360:m<-180&&(m+=360);let p=t.ascaleX,x=t.ascaleY;if(n||a){switch(t.inherit){case 3:case 4:f=e-t.worldX,g=s-t.worldY}const i=t.data.length*p;if(i>1e-4){const t=f*f+g*g;if(n&&t<i*i||a&&t>i*i){const e=(Math.sqrt(t)/i-1)*o+1;p*=e,r&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*o,p,x,t.ashearX,t.ashearY)}apply2(t,e,s,n,a,r,o,l,h){if(0!=t.inherit||0!=e.inherit)return;let c=t.ax,d=t.ay,u=t.ascaleX,m=t.ascaleY,f=u,g=m,p=e.ascaleX,x=0,w=0,b=0;u<0?(u=-u,x=180,b=-1):(x=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,w=180):w=0;let y=e.ax,k=0,v=0,S=0,C=t.a,A=t.b,I=t.c,T=t.d,M=Math.abs(u-m)<=1e-4;!M||r?(k=0,v=C*y+t.worldX,S=I*y+t.worldY):(k=e.ay,v=C*y+A*k+t.worldX,S=I*y+T*k+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,A=F.b,I=F.c,T=F.d;let Y=C*T-A*I,P=v-F.worldX,X=S-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let B,E,R=(P*T-X*A)*Y-c,D=(X*C-P*I)*Y-d,V=Math.sqrt(R*R+D*D),L=e.data.length*p;if(V<1e-4)return this.apply1(t,s,n,!1,r,!1,h),void e.updateWorldTransformWith(y,k,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);P=s-F.worldX,X=n-F.worldY;let _=(P*T-X*A)*Y-c,N=(X*C-P*I)*Y-d,O=_*_+N*N;if(0!=l){l*=u*(p+1)*.5;let t=Math.sqrt(O),e=t-V-L*u+l;if(e>0){let s=Math.min(1,e/(2*l))-1;s=(e-l*(1-s*s))/t,_-=s*_,N-=s*N,O=_*_+N*N}}t:if(M){L*=u;let t=(O-V*V-L*L)/(2*V*L);t<-1?(t=-1,E=Math.PI*a):t>1?(t=1,E=0,r&&(C=(Math.sqrt(O)/(V+L)-1)*h+1,f*=C,o&&(g*=C))):E=Math.acos(t)*a,C=V+L*t,A=L*Math.sin(E),B=Math.atan2(N*C-_*A,_*C+N*A)}else{C=u*L,A=m*L;let t=C*C,e=A*A,s=Math.atan2(N,_);I=e*V*V+t*O-t*e;let n=-2*e*V,r=e-t;if(T=n*n-4*r*I,T>=0){let t=Math.sqrt(T);n<0&&(t=-t),t=.5*-(n+t);let e=t/r,i=I/t,o=Math.abs(e)<Math.abs(i)?e:i;if(e=O-o*o,e>=0){X=Math.sqrt(e)*a,B=s-Math.atan2(X,o),E=Math.atan2(X/m,(o-V)/u);break t}}let o=i.PI,l=V-C,h=l*l,c=0,d=0,f=V+C,g=f*f,p=0;I=-C*V/(t-e),I>=-1&&I<=1&&(I=Math.acos(I),P=C*Math.cos(I)+V,X=A*Math.sin(I),T=P*P+X*X,T<h&&(o=I,h=T,l=P,c=X),T>g&&(d=I,g=T,f=P,p=X)),O<=.5*(h+g)?(B=s-Math.atan2(c*a,l),E=o*a):(B=s-Math.atan2(p*a,f),E=d*a)}let U=Math.atan2(k,y)*b,q=t.arotation;B=(B-U)*i.radDeg+x-q,B>180?B-=360:B<-180&&(B+=360),t.updateWorldTransformWith(c,d,q+B*h,f,g,0,0),q=e.arotation,E=((E+U)*i.radDeg-e.ashearX)*b+w-q,E>180?E-=360:E<-180&&(E+=360),e.updateWorldTransformWith(y,k,q+E*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},_t=class extends Et{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)}},Nt=class extends Et{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Ot=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Ot||{}),Ut=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ut||{}),qt=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(qt||{}),Wt=class t{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,n=t.bones.length;s<n;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(n)}let 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(e){let s=this.target.getAttachment();if(!(s instanceof Tt))return;let n=this.mixRotate,a=this.mixX,r=this.mixY;if(0==n&&0==a&&0==r)return;let l=this.data,h=0==l.rotateMode,c=2==l.rotateMode,d=this.bones,u=d.length,m=h?u:u+1,f=o.setArraySize(this.spaces,m),g=c?this.lengths=o.setArraySize(this.lengths,u):[],p=this.spacing;switch(l.spacingMode){case 2:if(c)for(let t=0,e=m-1;t<e;t++){let e=d[t],s=e.data.length,n=s*e.a,i=s*e.c;g[t]=Math.sqrt(n*n+i*i)}o.arrayFill(f,1,m,p);break;case 3:let e=0;for(let s=0,n=m-1;s<n;){let n=d[s],i=n.data.length;if(i<t.epsilon)c&&(g[s]=0),f[++s]=p;else{let t=i*n.a,a=i*n.c,r=Math.sqrt(t*t+a*a);c&&(g[s]=r),f[++s]=r,e+=r}}if(e>0){e=m/e*p;for(let t=1;t<m;t++)f[t]*=e}break;default:let s=0==l.spacingMode;for(let e=0,n=m-1;e<n;){let n=d[e],i=n.data.length;if(i<t.epsilon)c&&(g[e]=0),f[++e]=p;else{let t=i*n.a,a=i*n.c,r=Math.sqrt(t*t+a*a);c&&(g[e]=r),f[++e]=(s?i+p:p)*r/i}}}let x=this.computeWorldPositions(s,m,h),w=x[0],b=x[1],y=l.offsetRotation,k=!1;if(0==y)k=1==l.rotateMode;else{k=!1;let t=this.target.bone;y*=t.a*t.d-t.b*t.c>0?i.degRad:-i.degRad}for(let t=0,e=3;t<u;t++,e+=3){let s=d[t];s.worldX+=(w-s.worldX)*a,s.worldY+=(b-s.worldY)*r;let o=x[e],l=x[e+1],u=o-w,m=l-b;if(c){let e=g[t];if(0!=e){let t=(Math.sqrt(u*u+m*m)/e-1)*n+1;s.a*=t,s.c*=t}}if(w=o,b=l,n>0){let a=s.a,r=s.b,o=s.c,l=s.d,c=0,d=0,g=0;if(c=h?x[e-1]:0==f[t+1]?x[e+2]:Math.atan2(m,u),c-=Math.atan2(o,a),k){d=Math.cos(c),g=Math.sin(c);let t=s.data.length;w+=(t*(d*a-g*o)-u)*n,b+=(t*(g*a+d*o)-m)*n}else c+=y;c>i.PI?c-=i.PI2:c<-i.PI&&(c+=i.PI2),c*=n,d=Math.cos(c),g=Math.sin(c),s.a=d*a-g*o,s.b=d*r-g*l,s.c=g*a+d*o,s.d=g*r+d*l}s.updateAppliedTransform()}}computeWorldPositions(e,s,n){let i=this.target,a=this.position,r=this.spaces,l=o.setArraySize(this.positions,3*s+2),h=this.world,c=e.closed,d=e.worldVerticesLength,u=d/6,m=t.NONE;if(!e.constantSpeed){let f=e.lengths;u-=c?1:2;let g,p=f[u];switch(1==this.data.positionMode&&(a*=p),this.data.spacingMode){case 2:g=p;break;case 3:g=p/s;break;default:g=1}h=o.setArraySize(this.world,8);for(let o=0,x=0,w=0;o<s;o++,x+=3){let s=r[o]*g;a+=s;let b=a;if(c)b%=p,b<0&&(b+=p),w=0;else{if(b<0){m!=t.BEFORE&&(m=t.BEFORE,e.computeWorldVertices(i,2,4,h,0,2)),this.addBeforePosition(b,h,0,l,x);continue}if(b>p){m!=t.AFTER&&(m=t.AFTER,e.computeWorldVertices(i,d-6,4,h,0,2)),this.addAfterPosition(b-p,h,0,l,x);continue}}for(;;w++){let t=f[w];if(!(b>t)){if(0==w)b/=t;else{let e=f[w-1];b=(b-e)/(t-e)}break}}w!=m&&(m=w,c&&w==u?(e.computeWorldVertices(i,d-4,4,h,0,2),e.computeWorldVertices(i,0,4,h,4,2)):e.computeWorldVertices(i,6*w+2,8,h,0,2)),this.addCurvePosition(b,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],l,x,n||o>0&&0==s)}return l}c?(d+=2,h=o.setArraySize(this.world,d),e.computeWorldVertices(i,2,d-4,h,0,2),e.computeWorldVertices(i,0,2,h,d-4,2),h[d-2]=h[0],h[d-1]=h[1]):(u--,d-=4,h=o.setArraySize(this.world,d),e.computeWorldVertices(i,2,d,h,0,2));let f,g=o.setArraySize(this.curves,u),p=0,x=h[0],w=h[1],b=0,y=0,k=0,v=0,S=0,C=0,A=0,I=0,T=0,M=0,F=0,Y=0,P=0,X=0;for(let t=0,e=2;t<u;t++,e+=6)b=h[e],y=h[e+1],k=h[e+2],v=h[e+3],S=h[e+4],C=h[e+5],A=.1875*(x-2*b+k),I=.1875*(w-2*y+v),T=.09375*(3*(b-k)-x+S),M=.09375*(3*(y-v)-w+C),F=2*A+T,Y=2*I+M,P=.75*(b-x)+A+.16666667*T,X=.75*(y-w)+I+.16666667*M,p+=Math.sqrt(P*P+X*X),P+=F,X+=Y,F+=T,Y+=M,p+=Math.sqrt(P*P+X*X),P+=F,X+=Y,p+=Math.sqrt(P*P+X*X),P+=F+T,X+=Y+M,p+=Math.sqrt(P*P+X*X),g[t]=p,x=S,w=C;switch(1==this.data.positionMode&&(a*=p),this.data.spacingMode){case 2:f=p;break;case 3:f=p/s;break;default:f=1}let B=this.segments,E=0;for(let t=0,e=0,i=0,o=0;t<s;t++,e+=3){let s=r[t]*f;a+=s;let u=a;if(c)u%=p,u<0&&(u+=p),i=0;else{if(u<0){this.addBeforePosition(u,h,0,l,e);continue}if(u>p){this.addAfterPosition(u-p,h,d-4,l,e);continue}}for(;;i++){let t=g[i];if(!(u>t)){if(0==i)u/=t;else{let e=g[i-1];u=(u-e)/(t-e)}break}}if(i!=m){m=i;let t=6*i;for(x=h[t],w=h[t+1],b=h[t+2],y=h[t+3],k=h[t+4],v=h[t+5],S=h[t+6],C=h[t+7],A=.03*(x-2*b+k),I=.03*(w-2*y+v),T=.006*(3*(b-k)-x+S),M=.006*(3*(y-v)-w+C),F=2*A+T,Y=2*I+M,P=.3*(b-x)+A+.16666667*T,X=.3*(y-w)+I+.16666667*M,E=Math.sqrt(P*P+X*X),B[0]=E,t=1;t<8;t++)P+=F,X+=Y,F+=T,Y+=M,E+=Math.sqrt(P*P+X*X),B[t]=E;P+=F,X+=Y,E+=Math.sqrt(P*P+X*X),B[8]=E,P+=F+T,X+=Y+M,E+=Math.sqrt(P*P+X*X),B[9]=E,o=0}for(u*=E;;o++){let t=B[o];if(!(u>t)){if(0==o)u/=t;else{let e=B[o-1];u=o+(u-e)/(t-e)}break}}this.addCurvePosition(.1*u,x,w,b,y,k,v,S,C,l,e,n||t>0&&0==s)}return l}addBeforePosition(t,e,s,n,i){let a=e[s],r=e[s+1],o=e[s+2]-a,l=e[s+3]-r,h=Math.atan2(l,o);n[i]=a+t*Math.cos(h),n[i+1]=r+t*Math.sin(h),n[i+2]=h}addAfterPosition(t,e,s,n,i){let a=e[s+2],r=e[s+3],o=a-e[s],l=r-e[s+1],h=Math.atan2(l,o);n[i]=a+t*Math.cos(h),n[i+1]=r+t*Math.sin(h),n[i+2]=h}addCurvePosition(t,e,s,n,i,a,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,n-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,w=3*x,b=f*w,y=w*t,k=e*p+n*b+a*y+o*m,v=s*p+i*b+r*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(i-s,n-e):Math.atan2(v-(s*g+i*x*2+r*u),k-(e*g+n*x*2+a*u)))}},zt=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,n=this.data.y>0,a=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,o=this.bone,l=o.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=t.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,p=-1,x=this.data.limit*h,w=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||n){if(s){const t=(this.ux-c)*m;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=c}if(n){const t=(this.uy-d)*m;this.yOffset+=t>w?w:t<-w?-w:t,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const e=this.massInverse*f,i=this.strength,a=this.wind*g*t.scaleX,r=this.gravity*g*t.scaleY;do{s&&(this.xVelocity+=(a-this.xOffset*i)*e,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),n&&(this.yVelocity-=(r+this.yOffset*i)*e,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f}while(u>=f)}s&&(o.worldX+=this.xOffset*e*this.data.x),n&&(o.worldY+=this.yOffset*e*this.data.y)}if(a||r){let t=Math.atan2(o.c,o.a),s=0,n=0,h=0,c=this.cx-o.worldX,d=this.cy-o.worldY;if(c>x?c=x:c<-x&&(c=-x),d>w?d=w:d<-w&&(d=-w),a){h=(this.data.rotate+this.data.shearX)*e;let a=Math.atan2(d+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(a-Math.ceil(a*i.invPI2-.5)*i.PI2)*m,a=this.rotateOffset*h+t,s=Math.cos(a),n=Math.sin(a),r&&(a=l*o.getWorldScaleX(),a>0&&(this.scaleOffset+=(c*s+d*n)*m/a))}else{s=Math.cos(t),n=Math.sin(t);const e=l*o.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+d*n)*m/e)}if(u=this.remaining,u>=f){-1==p&&(p=Math.pow(this.damping,60*f));const e=this.massInverse*f,i=this.strength,o=this.wind,c=jt.yDown?-this.gravity:this.gravity,d=l/g;for(;;)if(u-=f,r&&(this.scaleVelocity+=(o*s-c*n-this.scaleOffset*i)*e,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),a){if(this.rotateVelocity-=((o*n+c*s)*d+this.rotateOffset*i)*e,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const a=this.rotateOffset*h+t;s=Math.cos(a),n=Math.sin(a)}else if(u<f)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case 3:s&&(o.worldX+=this.xOffset*e*this.data.x),n&&(o.worldY+=this.yOffset*e*this.data.y)}if(a){let t=this.rotateOffset*e,s=0,n=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),n=Math.cos(e),i=o.b,o.b=n*i-s*o.d,o.d=s*i+n*o.d),e+=t*this.data.shearX,s=Math.sin(e),n=Math.cos(e),i=o.a,o.a=n*i-s*o.c,o.c=s*i+n*o.c}else t*=this.data.rotate,s=Math.sin(t),n=Math.cos(t),i=o.a,o.a=n*i-s*o.c,o.c=s*i+n*o.c,i=o.b,o.b=n*i-s*o.d,o.d=s*i+n*o.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;o.a*=t,o.c*=t}3!=t&&(this.tx=l*o.a,this.ty=l*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const n=s*i.degRad,a=Math.cos(n),r=Math.sin(n),o=this.cx-t,l=this.cy-e;this.translate(o*a-l*r-o,o*r+l*a-l)}},Gt=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new n,this.darkColor=t.darkColor?new n:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof d&&this.attachment instanceof d&&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}},$t=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new h;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 n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(n)}let 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,n=this.mixScaleX,a=this.mixScaleY,r=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,m=h*u-c*d>0?i.degRad:-i.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,n=x.c,a=x.d,r=Math.atan2(d,h)-Math.atan2(n,e)+f;r>i.PI?r-=i.PI2:r<-i.PI&&(r+=i.PI2),r*=t;let o=Math.cos(r),l=Math.sin(r);x.a=o*e-l*n,x.b=o*s-l*a,x.c=l*e+o*n,x.d=l*s+o*a}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=n){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*n)/t),x.a*=t,x.c*=t}if(0!=a){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*a)/t),x.b*=t,x.d*=t}if(r>0){let t=x.b,e=x.d,s=Math.atan2(e,t),n=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));n>i.PI?n-=i.PI2:n<-i.PI&&(n+=i.PI2),n=s+(n+g)*r;let a=Math.sqrt(t*t+e*e);x.b=Math.cos(n)*a,x.d=Math.sin(n)*a}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,a=this.mixScaleY,r=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,m=h*u-c*d>0?i.degRad:-i.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,n=x.c,a=x.d,r=Math.atan2(d,h)+f;r>i.PI?r-=i.PI2:r<-i.PI&&(r+=i.PI2),r*=t;let o=Math.cos(r),l=Math.sin(r);x.a=o*e-l*n,x.b=o*s-l*a,x.c=l*e+o*n,x.d=l*s+o*a}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*n+1;x.a*=t,x.c*=t}if(0!=a){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*a+1;x.b*=t,x.d*=t}if(r>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>i.PI?t-=i.PI2:t<-i.PI&&(t+=i.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-i.PI/2+g)*r;let n=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*n,x.d=Math.sin(t)*n}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,i=this.mixScaleY,a=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!=n&&0!=m&&(m=(m+(r.ascaleX-m+this.data.offsetScaleX)*n)/m),0!=i&&0!=f&&(f=(f+(r.ascaleY-f+this.data.offsetScaleY)*i)/f);let g=h.ashearY;0!=a&&(g+=(r.ashearY-g+this.data.offsetShearY)*a),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,i=this.mixScaleY,a=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)*n+1),f=h.ascaleY*((r.ascaleY-1+this.data.offsetScaleY)*i+1),g=h.ashearY+(r.ashearY+this.data.offsetShearY)*a;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},jt=class t{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 t.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,n=t.bones[e];if(n.parent){let t=this.bones[n.parent.index];s=new Bt(n,this,t),t.children.push(s)}else s=new Bt(n,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],n=this.bones[s.boneData.index],i=new Gt(s,n);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 Lt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new $t(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Wt(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new zt(s,this))}this.color=new n(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,n=this.pathConstraints,i=this.physicsConstraints,a=e.length,r=s.length,o=n.length,l=this.physicsConstraints.length,h=a+r+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<a;s++){let n=e[s];if(n.data.order==t){this.sortIkConstraint(n);continue t}}for(let e=0;e<r;e++){let n=s[e];if(n.data.order==t){this.sortTransformConstraint(n);continue t}}for(let e=0;e<o;e++){let s=n[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&&o.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,n=s[0];if(this.sortBone(n),1==s.length)this._updateCache.push(t),this.sortReset(n.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(n.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,n=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,n),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,n);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,n);let i=e.getAttachment();i instanceof Tt&&this.sortPathConstraintAttachmentWith(i,n);let a=t.bones,r=a.length;for(let t=0;t<r;t++)this.sortBone(a[t]);this._updateCache.push(t);for(let t=0;t<r;t++)this.sortReset(a[t].children);for(let t=0;t<r;t++)a[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 n=t.attachments[e];if(n)for(let t in n)this.sortPathConstraintAttachmentWith(n[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Tt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,n=s.length;e<n;){let n=s[e++];for(n+=e;e<n;)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,n=s.length;e<n;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let n=this.getRootBone();if(!n)throw new Error("Root bone must not be null.");let a=e.a,r=e.b,o=e.c,l=e.d;n.worldX=a*this.x+r*this.y+e.worldX,n.worldY=o*this.x+l*this.y+e.worldY;const h=(n.rotation+n.shearX)*i.degRad,c=(n.rotation+90+n.shearY)*i.degRad,d=Math.cos(h)*n.scaleX,u=Math.cos(c)*n.scaleY,m=Math.sin(h)*n.scaleX,f=Math.sin(c)*n.scaleY;n.a=(a*d+r*m)*this.scaleX,n.b=(a*u+r*f)*this.scaleX,n.c=(o*d+l*m)*this.scaleY,n.d=(o*u+l*f)*this.scaleY;let g=this._updateCache;for(let e=0,s=g.length;e<s;e++){let s=g[e];s!=n&&s.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,n=e.length;s<n;s++){let n=e[s];if(n.data.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.data.name==t)return n}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,n=e.length;s<n;s++){let n=e[s],i=n.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&n.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 n=0,i=s.length;n<i;n++){let i=s[n];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(n,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(t){let e=new h,s=new h;return this.getBounds(e,s,void 0,t),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(e,s,n=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let a=this.drawOrder,r=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let e=0,s=a.length;e<s;e++){let s=a[e];if(!s.bone.active)continue;let d=0,u=null,m=null,f=s.getAttachment();if(f instanceof Ft)d=8,u=o.setArraySize(n,d,0),f.computeWorldVertices(s,u,0,2),m=t.quadTriangles;else if(f instanceof It){let t=f;d=t.worldVerticesLength,u=o.setArraySize(n,d,0),t.computeWorldVertices(s,0,d,u,0,2),m=t.triangles}else if(f instanceof xt&&null!=i){i.clipStart(s,f);continue}if(u&&m){null!=i&&i.isClipping()&&(i.clipTriangles(u,m,m.length),u=i.clippedVertices,d=i.clippedVertices.length);for(let t=0,e=u.length;t<e;t+=2){let e=u[t],s=u[t+1];r=Math.min(r,e),l=Math.min(l,s),h=Math.max(h,e),c=Math.max(c,s)}}null!=i&&i.clipEndWithSlot(s)}null!=i&&i.clipEnd(),e.set(r,l),s.set(h-r,c-l)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let n=0,i=s.length;n<i;n++)s[n].translate(t,e)}physicsRotate(t,e,s){const n=this.physicsConstraints;for(let i=0,a=n.length;i<a;i++)n[i].rotate(t,e,s)}},Ht=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(Ht||{}),Jt=class extends Et{_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)}},Kt=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}},Qt=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Zt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new n(.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 n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],n=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){n=!0;break}n||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],n=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){n=!0;break}n||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],n=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){n=!0;break}n||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],n=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){n=!0;break}n||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 It?(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 n in s){let i=s[n];i&&t.push(new Qt(e,n,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let n in s){let i=s[n];i&&e.push(new Qt(t,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){let i=t.slots[n],a=i.getAttachment();if(a&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(a==t[e]){let t=this.getAttachment(s,e);t&&i.setAttachment(t);break}}}s++}}},te=class{index=0;name;boneData;color=new n(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},ee=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(ee||{}),se=class extends Et{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)}},ne=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Kt;s.name="";let i=new ie(t),a=i.readInt32(),r=i.readInt32();s.hash=0==r&&0==a?null:r.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 l=i.readBoolean();l&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let h=0;h=i.readInt(!0);for(let t=0;t<h;t++){let t=i.readString();if(!t)throw new Error("String in string table must not be null.");i.strings.push(t)}h=i.readInt(!0);for(let t=0;t<h;t++){let a=i.readString();if(!a)throw new Error("Bone name must not be null.");let r=0==t?null:s.bones[i.readInt(!0)],o=new Pt(t,a,r);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(),l&&(n.rgba8888ToColor(o.color,i.readInt32()),o.icon=i.readString()??void 0,o.visible=i.readBoolean()),s.bones.push(o)}h=i.readInt(!0);for(let t=0;t<h;t++){let e=i.readString();if(!e)throw new Error("Slot name must not be null.");let a=s.bones[i.readInt(!0)],r=new te(t,e,a);n.rgba8888ToColor(r.color,i.readInt32());let o=i.readInt32();-1!=o&&n.rgb888ToColor(r.darkColor=new n,o),r.attachmentName=i.readStringRef(),r.blendMode=i.readInt(!0),l&&(r.visible=i.readBoolean()),s.slots.push(r)}h=i.readInt(!0);for(let t,n=0;n<h;n++){let n=i.readString();if(!n)throw new Error("IK constraint data name must not be null.");let a=new _t(n);a.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[i.readInt(!0)]);a.target=s.bones[i.readInt(!0)];let r=i.readByte();a.skinRequired=!!(1&r),a.bendDirection=2&r?1:-1,a.compress=!!(4&r),a.stretch=!!(8&r),a.uniform=!!(16&r),32&r&&(a.mix=64&r?i.readFloat():1),128&r&&(a.softness=i.readFloat()*e),s.ikConstraints.push(a)}h=i.readInt(!0);for(let t,n=0;n<h;n++){let n=i.readString();if(!n)throw new Error("Transform constraint data name must not be null.");let a=new se(n);a.order=i.readInt(!0),t=i.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[i.readInt(!0)]);a.target=s.bones[i.readInt(!0)];let r=i.readByte();a.skinRequired=!!(1&r),a.local=!!(2&r),a.relative=!!(4&r),8&r&&(a.offsetRotation=i.readFloat()),16&r&&(a.offsetX=i.readFloat()*e),32&r&&(a.offsetY=i.readFloat()*e),64&r&&(a.offsetScaleX=i.readFloat()),128&r&&(a.offsetScaleY=i.readFloat()),r=i.readByte(),1&r&&(a.offsetShearY=i.readFloat()),2&r&&(a.mixRotate=i.readFloat()),4&r&&(a.mixX=i.readFloat()),8&r&&(a.mixY=i.readFloat()),16&r&&(a.mixScaleX=i.readFloat()),32&r&&(a.mixScaleY=i.readFloat()),64&r&&(a.mixShearY=i.readFloat()),s.transformConstraints.push(a)}h=i.readInt(!0);for(let t,n=0;n<h;n++){let n=i.readString();if(!n)throw new Error("Path constraint data name must not be null.");let a=new Nt(n);a.order=i.readInt(!0),a.skinRequired=i.readBoolean(),t=i.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[i.readInt(!0)]);a.target=s.slots[i.readInt(!0)];const r=i.readByte();a.positionMode=1&r,a.spacingMode=r>>1&3,a.rotateMode=r>>3&3,128&r&&(a.offsetRotation=i.readFloat()),a.position=i.readFloat(),0==a.positionMode&&(a.position*=e),a.spacing=i.readFloat(),0!=a.spacingMode&&1!=a.spacingMode||(a.spacing*=e),a.mixRotate=i.readFloat(),a.mixX=i.readFloat(),a.mixY=i.readFloat(),s.pathConstraints.push(a)}h=i.readInt(!0);for(let t=0;t<h;t++){const t=i.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const n=new Jt(t);n.order=i.readInt(!0),n.bone=s.bones[i.readInt(!0)];let a=i.readByte();n.skinRequired=!!(1&a),2&a&&(n.x=i.readFloat()),4&a&&(n.y=i.readFloat()),8&a&&(n.rotate=i.readFloat()),16&a&&(n.scaleX=i.readFloat()),32&a&&(n.shearX=i.readFloat()),n.limit=(64&a?i.readFloat():5e3)*e,n.step=1/i.readUnsignedByte(),n.inertia=i.readFloat(),n.strength=i.readFloat(),n.damping=i.readFloat(),n.massInverse=128&a?i.readFloat():1,n.wind=i.readFloat(),n.gravity=i.readFloat(),a=i.readByte(),1&a&&(n.inertiaGlobal=!0),2&a&&(n.strengthGlobal=!0),4&a&&(n.dampingGlobal=!0),8&a&&(n.massGlobal=!0),16&a&&(n.windGlobal=!0),32&a&&(n.gravityGlobal=!0),64&a&&(n.mixGlobal=!0),n.mix=128&a?i.readFloat():1,s.physicsConstraints.push(n)}let c=this.readSkin(i,s,!0,l);c&&(s.defaultSkin=c,s.skins.push(c));{let t=s.skins.length;for(o.setArraySize(s.skins,h=t+i.readInt(!0));t<h;t++){let e=this.readSkin(i,s,!1,l);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}h=this.linkedMeshes.length;for(let t=0;t<h;t++){let e=this.linkedMeshes[t];const n=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=n.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,h=i.readInt(!0);for(let t=0;t<h;t++){let t=i.readString();if(!t)throw new Error("Event data name must not be null");let e=new Vt(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)}h=i.readInt(!0);for(let t=0;t<h;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,r=0;if(s){if(r=t.readInt(!0),0==r)return null;a=new Zt("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");a=new Zt(s),i&&n.rgba8888ToColor(a.color,t.readInt32()),a.bones.length=t.readInt(!0);for(let s=0,n=a.bones.length;s<n;s++)a.bones[s]=e.bones[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,n=t.readInt(!0);s<n;s++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,n=t.readInt(!0);s<n;s++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,n=t.readInt(!0);s<n;s++)a.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;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,r){let l=this.scale,h=t.readByte();const c=8&h?t.readStringRef():a;if(!c)throw new Error("Attachment name must not be null");switch(7&h){case 0:{let e=16&h?t.readStringRef():null;const i=32&h?t.readInt32():4294967295,a=64&h?this.readSequence(t):null;let r=128&h?t.readFloat():0,o=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat();e||(e=c);let p=this.attachmentLoader.newRegionAttachment(s,c,e,a);return p?(p.path=e,p.x=o*l,p.y=d*l,p.scaleX=u,p.scaleY=m,p.rotation=r,p.width=f*l,p.height=g*l,n.rgba8888ToColor(p.color,i),p.sequence=a,null==a&&p.updateRegion(),p):null}case 1:{let e=this.readVertices(t,!!(16&h)),i=r?t.readInt32():0,a=this.attachmentLoader.newBoundingBoxAttachment(s,c);return a?(a.worldVerticesLength=e.length,a.vertices=e.vertices,a.bones=e.bones,r&&n.rgba8888ToColor(a.color,i),a):null}case 2:{let e=16&h?t.readStringRef():c;const i=32&h?t.readInt32():4294967295,a=64&h?this.readSequence(t):null,o=t.readInt(!0),d=this.readVertices(t,!!(128&h)),u=this.readFloatArray(t,d.length,1),m=this.readShortArray(t,3*(d.length-o-2));let f=[],g=0,p=0;r&&(f=this.readShortArray(t,t.readInt(!0)),g=t.readFloat(),p=t.readFloat()),e||(e=c);let x=this.attachmentLoader.newMeshAttachment(s,c,e,a);return x?(x.path=e,n.rgba8888ToColor(x.color,i),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=m,x.regionUVs=u,null==a&&x.updateRegion(),x.hullLength=o<<1,x.sequence=a,r&&(x.edges=f,x.width=g*l,x.height=p*l),x):null}case 3:{const e=16&h?t.readStringRef():c;if(null==e)throw new Error("Path of linked mesh must not be null");const a=32&h?t.readInt32():4294967295,o=64&h?this.readSequence(t):null,d=!!(128&h),u=t.readInt(!0),m=t.readStringRef();let f=0,g=0;r&&(f=t.readFloat(),g=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,c,e,o);return p?(p.path=e,n.rgba8888ToColor(p.color,a),p.sequence=o,r&&(p.width=f*l,p.height=g*l),this.linkedMeshes.push(new ae(p,u,i,m,d)),p):null}case 4:{const e=!!(16&h),i=!!(32&h),a=this.readVertices(t,!!(64&h)),d=o.newArray(a.length/6,0);for(let e=0,s=d.length;e<s;e++)d[e]=t.readFloat()*l;const u=r?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,c);return m?(m.closed=e,m.constantSpeed=i,m.worldVerticesLength=a.length,m.vertices=a.vertices,m.bones=a.bones,m.lengths=d,r&&n.rgba8888ToColor(m.color,u),m):null}case 5:{const e=t.readFloat(),i=t.readFloat(),a=t.readFloat(),o=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,c);return h?(h.x=i*l,h.y=a*l,h.rotation=e,r&&n.rgba8888ToColor(h.color,o),h):null}case 6:{const i=t.readInt(!0),a=this.readVertices(t,!!(16&h));let o=r?t.readInt32():0,l=this.attachmentLoader.newClippingAttachment(s,c);return l?(l.endSlot=e.slots[i],l.worldVerticesLength=a.length,l.vertices=a.vertices,l.bones=a.bones,r&&n.rgba8888ToColor(l.color,o),l):null}}return null}readSequence(t){let e=new u(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,n=t.readInt(!0),i=new re;if(i.length=n<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let a=new Array,r=new Array;for(let e=0;e<n;e++){let e=t.readInt(!0);r.push(e);for(let n=0;n<e;n++)r.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return i.vertices=o.toFloatArray(a),i.bones=r,i}readFloatArray(t,e,s){let n=new Array(e);if(1==s)for(let s=0;s<e;s++)n[s]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){let s=new Array(e);for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let n=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),a=i-1;switch(s){case ke:{let s=new _(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());n.push(s);break}case ve:{let s=t.readInt(!0),r=new E(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!=a;e++){let n=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Ne:r.setStepped(e);break;case Oe:he(t,r,s++,e,0,o,n,l,i,1),he(t,r,s++,e,1,o,n,h,a,1),he(t,r,s++,e,2,o,n,c,u,1),he(t,r,s++,e,3,o,n,d,m,1)}o=n,l=i,h=a,c=u,d=m}n.push(r);break}case Se:{let s=t.readInt(!0),r=new R(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!=a;e++){let n=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Ne:r.setStepped(e);break;case Oe:he(t,r,s++,e,0,o,n,l,i,1),he(t,r,s++,e,1,o,n,h,a,1),he(t,r,s++,e,2,o,n,c,d,1)}o=n,l=i,h=a,c=d}n.push(r);break}case Ce:{let s=t.readInt(!0),r=new V(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!=a;e++){let n=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Ne:r.setStepped(e);break;case Oe:he(t,r,s++,e,0,o,n,l,i,1),he(t,r,s++,e,1,o,n,h,a,1),he(t,r,s++,e,2,o,n,c,g,1),he(t,r,s++,e,3,o,n,d,p,1),he(t,r,s++,e,4,o,n,u,x,1),he(t,r,s++,e,5,o,n,m,w,1),he(t,r,s++,e,6,o,n,f,b,1)}o=n,l=i,h=a,c=g,d=p,u=x,m=w,f=b}n.push(r);break}case Ae:{let s=t.readInt(!0),r=new L(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!=a;e++){let n=t.readFloat(),i=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Ne:r.setStepped(e);break;case Oe:he(t,r,s++,e,0,o,n,l,i,1),he(t,r,s++,e,1,o,n,h,a,1),he(t,r,s++,e,2,o,n,c,f,1),he(t,r,s++,e,3,o,n,d,g,1),he(t,r,s++,e,4,o,n,u,p,1),he(t,r,s++,e,5,o,n,m,x,1)}o=n,l=i,h=a,c=f,d=g,u=p,m=x}n.push(r);break}case Ie:{let s=new D(i,t.readInt(!0),e),r=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,n=0;s.setFrame(e,r,o),e!=a;e++){let i=t.readFloat(),a=t.readUnsignedByte()/255;switch(t.readByte()){case Ne:s.setStepped(e);break;case Oe:he(t,s,n++,e,0,r,i,o,a,1)}r=i,o=a}n.push(s)}}}}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);if(s==ye){let s=new B(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat(),t.readByte());n.push(s);continue}let r=t.readInt(!0);switch(s){case ce:n.push(oe(t,new S(a,r,e),1));break;case de:n.push(le(t,new C(a,r,e),i));break;case ue:n.push(oe(t,new A(a,r,e),i));break;case me:n.push(oe(t,new I(a,r,e),i));break;case fe:n.push(le(t,new T(a,r,e),1));break;case ge:n.push(oe(t,new M(a,r,e),1));break;case pe:n.push(oe(t,new F(a,r,e),1));break;case xe:n.push(le(t,new Y(a,r,e),1));break;case we:n.push(oe(t,new P(a,r,e),1));break;case be:n.push(oe(t,new X(a,r,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),a=s-1,r=new q(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!=a;e++){o=t.readByte();const n=t.readFloat(),a=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,n,h,a,1),he(t,r,s++,e,1,l,n,c,d,i)),l=n,h=a,c=d}n.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,a=new W(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;a.setFrame(e,r,o,l,h,c,d,u),e!=i;e++){let n=t.readFloat(),i=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Ne:a.setStepped(e);break;case Oe:he(t,a,s++,e,0,r,n,o,i,1),he(t,a,s++,e,1,r,n,l,m,1),he(t,a,s++,e,2,r,n,h,f,1),he(t,a,s++,e,3,r,n,c,g,1),he(t,a,s++,e,4,r,n,d,p,1),he(t,a,s++,e,5,r,n,u,x,1)}r=n,o=i,l=m,h=f,c=g,d=p,u=x}n.push(a)}for(let e=0,a=t.readInt(!0);e<a;e++){let e=t.readInt(!0),a=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 Fe:n.push(oe(t,new z(r,o,e),0==a.positionMode?i:1));break;case Ye:n.push(oe(t,new G(r,o,e),0==a.spacingMode||1==a.spacingMode?i:1));break;case Pe:let s=new $(r,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,n=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),a=t.readFloat(),r=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Ne:s.setStepped(e);break;case Oe:he(t,s,n++,e,0,l,i,h,a,1),he(t,s,n++,e,1,l,i,c,r,1),he(t,s,n++,e,2,l,i,d,o,1)}l=i,h=a,c=r,d=o}n.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==_e){const s=new st(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());n.push(s);continue}const a=t.readInt(!0);switch(s){case Xe:n.push(oe(t,new H(i,a,e),1));break;case Be:n.push(oe(t,new J(i,a,e),1));break;case Ee:n.push(oe(t,new K(i,a,e),1));break;case Re:n.push(oe(t,new Q(i,a,e),1));break;case De:n.push(oe(t,new Z(i,a,e),1));break;case Ve:n.push(oe(t,new tt(i,a,e),1));break;case Le:n.push(oe(t,new et(i,a,e),1))}}}for(let e=0,a=t.readInt(!0);e<a;e++){let e=s.skins[t.readInt(!0)];for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readInt(!0);for(let a=0,r=t.readInt(!0);a<r;a++){let a=t.readStringRef();if(!a)throw new Error("attachmentName must not be null.");let r=e.getAttachment(s,a),l=t.readByte(),h=t.readInt(!0),c=h-1;switch(l){case Te:{let e=r,a=e.bones,l=e.vertices,d=a?l.length/3*2:l.length,u=t.readInt(!0),m=new N(h,u,s,e),f=t.readFloat();for(let e=0,s=0;;e++){let n,r=t.readInt(!0);if(0==r)n=a?o.newFloatArray(d):l;else{n=o.newFloatArray(d);let e=t.readInt(!0);if(r+=e,1==i)for(let s=e;s<r;s++)n[s]=t.readFloat();else for(let s=e;s<r;s++)n[s]=t.readFloat()*i;if(!a)for(let t=0,e=n.length;t<e;t++)n[t]+=l[t]}if(m.setFrame(e,f,n),e==c)break;let h=t.readFloat();switch(t.readByte()){case Ne:m.setStepped(e);break;case Oe:he(t,m,s++,e,0,f,h,0,1,1)}f=h}n.push(m);break}case Me:{let e=new nt(h,s,r);for(let s=0;s<h;s++){let n=t.readFloat(),i=t.readInt32();e.setFrame(s,n,f[15&i],i>>4,t.readFloat())}n.push(e);break}}}}}let a=t.readInt(!0);if(a>0){let e=new U(a),i=s.slots.length;for(let s=0;s<a;s++){let n=t.readFloat(),a=t.readInt(!0),r=o.newArray(i,0);for(let t=i-1;t>=0;t--)r[t]=-1;let l=o.newArray(i-a,0),h=0,c=0;for(let e=0;e<a;e++){let e=t.readInt(!0);for(;h!=e;)l[c++]=h++;r[h+t.readInt(!0)]=h++}for(;h<i;)l[c++]=h++;for(let t=i-1;t>=0;t--)-1==r[t]&&(r[t]=l[--c]);e.setFrame(s,n,r)}n.push(e)}let r=t.readInt(!0);if(r>0){let e=new O(r);for(let n=0;n<r;n++){let i=t.readFloat(),a=s.events[t.readInt(!0)],r=new Dt(i,a);r.intValue=t.readInt(!1),r.floatValue=t.readFloat(),r.stringValue=t.readString(),null==r.stringValue&&(r.stringValue=a.stringValue),r.data.audioPath&&(r.volume=t.readFloat(),r.balance=t.readFloat()),e.setFrame(n,r)}n.push(e)}let l=0;for(let t=0,e=n.length;t<e;t++)l=Math.max(l,n[t].getDuration());return new g(e,n,l)}},ie=class{constructor(t,e=new Array,s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}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()}},ae=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,n,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=n,this.inheritTimeline=i}},re=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function oe(t,e,s){let n=t.readFloat(),i=t.readFloat()*s;for(let a=0,r=0,o=e.getFrameCount()-1;e.setFrame(a,n,i),a!=o;a++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Ne:e.setStepped(a);break;case Oe:he(t,e,r++,a,0,n,o,i,l,s)}n=o,i=l}return e}function le(t,e,s){let n=t.readFloat(),i=t.readFloat()*s,a=t.readFloat()*s;for(let r=0,o=0,l=e.getFrameCount()-1;e.setFrame(r,n,i,a),r!=l;r++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Ne:e.setStepped(r);break;case Oe:he(t,e,o++,r,0,n,l,i,h,s),he(t,e,o++,r,1,n,l,a,c,s)}n=l,i=h,a=c}return e}function he(t,e,s,n,i,a,r,o,l,h){e.setBezier(s,n,i,a,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,r,l)}var ce=0,de=1,ue=2,me=3,fe=4,ge=5,pe=6,xe=7,we=8,be=9,ye=10,ke=0,ve=1,Se=2,Ce=3,Ae=4,Ie=5,Te=0,Me=1,Fe=0,Ye=1,Pe=2,Xe=0,Be=1,Ee=2,Re=4,De=5,Ve=6,Le=7,_e=8,Ne=1,Oe=2,Ue=class{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,n=this.polygons,i=this.polygonPool,a=t.slots,r=a.length;s.length=0,i.freeAll(n),n.length=0;for(let t=0;t<r;t++){let e=a[t];if(!e.bone.active)continue;let r=e.getAttachment();if(r instanceof pt){let t=r;s.push(t);let a=i.obtain();a.length!=t.worldVerticesLength&&(a=o.newFloatArray(t.worldVerticesLength)),n.push(a),t.computeWorldVertices(e,0,t.worldVerticesLength,a,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,n=Number.NEGATIVE_INFINITY,i=this.polygons;for(let a=0,r=i.length;a<r;a++){let r=i[a],o=r;for(let i=0,a=r.length;i<a;i+=2){let a=o[i],r=o[i+1];t=Math.min(t,a),e=Math.min(e,r),s=Math.max(s,a),n=Math.max(n,r)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){let i=this.minX,a=this.minY,r=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=a&&n<=a||t>=r&&s>=r||e>=o&&n>=o)return!1;let l=(n-e)/(s-t),h=l*(i-t)+e;if(h>a&&h<o)return!0;if(h=l*(r-t)+e,h>a&&h<o)return!0;let c=(a-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 n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){let n=t,i=t.length,a=i-2,r=!1;for(let t=0;t<i;t+=2){let i=n[t+1],o=n[a+1];if(i<s&&o>=s||o<s&&i>=s){let l=n[t];l+(s-i)/(o-i)*(n[a]-l)<e&&(r=!r)}a=t}return r}intersectsSegment(t,e,s,n){let i=this.polygons;for(let a=0,r=i.length;a<r;a++)if(this.intersectsSegmentPolygon(i[a],t,e,s,n))return this.boundingBoxes[a];return null}intersectsSegmentPolygon(t,e,s,n,i){let a=t,r=t.length,o=e-n,l=s-i,h=e*i-s*n,c=a[r-2],d=a[r-1];for(let t=0;t<r;t+=2){let r=a[t],u=a[t+1],m=c*u-d*r,f=c-r,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=r||x>=r&&x<=c)&&(x>=e&&x<=n||x>=n&&x<=e)){let t=(h*g-l*m)/p;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}},qe=class t{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(e){let s=e,n=e.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<n;t++)i[t]=t;let a=this.isConcaveArray;a.length=0;for(let e=0,r=n;e<r;++e)a[e]=t.isConcave(e,n,s,i);let r=this.triangles;for(r.length=0;n>3;){let e=n-1,o=0,l=1;for(;;){t:if(!a[o]){let r=i[e]<<1,h=i[o]<<1,c=i[l]<<1,d=s[r],u=s[r+1],m=s[h],f=s[h+1],g=s[c],p=s[c+1];for(let r=(l+1)%n;r!=e;r=(r+1)%n){if(!a[r])continue;let e=i[r]<<1,n=s[e],o=s[e+1];if(t.positiveArea(g,p,d,u,n,o)&&t.positiveArea(d,u,m,f,n,o)&&t.positiveArea(m,f,g,p,n,o))break t}break}if(0==l){do{if(!a[o])break;o--}while(o>0);break}e=o,o=l,l=(l+1)%n}r.push(i[(n+o-1)%n]),r.push(i[o]),r.push(i[(o+1)%n]),i.splice(o,1),a.splice(o,1),n--;let h=(n+o-1)%n,c=o==n?0:o;a[h]=t.isConcave(h,n,s,i),a[c]=t.isConcave(c,n,s,i)}return 3==n&&(r.push(i[2]),r.push(i[0]),r.push(i[1])),r}decompose(e,s){let n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;let r=this.polygonIndicesPool.obtain();r.length=0;let o=this.polygonPool.obtain();o.length=0;let l=-1,h=0;for(let e=0,c=s.length;e<c;e+=3){let c=s[e]<<1,d=s[e+1]<<1,u=s[e+2]<<1,m=n[c],f=n[c+1],g=n[d],p=n[d+1],x=n[u],w=n[u+1],b=!1;if(l==c){let e=o.length-4,s=t.winding(o[e],o[e+1],o[e+2],o[e+3],x,w),n=t.winding(x,w,o[0],o[1],o[2],o[3]);s==h&&n==h&&(o.push(x),o.push(w),r.push(u),b=!0)}b||(o.length>0?(i.push(o),a.push(r)):(this.polygonPool.free(o),this.polygonIndicesPool.free(r)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(f),o.push(g),o.push(p),o.push(x),o.push(w),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(c),r.push(d),r.push(u),h=t.winding(m,f,g,p,x,w),l=c)}o.length>0&&(i.push(o),a.push(r));for(let e=0,s=i.length;e<s;e++){if(r=a[e],0==r.length)continue;let n=r[0],l=r[r.length-1];o=i[e];let h=o.length-4,c=o[h],d=o[h+1],u=o[h+2],m=o[h+3],f=o[0],g=o[1],p=o[2],x=o[3],w=t.winding(c,d,u,m,f,g);for(let h=0;h<s;h++){if(h==e)continue;let s=a[h];if(3!=s.length)continue;let b=s[0],y=s[1],k=s[2],v=i[h],S=v[v.length-2],C=v[v.length-1];if(b!=n||y!=l)continue;let A=t.winding(c,d,u,m,S,C),I=t.winding(S,C,f,g,p,x);A==w&&I==w&&(v.length=0,s.length=0,o.push(S),o.push(C),r.push(k),c=u,d=m,u=S,m=C,h=0)}}for(let t=i.length-1;t>=0;t--)o=i[t],0==o.length&&(i.splice(t,1),this.polygonPool.free(o),r=a[t],a.splice(t,1),this.polygonIndicesPool.free(r));return i}static isConcave(t,e,s,n){let i=n[(e+t-1)%e]<<1,a=n[t]<<1,r=n[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[a],s[a+1],s[r],s[r+1])}static positiveArea(t,e,s,n,i,a){return t*(a-n)+s*(e-a)+i*(n-e)>=0}static winding(t,e,s,n,i,a){let r=s-t,o=n-e;return i*o-a*r+r*e-t*o>=0?1:-1}},We=class t{triangulator=new qe;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let n=s.worldVerticesLength,i=o.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(e,0,n,i,0,2);let a=this.clippingPolygon;t.makeClockwise(a);let r=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a));for(let e=0,s=r.length;e<s;e++){let s=r[e];t.makeClockwise(s),s.push(s[0]),s.push(s[1])}return r.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,n,i,a,r,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=n,c=i,d=a,u=r,m=o):(l=e,h=s,c=n,d=i,u=a,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 n=this.clipOutput,i=this.clippedVertices,a=this.clippedTriangles,r=this.clippingPolygons,l=r.length,h=0;i.length=0,a.length=0;for(let c=0;c<s;c+=3){let s=e[c]<<1,d=t[s],u=t[s+1];s=e[c+1]<<1;let m=t[s],f=t[s+1];s=e[c+2]<<1;let g=t[s],p=t[s+1];for(let t=0;t<l;t++){let e=i.length;if(!this.clip(d,u,m,f,g,p,r[t],n)){let t=o.setArraySize(i,e+6);t[e]=d,t[e+1]=u,t[e+2]=m,t[e+3]=f,t[e+4]=g,t[e+5]=p,e=a.length;let s=o.setArraySize(a,e+3);s[e]=h,s[e+1]=h+1,s[e+2]=h+2,h+=3;break}{let t=n.length;if(0==t)continue;let s=t>>1,r=this.clipOutput,l=o.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=r[s],n=r[s+1];l[e]=t,l[e+1]=n}e=a.length;let c=o.setArraySize(a,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)c[e]=h,c[e+1]=h+t,c[e+2]=h+t+1;h+=s+1}}}}clipTrianglesRender(t,e,s,n,i,a,r){let l=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,m=r?12:8,f=0;h.length=0,c.length=0;for(let g=0;g<s;g+=3){let s=e[g]<<1,p=t[s],x=t[s+1],w=n[s],b=n[s+1];s=e[g+1]<<1;let y=t[s],k=t[s+1],v=n[s],S=n[s+1];s=e[g+2]<<1;let C=t[s],A=t[s+1],I=n[s],T=n[s+1];for(let t=0;t<u;t++){let e=h.length;if(!this.clip(p,x,y,k,C,A,d[t],l)){let t=o.setArraySize(h,e+3*m);t[e]=p,t[e+1]=x,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,r?(t[e+6]=w,t[e+7]=b,t[e+8]=a.r,t[e+9]=a.g,t[e+10]=a.b,t[e+11]=a.a,t[e+12]=y,t[e+13]=k,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=v,t[e+19]=S,t[e+20]=a.r,t[e+21]=a.g,t[e+22]=a.b,t[e+23]=a.a,t[e+24]=C,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]=T,t[e+32]=a.r,t[e+33]=a.g,t[e+34]=a.b,t[e+35]=a.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=k,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=v,t[e+15]=S,t[e+16]=C,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]=T),e=c.length;let s=o.setArraySize(c,e+3);s[e]=f,s[e+1]=f+1,s[e+2]=f+2,f+=3;break}{let t=l.length;if(0==t)continue;let s=k-A,n=C-y,d=p-C,u=A-x,g=1/(s*d+n*(x-A)),M=t>>1,F=this.clipOutput,Y=o.setArraySize(h,e+M*m);for(let o=0;o<t;o+=2,e+=m){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=i.r,Y[e+3]=i.g,Y[e+4]=i.b,Y[e+5]=i.a;let h=t-C,c=l-A,m=(s*h+n*c)*g,f=(u*h+d*c)*g,p=1-m-f;Y[e+6]=w*m+v*f+I*p,Y[e+7]=b*m+S*f+T*p,r&&(Y[e+8]=a.r,Y[e+9]=a.g,Y[e+10]=a.b,Y[e+11]=a.a)}e=c.length;let P=o.setArraySize(c,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)P[e]=f,P[e+1]=f+t,P[e+2]=f+t+1;f+=M+1}}}}clipTrianglesUnpacked(t,e,s,n){let i=this.clipOutput,a=this.clippedVertices,r=this.clippedUVs,l=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;a.length=0,r.length=0,l.length=0;for(let u=0;u<s;u+=3){let s=e[u]<<1,m=t[s],f=t[s+1],g=n[s],p=n[s+1];s=e[u+1]<<1;let x=t[s],w=t[s+1],b=n[s],y=n[s+1];s=e[u+2]<<1;let k=t[s],v=t[s+1],S=n[s],C=n[s+1];for(let t=0;t<c;t++){let e=a.length;if(!this.clip(m,f,x,w,k,v,h[t],i)){let t=o.setArraySize(a,e+6);t[e]=m,t[e+1]=f,t[e+2]=x,t[e+3]=w,t[e+4]=k,t[e+5]=v;let s=o.setArraySize(r,e+6);s[e]=g,s[e+1]=p,s[e+2]=b,s[e+3]=y,s[e+4]=S,s[e+5]=C,e=l.length;let n=o.setArraySize(l,e+3);n[e]=d,n[e+1]=d+1,n[e+2]=d+2,d+=3;break}{let t=i.length;if(0==t)continue;let s=w-v,n=k-x,h=m-k,c=v-f,u=1/(s*h+n*(f-v)),A=t>>1,I=this.clipOutput,T=o.setArraySize(a,e+2*A),M=o.setArraySize(r,e+2*A);for(let i=0;i<t;i+=2,e+=2){let t=I[i],a=I[i+1];T[e]=t,T[e+1]=a;let r=t-k,o=a-v,l=(s*r+n*o)*u,d=(c*r+h*o)*u,m=1-l-d;M[e]=g*l+b*d+S*m,M[e+1]=p*l+y*d+C*m}e=l.length;let F=o.setArraySize(l,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=d,F[e+1]=d+t,F[e+2]=d+t+1;d+=A+1}}}}clip(t,e,s,n,i,a,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(n),l.push(i),l.push(a),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],n=e-u[t+2],i=s-u[t+3],a=o.length,r=l;for(let t=0,a=l.length-2;t<a;){let a=r[t],l=r[t+1];t+=2;let h=r[t],d=r[t+1],u=i*(e-h)>n*(s-d),m=i*(e-a)-n*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-a,e=d-l,s=m/(t*i-e*n);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s)}else if(u){let t=h-a,e=d-l,s=m/(t*i-e*n);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(a==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,n=e[s-2]*e[1]-e[0]*e[s-1],i=0,a=0,r=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],a=e[t+1],r=e[t+2],o=e[t+3],n+=i*o-r*a;if(!(n<0))for(let t=0,n=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],a=n-t;e[t]=e[a],e[t+1]=e[a+1],e[a]=s,e[a+1]=i}}},ze=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Kt,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=Je(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 n=i.bones[t],a=null,r=Je(n,"parent",null);r&&(a=s.findBone(r));let l=new Pt(s.bones.length,n.name,a);l.length=Je(n,"length",0)*e,l.x=Je(n,"x",0)*e,l.y=Je(n,"y",0)*e,l.rotation=Je(n,"rotation",0),l.scaleX=Je(n,"scaleX",1),l.scaleY=Je(n,"scaleY",1),l.shearX=Je(n,"shearX",0),l.shearY=Je(n,"shearY",0),l.inherit=o.enumValue(Xt,Je(n,"inherit","Normal")),l.skinRequired=Je(n,"skin",!1);let h=Je(n,"color",null);h&&l.color.setFromString(h),s.bones.push(l)}if(i.slots)for(let t=0;t<i.slots.length;t++){let e=i.slots[t],a=e.name,r=s.findBone(e.bone);if(!r)throw new Error(`Couldn't find bone ${e.bone} for slot ${a}`);let l=new te(s.slots.length,a,r),h=Je(e,"color",null);h&&l.color.setFromString(h);let c=Je(e,"dark",null);c&&(l.darkColor=n.fromString(c)),l.attachmentName=Je(e,"attachment",null),l.blendMode=o.enumValue(ee,Je(e,"blend","normal")),l.visible=Je(e,"visible",!0),s.slots.push(l)}if(i.ik)for(let t=0;t<i.ik.length;t++){let n=i.ik[t],a=new _t(n.name);a.order=Je(n,"order",0),a.skinRequired=Je(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=s.findBone(n.bones[t]);if(!e)throw new Error(`Couldn't find bone ${n.bones[t]} for IK constraint ${n.name}.`);a.bones.push(e)}let r=s.findBone(n.target);if(!r)throw new Error(`Couldn't find target bone ${n.target} for IK constraint ${n.name}.`);a.target=r,a.mix=Je(n,"mix",1),a.softness=Je(n,"softness",0)*e,a.bendDirection=Je(n,"bendPositive",!0)?1:-1,a.compress=Je(n,"compress",!1),a.stretch=Je(n,"stretch",!1),a.uniform=Je(n,"uniform",!1),s.ikConstraints.push(a)}if(i.transform)for(let t=0;t<i.transform.length;t++){let n=i.transform[t],a=new se(n.name);a.order=Je(n,"order",0),a.skinRequired=Je(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for transform constraint ${n.name}.`);a.bones.push(i)}let r=n.target,o=s.findBone(r);if(!o)throw new Error(`Couldn't find target bone ${r} for transform constraint ${n.name}.`);a.target=o,a.local=Je(n,"local",!1),a.relative=Je(n,"relative",!1),a.offsetRotation=Je(n,"rotation",0),a.offsetX=Je(n,"x",0)*e,a.offsetY=Je(n,"y",0)*e,a.offsetScaleX=Je(n,"scaleX",0),a.offsetScaleY=Je(n,"scaleY",0),a.offsetShearY=Je(n,"shearY",0),a.mixRotate=Je(n,"mixRotate",1),a.mixX=Je(n,"mixX",1),a.mixY=Je(n,"mixY",a.mixX),a.mixScaleX=Je(n,"mixScaleX",1),a.mixScaleY=Je(n,"mixScaleY",a.mixScaleX),a.mixShearY=Je(n,"mixShearY",1),s.transformConstraints.push(a)}if(i.path)for(let t=0;t<i.path.length;t++){let n=i.path[t],a=new Nt(n.name);a.order=Je(n,"order",0),a.skinRequired=Je(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],i=s.findBone(e);if(!i)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);a.bones.push(i)}let r=n.target,l=s.findSlot(r);if(!l)throw new Error(`Couldn't find target slot ${r} for path constraint ${n.name}.`);a.target=l,a.positionMode=o.enumValue(Ot,Je(n,"positionMode","Percent")),a.spacingMode=o.enumValue(Ut,Je(n,"spacingMode","Length")),a.rotateMode=o.enumValue(qt,Je(n,"rotateMode","Tangent")),a.offsetRotation=Je(n,"rotation",0),a.position=Je(n,"position",0),0==a.positionMode&&(a.position*=e),a.spacing=Je(n,"spacing",0),0!=a.spacingMode&&1!=a.spacingMode||(a.spacing*=e),a.mixRotate=Je(n,"mixRotate",1),a.mixX=Je(n,"mixX",1),a.mixY=Je(n,"mixY",a.mixX),s.pathConstraints.push(a)}if(i.physics)for(let t=0;t<i.physics.length;t++){const n=i.physics[t],a=new Jt(n.name);a.order=Je(n,"order",0),a.skinRequired=Je(n,"skin",!1);const r=n.bone,o=s.findBone(r);if(null==o)throw new Error("Physics bone not found: "+r);a.bone=o,a.x=Je(n,"x",0),a.y=Je(n,"y",0),a.rotate=Je(n,"rotate",0),a.scaleX=Je(n,"scaleX",0),a.shearX=Je(n,"shearX",0),a.limit=Je(n,"limit",5e3)*e,a.step=1/Je(n,"fps",60),a.inertia=Je(n,"inertia",1),a.strength=Je(n,"strength",100),a.damping=Je(n,"damping",1),a.massInverse=1/Je(n,"mass",1),a.wind=Je(n,"wind",0),a.gravity=Je(n,"gravity",0),a.mix=Je(n,"mix",1),a.inertiaGlobal=Je(n,"inertiaGlobal",!1),a.strengthGlobal=Je(n,"strengthGlobal",!1),a.dampingGlobal=Je(n,"dampingGlobal",!1),a.massGlobal=Je(n,"massGlobal",!1),a.windGlobal=Je(n,"windGlobal",!1),a.gravityGlobal=Je(n,"gravityGlobal",!1),a.mixGlobal=Je(n,"mixGlobal",!1),s.physicsConstraints.push(a)}if(i.skins)for(let t=0;t<i.skins.length;t++){let e=i.skins[t],n=new Zt(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],a=s.findBone(i);if(!a)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);n.bones.push(a)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],a=s.findIkConstraint(i);if(!a)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);n.constraints.push(a)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],a=s.findTransformConstraint(i);if(!a)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);n.constraints.push(a)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],a=s.findPathConstraint(i);if(!a)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);n.constraints.push(a)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],a=s.findPhysicsConstraint(i);if(!a)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);n.constraints.push(a)}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 a=e.attachments[t];for(let t in a){let e=this.readAttachment(a[t],n,i.index,t,s);e&&n.setAttachment(i.index,t,e)}}s.skins.push(n),"default"==n.name&&(s.defaultSkin=n)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],n=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${e.skin}`);let i=n.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,i.events)for(let t in i.events){let e=i.events[t],n=new Vt(t);n.intValue=Je(e,"int",0),n.floatValue=Je(e,"float",0),n.stringValue=Je(e,"string",""),n.audioPath=Je(e,"audio",null),n.audioPath&&(n.volume=Je(e,"volume",1),n.balance=Je(e,"balance",0)),s.events.push(n)}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,n,i){let a=this.scale;switch(n=Je(t,"name",n),Je(t,"type","region")){case"region":{let s=Je(t,"path",n),i=this.readSequence(Je(t,"sequence",null)),r=this.attachmentLoader.newRegionAttachment(e,n,s,i);if(!r)return null;r.path=s,r.x=Je(t,"x",0)*a,r.y=Je(t,"y",0)*a,r.scaleX=Je(t,"scaleX",1),r.scaleY=Je(t,"scaleY",1),r.rotation=Je(t,"rotation",0),r.width=t.width*a,r.height=t.height*a,r.sequence=i;let o=Je(t,"color",null);return o&&r.color.setFromString(o),null!=r.region&&r.updateRegion(),r}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Je(t,"path",n),r=this.readSequence(Je(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,n,i,r);if(!o)return null;o.path=i;let l=Je(t,"color",null);l&&o.color.setFromString(l),o.width=Je(t,"width",0)*a,o.height=Je(t,"height",0)*a,o.sequence=r;let h=Je(t,"parent",null);if(h)return this.linkedMeshes.push(new Ge(o,Je(t,"skin",null),s,h,Je(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=Je(t,"edges",null),o.hullLength=2*Je(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,n);if(!s)return null;s.closed=Je(t,"closed",!1),s.constantSpeed=Je(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let r=o.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)r[e]=t.lengths[e]*a;s.lengths=r;let l=Je(t,"color",null);return l&&s.color.setFromString(l),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,n);if(!s)return null;s.x=Je(t,"x",0)*a,s.y=Je(t,"y",0)*a,s.rotation=Je(t,"rotation",0);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,n);if(!s)return null;let a=Je(t,"end",null);a&&(s.endSlot=i.findSlot(a));let r=t.vertexCount;this.readVertices(t,s,r<<1);let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new u(Je(t,"count",0));return e.start=Je(t,"start",1),e.digits=Je(t,"digits",0),e.setupIndex=Je(t,"setup",0),e}readVertices(t,e,s){let n=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=o.toFloatArray(i);if(1!=n)for(let e=0,s=i.length;e<s;e++)t[e]*=n;return void(e.vertices=t)}let a=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]),a.push(i[t+1]*n),a.push(i[t+2]*n),a.push(i[t+3])}e.bones=r,e.vertices=o.toFloatArray(a)}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],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let o=r.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new _(s,o);for(let n=0;n<s;n++){let s=e[n];t.setFrame(n,Je(s,"time",0),Je(s,"name",null))}a.push(t)}else if("rgba"==t){let t=new E(s,s<<2,o),i=e[0],r=Je(i,"time",0),l=n.fromString(i.color);for(let s=0,a=0;;s++){t.setFrame(s,r,l.r,l.g,l.b,l.a);let o=e[s+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=n.fromString(o.color),d=i.curve;d&&(a=He(d,t,a,s,0,r,h,l.r,c.r,1),a=He(d,t,a,s,1,r,h,l.g,c.g,1),a=He(d,t,a,s,2,r,h,l.b,c.b,1),a=He(d,t,a,s,3,r,h,l.a,c.a,1)),r=h,l=c,i=o}a.push(t)}else if("rgb"==t){let t=new R(s,3*s,o),i=e[0],r=Je(i,"time",0),l=n.fromString(i.color);for(let s=0,a=0;;s++){t.setFrame(s,r,l.r,l.g,l.b);let o=e[s+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=n.fromString(o.color),d=i.curve;d&&(a=He(d,t,a,s,0,r,h,l.r,c.r,1),a=He(d,t,a,s,1,r,h,l.g,c.g,1),a=He(d,t,a,s,2,r,h,l.b,c.b,1)),r=h,l=c,i=o}a.push(t)}else if("alpha"==t)a.push($e(e,new D(s,s,o),0,1));else if("rgba2"==t){let t=new V(s,7*s,o),i=e[0],r=Je(i,"time",0),l=n.fromString(i.light),h=n.fromString(i.dark);for(let s=0,a=0;;s++){t.setFrame(s,r,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=n.fromString(o.light),u=n.fromString(o.dark),m=i.curve;m&&(a=He(m,t,a,s,0,r,c,l.r,d.r,1),a=He(m,t,a,s,1,r,c,l.g,d.g,1),a=He(m,t,a,s,2,r,c,l.b,d.b,1),a=He(m,t,a,s,3,r,c,l.a,d.a,1),a=He(m,t,a,s,4,r,c,h.r,u.r,1),a=He(m,t,a,s,5,r,c,h.g,u.g,1),a=He(m,t,a,s,6,r,c,h.b,u.b,1)),r=c,l=d,h=u,i=o}a.push(t)}else if("rgb2"==t){let t=new L(s,6*s,o),i=e[0],r=Je(i,"time",0),l=n.fromString(i.light),h=n.fromString(i.dark);for(let s=0,a=0;;s++){t.setFrame(s,r,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=n.fromString(o.light),u=n.fromString(o.dark),m=i.curve;m&&(a=He(m,t,a,s,0,r,c,l.r,d.r,1),a=He(m,t,a,s,1,r,c,l.g,d.g,1),a=He(m,t,a,s,2,r,c,l.b,d.b,1),a=He(m,t,a,s,3,r,c,h.r,u.r,1),a=He(m,t,a,s,4,r,c,h.g,u.g,1),a=He(m,t,a,s,5,r,c,h.b,u.b,1)),r=c,l=d,h=u,i=o}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 l=r.index;for(let t in n){let e=n[t],s=e.length;if(0!=s)if("rotate"===t)a.push($e(e,new S(s,s,l),0,1));else if("translate"===t){let t=new C(s,s<<1,l);a.push(je(e,t,"x","y",0,i))}else if("translatex"===t){let t=new A(s,s,l);a.push($e(e,t,0,i))}else if("translatey"===t){let t=new I(s,s,l);a.push($e(e,t,0,i))}else if("scale"===t){let t=new T(s,s<<1,l);a.push(je(e,t,"x","y",1,1))}else if("scalex"===t){let t=new M(s,s,l);a.push($e(e,t,1,1))}else if("scaley"===t){let t=new F(s,s,l);a.push($e(e,t,1,1))}else if("shear"===t){let t=new Y(s,s<<1,l);a.push(je(e,t,"x","y",0,1))}else if("shearx"===t){let t=new P(s,s,l);a.push($e(e,t,0,1))}else if("sheary"===t){let t=new X(s,s,l);a.push($e(e,t,0,1))}else if("inherit"===t){let t=new B(s,r.index);for(let s=0;s<e.length;s++){let n=e[s];t.setFrame(s,Je(n,"time",0),o.enumValue(Xt,Je(n,"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 q(n.length,n.length<<1,l),c=Je(r,"time",0),d=Je(r,"mix",1),u=Je(r,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Je(r,"bendPositive",!0)?1:-1,Je(r,"compress",!1),Je(r,"stretch",!1));let s=n[t+1];if(!s){h.shrink(e);break}let a=Je(s,"time",0),o=Je(s,"mix",1),l=Je(s,"softness",0)*i,m=r.curve;m&&(e=He(m,h,e,t,0,c,a,d,o,1),e=He(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 n=t.transform[e],i=n[0];if(!i)continue;let r=s.findTransformConstraint(e);if(!r)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(r),l=new W(n.length,6*n.length,o),h=Je(i,"time",0),c=Je(i,"mixRotate",1),d=Je(i,"mixX",1),u=Je(i,"mixY",d),m=Je(i,"mixScaleX",1),f=Je(i,"mixScaleY",m),g=Je(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=n[t+1];if(!s){l.shrink(e);break}let a=Je(s,"time",0),r=Je(s,"mixRotate",1),o=Je(s,"mixX",1),p=Je(s,"mixY",o),x=Je(s,"mixScaleX",1),w=Je(s,"mixScaleY",x),b=Je(s,"mixShearY",1),y=i.curve;y&&(e=He(y,l,e,t,0,h,a,c,r,1),e=He(y,l,e,t,1,h,a,d,o,1),e=He(y,l,e,t,2,h,a,u,p,1),e=He(y,l,e,t,3,h,a,m,x,1),e=He(y,l,e,t,4,h,a,f,w,1),e=He(y,l,e,t,5,h,a,g,b,1)),h=a,c=r,d=o,u=p,m=x,f=w,m=x,i=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 z(l,l,o);a.push($e(e,t,0,0==r.positionMode?i:1))}else if("spacing"===t){let t=new G(l,l,o);a.push($e(e,t,0,0==r.spacingMode||1==r.spacingMode?i:1))}else if("mix"===t){let t=new $(l,3*l,o),n=Je(s,"time",0),i=Je(s,"mixRotate",1),r=Je(s,"mixX",1),h=Je(s,"mixY",r);for(let a=0,o=0;;a++){t.setFrame(a,n,i,r,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Je(l,"time",0),d=Je(l,"mixRotate",1),u=Je(l,"mixX",1),m=Je(l,"mixY",u),f=s.curve;f&&(o=He(f,t,o,a,0,n,c,i,d,1),o=He(f,t,o,a,1,n,c,r,u,1),o=He(f,t,o,a,2,n,c,h,m,1)),n=c,i=d,r=u,h=m,s=l}a.push(t)}}}if(t.physics)for(let e in t.physics){let n=t.physics[e],i=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);i=s.physicsConstraints.indexOf(t)}for(let t in n){let e=n[t],s=e[0];if(!s)continue;let r,o=e.length;if("reset"!=t){if("inertia"==t)r=new H(o,o,i);else if("strength"==t)r=new J(o,o,i);else if("damping"==t)r=new K(o,o,i);else if("mass"==t)r=new Q(o,o,i);else if("wind"==t)r=new Z(o,o,i);else if("gravity"==t)r=new tt(o,o,i);else{if("mix"!=t)continue;r=new et(o,o,i)}a.push($e(e,r,0,1))}else{const t=new st(o,i);for(let n=0;null!=s;s=e[n+1],n++)t.setFrame(n,Je(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],l=s.findSlot(t);if(!l)throw new Error("Slot not found: "+t);let h=l.index;for(let t in e){let s=e[t],n=r.getAttachment(h,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,l=t?s.length/3*2:s.length,c=new N(e.length,e.length,h,n),d=Je(r,"time",0);for(let n=0,a=0;;n++){let h,u=Je(r,"vertices",null);if(u){h=o.newFloatArray(l);let e=Je(r,"offset",0);if(o.arrayCopy(u,0,h,e,u.length),1!=i)for(let t=e,s=t+u.length;t<s;t++)h[t]*=i;if(!t)for(let t=0;t<l;t++)h[t]+=s[t]}else h=t?o.newFloatArray(l):s;c.setFrame(n,d,h);let m=e[n+1];if(!m){c.shrink(a);break}let f=Je(m,"time",0),g=r.curve;g&&(a=He(g,c,a,n,0,d,f,0,1,1)),d=f,r=m}a.push(c)}else if("sequence"==t){let t=new nt(e.length,h,n),s=0;for(let n=0;n<e.length;n++){let i=Je(r,"delay",s),a=Je(r,"time",0),o=m[Je(r,"mode","hold")],l=Je(r,"index",0);t.setFrame(n,a,o,l,i),s=i,r=e[n+1]}a.push(t)}}}}}if(t.drawOrder){let e=new U(t.drawOrder.length),n=s.slots.length,i=0;for(let a=0;a<t.drawOrder.length;a++,i++){let r=t.drawOrder[a],l=null,h=Je(r,"offsets",null);if(h){l=o.newArray(n,-1);let t=o.newArray(n-h.length,0),e=0,i=0;for(let n=0;n<h.length;n++){let a=h[n],r=s.findSlot(a.slot);if(!r)throw new Error("Slot not found: "+r);let o=r.index;for(;e!=o;)t[i++]=e++;l[e+a.offset]=e++}for(;e<n;)t[i++]=e++;for(let e=n-1;e>=0;e--)-1==l[e]&&(l[e]=t[--i])}e.setFrame(i,Je(r,"time",0),l)}a.push(e)}if(t.events){let e=new O(t.events.length),n=0;for(let i=0;i<t.events.length;i++,n++){let a=t.events[i],r=s.findEvent(a.name);if(!r)throw new Error("Event not found: "+a.name);let l=new Dt(o.toSinglePrecision(Je(a,"time",0)),r);l.intValue=Je(a,"int",r.intValue),l.floatValue=Je(a,"float",r.floatValue),l.stringValue=Je(a,"string",r.stringValue),l.data.audioPath&&(l.volume=Je(a,"volume",1),l.balance=Je(a,"balance",0)),e.setFrame(n,l)}a.push(e)}let r=0;for(let t=0,e=a.length;t<e;t++)r=Math.max(r,a[t].getDuration());s.animations.push(new g(e,a,r))}},Ge=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,n,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=n,this.inheritTimeline=i}};function $e(t,e,s,n){let i=t[0],a=Je(i,"time",0),r=Je(i,"value",s)*n,o=0;for(let l=0;;l++){e.setFrame(l,a,r);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Je(h,"time",0),d=Je(h,"value",s)*n;i.curve&&(o=He(i.curve,e,o,l,0,a,c,r,d,n)),a=c,r=d,i=h}}function je(t,e,s,n,i,a){let r=t[0],o=Je(r,"time",0),l=Je(r,s,i)*a,h=Je(r,n,i)*a,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=Je(u,"time",0),f=Je(u,s,i)*a,g=Je(u,n,i)*a,p=r.curve;p&&(c=He(p,e,c,d,0,o,m,l,f,a),c=He(p,e,c,d,1,o,m,h,g,a)),o=m,l=f,h=g,r=u}}function He(t,e,s,n,i,a,r,o,l,h){if("stepped"==t)return e.setStepped(n),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,n,i,a,o,d,u,m,f,r,l),s+1}function Je(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var Ke=class e extends wt{static textureMap=new Map;static from(t){return e.textureMap.has(t)?e.textureMap.get(t):new e(t)}texture;constructor(e){super(e.resource),this.texture=t.Texture.from(e)}setFilters(t,s){if(!this.texture||!this.texture.source||!this.texture.source.style)return;const n=this.texture.source.style;n.minFilter=e.toPixiTextureFilter(t),n.magFilter=e.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=e.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,s){if(!this.texture||!this.texture.source||!this.texture.source.style)return;const n=this.texture.source.style;n.addressModeU=e.toPixiTextureWrap(t),n.addressModeV=e.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Qe={extension:t.ExtensionType.Asset,resolver:{test:e=>t.checkExtension(e,".atlas"),parse:e=>{const s=e.split(".");return{resolution:parseFloat(t.Resolver.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:s[s.length-2],src:e}}},loader:{extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:e=>t.checkExtension(e,".atlas"),async load(e){const s=await t.DOMAdapter.get().fetch(e);return await s.text()},testParse(e,s){const n=t.checkExtension(s.src,".atlas"),i="string"==typeof e;return Promise.resolve(n&&i)},unload(t){t.dispose()},async parse(e,s,n){const i=s.data||{};let a=t.path.dirname(s.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");const r=new vt(e);if(i.images instanceof t.TextureSource||"string"==typeof i.images){const t=i.images;i.images={},i.images[r.pages[0].name]=t}const o=[];for(const e of r.pages){if(i.resolve){const t=i.resolve().then((t=>{e.setTexture(Ke.from(t.source))}));o.push(t);continue}const r=e.name,l=i?.images?i.images[r]:void 0;if(l instanceof t.TextureSource)e.setTexture(Ke.from(l));else{const h=l??t.path.normalize([...a.split(t.path.sep),r].join(t.path.sep)),c={src:t.copySearchParams(h,s.src),data:{...i.imageMetadata,alphaMode:e.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=n.load(c).then((t=>{e.setTexture(Ke.from(t.source))}));o.push(d)}}return await Promise.all(o),r}}};t.extensions.add(Qe);var Ze={extension:t.ExtensionType.Asset,loader:{extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:e=>t.checkExtension(e,".skel"),async load(e){const s=await t.DOMAdapter.get().fetch(e);return new Uint8Array(await s.arrayBuffer())},testParse(e,s){const n=t.checkExtension(s.src,".json")&&(i=e,Object.prototype.hasOwnProperty.call(i,"bones"));var i;const a=t.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(e);return Promise.resolve(n||a)}}};t.extensions.add(Ze);var ts=new Float32Array(1),es=new Uint32Array(1),ss=class extends t.Geometry{constructor(){const e=new t.Buffer({data:ts,label:"attribute-batch-buffer",usage:t.BufferUsage.VERTEX|t.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:28,offset:0},aUV:{buffer:e,format:"float32x2",stride:28,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:28,offset:24}},indexBuffer:new t.Buffer({data:es,label:"index-batch-buffer",usage:t.BufferUsage.INDEX|t.BufferUsage.COPY_DST,shrinkToFit:!1})})}},ns={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},is={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},as=class extends t.Shader{constructor(e){super({glProgram:t.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[t.colorBitGl,is,t.generateTextureBatchBitGl(e),t.roundPixelsBitGl]}),gpuProgram:t.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[t.colorBit,ns,t.generateTextureBatchBit(e),t.roundPixelsBit]}),resources:{batchSamplers:t.getBatchSamplersUniformGroup(e)}})}},rs=null,os=class e extends t.Batcher{static extension={type:[t.ExtensionType.Batcher],name:"darkTint"};geometry=new ss;shader=rs||(rs=new as(this.maxTextures));name=e.extension.name;vertexSize=7;packAttributes(e,s,n,i,a){const r=a<<16|65535&e.roundPixels,o=e.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=e,p=e.color,x=(p>>24&255)/255,w=t.Color.shared.setValue(e.darkColor).premultiply(x,!0).toPremultiplied(1,!1),b=e.attributeOffset,y=b+e.attributeSize;for(let t=b;t<y;t++){const e=2*t,a=f[e],o=f[e+1];s[i++]=l*a+c*o+u,s[i++]=d*o+h*a+m,s[i++]=g[e],s[i++]=g[e+1],n[i++]=p,n[i++]=w,n[i++]=r}}packQuadAttributes(t,e,s,n,i){const a=t.texture,r=t.transform,o=r.a,l=r.b,h=r.c,c=r.d,d=r.tx,u=r.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,w=a.uvs,b=t.color,y=t.darkColor,k=i<<16|65535&t.roundPixels;e[n+0]=o*g+h*x+d,e[n+1]=c*x+l*g+u,e[n+2]=w.x0,e[n+3]=w.y0,s[n+4]=b,s[n+5]=y,s[n+6]=k,e[n+7]=o*f+h*x+d,e[n+8]=c*x+l*f+u,e[n+9]=w.x1,e[n+10]=w.y1,s[n+11]=b,s[n+12]=y,s[n+13]=k,e[n+14]=o*f+h*p+d,e[n+15]=c*p+l*f+u,e[n+16]=w.x2,e[n+17]=w.y2,s[n+18]=b,s[n+19]=y,s[n+20]=k,e[n+21]=o*g+h*p+d,e[n+22]=c*p+l*g+u,e[n+23]=w.x3,e[n+24]=w.y3,s[n+25]=b,s[n+26]=y,s[n+27]=k}};t.extensions.add(os);var ls=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let n;const i=t.a*s*255;if(16777215!==e){const s=e>>16&255,a=e>>8&255,r=255&e,o=t.r*r,l=t.g*a;n=i<<24|t.b*s<<16|l<<8|o}else n=i<<24|255*t.b<<16|255*t.g<<8|255*t.r;return n}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,n){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=n,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},hs={0:"normal",1:"add",2:"multiply",3:"screen"},cs=class{static extension={type:[t.ExtensionType.WebGLPipes,t.ExtensionType.WebGPUPipes,t.ExtensionType.CanvasPipes],name:"spine"};renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let n=0,i=e.length;n<i;n++){const i=e[n],a=i.getAttachment();if(a instanceof Ft||a instanceof It){const e=t._getCachedData(i,a),n=s.slotBatches[e.id],r=e.texture;if(r!==n.texture&&!n._batcher.checkAndUpdateTexture(n,r))return!0}}}return!1}addRenderable(e,s){const n=this._getSpineData(e),i=this.renderer.renderPipes.batch,a=e.skeleton.drawOrder,r=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let o=0,l=a.length;o<l;o++){const l=a[o],h=l.getAttachment(),c=hs[l.data.blendMode];if(h instanceof Ft||h instanceof It){const t=e._getCachedData(l,h),a=n.slotBatches[t.id]||=new ls;a.setData(e,t,c,r),t.skipRender||i.addToBatch(a,s)}const d=e._slotsObject[l.data.name];if(d){const e=d.container;e.includeInBuild=!0,t.collectAllRenderables(e,s,this.renderer),e.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder;for(let n=0,i=s.length;n<i;n++){const i=s[n],a=i.getAttachment();if(a instanceof Ft||a instanceof It){if(!t._getCachedData(i,a).skipRender){const s=e.slotBatches[t._getCachedData(i,a).id];s._batcher?.updateElement(s)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};t.extensions.add(cs);var ds=new h;jt.yDown=!0;var us=new We,ms=new l((()=>new t.Graphics)),fs=class e extends t.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!0;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e?t.Ticker.shared.add(this.internalUpdate,this):t.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=e}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Kt&&(t={skeletonData:t}),super({});const e=t instanceof Kt?t:t.skeletonData;this.skeleton=new jt(e),this.state=new it(new gt(e)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=void 0===t?.darkTint?this.skeleton.slots.some((t=>!!t.data.darkColor)):t?.darkTint;const s=this.skeleton.slots;for(let t=0;t<s.length;t++)this.attachmentCacheData[t]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(e,s){this._updateAndApplyState(s??t.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(ds.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(ds);t.x=e.x,t.y=-e.y}else t.x=ds.x,t.y=ds.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,n=!1;for(let i=0;i<t.length;i++){const a=t[i].getAttachment();a&&(a!==e[s]&&(n=!0,e[s]=a),s++)}s!==e.length&&(n=!0,e.length=s),this.spineAttachmentsDirty||=n}updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof xt){return(this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array}).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let n=this.currentClippingSlot,i=this._slotsObject[t.data.name];if(n&&i){let t=n.slot,e=t.attachment,s=n.mask;if(s||(s=ms.obtain(),n.mask=s,this.addChild(s)),!n.maskComputed){n.maskComputed=!0;const i=e.worldVerticesLength,a=n.vertices;e.computeWorldVertices(t,0,i,a,0,2),s.clear().poly(a).stroke({width:0}).fill({alpha:.25})}i.container.mask=s}else i?.container.mask&&(i.container.mask=null);if(n&&n.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof xt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),ms.free(e.mask),e.mask=void 0)}}currentClippingSlot;transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const n=e[s];this.updateAndSetPixiMask(n,s===e.length-1);const i=n.getAttachment();if(i)if(i instanceof It||i instanceof Ft){const e=this._getCachedData(n,i);i instanceof Ft?i.computeWorldVertices(n,e.vertices,0,2):i.computeWorldVertices(n,0,i.worldVerticesLength,e.vertices,0,2),e.uvs.length<i.uvs.length&&(e.uvs=new Float32Array(i.uvs.length)),t.fastCopy(i.uvs.buffer,e.uvs.buffer);const s=n.bone.skeleton.color,a=n.color,r=i.color;e.color.set(s.r*a.r*r.r,s.g*a.g*r.g,s.b*a.b*r.b,s.a*a.a*r.a),n.darkColor&&e.darkColor.setFromColor(n.darkColor),e.skipRender=e.clipped=!1;const o=i.region?.texture.texture||t.Texture.EMPTY;e.texture!==o&&(e.texture=o,this.spineTexturesDirty=!0),us.isClipping()&&this.updateClippingData(e)}else if(i instanceof xt){us.clipStart(n,i);continue}us.clipEndWithSlot(n)}us.clipEnd()}updateClippingData(t){t.clipped=!0,us.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:n}=us,i=e.length/2,a=n.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*i),uvs:new Float32Array(2*i),vertexCount:i,indices:new Uint16Array(a),indicesCount:a},this.spineAttachmentsDirty=!0);const r=t.clippedData,o=r.vertexCount!==i||a!==r.indicesCount;t.skipRender=0===i,o&&(this.spineAttachmentsDirty=!0,r.vertexCount<i&&(r.vertices=new Float32Array(2*i),r.uvs=new Float32Array(2*i)),r.indices.length<a&&(r.indices=new Uint16Array(a)));const{vertices:l,uvs:h,indices:c}=r;for(let t=0;t<i;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];r.vertexCount=i;for(let t=0;t<a;t++)c[t]!==n[t]&&(this.spineAttachmentsDirty=!0,c[t]=n[t]);r.indicesCount=a}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(e){const{slot:s,container:n}=e,i=!e.followAttachmentTimeline||Boolean(s.attachment);if(n.visible=this.skeleton.drawOrder.includes(s)&&i,n.visible){const e=s.bone;n.position.set(e.worldX,e.worldY),n.scale.x=e.getWorldScaleX(),n.scale.y=e.getWorldScaleY(),n.rotation=e.getWorldRotationX()*t.DEG_TO_RAD,n.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){let s;return e instanceof Ft?(s=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new n(1,1,1,1),darkColor:new n(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}):(s=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new n(1,1,1,1),darkColor:new n(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,e,s){t=this.getSlotFromRef(t);for(const t in this._slotsObject)this._slotsObject[t]?.container===e&&this.removeSlotObject(this._slotsObject[t].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const n={container:e,slot:t,followAttachmentTimeline:s?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=n,this.updateSlotObject(n)}removeSlotObject(e){let s;if(e instanceof t.Container){for(const t in this._slotsObject)if(this._slotsObject[t]?.container===e){this._slotsObject[t]=null,s=e;break}}else{const t=this.getSlotFromRef(e);s=this._slotsObject[t.data.name]?.container,this._slotsObject[t.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach((([t,e])=>{e&&e.container.removeFromParent(),delete this._slotsObject[t]}))}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new Ue;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const t=this._boundsProvider.calculateBounds(this),e=this._bounds;e.clear(),e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const n=t[s],i=n.getAttachment();if(i&&(i instanceof Ft||i instanceof It)){const t=this._getCachedData(n,i);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),t.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:s,atlas:n,scale:i=1,darkTint:a,autoUpdate:r=!0,boundsProvider:o}){const l=`${s}-${n}-${i}`;if(t.Cache.has(l))return new e({skeletonData:t.Cache.get(l),darkTint:a,autoUpdate:r,boundsProvider:o});const h=t.Assets.get(s),c=t.Assets.get(n),d=new Yt(c),u=h instanceof Uint8Array?new ne(d):new ze(d);u.scale=i;const m=u.readSkeletonData(h);return t.Cache.set(l,m),new e({skeletonData:m,darkTint:a,autoUpdate:r,boundsProvider:o})}},gs={AABBRectangleBoundsProvider:class{constructor(t,e,s,n){this.x=t,this.y=e,this.width=s,this.height=n}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},AlphaTimeline:D,Animation:g,AnimationState:it,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:gt,AssetManagerBase:class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Rt){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,n)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${n}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,n)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${n}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,n)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${n}`)}))}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 n=new Image;n.crossOrigin="anonymous",n.onload=()=>{this.success(e,t,this.textureLoader(n))},n.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},n){let i=t.lastIndexOf("/"),a=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let r=new vt(i),o=r.pages.length,l=!1;for(let i of r.pages)this.loadTexture(n?n[i.name]:a+i.name,((s,n)=>{l||(i.setTexture(n),0==--o&&this.success(e,t,r))}),((e,n)=>{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,n)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${n}`)}))}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}},AtlasAttachmentLoader:Yt,Attachment:c,AttachmentTimeline:_,BinaryInput:ie,BlendMode:ee,Bone:Bt,BoneData:Pt,BoundingBoxAttachment:pt,CURRENT:ft,ClippingAttachment:xt,Color:n,ConstraintData:Et,CurveTimeline:y,CurveTimeline1:k,CurveTimeline2:v,DebugUtils:class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},DeformTimeline:N,Downloader:Rt,DrawOrderTimeline:U,Event:Dt,EventData:Vt,EventQueue:rt,EventTimeline:O,EventType:ot,FIRST:ht,FakeTexture:class extends wt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:dt,HOLD_MIX:ut,HOLD_SUBSEQUENT:ct,IkConstraint:Lt,IkConstraintData:_t,IkConstraintTimeline:q,Inherit:Xt,InheritTimeline:B,IntSet: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}},Interpolation:a,MathUtils:i,MeshAttachment:It,MixBlend:p,MixDirection:x,PathAttachment:Tt,PathConstraint:Wt,PathConstraintData:Nt,PathConstraintMixTimeline:$,PathConstraintPositionTimeline:z,PathConstraintSpacingTimeline:G,Physics:Ht,PhysicsConstraintDampingTimeline:K,PhysicsConstraintGravityTimeline:tt,PhysicsConstraintInertiaTimeline:H,PhysicsConstraintMassTimeline:Q,PhysicsConstraintMixTimeline:et,PhysicsConstraintResetTimeline:st,PhysicsConstraintStrengthTimeline:J,PhysicsConstraintTimeline:j,PhysicsConstraintWindTimeline:Z,PointAttachment:Mt,Pool:l,PositionMode:Ot,Pow:r,PowOut:class extends r{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:L,RGBA2Timeline:V,RGBATimeline:E,RGBTimeline:R,RegionAttachment:Ft,RotateMode:qt,RotateTimeline:S,SETUP:mt,SUBSEQUENT:lt,ScaleTimeline:T,ScaleXTimeline:M,ScaleYTimeline:F,SequenceTimeline:nt,SetupPoseBoundsProvider:class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new jt(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(2);const s=e.getBoundsRect(this.clipping?new We:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},ShearTimeline:Y,ShearXTimeline:P,ShearYTimeline:X,Skeleton:jt,SkeletonBinary:ne,SkeletonBounds:Ue,SkeletonClipping:We,SkeletonData:Kt,SkeletonJson:ze,Skin:Zt,SkinEntry:Qt,SkinsAndAnimationBoundsProvider:class{constructor(t,e=[],s=.05,n=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=n}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new it(t.state.data),s=new jt(t.skeleton.data),n=this.clipping?new We:void 0,i=s.data;if(this.skins.length>0){let t=new Zt("custom-skin");for(const e of this.skins){const s=i.findSkin(e);null!=s&&t.addSkin(s)}s.setSkin(t)}s.setToSetupPose();const a=null!=this.animation?i.findAnimation(this.animation):null;if(null==a){s.updateWorldTransform(2);const t=s.getBoundsRect(n);return t.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:t}{let t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,a,!1);const l=Math.max(a.duration/this.timeStep,1);for(let a=0;a<l;a++){const l=a>0?this.timeStep:0;e.update(l),e.apply(s),s.update(l),s.updateWorldTransform(2);const h=s.getBoundsRect(n);t=Math.min(t,h.x),i=Math.min(i,h.y),r=Math.max(r,h.x+h.width),o=Math.max(o,h.y+h.height)}const h={x:t,y:i,width:r-t,height:o-i};return h.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:h}}},Slot:Gt,SlotData:te,SpacingMode:Ut,Spine:fs,SpineDebugRenderer:class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);const s={parentDebugContainer:new t.Container,bones:new t.Container,skeletonXY:new t.Graphics,regionAttachmentsShape:new t.Graphics,meshTrianglesLine:new t.Graphics,meshHullLine:new t.Graphics,clippingPolygon:new t.Graphics,boundingBoxesRect:new t.Graphics,boundingBoxesCircle:new t.Graphics,boundingBoxesPolygon:new t.Graphics,pathsCurve:new t.Graphics,pathsLine:new t.Graphics,eventText:new t.Container,eventCallback:{event:(n,i)=>{if(this.drawEvents){const n=Math.abs(e.scale.x||e.scale.y||1),a=new t.Text({text:i.data.name,style:{fontSize:this.eventFontSize/n,fill:this.eventFontColor,fontFamily:"monospace"}});a.scale.x=Math.sign(e.scale.x),a.anchor.set(.5),s.eventText.addChild(a),setTimeout((()=>{a.destroyed||a.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,e.addChild(s.parentDebugContainer),e.state.addListener(s.eventCallback),this.registeredSpines.set(e,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),n=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,n,s),this.drawPaths&&this.drawPathsFunc(t,e,n),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,n),this.drawClipping&&this.drawClippingFunc(t,e,n),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,n),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,n),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(e,s,n,i){const a=e.skeleton,r=a.x,o=a.y,l=a.bones;s.skeletonXY.strokeStyle={width:n,color:this.skeletonXYColor};for(let e=0,a=l.length;e<a;e++){const a=l[e],h=a.data.length,c=r+a.worldX,d=o+a.worldY,u=r+h*a.a+a.worldX,m=o+h*a.b+a.worldY;if("root"===a.data.name||null===a.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,w=Math.pow(g,2),b=Math.sqrt(p+w),y=Math.pow(b,2),k=Math.PI/180,v=Math.acos((y+w-p)/(2*x*b))||0;if(0===b)continue;const S=new t.Graphics;s.bones.addChild(S);const C=b/50/i;S.context.poly([0,0,0-C,b-3*C,0,b-C,0+C,b-3*C]).fill(this.bonesColor),S.x=c,S.y=d,S.pivot.y=b;let A=0;c<u&&d<m?A=180*k-v:c>u&&d<m?A=180*k+v:c>u&&d>m?A=-v:c<u&&d>m?A=v:d===m&&c<u?A=90*k:d===m&&c>u?A=-90*k:c===u&&d<m?A=180*k:c===u&&d>m&&(A=0),S.rotation=A,S.circle(0,b,1.2*C).fill({color:0,alpha:.6}).stroke({width:n+C/2.4,color:this.bonesColor})}const h=3*n;s.skeletonXY.context.moveTo(r-h,o-h).lineTo(r+h,o+h).moveTo(r+h,o-h).lineTo(r-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t],i=s.getAttachment();if(null===i||!(i instanceof Ft))continue;const a=i,r=new Float32Array(8);a.computeWorldVertices(s,r,0,2),e.regionAttachmentsShape.poly(Array.from(r.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t];if(!s.bone.active)continue;const i=s.getAttachment();if(null===i||!(i instanceof It))continue;const a=i,r=new Float32Array(a.worldVerticesLength),o=a.triangles;let l=a.hullLength;if(a.computeWorldVertices(s,0,a.worldVerticesLength,r,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],n=2*o[t+1],i=2*o[t+2];e.meshTrianglesLine.context.moveTo(r[s],r[s+1]).lineTo(r[n],r[n+1]).lineTo(r[i],r[i+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=r[l-2],s=r[l-1];for(let n=0,i=l;n<i;n+=2){const i=r[n],a=r[n+1];e.meshHullLine.context.moveTo(i,a).lineTo(t,s),t=i,s=a}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t];if(!s.bone.active)continue;const i=s.getAttachment();if(null===i||!(i instanceof xt))continue;const a=i,r=a.worldVerticesLength,o=new Float32Array(r);a.computeWorldVertices(s,0,r,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const n=new Ue;n.update(t.skeleton,!0),n.minX!==1/0&&e.boundingBoxesRect.rect(n.minX,n.minY,n.getWidth(),n.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const i=n.polygons,a=(t,n,i)=>{if(i<3)throw new Error("Polygon must contain at least 3 vertices");const a=[],r=2*s;for(let s=0,n=t.length;s<n;s+=2){const n=t[s],i=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(n,i,r),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(n,i,r).fill({color:this.boundingBoxesCircleColor}),a.push(n,i)}e.boundingBoxesPolygon.poly(a).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=i.length;t<e;t++){const e=i[t];a(e,0,e.length)}}drawPathsFunc(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t];if(!s.bone.active)continue;const i=s.getAttachment();if(null===i||!(i instanceof Tt))continue;const a=i;let r=a.worldVerticesLength;const o=new Float32Array(r);a.computeWorldVertices(s,0,r,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(a.closed){const t=o[0],s=o[1],n=o[r-2],i=o[r-1];c=o[r-4],d=o[r-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,n,i,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,i)}r-=4;for(let t=4;t<r;t+=6){const s=o[t],n=o[t+1],i=o[t+2],a=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,n,i,a,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,n),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(i,a),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:cs,SpineTexture:Ke,StringSet:s,Texture:wt,TextureAtlas:vt,TextureAtlasPage:Ct,TextureAtlasRegion:At,TextureFilter:bt,TextureRegion:kt,TextureWrap:yt,TimeKeeper:class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Timeline:b,TrackEntry:at,TransformConstraint:$t,TransformConstraintData:se,TransformConstraintTimeline:W,TranslateTimeline:C,TranslateXTimeline:A,TranslateYTimeline:I,Triangulator:qe,Utils:o,Vector2:h,VertexAttachment:d,WindowedMean:class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}};class ps extends e.SpineSystem{init(){super.init({pixiSpine:gs})}}class xs extends e.Spine{}exports.PixiSpine=gs,exports.Spine=xs,exports.SpineSystem=ps;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/spine-base"),s=Object.defineProperty,r=(t,e,r)=>(((t,e,r)=>{e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r);if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var n=class{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,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},i=class{r;g;b;a;constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,r){return this.r+=t,this.g+=e,this.b+=s,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,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 i).setFromString(t)}},a=i;r(a,"WHITE",new i(1,1,1,1)),r(a,"RED",new i(1,0,0,1)),r(a,"GREEN",new i(0,1,0,1)),r(a,"BLUE",new i(0,0,1,1)),r(a,"MAGENTA",new i(1,0,1,1));var o=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*o.degRad)}static sinDeg(t){return Math.sin(t*o.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*o.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 o.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let r=Math.random(),n=e-t;return r<=(s-t)/n?t+Math.sqrt(r*n*(s-t)):e-Math.sqrt((1-r)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},l=o;r(l,"PI",3.1415927),r(l,"PI2",2*o.PI),r(l,"invPI2",1/o.PI2),r(l,"radiansToDegrees",180/o.PI),r(l,"radDeg",o.radiansToDegrees),r(l,"degreesToRadians",o.PI/180),r(l,"degRad",o.degreesToRadians);var h=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},c=class extends h{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}},d=class{static arrayCopy(t,e,s,r,n){for(let i=e,a=r;i<e+n;i++,a++)s[a]=t[i]}static arrayFill(t,e,s,r){for(let n=e;n<s;n++)t[n]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let n=r;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:d.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e;return s}static newFloatArray(t){if(d.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(d.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 d.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return d.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},u=d;r(u,"SUPPORTS_TYPED_ARRAYS","undefined"!=typeof Float32Array);var m=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},f=class{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}},g=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},p=class extends g{id=p.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,r,n,i){s=n+(s>>1)*i;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,m=a.c,f=a.d;for(let t=e,a=n;a<s;t+=2,a+=i){let e=l[t],s=l[t+1];r[a]=e*d+s*u+h,r[a+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=a.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=i){let s=0,n=0,i=h[c++];for(i+=c;c<i;c++,e+=3){let t=u[h[c]],r=l[e],i=l[e+1],a=l[e+2];s+=(r*t.a+i*t.b+t.worldX)*a,n+=(r*t.c+i*t.d+t.worldY)*a}r[t]=s,r[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=i){let s=0,n=0,i=h[c++];for(i+=c;c<i;c++,a+=3,o+=2){let e=u[h[c]],r=l[a]+t[o],i=l[a+1]+t[o+1],d=l[a+2];s+=(r*e.a+i*e.b+e.worldX)*d,n+=(r*e.c+i*e.d+e.worldY)*d}r[e]=s,r[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),u.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=u.newFloatArray(this.vertices.length),u.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},x=p;r(x,"nextID",0);var b,w,y=class{id=y.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new y(this.regions.length);return u.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 r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return y._nextID++}},k=y;r(k,"_nextID",0),(w=b||(b={}))[w.hold=0]="hold",w[w.once=1]="once",w[w.loop=2]="loop",w[w.pingpong=3]="pingpong",w[w.onceReverse=4]="onceReverse",w[w.loopReverse=5]="loopReverse",w[w.pingpongReverse=6]="pingpongReverse";var v,C,S,A,T=[b.hold,b.once,b.loop,b.pingpong,b.onceReverse,b.loopReverse,b.pingpongReverse],I=class{name;timelines=[];timelineIds=new n;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,r,n,i,a,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,n,i,a,o)}};(C=v||(v={}))[C.setup=0]="setup",C[C.first=1]="first",C[C.replace=2]="replace",C[C.add=3]="add",(A=S||(S={}))[A.mixIn=0]="mixIn",A[A.mixOut=1]="mixOut";var M={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},F=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=u.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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}},Y=class extends F{curves;constructor(t,e,s){super(t,s),this.curves=u.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=u.newFloatArray(e);u.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,n,i,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(r-2*i+o),f=.03*(n-2*a+l),g=.006*(3*(i-o)-r+h),p=.006*(3*(a-l)-n+c),x=2*m+g,b=2*f+p,w=.3*(i-r)+m+.16666667*g,y=.3*(a-n)+f+.16666667*p,k=r+w,v=n+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,w+=x,y+=b,x+=g,b+=p,k+=w,v+=y}getBezierValue(t,e,s,r){let n=this.curves;if(n[r]>t){let i=this.frames[e],a=this.frames[e+s];return a+(t-i)/(n[r]-i)*(n[r+1]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(n[r]>=t){let e=n[r-2],s=n[r-1];return s+(t-e)/(n[r]-e)*(n[r+1]-s)}e+=this.getFrameEntries();let a=n[i-2],o=n[i-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},P=class extends Y{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let r=this.curves[s>>1];switch(r){case 0:let r=e[s],n=e[s+1];return n+(t-r)/(e[s+2]-r)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,n){if(t<this.frames[0]){switch(s){case v.setup:return n;case v.first:return r+(n-r)*e}return r}let i=this.getCurveValue(t);switch(s){case v.setup:return n+i*e;case v.first:case v.replace:i+=n-r}return r+i*e}getAbsoluteValue(t,e,s,r,n){if(t<this.frames[0]){switch(s){case v.setup:return n;case v.first:return r+(n-r)*e}return r}let i=this.getCurveValue(t);return s==v.setup?n+(i-n)*e:r+(i-r)*e}getAbsoluteValue2(t,e,s,r,n,i){if(t<this.frames[0]){switch(s){case v.setup:return n;case v.first:return r+(n-r)*e}return r}return s==v.setup?n+(i-n)*e:r+(i-r)*e}getScaleValue(t,e,s,r,n,i){if(t<this.frames[0]){switch(s){case v.setup:return i;case v.first:return n+(i-n)*e}return n}let a=this.getCurveValue(t)*i;if(1==e)return s==v.add?n+a-i:a;if(r==S.mixOut)switch(s){case v.setup:return i+(Math.abs(a)*l.signum(i)-i)*e;case v.first:case v.replace:return n+(Math.abs(a)*l.signum(n)-n)*e}else{let t=0;switch(s){case v.setup:return t=Math.abs(i)*l.signum(a),t+(a-t)*e;case v.first:case v.replace:return t=Math.abs(n)*l.signum(a),t+(a-t)*e}}return n+(a-i)*e}},R=class extends Y{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}},X=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,i,o.rotation,o.data.rotation))}},B=class extends R{boneIndex=0;constructor(t,e,s){super(t,e,M.x+"|"+s,M.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(i){case v.setup:return o.x=o.data.x,void(o.y=o.data.y);case v.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=F.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(i){case v.setup:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case v.first:case v.replace:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case v.add:o.x+=h*n,o.y+=c*n}}},E=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,i,o.x,o.data.x))}},D=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,i,o.y,o.data.y))}},V=class extends R{boneIndex=0;constructor(t,e,s){super(t,e,M.scaleX+"|"+s,M.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;let h,c,d=this.frames;if(s<d[0]){switch(i){case v.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case v.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u=F.search(d,s,3),m=this.curves[u/3];switch(m){case 0:let t=d[u];h=d[u+1],c=d[u+2];let e=(s-t)/(d[u+3]-t);h+=(d[u+3+1]-h)*e,c+=(d[u+3+2]-c)*e;break;case 1:h=d[u+1],c=d[u+2];break;default:h=this.getBezierValue(s,u,1,m-2),c=this.getBezierValue(s,u,2,m+18-2)}if(h*=o.data.scaleX,c*=o.data.scaleY,1==n)i==v.add?(o.scaleX+=h-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=h,o.scaleY=c);else{let t=0,e=0;if(a==S.mixOut)switch(i){case v.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(h)*l.signum(t)-t)*n,o.scaleY=e+(Math.abs(c)*l.signum(e)-e)*n;break;case v.first:case v.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(h)*l.signum(t)-t)*n,o.scaleY=e+(Math.abs(c)*l.signum(e)-e)*n;break;case v.add:o.scaleX+=(h-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(i){case v.setup:t=Math.abs(o.data.scaleX)*l.signum(h),e=Math.abs(o.data.scaleY)*l.signum(c),o.scaleX=t+(h-t)*n,o.scaleY=e+(c-e)*n;break;case v.first:case v.replace:t=Math.abs(o.scaleX)*l.signum(h),e=Math.abs(o.scaleY)*l.signum(c),o.scaleX=t+(h-t)*n,o.scaleY=e+(c-e)*n;break;case v.add:o.scaleX+=(h-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}},L=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,i,a,o.scaleX,o.data.scaleX))}},N=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,i,a,o.scaleY,o.data.scaleY))}},_=class extends R{boneIndex=0;constructor(t,e,s){super(t,e,M.shearX+"|"+s,M.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(i){case v.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case v.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=F.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(i){case v.setup:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case v.first:case v.replace:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case v.add:o.shearX+=h*n,o.shearY+=c*n}}},O=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,i,o.shearX,o.data.shearX))}},U=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,i,o.shearY,o.data.shearY))}},q=class extends F{boneIndex=0;constructor(t,e){super(t,[M.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,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(a==S.mixOut)return void(i==v.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?i!=v.setup&&i!=v.first||(o.inherit=o.data.inherit):o.inherit=this.frames[F.search(l,s,2)+1]}},W=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s,M.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,i){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i}apply(t,e,s,r,n,i,a){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(i){case v.setup:return void h.setFromColor(t);case v.first:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=F.search(l,s,5),g=this.curves[f/5];switch(g){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,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==n?h.set(c,d,u,m):(i==v.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},z=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,i,a){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(i){case v.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case v.first:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=F.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==n)h.r=c,h.g=d,h.b=u;else{if(i==v.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}},G=class extends P{slotIndex=0;constructor(t,e,s){super(t,e,M.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,n,i,a){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(i){case v.setup:return void(l.a=t.a);case v.first:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(i==v.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},$=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s,M.alpha+"|"+s,M.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,i,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,i,a){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(i){case v.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case v.first:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,b=F.search(l,s,8),w=this.curves[b>>3];switch(w){case 0:let t=l[b];d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];let e=(s-t)/(l[b+8]-t);d+=(l[b+8+1]-d)*e,u+=(l[b+8+2]-u)*e,m+=(l[b+8+3]-m)*e,f+=(l[b+8+4]-f)*e,g+=(l[b+8+5]-g)*e,p+=(l[b+8+6]-p)*e,x+=(l[b+8+7]-x)*e;break;case 1:d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];break;default:d=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+36-2),f=this.getBezierValue(s,b,4,w+54-2),g=this.getBezierValue(s,b,5,w+72-2),p=this.getBezierValue(s,b,6,w+90-2),x=this.getBezierValue(s,b,7,w+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(i==v.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)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(g-c.r)*n,c.g+=(p-c.g)*n,c.b+=(x-c.b)*n}}},j=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s,M.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,i,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,n,i,a){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(i){case v.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 v.first:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=F.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=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,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,b-2),u=this.getBezierValue(s,x,2,b+18-2),m=this.getBezierValue(s,x,3,b+36-2),f=this.getBezierValue(s,x,4,b+54-2),g=this.getBezierValue(s,x,5,b+72-2),p=this.getBezierValue(s,x,6,b+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(i==v.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)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(g-c.g)*n,c.b+=(p-c.b)*n}}},H=class extends F{slotIndex=0;attachmentNames;constructor(t,e){super(t,[M.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,r,n,i,a){let o=t.slots[this.slotIndex];o.bone.active&&(a!=S.mixOut?s<this.frames[0]?i!=v.setup&&i!=v.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[F.search1(this.frames,s)]):i==v.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},J=class extends Y{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[M.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,n,i,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(r-2*i+o),f=.03*l-.06*a,g=.006*(3*(i-o)-r+h),p=.018*(a-l+.33333333),x=2*m+g,b=2*f+p,w=.3*(i-r)+m+.16666667*g,y=.3*a+f+.16666667*p,k=r+w,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,w+=x,y+=b,x+=g,b+=p,k+=w,v+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let n=this.frames[e];return s[r+1]*(t-n)/(s[r]-n)}let n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){let e=s[r-2],n=s[r-1];return n+(t-e)/(s[r]-e)*(s[r+1]-n)}let i=s[n-2],a=s[n-1];return a+(1-a)*(t-i)/(this.frames[e+this.getFrameEntries()]-i)}apply(t,e,s,r,n,i,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof x)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(i=v.setup);let c=this.vertices,d=c[0].length,m=this.frames;if(s<m[0]){switch(i){case v.setup:return void(h.length=0);case v.first:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(f=0;f<d;f++)h[f]*=n}else{let e=t.vertices;for(var f=0;f<d;f++)h[f]+=(e[f]-h[f])*n}}return}if(h.length=d,s>=m[m.length-1]){let t=c[m.length-1];if(1==n)if(i==v.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 u.arrayCopy(t,0,h,0,d);else switch(i){case v.setup:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let r=s[e];h[e]=r+(t[e]-r)*n}}break}case v.first:case v.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case v.add:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let g=F.search1(m,s),p=this.getCurvePercent(s,g),b=c[g],w=c[g+1];if(1==n)if(i==v.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=b[t];h[t]+=e+(w[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=b[t];h[t]+=s+(w[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=b[t];h[t]=e+(w[t]-e)*p}else switch(i){case v.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=b[t];h[t]=(e+(w[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=b[t],r=e[t];h[t]=r+(s+(w[t]-s)*p-r)*n}}break}case v.first:case v.replace:for(let t=0;t<d;t++){let e=b[t];h[t]+=(e+(w[t]-e)*p-h[t])*n}break;case v.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=b[t];h[t]+=(e+(w[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=b[t];h[t]+=(s+(w[t]-s)*p-e[t])*n}}}}},K=class extends F{events;constructor(t){super(t,K.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,r,n,i,a){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,i,a),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=F.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}},Q=K;r(Q,"propertyIds",[""+M.event]);var Z=class extends F{drawOrders;constructor(t){super(t,Z.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,r,n,i,a){if(a==S.mixOut)return void(i==v.setup&&u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(i!=v.setup&&i!=v.first||u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=F.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,r=l.length;t<r;t++)e[t]=s[l[t]]}else u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},tt=Z;r(tt,"propertyIds",[""+M.drawOrder]);var et=class extends Y{constraintIndex=0;constructor(t,e,s){super(t,e,[M.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,i,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,r,n,i,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(i){case v.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 v.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=F.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)}i==v.setup?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,a==S.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)*n,o.softness+=(c-o.softness)*n,a==S.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},st=class extends Y{constraintIndex=0;constructor(t,e,s){super(t,e,[M.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,i,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=i,l[t+5]=a,l[t+6]=o}apply(t,e,s,r,n,i,a){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(i){case v.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 v.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let g=F.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(i==v.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}},rt=class extends P{constraintIndex=0;constructor(t,e,s){super(t,e,M.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,n,i,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,i,o.position,o.data.position))}},nt=class extends P{constraintIndex=0;constructor(t,e,s){super(t,e,M.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,n,i,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,i,o.spacing,o.data.spacing))}},it=class extends Y{constraintIndex=0;constructor(t,e,s){super(t,e,[M.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){let i=this.frames;i[t<<=2]=e,i[t+1]=s,i[t+2]=r,i[t+3]=n}apply(t,e,s,r,n,i,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(i){case v.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case v.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=F.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(i==v.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}},at=class extends P{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,n,i,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,n,i,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,i,this.get(o),this.setup(o)))}},ot=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},lt=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ht=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ct=class extends at{constructor(t,e,s){super(t,e,s,M.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}},dt=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ut=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},mt=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},ft=class extends F{constraintIndex;constructor(t,e){super(t,ft.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,n,i,a){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,[],n,i,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[F.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},gt=ft;r(gt,"propertyIds",[M.physicsConstraintReset.toString()]);var pt=class extends F{slotIndex;attachment;constructor(t,e,s){super(t,[M.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return pt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,n){let i=this.frames;i[t*=pt.ENTRIES]=e,i[t+pt.MODE]=s|r<<4,i[t+pt.DELAY]=n}apply(t,e,s,r,n,i,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof x&&l.timelineAttachment==h))return;if(a==S.mixOut)return void(i==v.setup&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(i!=v.setup&&i!=v.first||(o.sequenceIndex=-1));let d=F.search(c,s,pt.ENTRIES),u=c[d],m=c[d+pt.MODE],f=c[d+pt.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,w=T[15&m];if(w!=b.hold)switch(g+=(s-u)/f+1e-5|0,w){case b.once:g=Math.min(p-1,g);break;case b.loop:g%=p;break;case b.pingpong:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case b.onceReverse:g=Math.max(p-1-g,0);break;case b.loopReverse:g=p-1-g%p;break;case b.pingpongReverse:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},xt=pt;r(xt,"ENTRIES",3),r(xt,"MODE",1),r(xt,"DELAY",2);var bt=class{static emptyAnimation(){return bt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ct(this);propertyIDs=new n;animationsChanged=!1;trackEntryPool=new m((()=>new vt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=t*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let i=r.next;if(i){let e=r.trackLast-i.delay;if(e>=0){for(i.delay=0,i.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*i.timeScale,r.trackTime+=n,this.setCurrent(s,i,!0);i.mixingFrom;)i.mixTime+=t,i=i.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r}return 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,r=!1;for(let i=0,a=s.length;i<a;i++){let a=s[i];if(!a||a.delay>0)continue;r=!0;let o=0==i?v.first:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let h=l>=a.alphaAttachmentThreshold,c=a.animationLast,d=a.getAnimationTime(),m=d,f=e;a.reverse&&(m=a.animation.duration-m,f=null);let g=a.animation.timelines,p=g.length;if(0==i&&1==l||o==v.add){0==i&&(h=!0);for(let e=0;e<p;e++){u.webkit602BugfixHelper(l,o);var n=g[e];n instanceof H?this.applyAttachmentTimeline(n,t,m,o,h):n.apply(t,c,m,f,l,o,S.mixIn)}}else{let e=a.timelineMode,s=a.shortestRotation,r=!s&&a.timelinesRotation.length!=p<<1;r&&(a.timelinesRotation.length=p<<1);for(let n=0;n<p;n++){let i=g[n],d=e[n]==Mt?o:v.setup;!s&&i instanceof X?this.applyRotateTimeline(i,t,m,l,d,a.timelinesRotation,n<<1,r):i instanceof H?this.applyAttachmentTimeline(i,t,m,o,h):(u.webkit602BugfixHelper(l,o),i.apply(t,c,m,f,l,d,S.mixIn))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var i=this.unkeyedState+Xt,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==i){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let n=0;0==t.mixDuration?(n=1,s==v.first&&(s=v.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),s!=v.first&&(s=r.mixBlend));let i=n<r.mixAttachmentThreshold,a=n<r.mixDrawOrderThreshold,o=r.animation.timelines,l=o.length,h=r.alpha*t.interruptAlpha,c=h*(1-n),d=r.animationLast,m=r.getAnimationTime(),f=m,g=null;if(r.reverse?f=r.animation.duration-f:n<r.eventThreshold&&(g=this.events),s==v.add)for(let t=0;t<l;t++)o[t].apply(e,d,f,g,c,s,S.mixOut);else{let t=r.timelineMode,n=r.timelineHoldMix,m=r.shortestRotation,p=!m&&r.timelinesRotation.length!=l<<1;p&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let x=0;x<l;x++){let l,b=o[x],w=S.mixOut,y=0;switch(t[x]){case Mt:if(!a&&b instanceof tt)continue;l=s,y=c;break;case Ft:l=v.setup,y=c;break;case Yt:l=s,y=h;break;case Pt:l=v.setup,y=h;break;default:l=v.setup;let t=n[x];y=h*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=y,!m&&b instanceof X?this.applyRotateTimeline(b,e,f,y,l,r.timelinesRotation,x<<1,p):b instanceof H?this.applyAttachmentTimeline(b,e,f,l,i&&y>=r.alphaAttachmentThreshold):(u.webkit602BugfixHelper(y,s),a&&b instanceof tt&&l==v.setup&&(w=S.mixIn),b.apply(e,d,f,g,y,l,w))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,n}applyAttachmentTimeline(t,e,s,r,n){var i=e.slots[t.slotIndex];i.bone.active&&(s<t.frames[0]?r!=v.setup&&r!=v.first||this.setAttachment(e,i,i.data.attachmentName,n):this.setAttachment(e,i,t.attachmentNames[F.search1(t.frames,s)],n),i.attachmentState<=this.unkeyedState&&(i.attachmentState=this.unkeyedState+Xt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+Bt)}applyRotateTimeline(t,e,s,r,n,i,a,o){if(o&&(i[a]=0),1==r)return void t.apply(e,0,s,null,1,n,S.mixIn);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(n){case v.setup:h.rotation=h.data.rotation;default:return;case v.first:c=h.rotation,d=h.data.rotation}else c=n==v.setup?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,m=d-c;if(m-=360*Math.ceil(m/360-.5),0==m)u=i[a];else{let t=0,e=0;o?(t=0,e=m):(t=i[a],e=i[a+1]);let s=t-t%360;u=m+s;let r=m>=0,n=t>=0;Math.abs(e)<=90&&l.signum(e)!=l.signum(m)&&(Math.abs(t-s)>180?(u+=360*l.signum(t),n=r):0!=s?u-=360*l.signum(t):n=r),n!=r&&(u+=360*l.signum(t)),i[a]=u}i[a+1]=m,h.rotation=c+u*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,n=r-s,i=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<i)break;e.time>r||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=a[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 r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,r=!1):this.clearNext(n));let i=this.trackEntry(t,e,s,n);return this.setCurrent(t,i,r),this.queue.drain(),i}addAnimation(t,e,s=!1,r=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let i=this.trackEntry(t,e,s,n);return n?(n.next=i,i.previous=n,r<=0&&(r+=n.getTrackComplete()-i.mixDuration)):(this.setCurrent(t,i,!0),this.queue.drain()),i.delay=r,i}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,bt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,bt.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}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]:(u.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=r?this.data.getMix(r.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=v.replace,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==v.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,n=t.timelineMode;n.length=r;let i=t.timelineHoldMix;i.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)n[t]=a.addAll(s[t].getPropertyIds())?Pt:Yt;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(a.addAll(l))if(!e||r instanceof H||r instanceof tt||r instanceof Q||!e.animation.hasTimeline(l))n[o]=Ft;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Rt,i[o]=s;continue t}break}n[o]=Pt}else n[o]=Mt}}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()}},wt=bt;r(wt,"_emptyAnimation",new I("<empty>",[],0));var yt,kt,vt=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=v.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}},Ct=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(yt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(yt.interrupt),this.objects.push(t)}end(t){this.objects.push(yt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(yt.dispose),this.objects.push(t)}complete(t){this.objects.push(yt.complete),this.objects.push(t)}event(t,e){this.objects.push(yt.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 r=t[s],n=t[s+1];switch(r){case yt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case yt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case yt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case yt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case yt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case yt.event:let r=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};(kt=yt||(yt={}))[kt.start=0]="start",kt[kt.interrupt=1]="interrupt",kt[kt.end=2]="end",kt[kt.dispose=3]="dispose",kt[kt.complete=4]="complete",kt[kt.event=5]="event";var St,At,Tt,It,Mt=0,Ft=1,Yt=2,Pt=3,Rt=4,Xt=1,Bt=2,Et=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(r,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}},Dt=class extends x{color=new a(1,1,1,1);constructor(t){super(t)}copy(){let t=new Dt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Vt=class extends x{endSlot=null;color=new a(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Vt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Lt=class{_image;constructor(t){this._image=t}getImage(){return this._image}};(At=St||(St={}))[At.Nearest=9728]="Nearest",At[At.Linear=9729]="Linear",At[At.MipMap=9987]="MipMap",At[At.MipMapNearestNearest=9984]="MipMapNearestNearest",At[At.MipMapLinearNearest=9985]="MipMapLinearNearest",At[At.MipMapNearestLinear=9986]="MipMapNearestLinear",At[At.MipMapLinearLinear=9987]="MipMapLinearLinear",(It=Tt||(Tt={}))[It.MirroredRepeat=33648]="MirroredRepeat",It[It.ClampToEdge=33071]="ClampToEdge",It[It.Repeat=10497]="Repeat";var Nt=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},_t=class{pages=new Array;regions=new Array;constructor(t){let e=new Ot(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=u.enumValue(St,s[1]),t.magFilter=u.enumValue(St,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=Tt.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=Tt.Repeat)},pma:t=>{t.pma="true"==s[1]}};var n={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 i=e.readLine();for(;i&&0==i.trim().length;)i=e.readLine();for(;i&&0!=i.trim().length&&0!=e.readEntry(s,i);)i=e.readLine();let a=null,o=null,l=null;for(;null!==i;)if(0==i.trim().length)a=null,i=e.readLine();else if(a){let t=new qt(a,i);for(;;){let r=e.readEntry(s,i=e.readLine());if(0==r)break;let a=n[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<r;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/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Ut(i.trim());0!=e.readEntry(s,i=e.readLine());){let t=r[s[0]];t&&t(a)}this.pages.push(a)}}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()}},Ot=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)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 r=1,n=s+1;;r++){let s=e.indexOf(",",n);if(-1==s)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,s-n).trim(),n=s+1,4==r)return 4}}},Ut=class{name;minFilter=St.Nearest;magFilter=St.Nearest;uWrap=Tt.ClampToEdge;vWrap=Tt.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}},qt=class extends Nt{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)}},Wt=class extends x{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new a(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new a(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=u.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,r=this.region.u,n=this.region.v,i=0,a=0;if(this.region instanceof qt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,i=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*i,e[o+1]=n+(1-t[o])*a;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,i=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*i,e[o+1]=n+(1-t[o+1])*a;return;case 270:r-=o.offsetY/h,n-=o.offsetX/c,i=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*i,e[o+1]=n+t[o]*a;return}r-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,i=o.originalWidth/h,a=o.originalHeight/c}else this.region?(i=this.region.u2-r,a=this.region.v2-n):(r=n=0,i=a=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*i,e[o+1]=n+t[o+1]*a}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 Wt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),u.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),u.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),u.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),u.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,i){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,i)}newLinkedMesh(){let t=new Wt(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}},zt=class extends x{lengths=[];closed=!1;constantSpeed=!1;color=new a(1,1,1,1);constructor(t){super(t)}copy(){let t=new zt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),u.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Gt=class extends x{x=0;y=0;rotation=0;color=new a(.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*l.degRad,s=Math.cos(e),r=Math.sin(e),n=s*t.a+r*t.b,i=s*t.c+r*t.d;return l.atan2Deg(i,n)}copy(){let t=new Gt(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},$t=class extends g{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new a(1,1,1,1);path;region=null;sequence=null;offset=u.newFloatArray(8);uvs=u.newFloatArray(8);tempColor=new a(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,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*r,a=n+this.region.width*s,o=i+this.region.height*r,h=this.rotation*l.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=n*c+u,g=n*d,p=i*c+m,x=i*d,b=a*c+u,w=a*d,y=o*c+m,k=o*d,v=this.offset;v[0]=f-x,v[1]=p+g,v[2]=f-k,v[3]=y+g,v[4]=b-k,v[5]=y+w,v[6]=b-x,v[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,r){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,i=this.offset,a=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=i[0],m=i[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=r,u=i[2],m=i[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=r,u=i[4],m=i[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=r,u=i[6],m=i[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new $t(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,u.arrayCopy(this.uvs,0,t.uvs,0,8),u.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},jt=$t;r(jt,"X1",0),r(jt,"Y1",1),r(jt,"C1R",2),r(jt,"C1G",3),r(jt,"C1B",4),r(jt,"C1A",5),r(jt,"U1",6),r(jt,"V1",7),r(jt,"X2",8),r(jt,"Y2",9),r(jt,"C2R",10),r(jt,"C2G",11),r(jt,"C2B",12),r(jt,"C2A",13),r(jt,"U2",14),r(jt,"V2",15),r(jt,"X3",16),r(jt,"Y3",17),r(jt,"C3R",18),r(jt,"C3G",19),r(jt,"C3B",20),r(jt,"C3A",21),r(jt,"U3",22),r(jt,"V3",23),r(jt,"X4",24),r(jt,"Y4",25),r(jt,"C4R",26),r(jt,"C4G",27),r(jt,"C4B",28),r(jt,"C4A",29),r(jt,"U4",30),r(jt,"V4",31);var Ht,Jt,Kt=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let n=0,i=r.length;n<i;n++){let i=s.getPath(e,n),a=this.atlas.findRegion(i);if(null==a)throw new Error("Region not found in atlas: "+i+" (sequence: "+t+")");r[n]=a}}newRegionAttachment(t,e,s,r){let n=new jt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,r){let n=new Wt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new Dt(e)}newPathAttachment(t,e){return new zt(e)}newPointAttachment(t,e){return new Gt(e)}newClippingAttachment(t,e){return new Vt(e)}},Qt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Ht.Normal;skinRequired=!1;color=new a;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}};(Jt=Ht||(Ht={}))[Jt.Normal=0]="Normal",Jt[Jt.OnlyTranslation=1]="OnlyTranslation",Jt[Jt.NoRotationOrReflection=2]="NoRotationOrReflection",Jt[Jt.NoScale=3]="NoScale",Jt[Jt.NoScaleOrReflection=4]="NoScaleOrReflection";var Zt,te,ee,se,re,ne,ie=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=Ht.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,r,n,i,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=i,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const h=o.scaleX,c=o.scaleY,d=(s+i)*l.degRad,u=(s+90+a)*l.degRad;return this.a=Math.cos(d)*r*h,this.b=Math.cos(u)*n*h,this.c=Math.sin(d)*r*c,this.d=Math.sin(u)*n*c,this.worldX=t*h+o.x,void(this.worldY=e*c+o.y)}let h=o.a,c=o.b,d=o.c,u=o.d;switch(this.worldX=h*t+c*e+o.worldX,this.worldY=d*t+u*e+o.worldY,this.inherit){case Ht.Normal:{const t=(s+i)*l.degRad,e=(s+90+a)*l.degRad,o=Math.cos(t)*r,m=Math.cos(e)*n,f=Math.sin(t)*r,g=Math.sin(e)*n;return this.a=h*o+c*f,this.b=h*m+c*g,this.c=d*o+u*f,void(this.d=d*m+u*g)}case Ht.OnlyTranslation:{const t=(s+i)*l.degRad,e=(s+90+a)*l.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*n,this.c=Math.sin(t)*r,this.d=Math.sin(e)*n;break}case Ht.NoRotationOrReflection:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;h*=t,d*=e;let o=h*h+d*d,m=0;o>1e-4?(o=Math.abs(h*u*e-c*t*d)/o,c=d*o,u=h*o,m=Math.atan2(d,h)*l.radDeg):(h=0,d=0,m=90-Math.atan2(u,c)*l.radDeg);const f=(s+i-m)*l.degRad,g=(s+a-m+90)*l.degRad,p=Math.cos(f)*r,x=Math.cos(g)*n,b=Math.sin(f)*r,w=Math.sin(g)*n;this.a=h*p-c*b,this.b=h*x-c*w,this.c=d*p+u*b,this.d=d*x+u*w;break}case Ht.NoScale:case Ht.NoScaleOrReflection:{s*=l.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(h*t+c*e)/this.skeleton.scaleX,m=(d*t+u*e)/this.skeleton.scaleY,f=Math.sqrt(o*o+m*m);f>1e-5&&(f=1/f),o*=f,m*=f,f=Math.sqrt(o*o+m*m),this.inherit==Ht.NoScale&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(f=-f),s=Math.PI/2+Math.atan2(m,o);const g=Math.cos(s)*f,p=Math.sin(s)*f;i*=l.degRad,a=(90+a)*l.degRad;const x=Math.cos(i)*r,b=Math.cos(a)*n,w=Math.sin(i)*r,y=Math.sin(a)*n;this.a=o*x+g*w,this.b=o*b+g*y,this.c=m*x+p*w,this.d=m*b+p*y;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)*l.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*l.radDeg);let e,s,r,n,i=t.a,a=t.b,o=t.c,h=t.d,c=1/(i*h-a*o),d=h*c,u=a*c,m=o*c,f=i*c,g=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=g*d-p*u,this.ay=p*f-g*m,this.inherit==Ht.OnlyTranslation)e=this.a,s=this.b,r=this.c,n=this.d;else{switch(this.inherit){case Ht.NoRotationOrReflection:{let t=Math.abs(i*h-a*o)/(i*i+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,h=i*this.skeleton.scaleY*t/this.skeleton.scaleX,c=1/(i*h-a*o),d=h*c,u=a*c;break}case Ht.NoScale:case Ht.NoScaleOrReflection:let t=l.cosDeg(this.rotation),e=l.sinDeg(this.rotation);i=(i*t+a*e)/this.skeleton.scaleX,o=(o*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(i*i+o*o);s>1e-5&&(s=1/s),i*=s,o*=s,s=Math.sqrt(i*i+o*o),this.inherit==Ht.NoScale&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=l.PI/2+Math.atan2(o,i);a=Math.cos(r)*s,h=Math.sin(r)*s,c=1/(i*h-a*o),d=h*c,u=a*c,m=o*c,f=i*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,r=f*this.c-m*this.a,n=f*this.d-m*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*n-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*n,t)*l.radDeg,this.arotation=Math.atan2(r,e)*l.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*l.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*l.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*l.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*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=l.sinDeg(t),s=l.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*l.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=l.sinDeg(t),s=l.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*l.radDeg}rotateWorld(t){t*=l.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,n=this.b;this.a=s*r-e*this.c,this.b=s*n-e*this.d,this.c=e*r+s*this.c,this.d=e*n+s*this.d}},ae=class{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},oe=class{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,r=new Uint8Array(s),n=0;n<s;n++)r[n]=e.charCodeAt(n);return r}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 r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",t,!0);let n=()=>{this.finish(t,r.status,r.responseText)};r.onload=n,r.onerror=n,r.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 r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer";let n=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{200==r.status||0==r.status?this.finish(t,200,new Uint8Array(r.response)):n()},r.onerror=n,r.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=r.length;t<e;t+=2)r[t].apply(null,n)}},le=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},he=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},ce=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(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,r,n,i,a){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let h=o.a,c=o.b,d=o.c,u=o.d,m=-t.ashearX-t.arotation,f=0,g=0;switch(t.inherit){case Ht.OnlyTranslation:f=(e-t.worldX)*l.signum(t.skeleton.scaleX),g=(s-t.worldY)*l.signum(t.skeleton.scaleY);break;case Ht.NoRotationOrReflection:let r=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),n=h/t.skeleton.scaleX,i=d/t.skeleton.scaleY;c=-i*r*t.skeleton.scaleX,u=n*r*t.skeleton.scaleY,m+=Math.atan2(i,n)*l.radDeg;default:let a=e-o.worldX,p=s-o.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(f=0,g=0):(f=(a*u-p*c)/x-t.ax,g=(p*h-a*d)/x-t.ay)}m+=Math.atan2(g,f)*l.radDeg,t.ascaleX<0&&(m+=180),m>180?m-=360:m<-180&&(m+=360);let p=t.ascaleX,x=t.ascaleY;if(r||n){switch(t.inherit){case Ht.NoScale:case Ht.NoScaleOrReflection:f=e-t.worldX,g=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=f*f+g*g;if(r&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;p*=e,i&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*a,p,x,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,i,a,o,h){if(t.inherit!=Ht.Normal||e.inherit!=Ht.Normal)return;let c=t.ax,d=t.ay,u=t.ascaleX,m=t.ascaleY,f=u,g=m,p=e.ascaleX,x=0,b=0,w=0;u<0?(u=-u,x=180,w=-1):(x=0,w=1),m<0&&(m=-m,w=-w),p<0?(p=-p,b=180):b=0;let y=e.ax,k=0,v=0,C=0,S=t.a,A=t.b,T=t.c,I=t.d,M=Math.abs(u-m)<=1e-4;!M||i?(k=0,v=S*y+t.worldX,C=T*y+t.worldY):(k=e.ay,v=S*y+A*k+t.worldX,C=T*y+I*k+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,A=F.b,T=F.c,I=F.d;let Y=S*I-A*T,P=v-F.worldX,R=C-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let X,B,E=(P*I-R*A)*Y-c,D=(R*S-P*T)*Y-d,V=Math.sqrt(E*E+D*D),L=e.data.length*p;if(V<1e-4)return this.apply1(t,s,r,!1,i,!1,h),void e.updateWorldTransformWith(y,k,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);P=s-F.worldX,R=r-F.worldY;let N=(P*I-R*A)*Y-c,_=(R*S-P*T)*Y-d,O=N*N+_*_;if(0!=o){o*=u*(p+1)*.5;let t=Math.sqrt(O),e=t-V-L*u+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,N-=s*N,_-=s*_,O=N*N+_*_}}t:if(M){L*=u;let t=(O-V*V-L*L)/(2*V*L);t<-1?(t=-1,B=Math.PI*n):t>1?(t=1,B=0,i&&(S=(Math.sqrt(O)/(V+L)-1)*h+1,f*=S,a&&(g*=S))):B=Math.acos(t)*n,S=V+L*t,A=L*Math.sin(B),X=Math.atan2(_*S-N*A,N*S+_*A)}else{S=u*L,A=m*L;let t=S*S,e=A*A,s=Math.atan2(_,N);T=e*V*V+t*O-t*e;let r=-2*e*V,i=e-t;if(I=r*r-4*i*T,I>=0){let t=Math.sqrt(I);r<0&&(t=-t),t=.5*-(r+t);let e=t/i,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=O-o*o,e>=0){R=Math.sqrt(e)*n,X=s-Math.atan2(R,o),B=Math.atan2(R/m,(o-V)/u);break t}}let a=l.PI,o=V-S,h=o*o,c=0,d=0,f=V+S,g=f*f,p=0;T=-S*V/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),P=S*Math.cos(T)+V,R=A*Math.sin(T),I=P*P+R*R,I<h&&(a=T,h=I,o=P,c=R),I>g&&(d=T,g=I,f=P,p=R)),O<=.5*(h+g)?(X=s-Math.atan2(c*n,o),B=a*n):(X=s-Math.atan2(p*n,f),B=d*n)}let U=Math.atan2(k,y)*w,q=t.arotation;X=(X-U)*l.radDeg+x-q,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(c,d,q+X*h,f,g,0,0),q=e.arotation,B=((B+U)*l.radDeg-e.ashearX)*w+b-q,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(y,k,q+B*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},de=class 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)}},ue=class 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=Zt.Fixed;spacingMode=ee.Fixed;rotateMode=re.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}};(te=Zt||(Zt={}))[te.Fixed=0]="Fixed",te[te.Percent=1]="Percent",(se=ee||(ee={}))[se.Length=0]="Length",se[se.Fixed=1]="Fixed",se[se.Percent=2]="Percent",se[se.Proportional=3]="Proportional",(ne=re||(re={}))[ne.Tangent=0]="Tangent",ne[ne.Chain=1]="Chain",ne[ne.ChainScale=2]="ChainScale";var me=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(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,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}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 zt))return;let s=this.mixRotate,r=this.mixX,n=this.mixY;if(0==s&&0==r&&0==n)return;let i=this.data,a=i.rotateMode==re.Tangent,o=i.rotateMode==re.ChainScale,h=this.bones,c=h.length,d=a?c:c+1,m=u.setArraySize(this.spaces,d),f=o?this.lengths=u.setArraySize(this.lengths,c):[],g=this.spacing;switch(i.spacingMode){case ee.Percent:if(o)for(let t=0,e=d-1;t<e;t++){let e=h[t],s=e.data.length,r=s*e.a,n=s*e.c;f[t]=Math.sqrt(r*r+n*n)}u.arrayFill(m,1,d,g);break;case ee.Proportional:let t=0;for(let e=0,s=d-1;e<s;){let s=h[e],r=s.data.length;if(r<me.epsilon)o&&(f[e]=0),m[++e]=g;else{let n=r*s.a,i=r*s.c,a=Math.sqrt(n*n+i*i);o&&(f[e]=a),m[++e]=a,t+=a}}if(t>0){t=d/t*g;for(let e=1;e<d;e++)m[e]*=t}break;default:let e=i.spacingMode==ee.Length;for(let t=0,s=d-1;t<s;){let s=h[t],r=s.data.length;if(r<me.epsilon)o&&(f[t]=0),m[++t]=g;else{let n=r*s.a,i=r*s.c,a=Math.sqrt(n*n+i*i);o&&(f[t]=a),m[++t]=(e?r+g:g)*a/r}}}let p=this.computeWorldPositions(e,d,a),x=p[0],b=p[1],w=i.offsetRotation,y=!1;if(0==w)y=i.rotateMode==re.Chain;else{y=!1;let t=this.target.bone;w*=t.a*t.d-t.b*t.c>0?l.degRad:-l.degRad}for(let t=0,e=3;t<c;t++,e+=3){let i=h[t];i.worldX+=(x-i.worldX)*r,i.worldY+=(b-i.worldY)*n;let c=p[e],d=p[e+1],u=c-x,g=d-b;if(o){let e=f[t];if(0!=e){let t=(Math.sqrt(u*u+g*g)/e-1)*s+1;i.a*=t,i.c*=t}}if(x=c,b=d,s>0){let r=i.a,n=i.b,o=i.c,h=i.d,c=0,d=0,f=0;if(c=a?p[e-1]:0==m[t+1]?p[e+2]:Math.atan2(g,u),c-=Math.atan2(o,r),y){d=Math.cos(c),f=Math.sin(c);let t=i.data.length;x+=(t*(d*r-f*o)-u)*s,b+=(t*(f*r+d*o)-g)*s}else c+=w;c>l.PI?c-=l.PI2:c<-l.PI&&(c+=l.PI2),c*=s,d=Math.cos(c),f=Math.sin(c),i.a=d*r-f*o,i.b=d*n-f*h,i.c=f*r+d*o,i.d=f*n+d*h}i.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,n=this.position,i=this.spaces,a=u.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=me.NONE;if(!t.constantSpeed){let m=t.lengths;c-=l?1:2;let f,g=m[c];switch(this.data.positionMode==Zt.Percent&&(n*=g),this.data.spacingMode){case ee.Percent:f=g;break;case ee.Proportional:f=g/e;break;default:f=1}o=u.setArraySize(this.world,8);for(let u=0,p=0,x=0;u<e;u++,p+=3){let e=i[u]*f;n+=e;let b=n;if(l)b%=g,b<0&&(b+=g),x=0;else{if(b<0){d!=me.BEFORE&&(d=me.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(b,o,0,a,p);continue}if(b>g){d!=me.AFTER&&(d=me.AFTER,t.computeWorldVertices(r,h-6,4,o,0,2)),this.addAfterPosition(b-g,o,0,a,p);continue}}for(;;x++){let t=m[x];if(!(b>t)){if(0==x)b/=t;else{let e=m[x-1];b=(b-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(r,h-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,6*x+2,8,o,0,2)),this.addCurvePosition(b,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,p,s||u>0&&0==e)}return a}l?(h+=2,o=u.setArraySize(this.world,h),t.computeWorldVertices(r,2,h-4,o,0,2),t.computeWorldVertices(r,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=u.setArraySize(this.world,h),t.computeWorldVertices(r,2,h,o,0,2));let m,f=u.setArraySize(this.curves,c),g=0,p=o[0],x=o[1],b=0,w=0,y=0,k=0,v=0,C=0,S=0,A=0,T=0,I=0,M=0,F=0,Y=0,P=0;for(let t=0,e=2;t<c;t++,e+=6)b=o[e],w=o[e+1],y=o[e+2],k=o[e+3],v=o[e+4],C=o[e+5],S=.1875*(p-2*b+y),A=.1875*(x-2*w+k),T=.09375*(3*(b-y)-p+v),I=.09375*(3*(w-k)-x+C),M=2*S+T,F=2*A+I,Y=.75*(b-p)+S+.16666667*T,P=.75*(w-x)+A+.16666667*I,g+=Math.sqrt(Y*Y+P*P),Y+=M,P+=F,M+=T,F+=I,g+=Math.sqrt(Y*Y+P*P),Y+=M,P+=F,g+=Math.sqrt(Y*Y+P*P),Y+=M+T,P+=F+I,g+=Math.sqrt(Y*Y+P*P),f[t]=g,p=v,x=C;switch(this.data.positionMode==Zt.Percent&&(n*=g),this.data.spacingMode){case ee.Percent:m=g;break;case ee.Proportional:m=g/e;break;default:m=1}let R=this.segments,X=0;for(let t=0,r=0,c=0,u=0;t<e;t++,r+=3){let e=i[t]*m;n+=e;let B=n;if(l)B%=g,B<0&&(B+=g),c=0;else{if(B<0){this.addBeforePosition(B,o,0,a,r);continue}if(B>g){this.addAfterPosition(B-g,o,h-4,a,r);continue}}for(;;c++){let t=f[c];if(!(B>t)){if(0==c)B/=t;else{let e=f[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],x=o[t+1],b=o[t+2],w=o[t+3],y=o[t+4],k=o[t+5],v=o[t+6],C=o[t+7],S=.03*(p-2*b+y),A=.03*(x-2*w+k),T=.006*(3*(b-y)-p+v),I=.006*(3*(w-k)-x+C),M=2*S+T,F=2*A+I,Y=.3*(b-p)+S+.16666667*T,P=.3*(w-x)+A+.16666667*I,X=Math.sqrt(Y*Y+P*P),R[0]=X,t=1;t<8;t++)Y+=M,P+=F,M+=T,F+=I,X+=Math.sqrt(Y*Y+P*P),R[t]=X;Y+=M,P+=F,X+=Math.sqrt(Y*Y+P*P),R[8]=X,Y+=M+T,P+=F+I,X+=Math.sqrt(Y*Y+P*P),R[9]=X,u=0}for(B*=X;;u++){let t=R[u];if(!(B>t)){if(0==u)B/=t;else{let e=R[u-1];B=u+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,p,x,b,w,y,k,v,C,a,r,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,r,n){let i=e[s],a=e[s+1],o=e[s+2]-i,l=e[s+3]-a,h=Math.atan2(l,o);r[n]=i+t*Math.cos(h),r[n+1]=a+t*Math.sin(h),r[n+2]=h}addAfterPosition(t,e,s,r,n){let i=e[s+2],a=e[s+3],o=i-e[s],l=a-e[s+1],h=Math.atan2(l,o);r[n]=i+t*Math.cos(h),r[n+1]=a+t*Math.sin(h),r[n+2]=h}addCurvePosition(t,e,s,r,n,i,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(n-s,r-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,y=b*t,k=e*p+r*w+i*y+o*m,v=s*p+n*w+a*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(n-s,r-e):Math.atan2(v-(s*g+n*x*2+a*u),k-(e*g+r*x*2+i*u)))}},fe=me;r(fe,"NONE",-1),r(fe,"BEFORE",-2),r(fe,"AFTER",-3),r(fe,"epsilon",1e-5);var ge,pe,xe=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,r=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,i=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case ge.none:return;case ge.reset:this.reset();case ge.update:const t=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=t.time;const c=a.worldX,d=a.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,p=-1,x=this.data.limit*h,b=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||r){if(s){const t=(this.ux-c)*m;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=c}if(r){const t=(this.uy-d)*m;this.yOffset+=t>b?b:t<-b?-b:t,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const e=this.massInverse*f,n=this.strength,i=this.wind*g*t.scaleX,a=this.gravity*g*t.scaleY;do{s&&(this.xVelocity+=(i-this.xOffset*n)*e,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),r&&(this.yVelocity-=(a+this.yOffset*n)*e,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f}while(u>=f)}s&&(a.worldX+=this.xOffset*e*this.data.x),r&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||i){let t=Math.atan2(a.c,a.a),s=0,r=0,h=0,c=this.cx-a.worldX,d=this.cy-a.worldY;if(c>x?c=x:c<-x&&(c=-x),d>b?d=b:d<-b&&(d=-b),n){h=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(d+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(n-Math.ceil(n*l.invPI2-.5)*l.PI2)*m,n=this.rotateOffset*h+t,s=Math.cos(n),r=Math.sin(n),i&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(c*s+d*r)*m/n))}else{s=Math.cos(t),r=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+d*r)*m/e)}if(u=this.remaining,u>=f){-1==p&&(p=Math.pow(this.damping,60*f));const e=this.massInverse*f,a=this.strength,l=this.wind,c=ke.yDown?-this.gravity:this.gravity,d=o/g;for(;;)if(u-=f,i&&(this.scaleVelocity+=(l*s-c*r-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),n){if(this.rotateVelocity-=((l*r+c*s)*d+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const n=this.rotateOffset*h+t;s=Math.cos(n),r=Math.sin(n)}else if(u<f)break}}this.remaining=u}this.cx=a.worldX,this.cy=a.worldY;break;case ge.pose:s&&(a.worldX+=this.xOffset*e*this.data.x),r&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,r=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),n=a.b,a.b=r*n-s*a.d,a.d=s*n+r*a.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),n=a.a,a.a=r*n-s*a.c,a.c=s*n+r*a.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),n=a.a,a.a=r*n-s*a.c,a.c=s*n+r*a.c,n=a.b,a.b=r*n-s*a.d,a.d=s*n+r*a.d}if(i){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}t!=ge.pose&&(this.tx=o*a.a,this.ty=o*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*l.degRad,n=Math.cos(r),i=Math.sin(r),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*i-a,a*i+o*n-o)}},be=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new a,this.darkColor=t.darkColor?new a:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof x&&this.attachment instanceof x&&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}},we=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new f;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 r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){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,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=0!=e||0!=s,o=this.target,h=o.a,c=o.b,d=o.c,u=o.d,m=h*u-c*d>0?l.degRad:-l.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,r=x.c,n=x.d,i=Math.atan2(d,h)-Math.atan2(r,e)+f;i>l.PI?i-=l.PI2:i<-l.PI&&(i+=l.PI2),i*=t;let a=Math.cos(i),o=Math.sin(i);x.a=a*e-o*r,x.b=a*s-o*n,x.c=o*e+a*r,x.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=r){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*r)/t),x.a*=t,x.c*=t}if(0!=n){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*n)/t),x.b*=t,x.d*=t}if(i>0){let t=x.b,e=x.d,s=Math.atan2(e,t),r=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));r>l.PI?r-=l.PI2:r<-l.PI&&(r+=l.PI2),r=s+(r+g)*i;let n=Math.sqrt(t*t+e*e);x.b=Math.cos(r)*n,x.d=Math.sin(r)*n}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=0!=e||0!=s,o=this.target,h=o.a,c=o.b,d=o.c,u=o.d,m=h*u-c*d>0?l.degRad:-l.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,r=x.c,n=x.d,i=Math.atan2(d,h)+f;i>l.PI?i-=l.PI2:i<-l.PI&&(i+=l.PI2),i*=t;let a=Math.cos(i),o=Math.sin(i);x.a=a*e-o*r,x.b=a*s-o*n,x.c=o*e+a*r,x.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=r){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*r+1;x.a*=t,x.c*=t}if(0!=n){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*n+1;x.b*=t,x.d*=t}if(i>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>l.PI?t-=l.PI2:t<-l.PI&&(t+=l.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-l.PI/2+g)*i;let r=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*r,x.d=Math.sin(t)*r}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=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+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=r&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*r)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=i&&(g+=(a.ashearY-g+this.data.offsetShearY)*i),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,m=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*r+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(a.ashearY+this.data.offsetShearY)*i;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},ye=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return ye.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,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new ie(r,this,t),t.children.push(s)}else s=new ie(r,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],r=this.bones[s.boneData.index],n=new be(s,r);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new ce(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new we(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new fe(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 a(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,r=this.pathConstraints,n=this.physicsConstraints,i=e.length,a=s.length,o=r.length,l=this.physicsConstraints.length,h=i+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<i;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<a;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[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&&u.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&u.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let n=e.getAttachment();n instanceof zt&&this.sortPathConstraintAttachmentWith(n,r);let i=t.bones,a=i.length;for(let t=0;t<a;t++)this.sortBone(i[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(i[t].children);for(let t=0;t<a;t++)i[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&u.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 r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof zt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)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&&u.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,r=s.length;e<r;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let n=e.a,i=e.b,a=e.c,o=e.d;r.worldX=n*this.x+i*this.y+e.worldX,r.worldY=a*this.x+o*this.y+e.worldY;const h=(r.rotation+r.shearX)*l.degRad,c=(r.rotation+90+r.shearY)*l.degRad,d=Math.cos(h)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(n*d+i*m)*this.scaleX,r.b=(n*u+i*f)*this.scaleX,r.c=(a*d+o*m)*this.scaleY,r.d=(a*u+o*f)*this.scaleY;let g=this._updateCache;for(let e=0,s=g.length;e<s;e++){let s=g[e];s!=r&&s.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;u.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,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}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,r=e.length;s<r;s++){let r=e[s],n=r.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&r.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 r=0,n=s.length;r<n;r++){let n=s[r];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.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(t){let e=new f,s=new f;return this.getBounds(e,s,void 0,t),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,m=e.getAttachment();if(m instanceof jt)h=8,c=u.setArraySize(s,h,0),m.computeWorldVertices(e,c,0,2),d=ye.quadTriangles;else if(m instanceof Wt){let t=m;h=t.worldVerticesLength,c=u.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(m instanceof Vt&&null!=r){r.clipStart(e,m);continue}if(c&&d){null!=r&&r.isClipping()&&(r.clipTriangles(c,d,d.length),c=r.clippedVertices,h=r.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];i=Math.min(i,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(i,a),e.set(o-i,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,n=s.length;r<n;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let n=0,i=r.length;n<i;n++)r[n].rotate(t,e,s)}},ke=ye;r(ke,"quadTriangles",[0,1,2,2,3,0]),r(ke,"yDown",!1),(pe=ge||(ge={}))[pe.none=0]="none",pe[pe.reset=1]="reset",pe[pe.update=2]="update",pe[pe.pose=3]="pose";var ve,Ce,Se=class 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)}},Ae=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}},Te=class{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Ie=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new a(.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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||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],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||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 Wt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(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 r in s){let n=s[r];n&&t.push(new Te(e,r,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let n=s[r];n&&e.push(new Te(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let n=t.slots[r],i=n.getAttachment();if(i&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(i==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},Me=class{index=0;name;boneData;color=new a(1,1,1,1);darkColor=null;attachmentName=null;blendMode=ve.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}};(Ce=ve||(ve={}))[Ce.Normal=0]="Normal",Ce[Ce.Additive=1]="Additive",Ce[Ce.Multiply=2]="Multiply",Ce[Ce.Screen=3]="Screen";var Fe,Ye,Pe=class 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)}},Re=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ae;s.name="";let r=new Xe(t),n=r.readInt32(),i=r.readInt32();s.hash=0==i&&0==n?null:i.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}l=r.readInt(!0);for(let t=0;t<l;t++){let n=r.readString();if(!n)throw new Error("Bone name must not be null.");let i=0==t?null:s.bones[r.readInt(!0)],l=new Qt(t,n,i);l.rotation=r.readFloat(),l.x=r.readFloat()*e,l.y=r.readFloat()*e,l.scaleX=r.readFloat(),l.scaleY=r.readFloat(),l.shearX=r.readFloat(),l.shearY=r.readFloat(),l.length=r.readFloat()*e,l.inherit=r.readByte(),l.skinRequired=r.readBoolean(),o&&(a.rgba8888ToColor(l.color,r.readInt32()),l.icon=r.readString()??void 0,l.visible=r.readBoolean()),s.bones.push(l)}l=r.readInt(!0);for(let t=0;t<l;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[r.readInt(!0)],i=new Me(t,e,n);a.rgba8888ToColor(i.color,r.readInt32());let l=r.readInt32();-1!=l&&a.rgb888ToColor(i.darkColor=new a,l),i.attachmentName=r.readStringRef(),i.blendMode=r.readInt(!0),o&&(i.visible=r.readBoolean()),s.slots.push(i)}l=r.readInt(!0);for(let t,n=0;n<l;n++){let n=r.readString();if(!n)throw new Error("IK constraint data name must not be null.");let i=new de(n);i.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)i.bones.push(s.bones[r.readInt(!0)]);i.target=s.bones[r.readInt(!0)];let a=r.readByte();i.skinRequired=!!(1&a),i.bendDirection=2&a?1:-1,i.compress=!!(4&a),i.stretch=!!(8&a),i.uniform=!!(16&a),32&a&&(i.mix=64&a?r.readFloat():1),128&a&&(i.softness=r.readFloat()*e),s.ikConstraints.push(i)}l=r.readInt(!0);for(let t,n=0;n<l;n++){let n=r.readString();if(!n)throw new Error("Transform constraint data name must not be null.");let i=new Pe(n);i.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)i.bones.push(s.bones[r.readInt(!0)]);i.target=s.bones[r.readInt(!0)];let a=r.readByte();i.skinRequired=!!(1&a),i.local=!!(2&a),i.relative=!!(4&a),8&a&&(i.offsetRotation=r.readFloat()),16&a&&(i.offsetX=r.readFloat()*e),32&a&&(i.offsetY=r.readFloat()*e),64&a&&(i.offsetScaleX=r.readFloat()),128&a&&(i.offsetScaleY=r.readFloat()),a=r.readByte(),1&a&&(i.offsetShearY=r.readFloat()),2&a&&(i.mixRotate=r.readFloat()),4&a&&(i.mixX=r.readFloat()),8&a&&(i.mixY=r.readFloat()),16&a&&(i.mixScaleX=r.readFloat()),32&a&&(i.mixScaleY=r.readFloat()),64&a&&(i.mixShearY=r.readFloat()),s.transformConstraints.push(i)}l=r.readInt(!0);for(let t,n=0;n<l;n++){let n=r.readString();if(!n)throw new Error("Path constraint data name must not be null.");let i=new ue(n);i.order=r.readInt(!0),i.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)i.bones.push(s.bones[r.readInt(!0)]);i.target=s.slots[r.readInt(!0)];const a=r.readByte();i.positionMode=1&a,i.spacingMode=a>>1&3,i.rotateMode=a>>3&3,128&a&&(i.offsetRotation=r.readFloat()),i.position=r.readFloat(),i.positionMode==Zt.Fixed&&(i.position*=e),i.spacing=r.readFloat(),i.spacingMode!=ee.Length&&i.spacingMode!=ee.Fixed||(i.spacing*=e),i.mixRotate=r.readFloat(),i.mixX=r.readFloat(),i.mixY=r.readFloat(),s.pathConstraints.push(i)}l=r.readInt(!0);for(let t=0;t<l;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const n=new Se(t);n.order=r.readInt(!0),n.bone=s.bones[r.readInt(!0)];let i=r.readByte();n.skinRequired=!!(1&i),2&i&&(n.x=r.readFloat()),4&i&&(n.y=r.readFloat()),8&i&&(n.rotate=r.readFloat()),16&i&&(n.scaleX=r.readFloat()),32&i&&(n.shearX=r.readFloat()),n.limit=(64&i?r.readFloat():5e3)*e,n.step=1/r.readUnsignedByte(),n.inertia=r.readFloat(),n.strength=r.readFloat(),n.damping=r.readFloat(),n.massInverse=128&i?r.readFloat():1,n.wind=r.readFloat(),n.gravity=r.readFloat(),i=r.readByte(),1&i&&(n.inertiaGlobal=!0),2&i&&(n.strengthGlobal=!0),4&i&&(n.dampingGlobal=!0),8&i&&(n.massGlobal=!0),16&i&&(n.windGlobal=!0),32&i&&(n.gravityGlobal=!0),64&i&&(n.mixGlobal=!0),n.mix=128&i?r.readFloat():1,s.physicsConstraints.push(n)}let h=this.readSkin(r,s,!0,o);h&&(s.defaultSkin=h,s.skins.push(h));{let t=s.skins.length;for(u.setArraySize(s.skins,l=t+r.readInt(!0));t<l;t++){let e=this.readSkin(r,s,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}l=this.linkedMeshes.length;for(let t=0;t<l;t++){let e=this.linkedMeshes[t];const r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=r.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new he(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let n=null,i=0;if(s){if(i=t.readInt(!0),0==i)return null;n=new Ie("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new Ie(s),r&&a.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,r=n.bones.length;s<r;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(let s=0;s<i;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,i,r);a&&n.setAttachment(s,i,a)}}return n}readAttachment(t,e,s,r,n,i){let o=this.scale,l=t.readByte();const h=8&l?t.readStringRef():n;if(!h)throw new Error("Attachment name must not be null");switch(7&l){case Fe.Region:{let e=16&l?t.readStringRef():null;const r=32&l?t.readInt32():4294967295,n=64&l?this.readSequence(t):null;let i=128&l?t.readFloat():0,c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat();e||(e=h);let p=this.attachmentLoader.newRegionAttachment(s,h,e,n);return p?(p.path=e,p.x=c*o,p.y=d*o,p.scaleX=u,p.scaleY=m,p.rotation=i,p.width=f*o,p.height=g*o,a.rgba8888ToColor(p.color,r),p.sequence=n,null==n&&p.updateRegion(),p):null}case Fe.BoundingBox:{let e=this.readVertices(t,!!(16&l)),r=i?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,h);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,i&&a.rgba8888ToColor(n.color,r),n):null}case Fe.Mesh:{let e=16&l?t.readStringRef():h;const r=32&l?t.readInt32():4294967295,n=64&l?this.readSequence(t):null,c=t.readInt(!0),d=this.readVertices(t,!!(128&l)),u=this.readFloatArray(t,d.length,1),m=this.readShortArray(t,3*(d.length-c-2));let f=[],g=0,p=0;i&&(f=this.readShortArray(t,t.readInt(!0)),g=t.readFloat(),p=t.readFloat()),e||(e=h);let x=this.attachmentLoader.newMeshAttachment(s,h,e,n);return x?(x.path=e,a.rgba8888ToColor(x.color,r),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=m,x.regionUVs=u,null==n&&x.updateRegion(),x.hullLength=c<<1,x.sequence=n,i&&(x.edges=f,x.width=g*o,x.height=p*o),x):null}case Fe.LinkedMesh:{const e=16&l?t.readStringRef():h;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&l?t.readInt32():4294967295,c=64&l?this.readSequence(t):null,d=!!(128&l),u=t.readInt(!0),m=t.readStringRef();let f=0,g=0;i&&(f=t.readFloat(),g=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,h,e,c);return p?(p.path=e,a.rgba8888ToColor(p.color,n),p.sequence=c,i&&(p.width=f*o,p.height=g*o),this.linkedMeshes.push(new Be(p,u,r,m,d)),p):null}case Fe.Path:{const e=!!(16&l),r=!!(32&l),n=this.readVertices(t,!!(64&l)),c=u.newArray(n.length/6,0);for(let e=0,s=c.length;e<s;e++)c[e]=t.readFloat()*o;const d=i?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,h);return m?(m.closed=e,m.constantSpeed=r,m.worldVerticesLength=n.length,m.vertices=n.vertices,m.bones=n.bones,m.lengths=c,i&&a.rgba8888ToColor(m.color,d),m):null}case Fe.Point:{const e=t.readFloat(),r=t.readFloat(),n=t.readFloat(),l=i?t.readInt32():0,c=this.attachmentLoader.newPointAttachment(s,h);return c?(c.x=r*o,c.y=n*o,c.rotation=e,i&&a.rgba8888ToColor(c.color,l),c):null}case Fe.Clipping:{const r=t.readInt(!0),n=this.readVertices(t,!!(16&l));let o=i?t.readInt32():0,c=this.attachmentLoader.newClippingAttachment(s,h);return c?(c.endSlot=e.slots[r],c.worldVerticesLength=n.length,c.vertices=n.vertices,c.bones=n.bones,i&&a.rgba8888ToColor(c.color,o),c):null}}return null}readSequence(t){let e=new k(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,r=t.readInt(!0),n=new Ee;if(n.length=r<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let i=new Array,a=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);a.push(e);for(let r=0;r<e;r++)a.push(t.readInt(!0)),i.push(t.readFloat()*s),i.push(t.readFloat()*s),i.push(t.readFloat())}return n.vertices=u.toFloatArray(i),n.bones=a,n}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,n=this.scale;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),i=n-1;switch(s){case Ke:{let s=new H(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case Qe:{let s=t.readInt(!0),a=new W(n,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;a.setFrame(e,o,l,h,c,d),e!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,u,1),Le(t,a,s++,e,3,o,r,d,m,1)}o=r,l=n,h=i,c=u,d=m}r.push(a);break}case Ze:{let s=t.readInt(!0),a=new z(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,d,1)}o=r,l=n,h=i,c=d}r.push(a);break}case ts:{let s=t.readInt(!0),a=new $(n,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;a.setFrame(e,o,l,h,c,d,u,m,f),e!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,g,1),Le(t,a,s++,e,3,o,r,d,p,1),Le(t,a,s++,e,4,o,r,u,x,1),Le(t,a,s++,e,5,o,r,m,b,1),Le(t,a,s++,e,6,o,r,f,w,1)}o=r,l=n,h=i,c=g,d=p,u=x,m=b,f=w}r.push(a);break}case es:{let s=t.readInt(!0),a=new j(n,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;a.setFrame(e,o,l,h,c,d,u,m),e!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,f,1),Le(t,a,s++,e,3,o,r,d,g,1),Le(t,a,s++,e,4,o,r,u,p,1),Le(t,a,s++,e,5,o,r,m,x,1)}o=r,l=n,h=i,c=f,d=g,u=p,m=x}r.push(a);break}case ss:{let s=new G(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,a,o),e!=i;e++){let n=t.readFloat(),i=t.readUnsignedByte()/255;switch(t.readByte()){case ps:s.setStepped(e);break;case xs:Le(t,s,r++,e,0,a,n,o,i,1)}a=n,o=i}r.push(s)}}}}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);if(s==Je){let s=new q(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let a=t.readInt(!0);switch(s){case _e:r.push(De(t,new X(i,a,e),1));break;case Oe:r.push(Ve(t,new B(i,a,e),n));break;case Ue:r.push(De(t,new E(i,a,e),n));break;case qe:r.push(De(t,new D(i,a,e),n));break;case We:r.push(Ve(t,new V(i,a,e),1));break;case ze:r.push(De(t,new L(i,a,e),1));break;case Ge:r.push(De(t,new N(i,a,e),1));break;case $e:r.push(Ve(t,new _(i,a,e),1));break;case je:r.push(De(t,new O(i,a,e),1));break;case He:r.push(De(t,new U(i,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,a=new et(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()*n:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=i;e++){o=t.readByte();const r=t.readFloat(),i=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(Le(t,a,s++,e,0,l,r,h,i,1),Le(t,a,s++,e,1,l,r,c,d,n)),l=r,h=i,c=d}r.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,i=new st(s,t.readInt(!0),e),a=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;i.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let r=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case ps:i.setStepped(e);break;case xs:Le(t,i,s++,e,0,a,r,o,n,1),Le(t,i,s++,e,1,a,r,l,m,1),Le(t,i,s++,e,2,a,r,h,f,1),Le(t,i,s++,e,3,a,r,c,g,1),Le(t,i,s++,e,4,a,r,d,p,1),Le(t,i,s++,e,5,a,r,u,x,1)}a=r,o=n,l=m,h=f,c=g,d=p,u=x}r.push(i)}for(let e=0,i=t.readInt(!0);e<i;e++){let e=t.readInt(!0),i=s.pathConstraints[e];for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case is:r.push(De(t,new rt(a,o,e),i.positionMode==Zt.Fixed?n:1));break;case as:r.push(De(t,new nt(a,o,e),i.spacingMode==ee.Length||i.spacingMode==ee.Fixed?n:1));break;case os:let s=new it(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),i=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case ps:s.setStepped(e);break;case xs:Le(t,s,r++,e,0,l,n,h,i,1),Le(t,s,r++,e,1,l,n,c,a,1),Le(t,s,r++,e,2,l,n,d,o,1)}l=n,h=i,c=a,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==gs){const s=new gt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const i=t.readInt(!0);switch(s){case ls:r.push(De(t,new ot(n,i,e),1));break;case hs:r.push(De(t,new lt(n,i,e),1));break;case cs:r.push(De(t,new ht(n,i,e),1));break;case ds:r.push(De(t,new ct(n,i,e),1));break;case us:r.push(De(t,new dt(n,i,e),1));break;case ms:r.push(De(t,new ut(n,i,e),1));break;case fs:r.push(De(t,new mt(n,i,e),1))}}}for(let e=0,i=t.readInt(!0);e<i;e++){let e=s.skins[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,i),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case rs:{let e=a,i=e.bones,o=e.vertices,c=i?o.length/3*2:o.length,d=t.readInt(!0),m=new J(l,d,s,e),f=t.readFloat();for(let e=0,s=0;;e++){let r,a=t.readInt(!0);if(0==a)r=i?u.newFloatArray(c):o;else{r=u.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)r[s]=t.readFloat();else for(let s=e;s<a;s++)r[s]=t.readFloat()*n;if(!i)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(m.setFrame(e,f,r),e==h)break;let l=t.readFloat();switch(t.readByte()){case ps:m.setStepped(e);break;case xs:Le(t,m,s++,e,0,f,l,0,1,1)}f=l}r.push(m);break}case ns:{let e=new xt(l,s,a);for(let s=0;s<l;s++){let r=t.readFloat(),n=t.readInt32();e.setFrame(s,r,T[15&n],n>>4,t.readFloat())}r.push(e);break}}}}}let i=t.readInt(!0);if(i>0){let e=new tt(i),n=s.slots.length;for(let s=0;s<i;s++){let r=t.readFloat(),i=t.readInt(!0),a=u.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=u.newArray(n-i,0),l=0,h=0;for(let e=0;e<i;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;a[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==a[t]&&(a[t]=o[--h]);e.setFrame(s,r,a)}r.push(e)}let a=t.readInt(!0);if(a>0){let e=new Q(a);for(let r=0;r<a;r++){let n=t.readFloat(),i=s.events[t.readInt(!0)],a=new le(n,i);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=i.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(r,a)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new I(e,r,o)}},Xe=class{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}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()}},Be=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}},Ee=class{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function De(t,e,s){let r=t.readFloat(),n=t.readFloat()*s;for(let i=0,a=0,o=e.getFrameCount()-1;e.setFrame(i,r,n),i!=o;i++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ps:e.setStepped(i);break;case xs:Le(t,e,a++,i,0,r,o,n,l,s)}r=o,n=l}return e}function Ve(t,e,s){let r=t.readFloat(),n=t.readFloat()*s,i=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,r,n,i),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case ps:e.setStepped(a);break;case xs:Le(t,e,o++,a,0,r,l,n,h,s),Le(t,e,o++,a,1,r,l,i,c,s)}r=l,n=h,i=c}return e}function Le(t,e,s,r,n,i,a,o,l,h){e.setBezier(s,r,n,i,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}(Ye=Fe||(Fe={}))[Ye.Region=0]="Region",Ye[Ye.BoundingBox=1]="BoundingBox",Ye[Ye.Mesh=2]="Mesh",Ye[Ye.LinkedMesh=3]="LinkedMesh",Ye[Ye.Path=4]="Path",Ye[Ye.Point=5]="Point",Ye[Ye.Clipping=6]="Clipping";var Ne,_e=0,Oe=1,Ue=2,qe=3,We=4,ze=5,Ge=6,$e=7,je=8,He=9,Je=10,Ke=0,Qe=1,Ze=2,ts=3,es=4,ss=5,rs=0,ns=1,is=0,as=1,os=2,ls=0,hs=1,cs=2,ds=4,us=5,ms=6,fs=7,gs=8,ps=1,xs=2,bs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new m((()=>u.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,n=this.polygonPool,i=t.slots,a=i.length;s.length=0,n.freeAll(r),r.length=0;for(let t=0;t<a;t++){let e=i[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof Dt){let t=a;s.push(t);let i=n.obtain();i.length!=t.worldVerticesLength&&(i=u.newFloatArray(t.worldVerticesLength)),r.push(i),t.computeWorldVertices(e,0,t.worldVerticesLength,i,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,r=Number.NEGATIVE_INFINITY,n=this.polygons;for(let i=0,a=n.length;i<a;i++){let a=n[i],o=a;for(let n=0,i=a.length;n<i;n+=2){let i=o[n],a=o[n+1];t=Math.min(t,i),e=Math.min(e,a),s=Math.max(s,i),r=Math.max(r,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let n=this.minX,i=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=i&&r<=i||t>=a&&s>=a||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(n-t)+e;if(h>i&&h<o)return!0;if(h=l*(a-t)+e,h>i&&h<o)return!0;let c=(i-e)/l+t;return c>n&&c<a||(c=(o-e)/l+t,c>n&&c<a)}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 r=0,n=s.length;r<n;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,n=t.length,i=n-2,a=!1;for(let t=0;t<n;t+=2){let n=r[t+1],o=r[i+1];if(n<s&&o>=s||o<s&&n>=s){let l=r[t];l+(s-n)/(o-n)*(r[i]-l)<e&&(a=!a)}i=t}return a}intersectsSegment(t,e,s,r){let n=this.polygons;for(let i=0,a=n.length;i<a;i++)if(this.intersectsSegmentPolygon(n[i],t,e,s,r))return this.boundingBoxes[i];return null}intersectsSegmentPolygon(t,e,s,r,n){let i=t,a=t.length,o=e-r,l=s-n,h=e*n-s*r,c=i[a-2],d=i[a-1];for(let t=0;t<a;t+=2){let a=i[t],u=i[t+1],m=c*u-d*a,f=c-a,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&t<=s))return!0}c=a,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}},ws=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new m((()=>new Array));polygonIndicesPool=new m((()=>new Array));triangulate(t){let e=t,s=t.length>>1,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,i=s;t<i;++t)n[t]=ws.isConcave(t,s,e,r);let i=this.triangles;for(i.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let i=r[t]<<1,l=r[a]<<1,h=r[o]<<1,c=e[i],d=e[i+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let i=(o+1)%s;i!=t;i=(i+1)%s){if(!n[i])continue;let t=r[i]<<1,s=e[t],a=e[t+1];if(ws.positiveArea(f,g,c,d,s,a)&&ws.positiveArea(c,d,u,m,s,a)&&ws.positiveArea(u,m,f,g,s,a))break t}break}if(0==o){do{if(!n[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}i.push(r[(s+a-1)%s]),i.push(r[a]),i.push(r[(a+1)%s]),r.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=ws.isConcave(l,s,e,r),n[h]=ws.isConcave(h,s,e,r)}return 3==s&&(i.push(r[2]),i.push(r[0]),i.push(r[1])),i}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let i=this.polygonIndicesPool.obtain();i.length=0;let a=this.polygonPool.obtain();a.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],g=s[c+1],p=s[d],x=s[d+1],b=!1;if(o==h){let t=a.length-4,e=ws.winding(a[t],a[t+1],a[t+2],a[t+3],p,x),s=ws.winding(p,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(p),a.push(x),i.push(d),b=!0)}b||(a.length>0?(r.push(a),n.push(i)):(this.polygonPool.free(a),this.polygonIndicesPool.free(i)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(m),a.push(f),a.push(g),a.push(p),a.push(x),i=this.polygonIndicesPool.obtain(),i.length=0,i.push(h),i.push(c),i.push(d),l=ws.winding(u,m,f,g,p,x),o=h)}a.length>0&&(r.push(a),n.push(i));for(let t=0,e=r.length;t<e;t++){if(i=n[t],0==i.length)continue;let s=i[0],o=i[i.length-1];a=r[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],g=a[2],p=a[3],x=ws.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let b=e[0],w=e[1],y=e[2],k=r[l],v=k[k.length-2],C=k[k.length-1];if(b!=s||w!=o)continue;let S=ws.winding(h,c,d,u,v,C),A=ws.winding(v,C,m,f,g,p);S==x&&A==x&&(k.length=0,e.length=0,a.push(v),a.push(C),i.push(y),h=d,c=u,d=v,u=C,l=0)}}for(let t=r.length-1;t>=0;t--)a=r[t],0==a.length&&(r.splice(t,1),this.polygonPool.free(a),i=n[t],n.splice(t,1),this.polygonIndicesPool.free(i));return r}static isConcave(t,e,s,r){let n=r[(e+t-1)%e]<<1,i=r[t]<<1,a=r[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[i],s[i+1],s[a],s[a+1])}static positiveArea(t,e,s,r,n,i){return t*(i-r)+s*(e-i)+n*(r-e)>=0}static winding(t,e,s,r,n,i){let a=s-t,o=r-e;return n*o-i*a+a*e-t*o>=0?1:-1}},ys=class{triangulator=new ws;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,r=u.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let n=this.clippingPolygon;ys.makeClockwise(n);let i=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=i.length;t<e;t++){let e=i[t];ys.makeClockwise(e),e.push(e[0]),e.push(e[1])}return i.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,r,n,i,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=r,c=n,d=i,u=a,m=o):(l=e,h=s,c=r,d=n,u=i,m=a),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 r=this.clipOutput,n=this.clippedVertices,i=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,i.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 m=t[s],f=t[s+1];s=e[h+2]<<1;let g=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,m,f,g,p,a[t],r)){let t=u.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=m,t[e+3]=f,t[e+4]=g,t[e+5]=p,e=i.length;let s=u.setArraySize(i,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=u.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],r=a[s+1];o[e]=t,o[e+1]=r}e=i.length;let h=u.setArraySize(i,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,r,n,i,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,m=a?12:8,f=0;l.length=0,h.length=0;for(let g=0;g<s;g+=3){let s=e[g]<<1,p=t[s],x=t[s+1],b=r[s],w=r[s+1];s=e[g+1]<<1;let y=t[s],k=t[s+1],v=r[s],C=r[s+1];s=e[g+2]<<1;let S=t[s],A=t[s+1],T=r[s],I=r[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,x,y,k,S,A,c[t],o)){let t=u.setArraySize(l,e+3*m);t[e]=p,t[e+1]=x,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=b,t[e+7]=w,t[e+8]=i.r,t[e+9]=i.g,t[e+10]=i.b,t[e+11]=i.a,t[e+12]=y,t[e+13]=k,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=v,t[e+19]=C,t[e+20]=i.r,t[e+21]=i.g,t[e+22]=i.b,t[e+23]=i.a,t[e+24]=S,t[e+25]=A,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=T,t[e+31]=I,t[e+32]=i.r,t[e+33]=i.g,t[e+34]=i.b,t[e+35]=i.a):(t[e+6]=b,t[e+7]=w,t[e+8]=y,t[e+9]=k,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=v,t[e+15]=C,t[e+16]=S,t[e+17]=A,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=T,t[e+23]=I),e=h.length;let s=u.setArraySize(h,e+3);s[e]=f,s[e+1]=f+1,s[e+2]=f+2,f+=3;break}{let t=o.length;if(0==t)continue;let s=k-A,r=S-y,c=p-S,d=A-x,g=1/(s*c+r*(x-A)),M=t>>1,F=this.clipOutput,Y=u.setArraySize(l,e+M*m);for(let o=0;o<t;o+=2,e+=m){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=n.r,Y[e+3]=n.g,Y[e+4]=n.b,Y[e+5]=n.a;let h=t-S,u=l-A,m=(s*h+r*u)*g,f=(d*h+c*u)*g,p=1-m-f;Y[e+6]=b*m+v*f+T*p,Y[e+7]=w*m+C*f+I*p,a&&(Y[e+8]=i.r,Y[e+9]=i.g,Y[e+10]=i.b,Y[e+11]=i.a)}e=h.length;let P=u.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)P[e]=f,P[e+1]=f+t,P[e+2]=f+t+1;f+=M+1}}}}clipTrianglesUnpacked(t,e,s,r){let n=this.clipOutput,i=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;i.length=0,a.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,m=t[s],f=t[s+1],g=r[s],p=r[s+1];s=e[d+1]<<1;let x=t[s],b=t[s+1],w=r[s],y=r[s+1];s=e[d+2]<<1;let k=t[s],v=t[s+1],C=r[s],S=r[s+1];for(let t=0;t<h;t++){let e=i.length;if(!this.clip(m,f,x,b,k,v,l[t],n)){let t=u.setArraySize(i,e+6);t[e]=m,t[e+1]=f,t[e+2]=x,t[e+3]=b,t[e+4]=k,t[e+5]=v;let s=u.setArraySize(a,e+6);s[e]=g,s[e+1]=p,s[e+2]=w,s[e+3]=y,s[e+4]=C,s[e+5]=S,e=o.length;let r=u.setArraySize(o,e+3);r[e]=c,r[e+1]=c+1,r[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=b-v,r=k-x,l=m-k,h=v-f,d=1/(s*l+r*(f-v)),A=t>>1,T=this.clipOutput,I=u.setArraySize(i,e+2*A),M=u.setArraySize(a,e+2*A);for(let n=0;n<t;n+=2,e+=2){let t=T[n],i=T[n+1];I[e]=t,I[e+1]=i;let a=t-k,o=i-v,c=(s*a+r*o)*d,u=(h*a+l*o)*d,m=1-c-u;M[e]=g*c+w*u+C*m,M[e+1]=p*c+y*u+S*m}e=o.length;let F=u.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,r,n,i,a,o){let l,h=o,c=!1;a.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(r),l.push(n),l.push(i),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],n=s-u[t+3],i=o.length,a=l;for(let t=0,i=l.length-2;t<i;){let i=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>r*(s-d),m=n*(e-i)-r*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-i,e=d-l,s=m/(t*n-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(i+t*s),o.push(l+e*s)}else if(u){let t=h-i,e=d-l,s=m/(t*n-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(i+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(i==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,r=e[s-2]*e[1]-e[0]*e[s-1],n=0,i=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],i=e[t+1],a=e[t+2],o=e[t+3],r+=n*o-a*i;if(!(r<0))for(let t=0,r=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],i=r-t;e[t]=e[i],e[t+1]=e[i+1],e[i]=s,e[i+1]=n}}},ks=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ae,r="string"==typeof t?JSON.parse(t):t,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=Ts(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let n=r.bones[t],i=null,a=Ts(n,"parent",null);a&&(i=s.findBone(a));let o=new Qt(s.bones.length,n.name,i);o.length=Ts(n,"length",0)*e,o.x=Ts(n,"x",0)*e,o.y=Ts(n,"y",0)*e,o.rotation=Ts(n,"rotation",0),o.scaleX=Ts(n,"scaleX",1),o.scaleY=Ts(n,"scaleY",1),o.shearX=Ts(n,"shearX",0),o.shearY=Ts(n,"shearY",0),o.inherit=u.enumValue(Ht,Ts(n,"inherit","Normal")),o.skinRequired=Ts(n,"skin",!1);let l=Ts(n,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],n=e.name,i=s.findBone(e.bone);if(!i)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let o=new Me(s.slots.length,n,i),l=Ts(e,"color",null);l&&o.color.setFromString(l);let h=Ts(e,"dark",null);h&&(o.darkColor=a.fromString(h)),o.attachmentName=Ts(e,"attachment",null),o.blendMode=u.enumValue(ve,Ts(e,"blend","normal")),o.visible=Ts(e,"visible",!0),s.slots.push(o)}if(r.ik)for(let t=0;t<r.ik.length;t++){let n=r.ik[t],i=new de(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=s.findBone(n.bones[t]);if(!e)throw new Error(`Couldn't find bone ${n.bones[t]} for IK constraint ${n.name}.`);i.bones.push(e)}let a=s.findBone(n.target);if(!a)throw new Error(`Couldn't find target bone ${n.target} for IK constraint ${n.name}.`);i.target=a,i.mix=Ts(n,"mix",1),i.softness=Ts(n,"softness",0)*e,i.bendDirection=Ts(n,"bendPositive",!0)?1:-1,i.compress=Ts(n,"compress",!1),i.stretch=Ts(n,"stretch",!1),i.uniform=Ts(n,"uniform",!1),s.ikConstraints.push(i)}if(r.transform)for(let t=0;t<r.transform.length;t++){let n=r.transform[t],i=new Pe(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${n.name}.`);i.bones.push(r)}let a=n.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${n.name}.`);i.target=o,i.local=Ts(n,"local",!1),i.relative=Ts(n,"relative",!1),i.offsetRotation=Ts(n,"rotation",0),i.offsetX=Ts(n,"x",0)*e,i.offsetY=Ts(n,"y",0)*e,i.offsetScaleX=Ts(n,"scaleX",0),i.offsetScaleY=Ts(n,"scaleY",0),i.offsetShearY=Ts(n,"shearY",0),i.mixRotate=Ts(n,"mixRotate",1),i.mixX=Ts(n,"mixX",1),i.mixY=Ts(n,"mixY",i.mixX),i.mixScaleX=Ts(n,"mixScaleX",1),i.mixScaleY=Ts(n,"mixScaleY",i.mixScaleX),i.mixShearY=Ts(n,"mixShearY",1),s.transformConstraints.push(i)}if(r.path)for(let t=0;t<r.path.length;t++){let n=r.path[t],i=new ue(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);i.bones.push(r)}let a=n.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${n.name}.`);i.target=o,i.positionMode=u.enumValue(Zt,Ts(n,"positionMode","Percent")),i.spacingMode=u.enumValue(ee,Ts(n,"spacingMode","Length")),i.rotateMode=u.enumValue(re,Ts(n,"rotateMode","Tangent")),i.offsetRotation=Ts(n,"rotation",0),i.position=Ts(n,"position",0),i.positionMode==Zt.Fixed&&(i.position*=e),i.spacing=Ts(n,"spacing",0),i.spacingMode!=ee.Length&&i.spacingMode!=ee.Fixed||(i.spacing*=e),i.mixRotate=Ts(n,"mixRotate",1),i.mixX=Ts(n,"mixX",1),i.mixY=Ts(n,"mixY",i.mixX),s.pathConstraints.push(i)}if(r.physics)for(let t=0;t<r.physics.length;t++){const n=r.physics[t],i=new Se(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);const a=n.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);i.bone=o,i.x=Ts(n,"x",0),i.y=Ts(n,"y",0),i.rotate=Ts(n,"rotate",0),i.scaleX=Ts(n,"scaleX",0),i.shearX=Ts(n,"shearX",0),i.limit=Ts(n,"limit",5e3)*e,i.step=1/Ts(n,"fps",60),i.inertia=Ts(n,"inertia",1),i.strength=Ts(n,"strength",100),i.damping=Ts(n,"damping",1),i.massInverse=1/Ts(n,"mass",1),i.wind=Ts(n,"wind",0),i.gravity=Ts(n,"gravity",0),i.mix=Ts(n,"mix",1),i.inertiaGlobal=Ts(n,"inertiaGlobal",!1),i.strengthGlobal=Ts(n,"strengthGlobal",!1),i.dampingGlobal=Ts(n,"dampingGlobal",!1),i.massGlobal=Ts(n,"massGlobal",!1),i.windGlobal=Ts(n,"windGlobal",!1),i.gravityGlobal=Ts(n,"gravityGlobal",!1),i.mixGlobal=Ts(n,"mixGlobal",!1),s.physicsConstraints.push(i)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],n=new Ie(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],i=s.findBone(r);if(!i)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);n.bones.push(i)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],i=s.findIkConstraint(r);if(!i)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],i=s.findTransformConstraint(r);if(!i)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],i=s.findPathConstraint(r);if(!i)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],i=s.findPhysicsConstraint(r);if(!i)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let i=e.attachments[t];for(let t in i){let e=this.readAttachment(i[t],n,r.index,t,s);e&&n.setAttachment(r.index,t,e)}}s.skins.push(n),"default"==n.name&&(s.defaultSkin=n)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let n=r.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],n=new he(t);n.intValue=Ts(e,"int",0),n.floatValue=Ts(e,"float",0),n.stringValue=Ts(e,"string",""),n.audioPath=Ts(e,"audio",null),n.audioPath&&(n.volume=Ts(e,"volume",1),n.balance=Ts(e,"balance",0)),s.events.push(n)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,n){let i=this.scale;switch(r=Ts(t,"name",r),Ts(t,"type","region")){case"region":{let s=Ts(t,"path",r),n=this.readSequence(Ts(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,s,n);if(!a)return null;a.path=s,a.x=Ts(t,"x",0)*i,a.y=Ts(t,"y",0)*i,a.scaleX=Ts(t,"scaleX",1),a.scaleY=Ts(t,"scaleY",1),a.rotation=Ts(t,"rotation",0),a.width=t.width*i,a.height=t.height*i,a.sequence=n;let o=Ts(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Ts(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Ts(t,"path",r),a=this.readSequence(Ts(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,n,a);if(!o)return null;o.path=n;let l=Ts(t,"color",null);l&&o.color.setFromString(l),o.width=Ts(t,"width",0)*i,o.height=Ts(t,"height",0)*i,o.sequence=a;let h=Ts(t,"parent",null);if(h)return this.linkedMeshes.push(new vs(o,Ts(t,"skin",null),s,h,Ts(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=Ts(t,"edges",null),o.hullLength=2*Ts(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Ts(t,"closed",!1),s.constantSpeed=Ts(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=u.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*i;s.lengths=a;let o=Ts(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Ts(t,"x",0)*i,s.y=Ts(t,"y",0)*i,s.rotation=Ts(t,"rotation",0);let n=Ts(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let i=Ts(t,"end",null);i&&(s.endSlot=n.findSlot(i));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Ts(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new k(Ts(t,"count",0));return e.start=Ts(t,"start",1),e.digits=Ts(t,"digits",0),e.setupIndex=Ts(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=u.toFloatArray(n);if(1!=r)for(let e=0,s=n.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let i=new Array,a=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(n[t]),i.push(n[t+1]*r),i.push(n[t+2]*r),i.push(n[t+3])}e.bones=a,e.vertices=u.toFloatArray(i)}readAnimation(t,e,s){let r=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let r=t.slots[e],i=s.findSlot(e);if(!i)throw new Error("Slot not found: "+e);let o=i.index;for(let t in r){let e=r[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new H(s,o);for(let r=0;r<s;r++){let s=e[r];t.setFrame(r,Ts(s,"time",0),Ts(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new W(s,s<<2,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.color);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b,l.a);let o=e[s+1];if(!o){t.shrink(n);break}let h=Ts(o,"time",0),c=a.fromString(o.color),d=r.curve;d&&(n=As(d,t,n,s,0,i,h,l.r,c.r,1),n=As(d,t,n,s,1,i,h,l.g,c.g,1),n=As(d,t,n,s,2,i,h,l.b,c.b,1),n=As(d,t,n,s,3,i,h,l.a,c.a,1)),i=h,l=c,r=o}n.push(t)}else if("rgb"==t){let t=new z(s,3*s,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.color);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b);let o=e[s+1];if(!o){t.shrink(n);break}let h=Ts(o,"time",0),c=a.fromString(o.color),d=r.curve;d&&(n=As(d,t,n,s,0,i,h,l.r,c.r,1),n=As(d,t,n,s,1,i,h,l.g,c.g,1),n=As(d,t,n,s,2,i,h,l.b,c.b,1)),i=h,l=c,r=o}n.push(t)}else if("alpha"==t)n.push(Cs(e,new G(s,s,o),0,1));else if("rgba2"==t){let t=new $(s,7*s,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.light),h=a.fromString(r.dark);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(n);break}let c=Ts(o,"time",0),d=a.fromString(o.light),u=a.fromString(o.dark),m=r.curve;m&&(n=As(m,t,n,s,0,i,c,l.r,d.r,1),n=As(m,t,n,s,1,i,c,l.g,d.g,1),n=As(m,t,n,s,2,i,c,l.b,d.b,1),n=As(m,t,n,s,3,i,c,l.a,d.a,1),n=As(m,t,n,s,4,i,c,h.r,u.r,1),n=As(m,t,n,s,5,i,c,h.g,u.g,1),n=As(m,t,n,s,6,i,c,h.b,u.b,1)),i=c,l=d,h=u,r=o}n.push(t)}else if("rgb2"==t){let t=new j(s,6*s,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.light),h=a.fromString(r.dark);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(n);break}let c=Ts(o,"time",0),d=a.fromString(o.light),u=a.fromString(o.dark),m=r.curve;m&&(n=As(m,t,n,s,0,i,c,l.r,d.r,1),n=As(m,t,n,s,1,i,c,l.g,d.g,1),n=As(m,t,n,s,2,i,c,l.b,d.b,1),n=As(m,t,n,s,3,i,c,h.r,u.r,1),n=As(m,t,n,s,4,i,c,h.g,u.g,1),n=As(m,t,n,s,5,i,c,h.b,u.b,1)),i=c,l=d,h=u,r=o}n.push(t)}}}if(t.bones)for(let e in t.bones){let i=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in i){let e=i[t],s=e.length;if(0!=s)if("rotate"===t)n.push(Cs(e,new X(s,s,o),0,1));else if("translate"===t){let t=new B(s,s<<1,o);n.push(Ss(e,t,"x","y",0,r))}else if("translatex"===t){let t=new E(s,s,o);n.push(Cs(e,t,0,r))}else if("translatey"===t){let t=new D(s,s,o);n.push(Cs(e,t,0,r))}else if("scale"===t){let t=new V(s,s<<1,o);n.push(Ss(e,t,"x","y",1,1))}else if("scalex"===t){let t=new L(s,s,o);n.push(Cs(e,t,1,1))}else if("scaley"===t){let t=new N(s,s,o);n.push(Cs(e,t,1,1))}else if("shear"===t){let t=new _(s,s<<1,o);n.push(Ss(e,t,"x","y",0,1))}else if("shearx"===t){let t=new O(s,s,o);n.push(Cs(e,t,0,1))}else if("sheary"===t){let t=new U(s,s,o);n.push(Cs(e,t,0,1))}else if("inherit"===t){let t=new q(s,a.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Ts(r,"time",0),u.enumValue(Ht,Ts(r,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let i=t.ik[e],a=i[0];if(!a)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new et(i.length,i.length<<1,l),c=Ts(a,"time",0),d=Ts(a,"mix",1),u=Ts(a,"softness",0)*r;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Ts(a,"bendPositive",!0)?1:-1,Ts(a,"compress",!1),Ts(a,"stretch",!1));let s=i[t+1];if(!s){h.shrink(e);break}let n=Ts(s,"time",0),o=Ts(s,"mix",1),l=Ts(s,"softness",0)*r,m=a.curve;m&&(e=As(m,h,e,t,0,c,n,d,o,1),e=As(m,h,e,t,1,c,n,u,l,r)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let r=t.transform[e],i=r[0];if(!i)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new st(r.length,6*r.length,o),h=Ts(i,"time",0),c=Ts(i,"mixRotate",1),d=Ts(i,"mixX",1),u=Ts(i,"mixY",d),m=Ts(i,"mixScaleX",1),f=Ts(i,"mixScaleY",m),g=Ts(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=r[t+1];if(!s){l.shrink(e);break}let n=Ts(s,"time",0),a=Ts(s,"mixRotate",1),o=Ts(s,"mixX",1),p=Ts(s,"mixY",o),x=Ts(s,"mixScaleX",1),b=Ts(s,"mixScaleY",x),w=Ts(s,"mixShearY",1),y=i.curve;y&&(e=As(y,l,e,t,0,h,n,c,a,1),e=As(y,l,e,t,1,h,n,d,o,1),e=As(y,l,e,t,2,h,n,u,p,1),e=As(y,l,e,t,3,h,n,m,x,1),e=As(y,l,e,t,4,h,n,f,b,1),e=As(y,l,e,t,5,h,n,g,w,1)),h=n,c=a,d=o,u=p,m=x,f=b,m=x,i=s}n.push(l)}if(t.path)for(let e in t.path){let i=t.path[e],a=s.findPathConstraint(e);if(!a)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(a);for(let t in i){let e=i[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new rt(l,l,o);n.push(Cs(e,t,0,a.positionMode==Zt.Fixed?r:1))}else if("spacing"===t){let t=new nt(l,l,o);n.push(Cs(e,t,0,a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?r:1))}else if("mix"===t){let t=new it(l,3*l,o),r=Ts(s,"time",0),i=Ts(s,"mixRotate",1),a=Ts(s,"mixX",1),h=Ts(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,r,i,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=Ts(l,"time",0),d=Ts(l,"mixRotate",1),u=Ts(l,"mixX",1),m=Ts(l,"mixY",u),f=s.curve;f&&(o=As(f,t,o,n,0,r,c,i,d,1),o=As(f,t,o,n,1,r,c,a,u,1),o=As(f,t,o,n,2,r,c,h,m,1)),r=c,i=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let r=t.physics[e],i=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);i=s.physicsConstraints.indexOf(t)}for(let t in r){let e=r[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new ot(o,o,i);else if("strength"==t)a=new lt(o,o,i);else if("damping"==t)a=new ht(o,o,i);else if("mass"==t)a=new ct(o,o,i);else if("wind"==t)a=new dt(o,o,i);else if("gravity"==t)a=new ut(o,o,i);else{if("mix"!=t)continue;a=new mt(o,o,i)}n.push(Cs(e,a,0,1))}else{const t=new gt(o,i);for(let r=0;null!=s;s=e[r+1],r++)t.setFrame(r,Ts(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let i=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in i){let e=i[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],i=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=i.bones,s=i.vertices,o=t?s.length/3*2:s.length,h=new J(e.length,e.length,l,i),c=Ts(a,"time",0);for(let n=0,i=0;;n++){let l,d=Ts(a,"vertices",null);if(d){l=u.newFloatArray(o);let e=Ts(a,"offset",0);if(u.arrayCopy(d,0,l,e,d.length),1!=r)for(let t=e,s=t+d.length;t<s;t++)l[t]*=r;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?u.newFloatArray(o):s;h.setFrame(n,c,l);let m=e[n+1];if(!m){h.shrink(i);break}let f=Ts(m,"time",0),g=a.curve;g&&(i=As(g,h,i,n,0,c,f,0,1,1)),c=f,a=m}n.push(h)}else if("sequence"==t){let t=new xt(e.length,l,i),s=0;for(let r=0;r<e.length;r++){let n=Ts(a,"delay",s),i=Ts(a,"time",0),o=b[Ts(a,"mode","hold")],l=Ts(a,"index",0);t.setFrame(r,i,o,l,n),s=n,a=e[r+1]}n.push(t)}}}}}if(t.drawOrder){let e=new tt(t.drawOrder.length),r=s.slots.length,i=0;for(let n=0;n<t.drawOrder.length;n++,i++){let a=t.drawOrder[n],o=null,l=Ts(a,"offsets",null);if(l){o=u.newArray(r,-1);let t=u.newArray(r-l.length,0),e=0,n=0;for(let r=0;r<l.length;r++){let i=l[r],a=s.findSlot(i.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+i.offset]=e++}for(;e<r;)t[n++]=e++;for(let e=r-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(i,Ts(a,"time",0),o)}n.push(e)}if(t.events){let e=new Q(t.events.length),r=0;for(let n=0;n<t.events.length;n++,r++){let i=t.events[n],a=s.findEvent(i.name);if(!a)throw new Error("Event not found: "+i.name);let o=new le(u.toSinglePrecision(Ts(i,"time",0)),a);o.intValue=Ts(i,"int",a.intValue),o.floatValue=Ts(i,"float",a.floatValue),o.stringValue=Ts(i,"string",a.stringValue),o.data.audioPath&&(o.volume=Ts(i,"volume",1),o.balance=Ts(i,"balance",0)),e.setFrame(r,o)}n.push(e)}let i=0;for(let t=0,e=n.length;t<e;t++)i=Math.max(i,n[t].getDuration());s.animations.push(new I(e,n,i))}},vs=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};function Cs(t,e,s,r){let n=t[0],i=Ts(n,"time",0),a=Ts(n,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,i,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Ts(h,"time",0),d=Ts(h,"value",s)*r;n.curve&&(o=As(n.curve,e,o,l,0,i,c,a,d,r)),i=c,a=d,n=h}}function Ss(t,e,s,r,n,i){let a=t[0],o=Ts(a,"time",0),l=Ts(a,s,n)*i,h=Ts(a,r,n)*i,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=Ts(u,"time",0),f=Ts(u,s,n)*i,g=Ts(u,r,n)*i,p=a.curve;p&&(c=As(p,e,c,d,0,o,m,l,f,i),c=As(p,e,c,d,1,o,m,h,g,i)),o=m,l=f,h=g,a=u}}function As(t,e,s,r,n,i,a,o,l,h){if("stepped"==t)return e.setStepped(r),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,r,n,i,o,d,u,m,f,a,l),s+1}function Ts(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=(Ne=new Float32Array(1),function(t){return Ne[0]=t,Ne[0]}));var Is=class extends Lt{static from(t){return Is.textureMap.has(t)?Is.textureMap.get(t):new Is(t)}texture;constructor(e){super(e.resource),this.texture=t.Texture.from(e)}setFilters(t,e){if(!this.texture||!this.texture.source||!this.texture.source.style)return;const s=this.texture.source.style;s.minFilter=Is.toPixiTextureFilter(t),s.magFilter=Is.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=Is.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){if(!this.texture||!this.texture.source||!this.texture.source.style)return;const s=this.texture.source.style;s.addressModeU=Is.toPixiTextureWrap(t),s.addressModeV=Is.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case St.Nearest:case St.Linear:return!1;case St.MipMapNearestLinear:case St.MipMapNearestNearest:case St.MipMapLinearLinear:case St.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case St.Nearest:case St.MipMapNearestLinear:case St.MipMapNearestNearest:return"nearest";case St.Linear:case St.MipMapLinearLinear:case St.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case Tt.ClampToEdge:return"clamp-to-edge";case Tt.MirroredRepeat:return"mirror-repeat";case Tt.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case ve.Normal:return"normal";case ve.Additive:return"add";case ve.Multiply:return"multiply";case ve.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Ms=Is;r(Ms,"textureMap",new Map);var Fs="spineTextureAtlasLoader",Ys={extension:t.ExtensionType.Asset,resolver:{test:e=>t.checkExtension(e,".atlas"),parse:e=>{const s=e.split(".");return{resolution:parseFloat(t.Resolver.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:s[s.length-2],src:e}}},loader:{id:Fs,name:Fs,extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:Fs},test:e=>t.checkExtension(e,".atlas"),async load(e){const s=await t.DOMAdapter.get().fetch(e);return await s.text()},testParse(e,s){const r=t.checkExtension(s.src,".atlas"),n="string"==typeof e,i=s.parser===Fs||s.loadParser===Fs;return Promise.resolve((r||i)&&n)},unload(t){t.dispose()},async parse(e,s,r){const n=s.data||{};let i=t.path.dirname(s.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const a=new _t(e);if(n.images instanceof t.TextureSource||"string"==typeof n.images){const t=n.images;n.images={},n.images[a.pages[0].name]=t}const o=[];for(const e of a.pages){if(n.resolve){const t=n.resolve().then((t=>{e.setTexture(Ms.from(t.source))}));o.push(t);continue}const a=e.name,l=n?.images?n.images[a]:void 0;if(l instanceof t.TextureSource)e.setTexture(Ms.from(l));else{const h=l??t.path.normalize([...i.split(t.path.sep),a].join(t.path.sep)),c={src:t.copySearchParams(h,s.src),data:{...n.imageMetadata,alphaMode:e.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=r.load(c).then((t=>{e.setTexture(Ms.from(t.source))}));o.push(d)}}return await Promise.all(o),a}}};t.extensions.add(Ys);var Ps="spineSkeletonLoader";var Rs={extension:t.ExtensionType.Asset,loader:{id:Ps,name:Ps,extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:Ps},test:e=>t.checkExtension(e,".skel"),async load(e){const s=await t.DOMAdapter.get().fetch(e);return new Uint8Array(await s.arrayBuffer())},testParse(e,s){const r=t.checkExtension(s.src,".json")&&(n=e,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const i=t.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(e),a=s.parser===Ps||s.loadParser===Ps;return Promise.resolve(r||i||a)}}};t.extensions.add(Rs);var Xs=new Float32Array(1),Bs=new Uint32Array(1),Es=class extends t.Geometry{constructor(){const e=new t.Buffer({data:Xs,label:"attribute-batch-buffer",usage:t.BufferUsage.VERTEX|t.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:28,offset:0},aUV:{buffer:e,format:"float32x2",stride:28,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:28,offset:24}},indexBuffer:new t.Buffer({data:Bs,label:"index-batch-buffer",usage:t.BufferUsage.INDEX|t.BufferUsage.COPY_DST,shrinkToFit:!1})})}},Ds={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},Vs={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},Ls=class extends t.Shader{constructor(e){super({glProgram:t.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[t.colorBitGl,Vs,t.generateTextureBatchBitGl(e),t.roundPixelsBitGl]}),gpuProgram:t.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[t.colorBit,Ds,t.generateTextureBatchBit(e),t.roundPixelsBit]}),resources:{batchSamplers:t.getBatchSamplersUniformGroup(e)}})}},Ns=null,_s=class extends t.Batcher{geometry=new Es;shader=Ns||(Ns=new Ls(this.maxTextures));name=_s.extension.name;vertexSize=7;packAttributes(e,s,r,n,i){const a=i<<16|65535&e.roundPixels,o=e.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=e,p=e.color,x=(p>>24&255)/255,b=t.Color.shared.setValue(e.darkColor).premultiply(x,!0).toPremultiplied(1,!1),w=e.attributeOffset,y=w+e.attributeSize;for(let t=w;t<y;t++){const e=2*t,i=f[e],o=f[e+1];s[n++]=l*i+c*o+u,s[n++]=d*o+h*i+m,s[n++]=g[e],s[n++]=g[e+1],r[n++]=p,r[n++]=b,r[n++]=a}}packQuadAttributes(t,e,s,r,n){const i=t.texture,a=t.transform,o=a.a,l=a.b,h=a.c,c=a.d,d=a.tx,u=a.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,b=i.uvs,w=t.color,y=t.darkColor,k=n<<16|65535&t.roundPixels;e[r+0]=o*g+h*x+d,e[r+1]=c*x+l*g+u,e[r+2]=b.x0,e[r+3]=b.y0,s[r+4]=w,s[r+5]=y,s[r+6]=k,e[r+7]=o*f+h*x+d,e[r+8]=c*x+l*f+u,e[r+9]=b.x1,e[r+10]=b.y1,s[r+11]=w,s[r+12]=y,s[r+13]=k,e[r+14]=o*f+h*p+d,e[r+15]=c*p+l*f+u,e[r+16]=b.x2,e[r+17]=b.y2,s[r+18]=w,s[r+19]=y,s[r+20]=k,e[r+21]=o*g+h*p+d,e[r+22]=c*p+l*g+u,e[r+23]=b.x3,e[r+24]=b.y3,s[r+25]=w,s[r+26]=y,s[r+27]=k}},Os=_s;r(Os,"extension",{type:[t.ExtensionType.Batcher],name:"darkTint"}),t.extensions.add(Os);var Us=u.newFloatArray(8),qs=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=u.newFloatArray(8192);tempColor=new a;constructor(t){this.ctx=t}draw(t){this.triangleRendering?this.drawTriangles(t):this.drawImages(t)}drawImages(t){let e=this.ctx,s=this.tempColor,r=t.color,n=t.drawOrder;this.debugRendering&&(e.strokeStyle="green");for(let t=0,i=n.length;t<i;t++){let i=n[t],a=i.bone;if(!a.active)continue;let o=i.getAttachment();if(!(o instanceof jt))continue;o.computeWorldVertices(i,Us,0,2);let l=o.region,h=l.texture.getImage(),c=i.color,d=o.color;s.set(r.r*c.r*d.r,r.g*c.g*d.g,r.b*c.b*d.b,r.a*c.a*d.a),e.save(),e.transform(a.a,a.c,a.b,a.d,a.worldX,a.worldY),e.translate(o.offset[0],o.offset[1]),e.rotate(o.rotation*Math.PI/180);let u=o.width/l.originalWidth;e.scale(u*o.scaleX,u*o.scaleY);let m=l.width,f=l.height;if(e.translate(m/2,f/2),90==o.region.degrees){let t=m;m=f,f=t,e.rotate(-Math.PI/2)}e.scale(1,-1),e.translate(-m/2,-f/2),e.globalAlpha=s.a,e.drawImage(h,h.width*l.u,h.height*l.v,m,f,0,0,m,f),this.debugRendering&&e.strokeRect(0,0,m,f),e.restore()}}drawTriangles(t){let e=this.ctx,s=this.tempColor,r=t.color,n=t.drawOrder,i=null,a=this.vertices,o=null;for(let t=0,h=n.length;t<h;t++){let h,c=n[t],d=c.getAttachment();if(d instanceof jt){let t=d;a=this.computeRegionVertices(c,t,!1),o=qs.QUAD_TRIANGLES,h=t.region.texture.getImage()}else{if(!(d instanceof Wt))continue;{let t=d;a=this.computeMeshVertices(c,t,!1),o=t.triangles,h=t.region.texture.getImage()}}if(h){c.data.blendMode!=i&&(i=c.data.blendMode);let t=c.color,n=d.color;s.set(r.r*t.r*n.r,r.g*t.g*n.g,r.b*t.b*n.b,r.a*t.a*n.a),e.globalAlpha=s.a;for(var l=0;l<o.length;l+=3){let t=8*o[l],s=8*o[l+1],r=8*o[l+2],n=a[t],i=a[t+1],c=a[t+6],d=a[t+7],u=a[s],m=a[s+1],f=a[s+6],g=a[s+7],p=a[r],x=a[r+1],b=a[r+6],w=a[r+7];this.drawTriangle(h,n,i,c,d,u,m,f,g,p,x,b,w),this.debugRendering&&(e.strokeStyle="green",e.beginPath(),e.moveTo(n,i),e.lineTo(u,m),e.lineTo(p,x),e.lineTo(n,i),e.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,e,s,r,n,i,a,o,l,h,c,d,u){let m=this.ctx;const f=t.width-1,g=t.height-1;r*=f,n*=g,o*=f,l*=g,d*=f,u*=g,m.beginPath(),m.moveTo(e,s),m.lineTo(i,a),m.lineTo(h,c),m.closePath();let p=(o-=r)*(u-=n)-(d-=r)*(l-=n);if(0==p)return;p=1/p;const x=(u*(i-=e)-l*(h-=e))*p,b=(u*(a-=s)-l*(c-=s))*p,w=(o*h-d*i)*p,y=(o*c-d*a)*p,k=e-x*r-w*n,v=s-b*r-y*n;m.save(),m.transform(x,b,w,y,k,v),m.clip(),m.drawImage(t,0,0),m.restore()}computeRegionVertices(t,e,s){let r=t.bone.skeleton.color,n=t.color,i=e.color,a=r.a*n.a*i.a,o=s?a:1,l=this.tempColor;l.set(r.r*n.r*i.r*o,r.g*n.g*i.g*o,r.b*n.b*i.b*o,a),e.computeWorldVertices(t,this.vertices,0,qs.VERTEX_SIZE);let h=this.vertices,c=e.uvs;return h[jt.C1R]=l.r,h[jt.C1G]=l.g,h[jt.C1B]=l.b,h[jt.C1A]=l.a,h[jt.U1]=c[0],h[jt.V1]=c[1],h[jt.C2R]=l.r,h[jt.C2G]=l.g,h[jt.C2B]=l.b,h[jt.C2A]=l.a,h[jt.U2]=c[2],h[jt.V2]=c[3],h[jt.C3R]=l.r,h[jt.C3G]=l.g,h[jt.C3B]=l.b,h[jt.C3A]=l.a,h[jt.U3]=c[4],h[jt.V3]=c[5],h[jt.C4R]=l.r,h[jt.C4G]=l.g,h[jt.C4B]=l.b,h[jt.C4A]=l.a,h[jt.U4]=c[6],h[jt.V4]=c[7],h}computeMeshVertices(t,e,s){let r=t.bone.skeleton.color,n=t.color,i=e.color,a=r.a*n.a*i.a,o=s?a:1,l=this.tempColor;l.set(r.r*n.r*i.r*o,r.g*n.g*i.g*o,r.b*n.b*i.b*o,a);let h=e.worldVerticesLength/2,c=this.vertices;c.length<e.worldVerticesLength&&(this.vertices=c=u.newFloatArray(e.worldVerticesLength)),e.computeWorldVertices(t,0,e.worldVerticesLength,c,0,qs.VERTEX_SIZE);let d=e.uvs;for(let t=0,e=0,s=2;t<h;t++)c[s++]=l.r,c[s++]=l.g,c[s++]=l.b,c[s++]=l.a,c[s++]=d[e++],c[s++]=d[e++],s+=2;return c}},Ws=qs;r(Ws,"QUAD_TRIANGLES",[0,1,2,2,3,0]),r(Ws,"VERTEX_SIZE",8);var zs=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let r;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,i=e>>8&255,a=255&e,o=t.r*a,l=t.g*i;r=n<<24|t.b*s<<16|l<<8|o}else r=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return r}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,r){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=r,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Gs={0:"normal",1:"add",2:"multiply",3:"screen"},$s=class{renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(e){if(this.renderer.type===t.RendererType.CANVAS)return!0;if(e._validateAndTransformAttachments(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let r=0,n=t.length;r<n;r++){const n=t[r],i=n.getAttachment();if(i instanceof jt||i instanceof Wt){const t=e._getCachedData(n,i),r=s.slotBatches[t.id],a=t.texture;if(a!==r?.texture&&!r?._batcher.checkAndUpdateTexture(r,a))return!0}}}return!1}execute(e){if(this.renderer.type===t.RendererType.CANVAS){const t=this.renderer,s=(e.groupColorAlpha>>>24&255)/255,r=t.canvasContext,n=r.activeContext;n.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new Ws(n),this.canvasSkeletonRenderer.triangleRendering=!0),r.setContextTransform(e.groupTransform,1==(t._roundPixels|e._roundPixels));const i=e.skeleton.color.a;e.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(e.skeleton),e.skeleton.color.a=i,n.restore()}}addRenderable(e,s){if(this.renderer.type===t.RendererType.CANVAS)return this.renderer.renderPipes.batch.break(s),void s.add(e);const r=this._getSpineData(e),n=this.renderer.renderPipes.batch,i=e.skeleton.drawOrder,a=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let t=0,o=i.length;t<o;t++){const o=i[t],l=o.getAttachment(),h=Gs[o.data.blendMode];let c=!1;if(l instanceof jt||l instanceof Wt){const t=e._getCachedData(o,l),i=r.slotBatches[t.id]||=new zs;i.setData(e,t,h,a),c=t.skipRender,c||n.addToBatch(i,s)}const d=e._slotsObject[o.data.name];if(d){const t=d.container;c||(t.includeInBuild=!0,t.collectRenderables(s,this.renderer,null)),t.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder;for(let r=0,n=s.length;r<n;r++){const n=s[r],i=n.getAttachment();if(i instanceof jt||i instanceof Wt){const s=t._getCachedData(n,i);if(!s.skipRender){const t=e.slotBatches[s.id];t?._batcher?.updateElement(t)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null,this.canvasSkeletonRenderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};r($s,"extension",{type:[t.ExtensionType.WebGLPipes,t.ExtensionType.WebGPUPipes,t.ExtensionType.CanvasPipes],name:"spine"}),t.extensions.add($s);var js=new f;ke.yDown=!0;var Hs=new ys,Js=new m((()=>new t.Graphics)),Ks=class extends t.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!1;_ticker=t.Ticker.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(e){e=e??t.Ticker.shared,this._ticker!==e&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),e.add(this.internalUpdate,this)),this._ticker=e)}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Ae&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const e=t instanceof Ae?t:t.skeletonData;this.skeleton=new ke(e),this.state=new wt(new Et(e)),t?.ticker&&(this._ticker=t.ticker),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=void 0===t?.darkTint?this.skeleton.slots.some((t=>!!t.data.darkColor)):t?.darkTint;const s=this.skeleton.slots;for(let t=0;t<s.length;t++)this.attachmentCacheData[t]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,e){this._updateAndApplyState(e??this._ticker.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(js.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(js);t.x=e.x,t.y=-e.y}else t.x=js.x,t.y=js.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(ge.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,r=!1;for(let n=0;n<t.length;n++){const i=t[n].getAttachment();i&&(i!==e[s]&&(r=!0,e[s]=i),s++)}s!==e.length&&(r=!0,e.length=s),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof Vt){const e=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};return e.maskComputed=!1,void(this.currentClippingSlot=e)}let r=this.currentClippingSlot,n=this._slotsObject[t.data.name];if(r&&n){let t=r.mask;if(t||(t=Js.obtain(),r.mask=t,this.addChild(t)),!r.maskComputed){let e=r.slot,s=e.attachment;r.maskComputed=!0;const n=s.worldVerticesLength,i=r.vertices;s.computeWorldVertices(e,0,n,i,0,2),t.clear().poly(i).stroke({width:0}).fill({alpha:.25})}n.container.mask=t}else n?.container.mask&&(n.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e){for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof Vt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),Js.free(e.mask),e.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const r=e[s];this.updateAndSetPixiMask(r,s===e.length-1);const n=r.getAttachment();if(n)if(n instanceof Wt||n instanceof jt){const e=this._getCachedData(r,n);n instanceof jt?n.computeWorldVertices(r,e.vertices,0,2):n.computeWorldVertices(r,0,n.worldVerticesLength,e.vertices,0,2),e.uvs.length<n.uvs.length&&(e.uvs=new Float32Array(n.uvs.length)),t.fastCopy(n.uvs.buffer,e.uvs.buffer);const s=r.bone.skeleton.color,i=r.color,a=n.color,o=s.a*i.a*a.a;if(e.color.set(s.r*i.r*a.r,s.g*i.g*a.g,s.b*i.b*a.b,o),0===this.alpha||0===o)e.skipRender||(this.spineAttachmentsDirty=!0),e.skipRender=!0;else{e.skipRender&&(this.spineAttachmentsDirty=!0),e.skipRender=e.clipped=!1,r.darkColor&&e.darkColor.setFromColor(r.darkColor);const s=n.region?.texture.texture||t.Texture.EMPTY;e.texture!==s&&(e.texture=s,this.spineTexturesDirty=!0),Hs.isClipping()&&this.updateClippingData(e)}}else if(n instanceof Vt){Hs.clipStart(r,n);continue}Hs.clipEndWithSlot(r)}Hs.clipEnd()}updateClippingData(t){t.clipped=!0,Hs.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:r}=Hs,n=e.length/2,i=r.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(i),indicesCount:i},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||i!==a.indicesCount;t.skipRender=0===n,o&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(2*n),a.uvs=new Float32Array(2*n)),a.indices.length<i&&(a.indices=new Uint16Array(i)));const{vertices:l,uvs:h,indices:c}=a;for(let t=0;t<n;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];a.vertexCount=n;for(let t=0;t<i;t++)c[t]!==r[t]&&(this.spineAttachmentsDirty=!0,c[t]=r[t]);a.indicesCount=i}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:e,container:s}=t,r=!t.followAttachmentTimeline||Boolean(e.attachment);if(s.visible=this.skeleton.drawOrder.includes(e)&&r,s.visible){let t=e.bone;const r=s.localTransform;r.a=t.a,r.b=t.c,r.c=-t.b,r.d=-t.d,r.tx=t.worldX,r.ty=t.worldY,s.setFromMatrix(r),s.alpha=this.skeleton.color.a*e.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){let s;return e instanceof jt?(s=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new a(1,1,1,1),darkColor:new a(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}):(s=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new a(1,1,1,1),darkColor:new a(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,e,s){t=this.getSlotFromRef(t);for(const t in this._slotsObject)this._slotsObject[t]?.container===e&&this.removeSlotObject(this._slotsObject[t].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const r={container:e,slot:t,followAttachmentTimeline:s?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=r,this.updateSlotObject(r)}removeSlotObject(e){let s;if(e instanceof t.Container){for(const t in this._slotsObject)if(this._slotsObject[t]?.container===e){this._slotsObject[t]=null,s=e;break}}else{const t=this.getSlotFromRef(e);s=this._slotsObject[t.data.name]?.container,this._slotsObject[t.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach((([t,e])=>{e&&e.container.removeFromParent(),delete this._slotsObject[t]}))}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new bs;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const t=this._boundsProvider.calculateBounds(this),e=this._bounds;e.clear(),e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const r=t[s],n=r.getAttachment();if(n&&(n instanceof jt||n instanceof Wt)){const t=this._getCachedData(r,n);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),this._ticker.remove(this.internalUpdate,this),this._ticker=null,this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:e,atlas:s,scale:r=1,darkTint:n,autoUpdate:i=!0,boundsProvider:a,ticker:o}){const l=`${e}-${s}-${r}`;if(t.Cache.has(l))return new Ks({skeletonData:t.Cache.get(l),darkTint:n,autoUpdate:i,boundsProvider:a,ticker:o});const h=t.Assets.get(e),c=t.Assets.get(s),d=new Kt(c),u=h instanceof Uint8Array?new Re(d):new ks(d);u.scale=r;const m=u.readSkeletonData(h);return t.Cache.set(l,m),new Ks({skeletonData:m,darkTint:n,autoUpdate:i,boundsProvider:a,ticker:o})}},Qs={AABBRectangleBoundsProvider:class{constructor(t,e,s,r){this.x=t,this.y=e,this.width=s,this.height=r}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},AlphaTimeline:G,Animation:I,AnimationState:wt,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Et,AssetManagerBase:class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new oe){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,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}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 r=new Image;r.crossOrigin="anonymous",r.onload=()=>{this.success(e,t,this.textureLoader(r))},r.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new _t(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(r?r[n.name]:i+n.name,((s,r)=>{l||(n.setTexture(r),0==--o&&this.success(e,t,a))}),((e,r)=>{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,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let 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}},AtlasAttachmentLoader:Kt,Attachment:g,AttachmentTimeline:H,BinaryInput:Xe,BlendMode:ve,Bone:ie,BoneData:Qt,BoundingBoxAttachment:Dt,CURRENT:Bt,ClippingAttachment:Vt,Color:a,ConstraintData:ae,CurveTimeline:Y,CurveTimeline1:P,CurveTimeline2:R,DebugUtils:class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},DeformTimeline:J,Downloader:oe,DrawOrderTimeline:tt,Event:le,EventData:he,EventQueue:Ct,EventTimeline:Q,EventType:yt,FIRST:Ft,FakeTexture:class extends Lt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Pt,HOLD_MIX:Rt,HOLD_SUBSEQUENT:Yt,IkConstraint:ce,IkConstraintData:de,IkConstraintTimeline:et,Inherit:Ht,InheritTimeline:q,IntSet: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}},Interpolation:h,MathUtils:l,MeshAttachment:Wt,MixBlend:v,MixDirection:S,PathAttachment:zt,PathConstraint:fe,PathConstraintData:ue,PathConstraintMixTimeline:it,PathConstraintPositionTimeline:rt,PathConstraintSpacingTimeline:nt,Physics:ge,PhysicsConstraintDampingTimeline:ht,PhysicsConstraintGravityTimeline:ut,PhysicsConstraintInertiaTimeline:ot,PhysicsConstraintMassTimeline:ct,PhysicsConstraintMixTimeline:mt,PhysicsConstraintResetTimeline:gt,PhysicsConstraintStrengthTimeline:lt,PhysicsConstraintTimeline:at,PhysicsConstraintWindTimeline:dt,PointAttachment:Gt,Pool:m,PositionMode:Zt,Pow:c,PowOut:class extends c{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:j,RGBA2Timeline:$,RGBATimeline:W,RGBTimeline:z,RegionAttachment:jt,RotateMode:re,RotateTimeline:X,SETUP:Xt,SUBSEQUENT:Mt,ScaleTimeline:V,ScaleXTimeline:L,ScaleYTimeline:N,SequenceTimeline:xt,SetupPoseBoundsProvider:class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new ke(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(ge.update);const s=e.getBoundsRect(this.clipping?new ys:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},ShearTimeline:_,ShearXTimeline:O,ShearYTimeline:U,Skeleton:ke,SkeletonBinary:Re,SkeletonBounds:bs,SkeletonClipping:ys,SkeletonData:Ae,SkeletonJson:ks,Skin:Ie,SkinEntry:Te,SkinsAndAnimationBoundsProvider:class{constructor(t,e=[],s=.05,r=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=r}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new wt(t.state.data),s=new ke(t.skeleton.data),r=this.clipping?new ys:void 0,n=s.data;if(this.skins.length>0){let t=new Ie("custom-skin");for(const e of this.skins){const s=n.findSkin(e);null!=s&&t.addSkin(s)}s.setSkin(t)}s.setToSetupPose();const i=null!=this.animation?n.findAnimation(this.animation):null;if(null==i){s.updateWorldTransform(ge.update);const t=s.getBoundsRect(r);return t.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:t}{let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,i,!1);const l=Math.max(i.duration/this.timeStep,1);for(let i=0;i<l;i++){const l=i>0?this.timeStep:0;e.update(l),e.apply(s),s.update(l),s.updateWorldTransform(ge.update);const h=s.getBoundsRect(r);t=Math.min(t,h.x),n=Math.min(n,h.y),a=Math.max(a,h.x+h.width),o=Math.max(o,h.y+h.height)}const h={x:t,y:n,width:a-t,height:o-n};return h.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:h}}},Slot:be,SlotData:Me,SpacingMode:ee,Spine:Ks,SpineDebugRenderer:class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);const s={parentDebugContainer:new t.Container,bones:new t.Container,skeletonXY:new t.Graphics,regionAttachmentsShape:new t.Graphics,meshTrianglesLine:new t.Graphics,meshHullLine:new t.Graphics,clippingPolygon:new t.Graphics,boundingBoxesRect:new t.Graphics,boundingBoxesCircle:new t.Graphics,boundingBoxesPolygon:new t.Graphics,pathsCurve:new t.Graphics,pathsLine:new t.Graphics,eventText:new t.Container,eventCallback:{event:(r,n)=>{if(this.drawEvents){const r=Math.abs(e.scale.x||e.scale.y||1),i=new t.Text({text:n.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});i.scale.x=Math.sign(e.scale.x),i.anchor.set(.5),s.eventText.addChild(i),setTimeout((()=>{i.destroyed||i.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,e.addChild(s.parentDebugContainer),e.state.addListener(s.eventCallback),this.registeredSpines.set(e,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,r,s),this.drawPaths&&this.drawPathsFunc(t,e,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,r),this.drawClipping&&this.drawClippingFunc(t,e,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,r),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(e,s,r,n){const i=e.skeleton,a=i.x,o=i.y,l=i.bones;s.skeletonXY.strokeStyle={width:r,color:this.skeletonXYColor};for(let e=0,i=l.length;e<i;e++){const i=l[e],h=i.data.length,c=a+i.worldX,d=o+i.worldY,u=a+h*i.a+i.worldX,m=o+h*i.b+i.worldY;if("root"===i.data.name||null===i.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,b=Math.pow(g,2),w=Math.sqrt(p+b),y=Math.pow(w,2),k=Math.PI/180,v=Math.acos((y+b-p)/(2*x*w))||0;if(0===w)continue;const C=new t.Graphics;s.bones.addChild(C);const S=w/50/n;C.context.poly([0,0,0-S,w-3*S,0,w-S,0+S,w-3*S]).fill(this.bonesColor),C.x=c,C.y=d,C.pivot.y=w;let A=0;c<u&&d<m?A=180*k-v:c>u&&d<m?A=180*k+v:c>u&&d>m?A=-v:c<u&&d>m?A=v:d===m&&c<u?A=90*k:d===m&&c>u?A=-90*k:c===u&&d<m?A=180*k:c===u&&d>m&&(A=0),C.rotation=A,C.circle(0,w,1.2*S).fill({color:0,alpha:.6}).stroke({width:r+S/2.4,color:this.bonesColor})}const h=3*r;s.skeletonXY.context.moveTo(a-h,o-h).lineTo(a+h,o+h).moveTo(a+h,o-h).lineTo(a-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t],n=s.getAttachment();if(null===n||!(n instanceof jt))continue;const i=n,a=new Float32Array(8);i.computeWorldVertices(s,a,0,2),e.regionAttachmentsShape.poly(Array.from(a.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Wt))continue;const i=n,a=new Float32Array(i.worldVerticesLength),o=i.triangles;let l=i.hullLength;if(i.computeWorldVertices(s,0,i.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],r=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[r],a[r+1]).lineTo(a[n],a[n+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=a[l-2],s=a[l-1];for(let r=0,n=l;r<n;r+=2){const n=a[r],i=a[r+1];e.meshHullLine.context.moveTo(n,i).lineTo(t,s),t=n,s=i}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Vt))continue;const i=n,a=i.worldVerticesLength,o=new Float32Array(a);i.computeWorldVertices(s,0,a,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const r=new bs;r.update(t.skeleton,!0),r.minX!==1/0&&e.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=r.polygons,i=(t,r,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const i=[],a=2*s;for(let s=0,r=t.length;s<r;s+=2){const r=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(r,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(r,n,a).fill({color:this.boundingBoxesCircleColor}),i.push(r,n)}e.boundingBoxesPolygon.poly(i).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=n.length;t<e;t++){const e=n[t];i(e,0,e.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof zt))continue;const i=n;let a=i.worldVerticesLength;const o=new Float32Array(a);i.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(i.closed){const t=o[0],s=o[1],r=o[a-2],n=o[a-1];c=o[a-4],d=o[a-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,r,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(r,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],r=o[t+1],n=o[t+2],i=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,r,n,i,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,r),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,i),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:$s,SpineTexture:Ms,StringSet:n,Texture:Lt,TextureAtlas:_t,TextureAtlasPage:Ut,TextureAtlasRegion:qt,TextureFilter:St,TextureRegion:Nt,TextureWrap:Tt,TimeKeeper:class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Timeline:F,TrackEntry:vt,TransformConstraint:we,TransformConstraintData:Pe,TransformConstraintTimeline:st,TranslateTimeline:B,TranslateXTimeline:E,TranslateYTimeline:D,Triangulator:ws,Utils:u,Vector2:f,VertexAttachment:x,WindowedMean:class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}};class Zs extends e.SpineSystem{init(){super.init({pixiSpine:Qs})}}class tr extends e.Spine{}exports.PixiSpine=Qs,exports.Spine=tr,exports.SpineSystem=Zs;