@esotericsoftware/spine-core
Version:
The official Spine Runtimes for the web.
1 lines • 185 kB
JavaScript
"use strict";var Yn=class{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ie=class{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let 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}},z=class Ct{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Ct(1,1,1,1);static RED=new Ct(1,0,0,1);static GREEN=new Ct(0,1,0,1);static BLUE=new Ct(0,0,1,1);static MAGENTA=new Ct(1,0,1,1);set(e,s,n,i){return this.r=e,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,n,i){return this.r+=e,this.g+=s,this.b+=n,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${e(this.r)}${e(this.g)}${e(this.b)}`}static fromString(e,s=new Ct){return s.setFromString(e)}},R=class lt{static epsilon=1e-5;static epsilon2=lt.epsilon*lt.epsilon;static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*lt.degRad)}static sinDeg(e){return Math.sin(e*lt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*lt.radDeg}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){const s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return lt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,n){const i=Math.random(),r=s-e;return i<=(n-e)/r?e+Math.sqrt(i*r*(n-e)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Bt=class Vt{static linear=new class extends Vt{applyInternal(e){return e}};static smooth=new class extends Vt{applyInternal(e){return e*e*(3-2*e)}};static slowFast=new class extends Vt{applyInternal(e){return e*e}};static fastSlow=new class extends Vt{applyInternal(e){return(e-1)*(e-1)*-1+1}};static circle=new class extends Vt{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}};apply(e,s,n){return s===void 0||n===void 0?this.applyInternal(e):e+(s-e)*this.applyInternal(n)}},Ls=class extends Bt{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}},Fn=class extends Ls{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},B=class Rt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,n,i,r){for(let l=s,c=i;l<s+r;l++,c++)n[c]=e[l]}static arrayFill(e,s,n,i){for(let r=s;r<n;r++)e[r]=i}static setArraySize(e,s,n=0){const i=e.length;if(i===s)return e;if(e.length=s,i<s)for(let r=i;r<s;r++)e[r]=n;return e}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:Rt.setArraySize(e,s,n)}static newArray(e,s){const n=[];for(let i=0;i<e;i++)n[i]=s;return n}static newFloatArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(e){return Rt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Rt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,s,n=!0){for(let i=0;i<e.length;i++)if(e[i]===s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},kn=class{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Ot=class{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){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}},Ce=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}},Pn=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const 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)}},En=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}},Bs=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Kt=(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))(Kt||{}),Os=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Os||{}),Ns=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Xn=class extends Bs{setFilters(t,e){}setWraps(t,e){}dispose(){}},Me=class{pages=[];regions=[];constructor(t){const e=new Vn(t),s=new Array(4),n={};n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.format=()=>{},n.filter=a=>{a.minFilter=B.enumValue(Kt,s[1]),a.magFilter=B.enumValue(Kt,s[2])},n.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},n.pma=a=>{a.pma=s[1]==="true"};var i={};i.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},i.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},i.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},i.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},i.rotate=a=>{const h=s[1];h==="true"?a.degrees=90:h!=="false"&&(a.degrees=parseInt(h))},i.index=a=>{a.index=parseInt(s[1])};let r=e.readLine();for(;r&&r.trim().length===0;)r=e.readLine();for(;!(!r||r.trim().length===0||e.readEntry(s,r)===0);)r=e.readLine();let l=null,c=null,o=null;for(;r!==null;)if(r.trim().length===0)l=null,r=e.readLine();else if(l){const a=new Ye(l,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{c||(c=[]),o||(o=[]),c.push(s[0]);const f=[];for(let u=0;u<h;u++)f.push(parseInt(s[u+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),c&&c.length>0&&o&&o.length>0&&(a.names=c,a.values=o,c=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees===90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new Us(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name===t)return this.regions[e];return null}setTextures(t,e=""){for(const 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()}},Vn=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length===0))return 0;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=e.indexOf(",",i);if(r===-1)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},Us=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}},Ye=class extends Ns{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)}},Fe=class un{static empty=[];name;timelineAttachment;timelineSlots=un.empty;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,s,n){let i=e[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,l=this.timelineSlots.length;r<l;r++){if(i=e[this.timelineSlots[r]],!i.bone.isActive())continue;const c=(n?i.getAppliedPose():i.getPose()).getAttachment();if(c!=null&&c.timelineAttachment===this)return!0}return!1}},xt=class mn extends Fe{static nextID=0;id=mn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,l,c){i=l+(i>>1)*c;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);const m=s.bone.appliedPose,p=m.worldX,g=m.worldY,x=m.a,b=m.b,w=m.c,S=m.d;for(let y=n,v=l;v<i;y+=2,v+=c){const T=a[y],A=a[y+1];r[v]=T*x+A*b+p,r[v+1]=T*w+A*S+g}return}let d=0,f=0;for(let m=0;m<n;m+=2){const p=h[d];d+=p+1,f+=p}const u=e.bones;if(o.length===0)for(let m=l,p=f*3;m<i;m+=c){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=u[h[d]].appliedPose,S=a[p],y=a[p+1],v=a[p+2];g+=(S*w.a+y*w.b+w.worldX)*v,x+=(S*w.c+y*w.d+w.worldY)*v}r[m]=g,r[m+1]=x}else{const m=o;for(let p=l,g=f*3,x=f<<1;p<i;p+=c){let b=0,w=0,S=h[d++];for(S+=d;d<S;d++,g+=3,x+=2){const y=u[h[d]].appliedPose,v=a[g]+m[x],T=a[g+1]+m[x+1],A=a[g+2];b+=(v*y.a+T*y.b+y.worldX)*A,w+=(v*y.c+T*y.d+y.worldY)*A}r[p]=b,r[p+1]=w}}}copyTo(e){this.bones?(e.bones=[],B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment,e.timelineSlots=this.timelineSlots}},St=class Es extends xt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new z(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new z(0,0,0,0);constructor(e,s){super(e),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const e=new Es(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],B.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],B.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){const e=new Es(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,s,n){if(!e)throw new Error("Region not set.");const i=n.length;let r=e.u,l=e.v,c=0,o=0;if(e instanceof Ye){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,l-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*c,n[f+1]=l+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,l-=e.offsetY/d,c=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*c,n[f+1]=l+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,l-=e.offsetX/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*c,n[f+1]=l+s[f]*o;return;default:r-=e.offsetX/h,l-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,o=e.originalHeight/d}}else e?(c=e.u2-r,o=e.v2-l):(r=l=0,c=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*c,n[a+1]=l+s[a+1]*o}},Ft=class gn extends Fe{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new z(1,1,1,1);tempColor=new z(1,1,1,1);constructor(e,s){super(e),this.sequence=s}copy(){const e=new gn(this.name,this.sequence.copy());return e.path=this.path,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,e.color.setFromColor(this.color),e}computeWorldVertices(e,s,n,i,r){const l=e.bone.appliedPose,c=l.worldX,o=l.worldY,a=l.a,h=l.b,d=l.c,f=l.d;let u=s[0],m=s[1];n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[2],m=s[3],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[4],m=s[5],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[6],m=s[7],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,l,c,o,a,h){if(!e)throw new Error("Region not set.");const d=c/e.originalWidth*i,f=o/e.originalHeight*r,u=-c/2*i+e.offsetX*d,m=-o/2*r+e.offsetY*f,p=u+e.width*d,g=m+e.height*f,x=l*R.degRad,b=Math.cos(x),w=Math.sin(x),S=u*b+s,y=u*w,v=m*b+n,T=m*w,A=p*b+s,I=p*w,M=g*b+n,Y=g*w;a[0]=S-T,a[1]=v+y,a[2]=S-Y,a[3]=M+y,a[4]=A-Y,a[5]=M+I,a[6]=A-T,a[7]=v+I,e==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Nt=class Se{static _nextID=0;id=Se.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(e,s){this.regions=new Array(e),this.pathSuffix=s}copy(){const e=this.regions.length,s=new Se(e,this.pathSuffix);if(B.arrayCopy(this.regions,0,s.regions,0,e),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const n=this.uvs[0].length;s.uvs=[];for(let i=0;i<e;i++)s.uvs[i]=B.newFloatArray(n),B.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<e;n++)s.offsets[n]=[],B.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(e){const s=this.regions.length;if(e instanceof Ft){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Ft.computeUVs(this.regions[n],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[n],this.uvs[n])}else if(e instanceof St){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),St.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(e){let s=e.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,s){if(!this.pathSuffix)return e;let n=e;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return Se._nextID++}},ke=(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))(ke||{}),Pe=[0,1,2,3,4,5,6],Qt=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new Ie,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=t;for(let i=0;i<e;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),qs(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}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,r,l,c,o,a){if(!t)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const h=this.timelines;for(let d=0,f=h.length;d<f;d++)h[d].apply(t,e,s,i,r,l,c,o,a)}},$s=(t=>(t[t.rotate=0]="rotate",t[t.x=1]="x",t[t.y=2]="y",t[t.scaleX=3]="scaleX",t[t.scaleY=4]="scaleY",t[t.shearX=5]="shearX",t[t.shearY=6]="shearY",t[t.inherit=7]="inherit",t[t.rgb=8]="rgb",t[t.alpha=9]="alpha",t[t.rgb2=10]="rgb2",t[t.attachment=11]="attachment",t[t.deform=12]="deform",t[t.event=13]="event",t[t.drawOrder=14]="drawOrder",t[t.ikConstraint=15]="ikConstraint",t[t.transformConstraint=16]="transformConstraint",t[t.pathConstraintPosition=17]="pathConstraintPosition",t[t.pathConstraintSpacing=18]="pathConstraintSpacing",t[t.pathConstraintMix=19]="pathConstraintMix",t[t.physicsConstraintInertia=20]="physicsConstraintInertia",t[t.physicsConstraintStrength=21]="physicsConstraintStrength",t[t.physicsConstraintDamping=22]="physicsConstraintDamping",t[t.physicsConstraintMass=23]="physicsConstraintMass",t[t.physicsConstraintWind=24]="physicsConstraintWind",t[t.physicsConstraintGravity=25]="physicsConstraintGravity",t[t.physicsConstraintMix=26]="physicsConstraintMix",t[t.physicsConstraintReset=27]="physicsConstraintReset",t[t.sequence=28]="sequence",t[t.sliderTime=29]="sliderTime",t[t.sliderMix=30]="sliderMix",t))($s||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=B.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 search(t,e,s=1){const n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}};function Ds(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var bt=class extends Q{curves;constructor(t,e,...s){super(t,...s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=(i-l*2+o)*.03,p=((r-c)*3-n+a)*.006,g=((l-o)*3-i+h)*.006;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,S=(l-i)*.3+m+g*.16666667,y=n+w,v=i+S;for(let T=f+18;f<T;f+=2)d[f]=y,d[f+1]=v,w+=x,S+=b,x+=p,b+=g,y+=w,v+=S}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const o=this.frames[e],a=this.frames[e+s];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const o=i[n-2],a=i[n-1];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}e+=this.getFrameEntries();const l=i[r-2],c=i[r-1];return c+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-c)}},Ut=class extends bt{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){const e=this.frames;let s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=e[s],r=e[s+1];return r+(t-i)/(e[s+2]-i)*(e[s+2+1]-r)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+l*e:i+(n?l:l+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,l){return l===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,l)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getAbsoluteValue2(t,e,s,n,i,r,l){return t<this.frames[0]?s?r:i:s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getScaleValue(t,e,s,n,i,r,l){if(t<this.frames[0])return s?l:r;const c=this.getCurveValue(t)*l;if(e===1&&!n)return c;let o=s?l:r;return n?o+(c-l)*e:i?o+(Math.abs(c)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(c),o+(c-o)*e)}};function qs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var wt=class extends Ut{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Zt=class extends bt{boneIndex;constructor(t,e,s,n,i){super(t,e,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},$t=class extends wt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,l){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Ee=class extends Zt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.x=e.x+o*n,t.y=e.y+a*n):r?(t.x+=o*n,t.y+=a*n):(t.x+=(e.x+o-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Xe=class extends wt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,l){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Ve=class extends wt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,l){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Re=class extends Zt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(o*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=o,t.scaleY=a;else{let f=0,u=0;i?(f=e.scaleX,u=e.scaleY):(f=t.scaleX,u=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=u+(a-e.scaleY)*n):l?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=u+(Math.abs(a)*Math.sign(u)-u)*n):(f=Math.abs(f)*Math.sign(o),u=Math.abs(u)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=u+(a-u)*n)}}},Le=class extends wt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,l){t.scaleX=this.getScaleValue(s,n,i,r,l,t.scaleX,e.scaleX)}},Be=class extends wt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,l){t.scaleY=this.getScaleValue(s,n,i,r,l,t.scaleY,e.scaleY)}},Oe=class extends Zt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.shearX=e.shearX+o*n,t.shearY=e.shearY+a*n):r?(t.shearX+=o*n,t.shearY+=a*n):(t.shearX+=(e.shearX+o-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},Ne=class extends wt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,l){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},Ue=class extends wt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,l){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},$e=class extends Q{boneIndex;constructor(t,e){super(t,`7|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(c)r&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Dt=class extends bt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,l)}},De=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,n,i,r){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]=r}apply1(t,e,s,n,i,r){const l=e.color,c=this.frames;if(s<c[0]){i&&l.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Q.search(c,s,5),u=this.curves[f/5];switch(u){case 0:{const m=c[f];o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];const p=(s-m)/(c[f+5]-m);o+=(c[f+5+1]-o)*p,a+=(c[f+5+2]-a)*p,h+=(c[f+5+3]-h)*p,d+=(c[f+5+4]-d)*p;break}case 1:o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];break;default:o=this.getBezierValue(s,f,1,u-2),a=this.getBezierValue(s,f,2,u+18-2),h=this.getBezierValue(s,f,3,u+18*2-2),d=this.getBezierValue(s,f,4,u+18*3-2)}if(n===1)l.set(o,a,h,d);else if(i){const m=t.data.setupPose.color;l.set(m.r+(o-m.r)*n,m.g+(a-m.g)*n,m.b+(h-m.b)*n,m.a+(d-m.a)*n)}else l.add((o-l.r)*n,(a-l.g)*n,(h-l.b)*n,(d-l.a)*n)}},qe=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${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}apply1(t,e,s,n,i,r){const l=e.color;let c=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const u=t.data.setupPose.color;l.r=u.r,l.g=u.g,l.b=u.b}return}const d=Q.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const u=h[d];c=h[d+1],o=h[d+2],a=h[d+3];const m=(s-u)/(h[d+4]-u);c+=(h[d+4+1]-c)*m,o+=(h[d+4+2]-o)*m,a+=(h[d+4+3]-a)*m;break}case 1:c=h[d+1],o=h[d+2],a=h[d+3];break;default:c=this.getBezierValue(s,d,1,f-2),o=this.getBezierValue(s,d,2,f+18-2),a=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const u=t.data.setupPose.color;c=u.r+(c-u.r)*n,o=u.g+(o-u.g)*n,a=u.b+(a-u.b)*n}else c=l.r+(c-l.r)*n,o=l.g+(o-l.g)*n,a=l.b+(a-l.b)*n;l.r=c<0?0:c>1?1:c,l.g=o<0?0:o>1?1:o,l.b=a<0?0:a>1?1:a}},_e=class extends Ut{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(o?a.appliedPose:a.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const u=a.data.setupPose.color;d=u.a+(d-u.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},ze=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,l,c,o){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]=r,this.frames[t+5]=l,this.frames[t+6]=c,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const b=t.data.setupPose;l.setFromColor(b.color);const w=b.darkColor;c.r=w.r,c.g=w.g,c.b=w.b}return}let f=0,u=0,m=0,p=0;const g=Q.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];f=d[g+1],u=d[g+2],m=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];const w=(s-b)/(d[g+8]-b);f+=(d[g+8+1]-f)*w,u+=(d[g+8+2]-u)*w,m+=(d[g+8+3]-m)*w,p+=(d[g+8+4]-p)*w,o+=(d[g+8+5]-o)*w,a+=(d[g+8+6]-a)*w,h+=(d[g+8+7]-h)*w;break}case 1:f=d[g+1],u=d[g+2],m=d[g+3],p=d[g+4],o=d[g+5],a=d[g+6],h=d[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),u=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),o=this.getBezierValue(s,g,5,x+18*4-2),a=this.getBezierValue(s,g,6,x+18*5-2),h=this.getBezierValue(s,g,7,x+18*6-2)}if(n===1)l.set(f,u,m,p);else if(i){const b=t.data.setupPose;let w=b.color;l.set(w.r+(f-w.r)*n,w.g+(u-w.g)*n,w.b+(m-w.b)*n,w.a+(p-w.a)*n),w=b.darkColor,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else l.add((f-l.r)*n,(u-l.g)*n,(m-l.b)*n,(p-l.a)*n),o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n;c.r=o<0?0:o>1?1:o,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h}},We=class extends Dt{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){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]=r,this.frames[t+5]=l,this.frames[t+6]=c}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0,d=0,f=0,u=0;const m=this.frames;if(s<m[0]){if(i){const x=t.data.setupPose,b=x.color,w=x.darkColor;l.r=b.r,l.g=b.g,l.b=b.b,c.r=w.r,c.g=w.g,c.b=w.b}return}const p=Q.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];o=m[p+1],a=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];const b=(s-x)/(m[p+7]-x);o+=(m[p+7+1]-o)*b,a+=(m[p+7+2]-a)*b,h+=(m[p+7+3]-h)*b,d+=(m[p+7+4]-d)*b,f+=(m[p+7+5]-f)*b,u+=(m[p+7+6]-u)*b;break}case 1:o=m[p+1],a=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];break;default:o=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),f=this.getBezierValue(s,p,5,g+18*4-2),u=this.getBezierValue(s,p,6,g+18*5-2)}if(n!==1)if(i){const x=t.data.setupPose;let b=x.color;o=b.r+(o-b.r)*n,a=b.g+(a-b.g)*n,h=b.b+(h-b.b)*n,b=x.darkColor,d=b.r+(d-b.r)*n,f=b.g+(f-b.g)*n,u=b.b+(u-b.b)*n}else o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n,d=c.r+(d-c.r)*n,f=c.g+(f-c.g)*n,u=c.b+(u-c.b)*n;l.r=o<0?0:o>1?1:o,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=f<0?0:f>1?1:f,c.b=u<0?0:u>1?1:u}},kt=class extends Q{slotIndex=0;attachmentNames;constructor(t,e){super(t,`11|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;c||s<this.frames[0]?r&&this.setAttachment(t,h,a.data.attachmentName):this.setAttachment(t,h,this.attachmentNames[Q.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},He=class extends bt{slotIndex;attachment;vertices;constructor(t,e,s,n){super(t,e,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=o*.03-l*.06,p=((r-c)*3-n+a)*.006,g=(l-o+.33333333)*.018;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,S=l*.3+m+g*.16666667,y=n+w,v=S;for(let T=f+18;f<T;f+=2)d[f]=y,d[f+1]=v,w+=x,S+=b,x+=p,b+=g,y+=w,v+=S}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const c=this.frames[e];return(t-c)/(this.frames[e+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>t){const c=this.frames[e];return s[n+1]*(t-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const c=s[n-2],o=s[n-1];return o+(t-c)/(s[n]-c)*(s[n+1]-o)}const r=s[i-2],l=s[i-1];return l+(1-l)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,l,c,o){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,o))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],o,r);for(const g of h)this.applyBeforeFirst(a[g],o,r);return}let f,u,m;if(s>=d[d.length-1])m=0,f=this.vertices[d.length-1],u=null;else{const g=Q.search(d,s);m=this.getCurvePercent(s,g),f=this.vertices[g],u=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],o,f,u,m,p,i,r,l);for(const g of h)this.applyToSlot(a[g],o,f,u,m,p,i,r,l)}applyToSlot(t,e,s,n,i,r,l,c,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const h=a.attachment,d=a.deform;if(d.length===0&&(c=!0),d.length=r,n===null)if(l===1)if(o&&!c)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=s[u]-f[u]}else B.arrayCopy(s,0,d,0,r);else if(c)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++){const m=f[u];d[u]=m+(s[u]-m)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*l}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*l;else if(l===1)if(o&&!c)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=u+(n[f]-u)*i}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u];d[u]+=m+(n[u]-m)*i-f[u]}}else if(i===0)B.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const u=s[f];d[f]=u+(n[f]-u)*i}else if(c)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*l}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u],p=f[u];d[u]=p+(m+(n[u]-m)*i-p)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*l}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u];d[u]+=(m+(n[u]-m)*i-f[u])*l}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*l}}applyBeforeFirst(t,e,s){if(!t.bone.active)return;const n=e?t.appliedPose:t.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},Ge=class vt extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`28|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return vt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const l=this.frames;e*=vt.ENTRIES,l[e]=s,l[e+vt.MODE]=n|i<<4,l[e+vt.DELAY]=r}apply(e,s,n,i,r,l,c,o,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,f=this.frames;if(o||n<f[0]){if(l){this.setupPose(h[this.slotIndex],a);for(const x of d)this.setupPose(h[x],a)}return}const u=Q.search(f,n,vt.ENTRIES),m=f[u],p=f[u+vt.MODE],g=f[u+vt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,m,p,g);for(const x of d)this.applyToSlot(h[x],a,n,m,p,g)}setupPose(e,s){if(!e.bone.active)return;const n=s?e.appliedPose:e.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(e,s,n,i,r,l){if(!e.bone.active)return;const c=s?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=c.attachment.sequence.regions.length;const h=Pe[r&15];if(h!==0)switch(o+=(n-i)/l+1e-5|0,h){case 1:o=Math.min(a-1,o);break;case 2:o%=a;break;case 3:{const d=(a<<1)-2;o=d===0?0:o%d,o>=a&&(o=d-o);break}case 4:o=Math.max(a-1-o,0);break;case 5:o=a-1-o%a;break;case 6:{const d=(a<<1)-2;o=d===0?0:(o+a-1)%d,o>=a&&(o=d-o)}}c.sequenceIndex=o}},te=class pn extends Q{static propertyIds=["13"];events;constructor(e){super(e,...pn.propertyIds),this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,n,i,r,l,c,o,a){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,!1,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let f=0;if(s<h[0])f=0;else{f=Q.search(h,s)+1;const u=h[f];for(;f>0&&h[f-1]===u;)f--}for(;f<d&&n>=h[f];f++)i.push(this.events[f])}},Tt=class Xs extends Q{static propertyID="14";static propertyIds=[Xs.propertyID];drawOrders;constructor(e){super(e,...Xs.propertyIds),this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){l&&B.arrayCopy(d,0,h,0,e.slots.length);return}const f=this.drawOrders[Q.search(this.frames,n)];if(!f)B.arrayCopy(d,0,h,0,e.slots.length);else for(let u=0,m=f.length;u<m;u++)h[u]=d[f[u]]}},qt=class xn extends Q{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...xn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(e),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(e){const s=e.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`d${e[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])l&&this.setup(h,d);else{const f=this.drawOrders[Q.search(this.frames,n)];if(!f)this.setup(h,d);else{const u=this.inFolder,m=this.slots;for(let p=0,g=0,x=m.length;!(u[h[p].data.index]&&(h[p]=d[m[f[g]]],++g===x));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,l=0,c=i.length;!(n[e[r].data.index]&&(e[r]=s[i[l]],++l===c));r++);}};function _s(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var je=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,l){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]=r?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.data.setupPose;h.mix=x.mix,h.softness=x.softness,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch}return}let f=0,u=0;const m=Q.search(d,s,6),p=this.curves[m/6];switch(p){case 0:{const x=d[m];f=d[m+1],u=d[m+2];const b=(s-x)/(d[m+6]-x);f+=(d[m+6+1]-f)*b,u+=(d[m+6+2]-u)*b;break}case 1:f=d[m+1],u=d[m+2];break;default:f=this.getBezierValue(s,m,1,p-2),u=this.getBezierValue(s,m,2,p+18-2)}const g=r?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,c?r&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[m+3],h.compress=d[m+4]!==0,h.stretch=d[m+5]!==0)}},Je=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){const o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=n,o[t+3]=i,o[t+4]=r,o[t+5]=l,o[t+6]=c}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.data.setupPose;h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY}return}let f,u,m,p,g,x;const b=Q.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];f=d[b+1],u=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const v=(s-y)/(d[b+7]-y);f+=(d[b+7+1]-f)*v,u+=(d[b+7+2]-u)*v,m+=(d[b+7+3]-m)*v,p+=(d[b+7+4]-p)*v,g+=(d[b+7+5]-g)*v,x+=(d[b+7+6]-x)*v;break}case 1:f=d[b+1],u=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:f=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+18*2-2),p=this.getBezierValue(s,b,4,w+18*3-2),g=this.getBezierValue(s,b,5,w+18*4-2),x=this.getBezierValue(s,b,6,w+18*5-2)}const S=r?a.data.setupPose:h;l?(h.mixRotate=S.mixRotate+f*i,h.mixX=S.mixX+u*i,h.mixY=S.mixY+m*i,h.mixScaleX=S.mixScaleX+p*i,h.mixScaleY=S.mixScaleY+g*i,h.mixShearY=S.mixShearY+x*i):(h.mixRotate=S.mixRotate+(f-S.mixRotate)*i,h.mixX=S.mixX+(u-S.mixX)*i,h.mixY=S.mixY+(m-S.mixY)*i,h.mixScaleX=S.mixScaleX+(p-S.mixScaleX)*i,h.mixScaleY=S.mixScaleY+(g-S.mixScaleY)*i,h.mixShearY=S.mixShearY+(x-S.mixShearY)*i)}},Pt=class extends Ut{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Ke=class extends Pt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,l,h.position,a.data.setupPose.position)}}},Qe=class extends Pt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},Ze=class extends bt{constraintIndex;constructor(t,e,s){super(t,e,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){const r=this.frames;t<<=2,r[t]=e,r[t+1]=s,r[t+2]=n,r[t+3]=i}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;h.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY}return}let f,u,m;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];f=d[p+1],u=d[p+2],m=d[p+3];const w=(s-b)/(d[p+4]-b);f+=(d[p+4+1]-f)*w,u+=(d[p+4+2]-u)*w,m+=(d[p+4+3]-m)*w;break}case 1:f=d[p+1],u=d[p+2],m=d[p+3];break;default:f=this.getBezierValue(s,p,1,g-2),u=this.getBezierValue(s,p,2,g+18-2),m=this.getBezierValue(s,p,3,g+18*2-2)}const x=r?a.data.setupPose:h;l?(h.mixRotate=x.mixRotate+f*i,h.mixX=x.mixX+u*i,h.mixY=x.mixY+m*i):(h.mixRotate=x.mixRotate+(f-x.mixRotate)*i,h.mixX=x.mixX+(u-x.mixX)*i,h.mixY=x.mixY+(m-x.mixY)*i)}},pt=class extends Pt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,l,c,o){if(l&&!this.additive&&(l=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,h=t.physics;for(const d of h)if(d.active&&this.global(d.data)){const f=o?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,l,this.get(f),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,l,this.get(h),this.get(a.data.setupPose)))}}}},ts=class extends pt{constructor(t,e,s){super(t,e,s,20)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},es=class extends pt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ss=class extends pt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ns=class extends pt{constructor(t,e,s){super(t,e,s,23)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},is=class extends pt{constructor(t,e,s){super(t,e,s,24),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},rs=class extends pt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},as=class extends pt{constructor(t,e,s){super(t,e,s,26)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},os=class bn extends Q{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...bn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,n,i,r,l,c,o,a){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(e,s,Number.MAX_VALUE,[],r,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[Q.search(d,s)+1]))if(h!=null)h.reset(e);else for(const f of e.physics)f.active&&f.reset(e)}},ls=class extends Pt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,l,h.time,a.data.setupPose.time)}}},cs=class extends Pt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,l,h.mix,a.data.setupPose.mix)}}},Rn=class Vs{static emptyAnimation=new Qt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Ws(this);propertyIds=new Ie;animationsChanged=!1;trackEntryPool=new Ot(()=>new zs);constructor(e){this.data=e}update(e){e*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n<i;n++){const r=s[n];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let l=e*r.timeScale;if(r.delay>0){if(r.delay-=l,r.delay>0)continue;l=-r.delay,r.delay=0}let c=r.next;if(c){const o=r.trackLast-c.delay;if(o>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*c.timeScale,r.trackTime+=l,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=e,c=c.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){const n=e.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(n.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=e),n.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,e.mixTime+=s,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,o=n.length;c<o;c++){const a=n[c];if(!a||a.delay>0)continue;i=!0;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,e):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,f=a.getAnimationTime(),u=f,m=s;a.reverse&&(u=a.animation.duration-u,m=null);const p=a.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x<g;x++){B.webkit602BugfixHelper(h);const b=p[x];b instanceof kt?this.applyAttachmentTimeline(b,e,u,!0,!0):b.apply(e,d,u,m,h,!0,!1,!1,!1)}else{const x=a.timelineMode,b=h>=a.alphaAttachmentThreshold,w=a.additive,S=w||a.shortestRotation,y=!S&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let v=0;v<g;v++){const T=p[v],A=(x[v]&_t)!==0;!S&&T instanceof $t?this.applyRotateTimeline(T,e,u,h,A,a.timelinesRotation,v<<1,y):T instanceof kt?this.applyAttachmentTimeline(T,e,u,A,b):(B.webkit602BugfixHelper(h),T.apply(e,d,u,m,h,A,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,f),this.queueEvents(a,f),s.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+hs,l=e.slots;for(let c=0,o=e.slots.length;c<o;c++){const a=l[c];if(a.attachmentState===r){const h=a.data.attachmentName;a.pose.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s){const n=e.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=e.mix(),l=n.alpha*i,c=1-r*e.alpha,o=l*(1-r),a=c>0?o/c:l,h=n.animation.timelines,d=h.length,f=n.timelineMode,u=n.timelineHoldMix,m=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,x=g||n.shortestRotation,b=!x&&n.timelinesRotation.length!==d<<1;b&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let S=n.animationLast,y=n.getAnimationTime(),v=y,T=null;n.reverse?v=n.animation.duration-v:r<n.eventThreshold&&(T=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const I=h[A],M=f[A],Y=(M&_t)!==0;let P=0;if((M&zt)!==0){const E=u[A];P=E==null?a:a*(1-E.mix())}else{if(!p&&I instanceof Tt&&!Y)continue;P=o}if(n.totalAlpha+=P,!x&&I instanceof $t)this.applyRotateTimeline(I,s,v,P,Y,w,A<<1,b);else if(I instanceof kt)this.applyAttachmentTimeline(I,s,v,Y,m&&P>=n.alphaAttachmentThreshold);else{const E=!p||!(I instanceof Tt)||!Y;I.apply(s,S,v,T,P,Y,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,S,y),e.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,s,n,i,r){const l=s.slots[e.slotIndex];if(!l.bone.active||!r&&l.attachmentState===this.unkeyedState+ds)return;let c=n<e.frames[0],o=null;if(c||(o=e.attachmentNames[Q.search(e.frames,n)],c=!r&&o==null),c){if(!i)return;o=l.data.attachmentName}l.pose.setAttachment(o==null?null:s.getAttachment(l.data.index,o)),r?l.attachmentState=t