@esotericsoftware/spine-core 4.3.8 → 4.3.10

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,2 +1,2 @@
1
- "use strict";var spine=(()=>{var Ae=Object.defineProperty,Xn=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyNames,Rn=Object.prototype.hasOwnProperty,Ln=(t,e)=>{for(var s in e)Ae(t,s,{get:e[s],enumerable:!0})},Bn=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vn(e))!Rn.call(t,i)&&i!==s&&Ae(t,i,{get:()=>e[i],enumerable:!(n=Xn(e,i))||n.enumerable});return t},On=t=>Bn(Ae({},"__esModule",{value:!0}),t),Ns={};Ln(Ns,{ATTACH_RETAIN:()=>us,ATTACH_SETUP:()=>fs,AlphaTimeline:()=>qe,Animation:()=>Kt,AnimationState:()=>Wn,AnimationStateAdapter:()=>Hn,AnimationStateData:()=>Gn,AssetCache:()=>en,AssetManagerBase:()=>jn,AtlasAttachmentLoader:()=>Jn,Attachment:()=>Ye,AttachmentTimeline:()=>kt,BinaryInput:()=>un,BlendMode:()=>Cs,Bone:()=>ie,BoneData:()=>gs,BonePose:()=>ne,BoneTimeline1:()=>wt,BoneTimeline2:()=>Qt,BoundingBoxAttachment:()=>ms,CURRENT:()=>ls,ClippingAttachment:()=>_t,Color:()=>z,Constraint:()=>Et,ConstraintData:()=>Xt,ConstraintTimeline1:()=>Ft,CurveTimeline:()=>xt,CurveTimeline1:()=>Nt,DebugUtils:()=>Un,DeformTimeline:()=>We,Downloader:()=>sn,DrawOrder:()=>rn,DrawOrderFolderTimeline:()=>$t,DrawOrderTimeline:()=>St,Event:()=>ae,EventData:()=>xs,EventQueue:()=>Qs,EventTimeline:()=>Zt,EventType:()=>Zs,FIRST:()=>hs,FakeTexture:()=>_n,FromProperty:()=>At,FromRotate:()=>me,FromScaleX:()=>be,FromScaleY:()=>xe,FromShearY:()=>we,FromX:()=>ge,FromY:()=>pe,HOLD:()=>qt,IkConstraint:()=>an,IkConstraintData:()=>zt,IkConstraintPose:()=>oe,IkConstraintTimeline:()=>Ge,Inherit:()=>se,InheritTimeline:()=>De,IntSet:()=>Nn,Interpolation:()=>Lt,MODE:()=>ds,MathUtils:()=>R,MeshAttachment:()=>Tt,MixFrom:()=>Ws,PathAttachment:()=>te,PathConstraint:()=>on,PathConstraintData:()=>Wt,PathConstraintMixTimeline:()=>Qe,PathConstraintPose:()=>ce,PathConstraintPositionTimeline:()=>Je,PathConstraintSpacingTimeline:()=>Ke,Physics:()=>cn,PhysicsConstraint:()=>Ts,PhysicsConstraintDampingTimeline:()=>es,PhysicsConstraintData:()=>Ht,PhysicsConstraintGravityTimeline:()=>is,PhysicsConstraintInertiaTimeline:()=>Ze,PhysicsConstraintMassTimeline:()=>ss,PhysicsConstraintMixTimeline:()=>rs,PhysicsConstraintPose:()=>le,PhysicsConstraintResetTimeline:()=>as,PhysicsConstraintStrengthTimeline:()=>ts,PhysicsConstraintTimeline:()=>gt,PhysicsConstraintWindTimeline:()=>ns,PointAttachment:()=>nn,Pool:()=>Bt,Posed:()=>ps,PosedActive:()=>bs,PosedData:()=>ee,PositionMode:()=>ws,Pow:()=>Us,PowOut:()=>Dn,Property:()=>Hs,RGB2Timeline:()=>ze,RGBA2Timeline:()=>_e,RGBATimeline:()=>Ue,RGBTimeline:()=>$e,RegionAttachment:()=>Pt,RotateMode:()=>vs,RotateTimeline:()=>Dt,SETUP:()=>tn,ScaleTimeline:()=>Ve,ScaleXTimeline:()=>Re,ScaleYMode:()=>re,ScaleYTimeline:()=>Le,Sequence:()=>Ot,SequenceMode:()=>Pe,SequenceModeValues:()=>ke,SequenceTimeline:()=>He,ShearTimeline:()=>Be,ShearXTimeline:()=>Oe,ShearYTimeline:()=>Ne,Skeleton:()=>hn,SkeletonBinary:()=>Kn,SkeletonBounds:()=>Oi,SkeletonClipping:()=>bn,SkeletonData:()=>Ss,SkeletonJson:()=>Ni,SkeletonRendererCore:()=>Ui,Skin:()=>fe,SkinEntry:()=>As,Slider:()=>dn,SliderData:()=>yt,SliderMixTimeline:()=>cs,SliderPose:()=>de,SliderTimeline:()=>os,Slot:()=>ln,SlotCurveTimeline:()=>Ut,SlotData:()=>Is,SlotPose:()=>he,SpacingMode:()=>ys,StringSet:()=>Ds,Texture:()=>$s,TextureAtlas:()=>Ce,TextureAtlasPage:()=>zs,TextureAtlasRegion:()=>Me,TextureFilter:()=>Jt,TextureRegion:()=>_s,TextureWrap:()=>qs,TimeKeeper:()=>$n,Timeline:()=>Q,ToProperty:()=>It,ToRotate:()=>Ms,ToScaleX:()=>ks,ToScaleY:()=>Fs,ToShearY:()=>Es,ToX:()=>Ys,ToY:()=>Ps,TrackEntry:()=>Ks,TransformConstraint:()=>fn,TransformConstraintData:()=>j,TransformConstraintPose:()=>ue,TransformConstraintTimeline:()=>je,TranslateTimeline:()=>Fe,TranslateXTimeline:()=>Ee,TranslateYTimeline:()=>Xe,Triangulator:()=>pn,Utils:()=>B,Vector2:()=>Ie,VertexAttachment:()=>bt,WindowedMean:()=>qn,isBoneTimeline:()=>js,isConstraintTimeline:()=>Js,isSlotTimeline:()=>Gs});var Nn=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}},Ds=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 ct{static epsilon=1e-5;static epsilon2=ct.epsilon*ct.epsilon;static PI=3.1415927;static PI2=ct.PI*2;static invPI2=1/ct.PI2;static radiansToDegrees=180/ct.PI;static radDeg=ct.radiansToDegrees;static degreesToRadians=ct.PI/180;static degRad=ct.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*ct.degRad)}static sinDeg(e){return Math.sin(e*ct.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ct.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 ct.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}},Lt=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)}},Us=class extends Lt{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}},Dn=class extends Us{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 o=s,c=i;o<s+r;o++,c++)n[c]=e[o]}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)]}},Un=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}`)}}},Bt=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}},Ie=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}},$n=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)}},qn=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}},$s=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Jt=(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))(Jt||{}),qs=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(qs||{}),_s=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},_n=class extends $s{setFilters(t,e){}setWraps(t,e){}dispose(){}},Ce=class{pages=[];regions=[];constructor(t){const e=new zn(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(Jt,s[1]),a.magFilter=B.enumValue(Jt,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 o=null,c=null,l=null;for(;r!==null;)if(r.trim().length===0)o=null,r=e.readLine();else if(o){const a=new Me(o,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=[]),l||(l=[]),c.push(s[0]);const m=[];for(let u=0;u<h;u++)m.push(parseInt(s[u+1]));l.push(m)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),c&&c.length>0&&l&&l.length>0&&(a.names=c,a.values=l,c=null,l=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees===90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new zs(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(o)}this.pages.push(o)}}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()}},zn=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}}},zs=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}},Me=class extends _s{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)}},Ye=class wn{static empty=[];name;timelineAttachment;timelineSlots=wn.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,o=this.timelineSlots.length;r<o;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}},bt=class yn extends Ye{static nextID=0;id=yn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,o,c){i=o+(i>>1)*c;const l=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){l.length>0&&(a=l);const f=s.bone.appliedPose,p=f.worldX,g=f.worldY,b=f.a,x=f.b,w=f.c,T=f.d;for(let y=n,v=o;v<i;y+=2,v+=c){const S=a[y],A=a[y+1];r[v]=S*b+A*x+p,r[v+1]=S*w+A*T+g}return}let d=0,m=0;for(let f=0;f<n;f+=2){const p=h[d];d+=p+1,m+=p}const u=e.bones;if(l.length===0)for(let f=o,p=m*3;f<i;f+=c){let g=0,b=0,x=h[d++];for(x+=d;d<x;d++,p+=3){const w=u[h[d]].appliedPose,T=a[p],y=a[p+1],v=a[p+2];g+=(T*w.a+y*w.b+w.worldX)*v,b+=(T*w.c+y*w.d+w.worldY)*v}r[f]=g,r[f+1]=b}else{const f=l;for(let p=o,g=m*3,b=m<<1;p<i;p+=c){let x=0,w=0,T=h[d++];for(T+=d;d<T;d++,g+=3,b+=2){const y=u[h[d]].appliedPose,v=a[g]+f[b],S=a[g+1]+f[b+1],A=a[g+2];x+=(v*y.a+S*y.b+y.worldX)*A,w+=(v*y.c+S*y.d+y.worldY)*A}r[p]=x,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}},Tt=class Vs extends bt{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 Vs(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 Vs(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,o=e.v,c=0,l=0;if(e instanceof Me){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,o-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,l=e.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+s[m+1]*c,n[m+1]=o+(1-s[m])*l;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,o-=e.offsetY/d,c=e.originalWidth/h,l=e.originalHeight/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m])*c,n[m+1]=o+(1-s[m+1])*l;return;case 270:r-=e.offsetY/h,o-=e.offsetX/d,c=e.originalHeight/h,l=e.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m+1])*c,n[m+1]=o+s[m]*l;return;default:r-=e.offsetX/h,o-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,l=e.originalHeight/d}}else e?(c=e.u2-r,l=e.v2-o):(r=o=0,c=l=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*c,n[a+1]=o+s[a+1]*l}},Pt=class vn extends Ye{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 vn(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 o=e.bone.appliedPose,c=o.worldX,l=o.worldY,a=o.a,h=o.b,d=o.c,m=o.d;let u=s[0],f=s[1];n[i]=u*a+f*h+c,n[i+1]=u*d+f*m+l,i+=r,u=s[2],f=s[3],n[i]=u*a+f*h+c,n[i+1]=u*d+f*m+l,i+=r,u=s[4],f=s[5],n[i]=u*a+f*h+c,n[i+1]=u*d+f*m+l,i+=r,u=s[6],f=s[7],n[i]=u*a+f*h+c,n[i+1]=u*d+f*m+l}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,o,c,l,a,h){if(!e)throw new Error("Region not set.");const d=c/e.originalWidth*i,m=l/e.originalHeight*r,u=-c/2*i+e.offsetX*d,f=-l/2*r+e.offsetY*m,p=u+e.width*d,g=f+e.height*m,b=o*R.degRad,x=Math.cos(b),w=Math.sin(b),T=u*x+s,y=u*w,v=f*x+n,S=f*w,A=p*x+s,I=p*w,M=g*x+n,Y=g*w;a[0]=T-S,a[1]=v+y,a[2]=T-Y,a[3]=M+y,a[4]=A-Y,a[5]=M+I,a[6]=A-S,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},Ot=class ve{static _nextID=0;id=ve.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 ve(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 Pt){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Pt.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 Tt){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),Tt.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 ve._nextID++}},Pe=(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))(Pe||{}),ke=[0,1,2,3,4,5,6],Kt=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 Ds,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),js(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,o,c,l,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,m=h.length;d<m;d++)h[d].apply(t,e,s,i,r,o,c,l,a)}},Ws=(t=>(t[t.current=0]="current",t[t.setup=1]="setup",t[t.first=2]="first",t))(Ws||{}),Hs=(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.drawOrderFolder=15]="drawOrderFolder",t[t.ikConstraint=16]="ikConstraint",t[t.transformConstraint=17]="transformConstraint",t[t.pathConstraintPosition=18]="pathConstraintPosition",t[t.pathConstraintSpacing=19]="pathConstraintSpacing",t[t.pathConstraintMix=20]="pathConstraintMix",t[t.physicsConstraintInertia=21]="physicsConstraintInertia",t[t.physicsConstraintStrength=22]="physicsConstraintStrength",t[t.physicsConstraintDamping=23]="physicsConstraintDamping",t[t.physicsConstraintMass=24]="physicsConstraintMass",t[t.physicsConstraintWind=25]="physicsConstraintWind",t[t.physicsConstraintGravity=26]="physicsConstraintGravity",t[t.physicsConstraintMix=27]="physicsConstraintMix",t[t.physicsConstraintReset=28]="physicsConstraintReset",t[t.sequence=29]="sequence",t[t.sliderTime=30]="sliderTime",t[t.sliderMix=31]="sliderMix",t))(Hs||{}),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 Gs(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var xt=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,o,c,l,a,h){const d=this.curves;let m=this.getFrameCount()+t*18;s===0&&(d[e]=2+m);const u=(n-r*2+c)*.03,f=(i-o*2+l)*.03,p=((r-c)*3-n+a)*.006,g=((o-l)*3-i+h)*.006;let b=u*2+p,x=f*2+g,w=(r-n)*.3+u+p*.16666667,T=(o-i)*.3+f+g*.16666667,y=n+w,v=i+T;for(let S=m+18;m<S;m+=2)d[m]=y,d[m+1]=v,w+=b,T+=x,b+=p,x+=g,y+=w,v+=T}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const l=this.frames[e],a=this.frames[e+s];return a+(t-l)/(i[n]-l)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const l=i[n-2],a=i[n-1];return a+(t-l)/(i[n]-l)*(i[n+1]-a)}e+=this.getFrameEntries();const o=i[r-2],c=i[r-1];return c+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-c)}},Nt=class jt extends xt{constructor(e,s,n){super(e,s,n)}getFrameEntries(){return 2}setFrame(e,s,n){e<<=1,this.frames[e]=s,this.frames[e+1]=n}getCurveValue(e){const s=this.frames;let n=s.length-2;for(let r=2;r<=n;r+=2)if(s[r]>e){n=r-2;break}const i=this.curves[n>>1];switch(i){case 0:{const r=s[n],o=s[n+1];return o+(e-r)/(s[n+2]-r)*(s[n+2+1]-o)}case 1:return s[n+1]}return this.getBezierValue(e,n,1,i-2)}getRelativeValue(e,s,n,i,r,o){if(e<this.frames[0])return jt.beforeFirstKey(n,s,r,o);const c=this.getCurveValue(e);return n===1?o+c*s:r+(i?c:c+o-r)*s}getAbsoluteValue(e,s,n,i,r,o,c){return c===void 0?this.getAbsoluteValue1(e,s,n,i,r,o):this.getAbsoluteValue2(e,s,n,i,r,o,c)}getAbsoluteValue1(e,s,n,i,r,o){if(e<this.frames[0])return jt.beforeFirstKey(n,s,r,o);const c=this.getCurveValue(e);return n===1?o+(i?c:c-o)*s:r+(i?c:c-r)*s}getAbsoluteValue2(e,s,n,i,r,o,c){return e<this.frames[0]?jt.beforeFirstKey(n,s,r,o):n===1?o+(i?c:c-o)*s:r+(i?c:c-r)*s}getScaleValue(e,s,n,i,r,o,c){if(e<this.frames[0])return jt.beforeFirstKey(n,s,o,c);const l=this.getCurveValue(e)*c;if(s===1&&!i)return l;let a=n===1?c:o;return i?a+(l-c)*s:r?a+(Math.abs(l)*Math.sign(a)-a)*s:(a=Math.abs(a)*Math.sign(l),a+(l-a)*s)}static beforeFirstKey(e,s,n,i){switch(e){case 1:return i;case 2:return n+(i-n)*s;case 0:return n}}};function js(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var wt=class extends Nt{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,o,c,l){const a=t.bones[this.boneIndex];a.active&&this.apply1(l?a.appliedPose:a.pose,a.data.setupPose,s,i,r,o,c)}},Qt=class extends xt{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,o,c,l){const a=t.bones[this.boneIndex];a.active&&this.apply1(l?a.appliedPose:a.pose,a.data.setupPose,s,i,r,o,c)}},Dt=class extends wt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,o){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Fe=class extends Qt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,o){const c=this.frames;if(s<c[0]){switch(i){case 1:t.x=e.x,t.y=e.y;break;case 2:t.x+=(e.x-t.x)*n,t.y+=(e.y-t.y)*n;break}return}let l=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],a=c[h+2];const u=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*u,a+=(c[h+3+2]-a)*u;break}case 1:l=c[h+1],a=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i===1?(t.x=e.x+l*n,t.y=e.y+a*n):r?(t.x+=l*n,t.y+=a*n):(t.x+=(e.x+l-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Ee=class extends wt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,o){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Xe=class extends wt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,o){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Ve=class extends Qt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,o){const c=this.frames;if(s<c[0]){switch(i){case 1:t.scaleX=e.scaleX,t.scaleY=e.scaleY;break;case 2:t.scaleX+=(e.scaleX-t.scaleX)*n,t.scaleY+=(e.scaleY-t.scaleY)*n;break}return}let l,a;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],a=c[h+2];const u=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*u,a+=(c[h+3+2]-a)*u;break}case 1:l=c[h+1],a=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(l*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=l,t.scaleY=a;else{let m=0,u=0;i===1?(m=e.scaleX,u=e.scaleY):(m=t.scaleX,u=t.scaleY),r?(t.scaleX=m+(l-e.scaleX)*n,t.scaleY=u+(a-e.scaleY)*n):o?(t.scaleX=m+(Math.abs(l)*Math.sign(m)-m)*n,t.scaleY=u+(Math.abs(a)*Math.sign(u)-u)*n):(m=Math.abs(m)*Math.sign(l),u=Math.abs(u)*Math.sign(a),t.scaleX=m+(l-m)*n,t.scaleY=u+(a-u)*n)}}},Re=class extends wt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,o){t.scaleX=this.getScaleValue(s,n,i,r,o,t.scaleX,e.scaleX)}},Le=class extends wt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,o){t.scaleY=this.getScaleValue(s,n,i,r,o,t.scaleY,e.scaleY)}},Be=class extends Qt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,o){const c=this.frames;if(s<c[0]){switch(i){case 1:t.shearX=e.shearX,t.shearY=e.shearY;break;case 2:t.shearX+=(e.shearX-t.shearX)*n,t.shearY+=(e.shearY-t.shearY)*n;break}return}let l=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],a=c[h+2];const u=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*u,a+=(c[h+3+2]-a)*u;break}case 1:l=c[h+1],a=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i===1?(t.shearX=e.shearX+l*n,t.shearY=e.shearY+a*n):r?(t.shearX+=l*n,t.shearY+=a*n):(t.shearX+=(e.shearX+l-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},Oe=class extends wt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,o){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},Ne=class extends wt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,o){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},De=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,o,c,l){const a=t.bones[this.boneIndex];if(!a.active)return;const h=l?a.appliedPose:a.pose;if(c)r!==0&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r!==0&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Ut=class extends xt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,o,c,l){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,l?a.appliedPose:a.pose,s,i,r,o)}},Ue=class extends Ut{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 o=e.color,c=this.frames;if(s<c[0]){const f=t.data.setupPose.color;switch(i){case 1:o.setFromColor(f);break;case 2:o.add((f.r-o.r)*n,(f.g-o.g)*n,(f.b-o.b)*n,(f.a-o.a)*n);break}return}let l=0,a=0,h=0,d=0;const m=Q.search(c,s,5),u=this.curves[m/5];switch(u){case 0:{const f=c[m];l=c[m+1],a=c[m+2],h=c[m+3],d=c[m+4];const p=(s-f)/(c[m+5]-f);l+=(c[m+5+1]-l)*p,a+=(c[m+5+2]-a)*p,h+=(c[m+5+3]-h)*p,d+=(c[m+5+4]-d)*p;break}case 1:l=c[m+1],a=c[m+2],h=c[m+3],d=c[m+4];break;default:l=this.getBezierValue(s,m,1,u-2),a=this.getBezierValue(s,m,2,u+18-2),h=this.getBezierValue(s,m,3,u+36-2),d=this.getBezierValue(s,m,4,u+54-2)}if(n===1)o.set(l,a,h,d);else if(i===1){const f=t.data.setupPose.color;o.set(f.r+(l-f.r)*n,f.g+(a-f.g)*n,f.b+(h-f.b)*n,f.a+(d-f.a)*n)}else o.add((l-o.r)*n,(a-o.g)*n,(h-o.b)*n,(d-o.a)*n)}},$e=class extends Ut{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 o=e.color;let c=0,l=0,a=0;const h=this.frames;if(s<h[0]){const u=t.data.setupPose.color;switch(i){case 1:{o.r=u.r,o.g=u.g,o.b=u.b;break}case 2:{o.r+=(u.r-o.r)*n,o.g+=(u.g-o.g)*n,o.b+=(u.b-o.b)*n;break}}return}const d=Q.search(h,s,4),m=this.curves[d>>2];switch(m){case 0:{const u=h[d];c=h[d+1],l=h[d+2],a=h[d+3];const f=(s-u)/(h[d+4]-u);c+=(h[d+4+1]-c)*f,l+=(h[d+4+2]-l)*f,a+=(h[d+4+3]-a)*f;break}case 1:c=h[d+1],l=h[d+2],a=h[d+3];break;default:c=this.getBezierValue(s,d,1,m-2),l=this.getBezierValue(s,d,2,m+18-2),a=this.getBezierValue(s,d,3,m+36-2)}if(n!==1)if(i===1){const u=t.data.setupPose.color;c=u.r+(c-u.r)*n,l=u.g+(l-u.g)*n,a=u.b+(a-u.b)*n}else c=o.r+(c-o.r)*n,l=o.g+(l-o.g)*n,a=o.b+(a-o.b)*n;o.r=c<0?0:c>1?1:c,o.g=l<0?0:l>1?1:l,o.b=a<0?0:a>1?1:a}},qe=class extends Nt{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,o,c,l){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(l?a.appliedPose:a.pose).color;let d=0;const m=this.frames;if(s<m[0]){const u=a.data.setupPose.color.a;switch(r){case 1:h.a=u;break;case 2:h.a+=(u-h.a)*i;break}return}if(d=this.getCurveValue(s),i!==1)if(r===1){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}},_e=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,o,c,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]=r,this.frames[t+5]=o,this.frames[t+6]=c,this.frames[t+7]=l}apply1(t,e,s,n,i,r){const o=e.color,c=e.darkColor;let l=0,a=0,h=0;const d=this.frames;if(s<d[0]){const x=t.data.setupPose,w=x.color,T=x.darkColor;switch(i){case 1:{o.setFromColor(w),c.r=T.r,c.g=T.g,c.b=T.b;break}case 2:{o.add((w.r-o.r)*n,(w.g-o.g)*n,(w.b-o.b)*n,(w.a-o.a)*n),c.r+=(T.r-c.r)*n,c.g+=(T.g-c.g)*n,c.b+=(T.b-c.b)*n;break}}return}let m=0,u=0,f=0,p=0;const g=Q.search(d,s,8),b=this.curves[g>>3];switch(b){case 0:{const x=d[g];m=d[g+1],u=d[g+2],f=d[g+3],p=d[g+4],l=d[g+5],a=d[g+6],h=d[g+7];const w=(s-x)/(d[g+8]-x);m+=(d[g+8+1]-m)*w,u+=(d[g+8+2]-u)*w,f+=(d[g+8+3]-f)*w,p+=(d[g+8+4]-p)*w,l+=(d[g+8+5]-l)*w,a+=(d[g+8+6]-a)*w,h+=(d[g+8+7]-h)*w;break}case 1:m=d[g+1],u=d[g+2],f=d[g+3],p=d[g+4],l=d[g+5],a=d[g+6],h=d[g+7];break;default:m=this.getBezierValue(s,g,1,b-2),u=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+36-2),p=this.getBezierValue(s,g,4,b+54-2),l=this.getBezierValue(s,g,5,b+72-2),a=this.getBezierValue(s,g,6,b+90-2),h=this.getBezierValue(s,g,7,b+108-2)}if(n===1)o.set(m,u,f,p);else if(i===1){const x=t.data.setupPose;let w=x.color;o.set(w.r+(m-w.r)*n,w.g+(u-w.g)*n,w.b+(f-w.b)*n,w.a+(p-w.a)*n),w=x.darkColor,l=w.r+(l-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else o.add((m-o.r)*n,(u-o.g)*n,(f-o.b)*n,(p-o.a)*n),l=c.r+(l-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h}},ze=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,o,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]=o,this.frames[t+6]=c}apply1(t,e,s,n,i,r){const o=e.color,c=e.darkColor;let l=0,a=0,h=0,d=0,m=0,u=0;const f=this.frames;if(s<f[0]){const b=t.data.setupPose,x=b.color,w=b.darkColor;switch(i){case 1:o.r=x.r,o.g=x.g,o.b=x.b,c.r=w.r,c.g=w.g,c.b=w.b;break;case 2:o.r+=(x.r-o.r)*n,o.g+=(x.g-o.g)*n,o.b+=(x.b-o.b)*n,c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n;break}return}const p=Q.search(f,s,7),g=this.curves[p/7];switch(g){case 0:{const b=f[p];l=f[p+1],a=f[p+2],h=f[p+3],d=f[p+4],m=f[p+5],u=f[p+6];const x=(s-b)/(f[p+7]-b);l+=(f[p+7+1]-l)*x,a+=(f[p+7+2]-a)*x,h+=(f[p+7+3]-h)*x,d+=(f[p+7+4]-d)*x,m+=(f[p+7+5]-m)*x,u+=(f[p+7+6]-u)*x;break}case 1:l=f[p+1],a=f[p+2],h=f[p+3],d=f[p+4],m=f[p+5],u=f[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),m=this.getBezierValue(s,p,5,g+72-2),u=this.getBezierValue(s,p,6,g+90-2)}if(n!==1)if(i===1){const b=t.data.setupPose;let x=b.color;l=x.r+(l-x.r)*n,a=x.g+(a-x.g)*n,h=x.b+(h-x.b)*n,x=b.darkColor,d=x.r+(d-x.r)*n,m=x.g+(m-x.g)*n,u=x.b+(u-x.b)*n}else l=o.r+(l-o.r)*n,a=o.g+(a-o.g)*n,h=o.b+(h-o.b)*n,d=c.r+(d-c.r)*n,m=c.g+(m-c.g)*n,u=c.b+(u-c.b)*n;o.r=l<0?0:l>1?1:l,o.g=a<0?0:a>1?1:a,o.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=m<0?0:m>1?1:m,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,o,c,l){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=l?a.appliedPose:a.pose;c||s<this.frames[0]?r!==0&&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)}},We=class extends xt{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,o,c,l,a,h){const d=this.curves;let m=this.getFrameCount()+t*18;s===0&&(d[e]=2+m);const u=(n-r*2+c)*.03,f=l*.03-o*.06,p=((r-c)*3-n+a)*.006,g=(o-l+.33333333)*.018;let b=u*2+p,x=f*2+g,w=(r-n)*.3+u+p*.16666667,T=o*.3+f+g*.16666667,y=n+w,v=T;for(let S=m+18;m<S;m+=2)d[m]=y,d[m+1]=v,w+=b,T+=x,b+=p,x+=g,y+=w,v+=T}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],l=s[n-1];return l+(t-c)/(s[n]-c)*(s[n+1]-l)}const r=s[i-2],o=s[i-1];return o+(1-o)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,o,c,l){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,l))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],l,i,r);for(const g of h)this.applyBeforeFirst(a[g],l,i,r);return}let m,u,f;if(s>=d[d.length-1])f=0,m=this.vertices[d.length-1],u=null;else{const g=Q.search(d,s);f=this.getCurvePercent(s,g),m=this.vertices[g],u=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],l,m,u,f,p,i,r,o);for(const g of h)this.applyToSlot(a[g],l,m,u,f,p,i,r,o)}applyBeforeFirst(t,e,s,n){if(!t.bone.active)return;const i=e?t.appliedPose:t.pose;if(i.attachment==null||i.attachment.timelineAttachment!==this.attachment)return;const r=i.deform;switch(r.length===0&&(n=1),n){case 1:r.length=0;break;case 2:{if(s===1){r.length=0;return}const o=this.vertices[0].length;r.length=o;const c=r,l=i.attachment;if(l.bones===null){const a=l.vertices;for(let h=0;h<o;h++)c[h]+=(a[h]-c[h])*s}else{s=1-s;for(let a=0;a<o;a++)c[a]*=s}}}}applyToSlot(t,e,s,n,i,r,o,c,l){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;d.length===0&&(c=1);const m=c===1;if(d.length=r,n===null)if(o===1)if(l&&!m)if(h.bones)for(let u=0;u<r;u++)d[u]+=s[u];else{const u=h.vertices;for(let f=0;f<r;f++)d[f]+=s[f]-u[f]}else B.arrayCopy(s,0,d,0,r);else if(m)if(h.bones)for(let u=0;u<r;u++)d[u]=s[u]*o;else{const u=h.vertices;for(let f=0;f<r;f++){const p=u[f];d[f]=p+(s[f]-p)*o}}else if(l)if(h.bones)for(let u=0;u<r;u++)d[u]+=s[u]*o;else{const u=h.vertices;for(let f=0;f<r;f++)d[f]+=(s[f]-u[f])*o}else for(let u=0;u<r;u++)d[u]+=(s[u]-d[u])*o;else if(o===1)if(l&&!m)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=f+(n[u]-f)*i}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f];d[f]+=p+(n[f]-p)*i-u[f]}}else if(i===0)B.arrayCopy(s,0,d,0,r);else for(let u=0;u<r;u++){const f=s[u];d[u]=f+(n[u]-f)*i}else if(m)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]=(f+(n[u]-f)*i)*o}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f],g=u[f];d[f]=g+(p+(n[f]-p)*i-g)*o}}else if(l)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(n[u]-f)*i)*o}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f];d[f]+=(p+(n[f]-p)*i-u[f])*o}}else for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(n[u]-f)*i-d[u])*o}}},He=class vt extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`29|${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 o=this.frames;e*=vt.ENTRIES,o[e]=s,o[e+vt.MODE]=n|i<<4,o[e+vt.DELAY]=r}apply(e,s,n,i,r,o,c,l,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,m=this.frames;if(l||n<m[0]){if(o!==0){this.setupPose(h[this.slotIndex],a);for(const b of d)this.setupPose(h[b],a)}return}const u=Q.search(m,n,vt.ENTRIES),f=m[u],p=m[u+vt.MODE],g=m[u+vt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,f,p,g);for(const b of d)this.applyToSlot(h[b],a,n,f,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,o){if(!e.bone.active)return;const c=s?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let l=r>>4,a=c.attachment.sequence.regions.length;const h=ke[r&15];if(h!==0)switch(l+=(n-i)/o+1e-5|0,h){case 1:l=Math.min(a-1,l);break;case 2:l%=a;break;case 3:{const d=(a<<1)-2;l=d===0?0:l%d,l>=a&&(l=d-l);break}case 4:l=Math.max(a-1-l,0);break;case 5:l=a-1-l%a;break;case 6:{const d=(a<<1)-2;l=d===0?0:(l+a-1)%d,l>=a&&(l=d-l)}}c.sequenceIndex=l}},Zt=class Tn extends Q{static propertyIds=["13"];events;constructor(e){super(e,...Tn.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,o,c,l,a){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,o,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let m=0;if(s<h[0])m=0;else{m=Q.search(h,s)+1;const u=h[m];for(;m>0&&h[m-1]===u;)m--}for(;m<d&&n>=h[m];m++)i.push(this.events[m])}},St=class Rs extends Q{static propertyID="14";static propertyIds=[Rs.propertyID];drawOrders;constructor(e){super(e,...Rs.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,o,c,l,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(l||n<this.frames[0]){o!==0&&B.arrayCopy(d,0,h,0,e.slots.length);return}const m=this.drawOrders[Q.search(this.frames,n)];if(!m)B.arrayCopy(d,0,h,0,e.slots.length);else for(let u=0,f=m.length;u<f;u++)h[u]=d[m[u]]}},$t=class Ls extends Q{static propertyID="15";slots;inFolder;drawOrders;constructor(e,s,n){super(e,...Ls.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]=`${Ls.propertyID}|${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,o,c,l,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(l||n<this.frames[0])o!==0&&this.setup(h,d);else{const m=this.drawOrders[Q.search(this.frames,n)];if(!m)this.setup(h,d);else{const u=this.inFolder,f=this.slots;for(let p=0,g=0,b=f.length;!(u[h[p].data.index]&&(h[p]=d[f[m[g]]],++g===b));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,o=0,c=i.length;!(n[e[r].data.index]&&(e[r]=s[i[o]],++o===c));r++);}};function Js(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Ge=class extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,o){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]=o?1:0}apply(t,e,s,n,i,r,o,c,l){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){const b=a.data.setupPose;switch(r){case 1:{h.mix=b.mix,h.softness=b.softness,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch;break}case 2:{h.mix+=(b.mix-h.mix)*i,h.softness+=(b.softness-h.softness)*i,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch;break}}return}let m=0,u=0;const f=Q.search(d,s,6),p=this.curves[f/6];switch(p){case 0:{const b=d[f];m=d[f+1],u=d[f+2];const x=(s-b)/(d[f+6]-b);m+=(d[f+6+1]-m)*x,u+=(d[f+6+2]-u)*x;break}case 1:m=d[f+1],u=d[f+2];break;default:m=this.getBezierValue(s,f,1,p-2),u=this.getBezierValue(s,f,2,p+18-2)}const g=r===1?a.data.setupPose:h;h.mix=g.mix+(m-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,c?r===1&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[f+3],h.compress=d[f+4]!==0,h.stretch=d[f+5]!==0)}},je=class extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,`17|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,o,c){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=n,l[t+3]=i,l[t+4]=r,l[t+5]=o,l[t+6]=c}apply(t,e,s,n,i,r,o,c,l){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){const y=a.data.setupPose;switch(r){case 1:{h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY;break}case 2:{h.mixRotate+=(y.mixRotate-h.mixRotate)*i,h.mixX+=(y.mixX-h.mixX)*i,h.mixY+=(y.mixY-h.mixY)*i,h.mixScaleX+=(y.mixScaleX-h.mixScaleX)*i,h.mixScaleY+=(y.mixScaleY-h.mixScaleY)*i,h.mixShearY+=(y.mixShearY-h.mixShearY)*i;break}}return}let m,u,f,p,g,b;const x=Q.search(d,s,7),w=this.curves[x/7];switch(w){case 0:{const y=d[x];m=d[x+1],u=d[x+2],f=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];const v=(s-y)/(d[x+7]-y);m+=(d[x+7+1]-m)*v,u+=(d[x+7+2]-u)*v,f+=(d[x+7+3]-f)*v,p+=(d[x+7+4]-p)*v,g+=(d[x+7+5]-g)*v,b+=(d[x+7+6]-b)*v;break}case 1:m=d[x+1],u=d[x+2],f=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];break;default:m=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),f=this.getBezierValue(s,x,3,w+36-2),p=this.getBezierValue(s,x,4,w+54-2),g=this.getBezierValue(s,x,5,w+72-2),b=this.getBezierValue(s,x,6,w+90-2)}const T=r===1?a.data.setupPose:h;o?(h.mixRotate=T.mixRotate+m*i,h.mixX=T.mixX+u*i,h.mixY=T.mixY+f*i,h.mixScaleX=T.mixScaleX+p*i,h.mixScaleY=T.mixScaleY+g*i,h.mixShearY=T.mixShearY+b*i):(h.mixRotate=T.mixRotate+(m-T.mixRotate)*i,h.mixX=T.mixX+(u-T.mixX)*i,h.mixY=T.mixY+(f-T.mixY)*i,h.mixScaleX=T.mixScaleX+(p-T.mixScaleX)*i,h.mixScaleY=T.mixScaleY+(g-T.mixScaleY)*i,h.mixShearY=T.mixShearY+(b-T.mixShearY)*i)}},Ft=class extends Nt{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Je=class extends Ft{constructor(t,e,s){super(t,e,s,18),this.additive=!0}apply(t,e,s,n,i,r,o,c,l){const a=t.constraints[this.constraintIndex];if(a.active){const h=l?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,o,h.position,a.data.setupPose.position)}}},Ke=class extends Ft{constructor(t,e,s){super(t,e,s,19)}apply(t,e,s,n,i,r,o,c,l){const a=t.constraints[this.constraintIndex];if(a.active){const h=l?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},Qe=class extends xt{constraintIndex;constructor(t,e,s){super(t,e,`20|${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,o,c,l){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=l?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){const x=a.data.setupPose;switch(r){case 1:{h.mixRotate=x.mixRotate,h.mixX=x.mixX,h.mixY=x.mixY;break}case 2:{h.mixRotate+=(x.mixRotate-h.mixRotate)*i,h.mixX+=(x.mixX-h.mixX)*i,h.mixY+=(x.mixY-h.mixY)*i;break}}return}let m,u,f;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const x=d[p];m=d[p+1],u=d[p+2],f=d[p+3];const w=(s-x)/(d[p+4]-x);m+=(d[p+4+1]-m)*w,u+=(d[p+4+2]-u)*w,f+=(d[p+4+3]-f)*w;break}case 1:m=d[p+1],u=d[p+2],f=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),u=this.getBezierValue(s,p,2,g+18-2),f=this.getBezierValue(s,p,3,g+36-2)}const b=r===1?a.data.setupPose:h;o?(h.mixRotate=b.mixRotate+m*i,h.mixX=b.mixX+u*i,h.mixY=b.mixY+f*i):(h.mixRotate=b.mixRotate+(m-b.mixRotate)*i,h.mixX=b.mixX+(u-b.mixX)*i,h.mixY=b.mixY+(f-b.mixY)*i)}},gt=class extends Ft{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,o,c,l){if(o&&!this.additive&&(o=!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 m=l?d.appliedPose:d.pose;this.set(m,this.getAbsoluteValue(s,i,r,o,this.get(m),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=l?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,o,this.get(h),this.get(a.data.setupPose)))}}}},Ze=class extends gt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ts=class extends gt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},es=class extends gt{constructor(t,e,s){super(t,e,s,23)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ss=class extends gt{constructor(t,e,s){super(t,e,s,24)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},ns=class extends gt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},is=class extends gt{constructor(t,e,s){super(t,e,s,26),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},rs=class extends gt{constructor(t,e,s){super(t,e,s,27)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},as=class Sn extends Q{static propertyIds=["28"];constraintIndex;constructor(e,s){super(e,...Sn.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,o,c,l,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,o,!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 m of e.physics)m.active&&m.reset(e)}},os=class extends Ft{constructor(t,e,s){super(t,e,s,30)}apply(t,e,s,n,i,r,o,c,l){const a=t.constraints[this.constraintIndex];if(a.active){const h=l?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,o,h.time,a.data.setupPose.time)}}},cs=class extends Ft{constructor(t,e,s){super(t,e,s,31),this.additive=!0}apply(t,e,s,n,i,r,o,c,l){const a=t.constraints[this.constraintIndex];if(a.active){const h=l?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,o,h.mix,a.data.setupPose.mix)}}},Wn=class Bs{static emptyAnimation=new Kt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Qs(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new Bt(()=>new Ks);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 o=e*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let c=r.next;if(c){const l=r.trackLast-c.delay;if(l>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(l/r.timeScale+e)*c.timeScale,r.trackTime+=o,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 l=r.mixingFrom;for(r.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(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,l=n.length;c<l;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,m=a.getAnimationTime(),u=m,f=s;a.reverse&&(u=a.animation.duration-u,f=null);const p=a.animation.timelines,g=p.length;if(c===0&&h===1)for(let b=0;b<g;b++){B.webkit602BugfixHelper(h);const x=p[b];x instanceof kt?this.applyAttachmentTimeline(x,e,u,1,!0):x.apply(e,d,u,f,h,1,!1,!1,!1)}else{const b=a.timelineMode,x=h>=a.alphaAttachmentThreshold,w=a.additive,T=w||a.shortestRotation,y=!T&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let v=0;v<g;v++){const S=p[v],A=b[v]&ds;!T&&S instanceof Dt?this.applyRotateTimeline(S,e,u,h,A,a.timelinesRotation,v<<1,y):S instanceof kt?this.applyAttachmentTimeline(S,e,u,A,x):(B.webkit602BugfixHelper(h),S.apply(e,d,u,f,h,A,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,m),this.queueEvents(a,m),s.length=0,a.nextAnimationLast=m,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+fs,o=e.slots;for(let c=0,l=e.slots.length;c<l;c++){const a=o[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(),o=n.alpha*i,c=1-r*e.alpha,l=o*(1-r),a=c>0?l/c:o,h=n.animation.timelines,d=h.length,m=n.timelineMode,u=n.timelineHoldMix,f=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,b=g||n.shortestRotation,x=!b&&n.timelinesRotation.length!==d<<1;x&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let T=n.animationLast,y=n.getAnimationTime(),v=y,S=null;n.reverse?v=n.animation.duration-v:r<n.eventThreshold&&(S=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const I=h[A],M=m[A],Y=M&ds;let F=0;if((M&qt)!==0){const E=u[A];F=E==null?a:a*(1-E.mix())}else{if(!p&&I instanceof St&&Y===0)continue;F=l}if(n.totalAlpha+=F,!b&&I instanceof Dt)this.applyRotateTimeline(I,s,v,F,Y,w,A<<1,x);else if(I instanceof kt)this.applyAttachmentTimeline(I,s,v,Y,f&&F>=n.alphaAttachmentThreshold);else{const E=!p||!(I instanceof St)||Y===0;I.apply(s,T,v,S,F,Y,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,T,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 o=s.slots[e.slotIndex];if(!o.bone.active||!r&&o.attachmentState===this.unkeyedState+us)return;let c=n<e.frames[0],l=null;if(c||(l=e.attachmentNames[Q.search(e.frames,n)],c=!r&&l==null),c){if(i===0)return;l=o.data.attachmentName}o.pose.setAttachment(l==null?null:s.getAttachment(o.data.index,l)),r?o.attachmentState=this.unkeyedState+us:c||(o.attachmentState=this.unkeyedState+fs)}applyRotateTimeline(e,s,n,i,r,o,c,l){if(l&&(o[c]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,m=e.frames;let u,f;if(n<m[0]){switch(r){case 1:{h.rotation=d.rotation;return}case 0:return}u=h.rotation,f=d.rotation}else u=r===1?d.rotation:h.rotation,f=d.rotation+e.getCurveValue(n);let p=0,g=f-u;if(g-=Math.ceil(g/360-.5)*360,g===0)p=o[c];else{let b=0,x=0;l?(b=0,x=g):(b=o[c],x=o[c+1]);const w=b-b%360;p=g+w;let T=g>=0,y=b>=0;Math.abs(x)<=90&&R.signum(x)!==R.signum(g)&&(Math.abs(b-w)>180?(p+=360*R.signum(b),y=T):w!==0?p-=360*R.signum(b):y=T),y!==T&&(p+=360*R.signum(b)),o[c]=p}o[c+1]=g,h.rotation=u+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,o=e.reverse;let c=e.trackLast%r;o&&(c=r-c);const l=this.events;let a=0,h=l.length;for(;a<h;a++){const m=l[a];if(m.time<c!==o)break;m.time>=n&&m.time<=i&&this.queue.event(e,m)}let d=!1;if(e.loop)if(r===0)d=!0;else{const m=Math.floor(e.trackTime/r);d=m>0&&m>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const m=l[a];m.time>=n&&m.time<=i&&this.queue.event(e,m)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,o=i-n,c=e.animation.timelines;for(let l=0,a=e.animation.timelines.length;l<a;l++){const h=c[l];if(!(h instanceof Zt))continue;const d=h.events,m=h.frames,u=m.length;if(r>=o){for(let f=0;f<u;f++)if(!(m[f]<o)){if(m[f]>=r)break;this.events.push(d[f])}}else{for(let p=0;p<u&&!(m[p]>=r);p++)this.events.push(d[p]);let f=0;for(;f<u&&!(m[f]>=o);f++);for(;f<u;f++)this.events.push(d[f])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const o=this.trackEntry(e,s,n,r);return this.setTrack(e,o,i),this.queue.drain(),o}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const o=this.trackEntry(e,s,n,r);return r?(r.next=o,o.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-o.mixDuration,0))):(this.setTrack(e,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Bs.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Bs.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){const i=e[s];if(!i)continue;let r=i;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,i),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(e,s){const n=e.animation.timelines,i=e.animation.timelines.length,r=e.timelineMode;r.length=i;const o=e.timelineHoldMix;o.length=0;const c=e.additive,l=e.keepHold,a=e.mixingTo;for(let h=0;h<i;h++){const d=n[h],m=d.propertyIds,u=this.from(s,d,m);if(c&&d.additive){r[h]=u;continue}let f;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(m))f=u;else{f=u|qt;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(m)){p.mixDuration>0&&(o[h]=p);break}}l&&(f=f&~qt|r[h]&qt),r[h]=f}}from(e,s,n){const i=this.propertyIds;let r=tn;for(let o=0,c=n.length;o<c;o++){const l=i.get(n[o]);if(l===void 0)i.set(n[o],e);else{if(l!==e){for(;++o<c;)i.has(n[o])||i.set(n[o],e);return ls}r=hs}}if(s instanceof $t){const o=i.get(St.propertyID);if(o!=null)return o!==e?ls:hs}return r}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ks=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=Lt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Lt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Lt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Qs=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){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const o=i[r];o.start&&o.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const o=i[r];o.interrupt&&o.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const o=i[r];o.end&&o.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const o=i[r];o.dispose&&o.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const o=i[r];o.complete&&o.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let o=0;o<i.length;o++){const c=i[o];c.event&&c.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Zs=(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))(Zs||{}),Hn=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},ls=0,tn=1,hs=2,ds=3,qt=4,fs=1,us=2,Gn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},jn=class{constructor(t,e="",s=new sn,n=new en){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,o)=>{const c=`Couldn't load binary ${t}: status ${r}, ${o}`;this.error(s,t,c),i(c)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,o)=>{const c=`Couldn't load JSON ${t}: status ${r}, ${o}`;this.error(s,t,c),i(c)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(l=>{if(l.ok)return l.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(l=>l?createImageBitmap(l,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(l=>{if(l){const a=this.createTexture(t,n,l);this.success(e,t,a),i(a)}});else{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{const a=this.createTexture(t,n,l);this.success(e,t,a),i(a)},l.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),l.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,c)=>{this.downloader.downloadText(t,l=>{try{const a=this.createTextureAtlas(l,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),o(a);return}for(const m of a.pages)this.loadTexture(this.texturePath(r,m.name,n),(u,f)=>{d||(m.setTexture(f),--h===0&&(this.success(e,t,a),o(a)))},(u,f)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${u}`;this.error(s,t,p),c(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),c(h)}},(l,a)=>{const h=`Couldn't load texture atlas ${t}: status ${l}, ${a}`;this.error(s,t,h),c(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,o)=>{this.downloader.downloadText(t,c=>{try{const l=this.createTextureAtlas(c,i,t);this.success(e,t,l),r(l)}catch(l){const a=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,a),o(a)}},(c,l)=>{const a=`Couldn't load texture atlas ${t}: status ${c}, ${l}`;this.error(s,t,a),o(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
2
- ${s}`:""}`)}remove(t){t=this.pathPrefix+t;const e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(const t in this.cache.assets){const e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Ce){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,s,n){const i=new Ce(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const o=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+o]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},en=class Te{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Te.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Te;return Te.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},sn=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!==-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let 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(e===-1)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;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(o){this.finish(t,400,JSON.stringify(o))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(o){this.finish(t,400,JSON.stringify(o))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.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){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},ms=class An extends bt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new An(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},_t=class In extends bt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new In(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},te=class Cn extends bt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Cn(this.name);return this.copyTo(e),e.lengths=[],B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},nn=class Mn extends bt{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*R.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,o=n*e.c+i*e.d;return R.atan2Deg(o,r)}copy(){const e=new Mn(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Jn=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Pt(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Tt(s,i)}newBoundingBoxAttachment(t,e,s){return new ms(s)}newPathAttachment(t,e,s){return new te(s)}newPointAttachment(t,e,s){return new nn(s)}newClippingAttachment(t,e,s){return new _t(s)}},ee=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},gs=class Yn extends ee{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new ne),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new Yn(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},se=(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))(se||{}),ne=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");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}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,m=t.scaleY,u=(e+i)*R.degRad,f=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(f)*n*d,this.c=Math.sin(u)*s*m,this.d=Math.sin(f)*n*m,this.worldX=this.x*d+t.x,this.worldY=this.y*m+t.y;return}const o=this.bone.parent.appliedPose;let c=o.a,l=o.b,a=o.c,h=o.d;switch(this.worldX=c*this.x+l*this.y+o.worldX,this.worldY=a*this.x+h*this.y+o.worldY,this.inherit){case 0:{const d=(e+i)*R.degRad,m=(e+90+r)*R.degRad,u=Math.cos(d)*s,f=Math.cos(m)*n,p=Math.sin(d)*s,g=Math.sin(m)*n;this.a=c*u+l*p,this.b=c*f+l*g,this.c=a*u+h*p,this.d=a*f+h*g;return}case 1:{const d=t.scaleX,m=t.scaleY,u=(e+i)*R.degRad,f=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(f)*n*d,this.c=Math.sin(u)*s*m,this.d=Math.sin(f)*n*m;break}case 2:{const d=t.scaleX,m=t.scaleY,u=1/d,f=1/m;c*=u,a*=f;let p=c*c+a*a,g=0;p>R.epsilon2?(p=Math.abs(c*h*f-l*u*a)/p,l=a*p,h=c*p,g=e-R.atan2Deg(a,c)):(c=0,a=0,g=e-90+R.atan2Deg(h,l));const b=(g+i)*R.degRad,x=(g+r+90)*R.degRad,w=Math.cos(b)*s,T=Math.cos(x)*n,y=Math.sin(b)*s,v=Math.sin(x)*n;this.a=(c*w-l*y)*d,this.b=(c*T-l*v)*d,this.c=(a*w+h*y)*m,this.d=(a*T+h*v)*m;break}case 3:case 4:{const d=t.scaleX,m=t.scaleY,u=1/d,f=1/m,p=e*R.degRad,g=Math.cos(p),b=Math.sin(p);let x=(c*g+l*b)*u,w=(a*g+h*b)*f;const T=1/Math.sqrt(x*x+w*w);x*=T,w*=T;let y=-w,v=x;this.inherit===3&&c*h-l*a<0!=(d<0!=m<0)&&(y=-y,v=-v);const S=i*R.degRad,A=(90+r)*R.degRad,I=Math.cos(S)*s,M=Math.cos(A)*n,Y=Math.sin(S)*s,F=Math.sin(A)*n;this.a=(x*I+y*Y)*d,this.b=(x*M+y*F)*d,this.c=(w*I+v*Y)*m,this.d=(w*M+v*F)*m;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;const e=t.scaleX,s=t.scaleY;if(!this.bone.parent){const g=1/e,b=1/s;this.x=(this.worldX-t.x)*g,this.y=(this.worldY-t.y)*b,this.set5(this.a*g,this.b*g,this.c*b,this.d*b,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,o=n.c,c=n.d;const l=i*c-r*o,a=1/(i*c-r*o),h=c*a,d=r*a,m=o*a,u=i*a,f=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=f*h-p*d,this.y=p*u-f*m,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,u*this.c-m*this.a,u*this.d-m*this.b,0);break;case 1:{const g=1/e,b=1/s;this.set5(this.a*g,this.b*g,this.c*b,this.d*b,0);break}case 2:{const g=1/e,b=1/s;i*=g,o*=b;const x=this.a*g,w=this.b*g,T=this.c*b,y=this.d*b,v=1/(i*i+o*o),S=1/Math.abs(l*g*b);this.set5((i*x+o*T)*v,(i*w+o*y)*v,(i*T-o*x)*S,(i*y-o*w)*S,R.atan2Deg(o,i));break}case 3:case 4:{const g=1/e,b=1/s,x=this.a*g,w=this.b*g,T=this.c*b,y=this.d*b;let v=c*this.a-r*this.c,S=i*this.c-o*this.a;l<0&&(v=-v,S=-S);let A=R.atan2Deg(S,v);this.rotation=A,A*=R.degRad;const I=Math.cos(A),M=Math.sin(A);let Y=(i*I+r*M)*g,F=(o*I+c*M)*b;const E=1/Math.sqrt(Y*Y+F*F);Y*=E,F*=E;const X=this.inherit===3&&l<0!=(e<0!=s<0)?-1:1;this.set4(Y*x+F*T,Y*w+F*y,(Y*T-F*x)*X,(Y*y-F*w)*X)}}}set4(t,e,s,n){const i=t*t+s*s,r=e*e+n*n;i>R.epsilon2?(this.shearX=R.atan2Deg(s,t),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,s,n,i){this.shearX=0;const r=t*t+s*s,o=e*e+n*n;if(r>R.epsilon2){const c=R.atan2Deg(s,t);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(o),o>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(o),this.shearY=0,this.rotation=o>R.epsilon2?R.atan2Deg(n,e)-90+i:i}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t._update)}modifyWorld(t){this.local=t,this.world=t,this.resetWorld(t)}resetWorld(t){const e=this.bone.children;for(let s=0,n=e.length;s<n;s++){const i=e[s].appliedPose;i.world===t&&(i.world=0,i.local=0,i.resetWorld(t))}}getWorldRotationX(){return R.atan2Deg(this.c,this.a)}getWorldRotationY(){return R.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const 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(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},ps=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},bs=class extends ps{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},ie=class Pn extends bs{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new ne,new ne),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Pn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends bs{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},rn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,B.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,B.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends ee{constructor(t,e){super(t,e)}},re=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(re||{}),ae=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},xs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new ae(-1,this);constructor(t){this.name=t}},oe=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},an=class Mt extends Et{bones;target;constructor(e,s){if(super(e,new oe,new oe),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Mt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Mt.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Mt.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,o,c,l,a,h){typeof n=="number"?Mt.apply1(e,s,n,i,r,o,c,l):Mt.apply2(e,s,n,i,r,o,c,l,a,h)}static apply1(e,s,n,i,r,o,c,l){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,m=a.c,u=a.d,f=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*R.signum(e.scaleX),g=(i-s.worldY)*R.signum(e.scaleY);break;case 2:{const b=Math.abs(h*u-d*m)/Math.max(R.epsilon,h*h+m*m),x=h/e.scaleX,w=m/e.scaleY;d=-w*b*e.scaleX,u=x*b*e.scaleY,f+=R.atan2Deg(w,x)}default:{const b=n-a.worldX,x=i-a.worldY,w=h*u-d*m;Math.abs(w)<=R.epsilon?(p=0,g=0):(p=(b*u-x*d)/w-s.x,g=(x*h-b*m)/w-s.y)}}if(f+=R.atan2Deg(g,p),s.scaleX<0&&(f+=180),f>180?f-=360:f<=-180&&(f+=360),s.rotation+=f*l,r||o){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const b=s.bone.data.length*s.scaleX;if(b>R.epsilon){const x=p*p+g*g;if(r&&x<b*b||o&&x>b*b){const w=(Math.sqrt(x)/b-1)*l+1;switch(s.scaleX*=w,c){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(e,s,n,i,r,o,c,l,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,m=s.y,u=s.scaleX,f=s.scaleY,p=n.scaleX,g=0,b=0,x=0;u<0?(u=-u,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,b=180):b=0;let w=0,T=0,y=s.a,v=s.b,S=s.c,A=s.d;const I=Math.abs(u-f)<=R.epsilon;!I||c?(n.y=0,w=y*n.x+s.worldX,T=S*n.x+s.worldY):(w=y*n.x+v*n.y+s.worldX,T=S*n.x+A*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,v=M.b,S=M.c,A=M.d;let Y=y*A-v*S,F=w-M.worldX,E=T-M.worldY;Y=Math.abs(Y)<=R.epsilon?0:1/Y;const X=(F*A-E*v)*Y-d,V=(E*y-F*S)*Y-m;let N=Math.sqrt(X*X+V*V),q=n.bone.data.length*p,O,k;if(N<R.epsilon){Mt.apply(e,s,i,r,!1,c,0,h),n.rotation=0;return}F=i-M.worldX,E=r-M.worldY;let P=(F*A-E*v)*Y-d,U=(E*y-F*S)*Y-m,D=P*P+U*U;if(a!==0){a*=u*(p+1)*.5;const L=Math.sqrt(D),_=L-N-q*u+a;if(_>0){let $=Math.min(1,_/(a*2))-1;$=(_-a*(1-$*$))/L,P-=$*P,U-=$*U,D=P*P+U*U}}t:if(I){q*=u;let L=(D-N*N-q*q)/(2*N*q);if(L<-1)L=-1,k=Math.PI*o;else if(L>1){if(L=1,k=0,c)switch(y=(Math.sqrt(D)/(N+q)-1)*h+1,s.scaleX*=y,l){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else k=Math.acos(L)*o;y=N+q*L,v=q*Math.sin(k),O=Math.atan2(U*y-P*v,P*y+U*v)}else{y=u*q,v=f*q;const L=y*y,_=v*v,$=Math.atan2(U,P);S=_*N*N+L*D-L*_;const J=-2*_*N,tt=_-L;if(A=J*J-4*tt*S,A>=0){let mt=Math.sqrt(A);J<0&&(mt=-mt),mt=-(J+mt)*.5;let pt=mt/tt,Gt=S/mt;const ye=Math.abs(pt)<Math.abs(Gt)?pt:Gt;if(pt=D-ye*ye,pt>=0){E=Math.sqrt(pt)*o,O=$-Math.atan2(E,ye),k=Math.atan2(E/f,(ye-N)/u);break t}}let K=R.PI,et=N-y,nt=et*et,st=0,ht=0,it=N+y,rt=it*it,dt=0;S=-y*N/(L-_),S>=-1&&S<=1&&(S=Math.acos(S),F=y*Math.cos(S)+N,E=v*Math.sin(S),A=F*F+E*E,A<nt&&(K=S,nt=A,et=F,st=E),A>rt&&(ht=S,rt=A,it=F,dt=E)),D<=(nt+rt)*.5?(O=$-Math.atan2(st*o,et),k=K*o):(O=$-Math.atan2(dt*o,it),k=ht*o)}const W=Math.atan2(n.y,n.x)*x;O=(O-W)*R.radDeg+g-s.rotation,O>180?O-=360:O<=-180&&(O+=360),s.rotation+=O*h,k=((k+W)*R.radDeg-n.shearX)*x+b-n.rotation,k>180?k-=360:k<=-180&&(k+=360),n.rotation+=k*h}},zt=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new oe)}create(t){return new an(this,t)}},ce=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Wt=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new ce)}create(t){return new on(this,t)}},ws=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(ws||{}),ys=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ys||{}),vs=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(vs||{}),on=class Yt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new ce,new ce),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new Yt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof te))return;const i=this.appliedPose,r=i.mixRotate,o=i.mixX,c=i.mixY;if(r===0&&o===0&&c===0)return;const l=this.data,a=l.rotateMode===0,h=l.rotateMode===2,d=this.bones,m=d.length,u=a?m:m+1,f=B.setArraySize(this.spaces,u),p=h?this.lengths=B.setArraySize(this.lengths,m):[],g=i.spacing;switch(l.spacingMode){case 2:if(h)for(let v=0,S=u-1;v<S;v++){const A=d[v],I=A.bone.data.length,M=I*A.a,Y=I*A.c;p[v]=Math.sqrt(M*M+Y*Y)}B.arrayFill(f,1,u,g);break;case 3:{let v=0;for(let S=0,A=u-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),f[++S]=g;else{const Y=M*I.a,F=M*I.c,E=Math.sqrt(Y*Y+F*F);h&&(p[S]=E),f[++S]=E,v+=E}}if(v>0){v=u/v*g;for(let S=1;S<u;S++)f[S]*=v}break}default:{const v=l.spacingMode===0;for(let S=0,A=u-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),f[++S]=g;else{const Y=M*I.a,F=M*I.c,E=Math.sqrt(Y*Y+F*F);h&&(p[S]=E),f[++S]=(v?Math.max(0,M+g):g)*E/M}}}}const b=this.computeWorldPositions(e,n,u,a);let x=b[0],w=b[1],T=l.offsetRotation,y=!1;if(T===0)y=l.rotateMode===1;else{y=!1;const v=this.slot.bone.appliedPose;T*=v.a*v.d-v.b*v.c>0?R.degRad:-R.degRad}for(let v=0,S=3,A=e._update;v<m;v++,S+=3){const I=d[v];I.worldX+=(x-I.worldX)*o,I.worldY+=(w-I.worldY)*c;const M=b[S],Y=b[S+1],F=M-x,E=Y-w;if(h){const X=p[v];if(X!==0){const V=(Math.sqrt(F*F+E*E)/X-1)*r+1;I.a*=V,I.c*=V}}if(x=M,w=Y,r>0){let X=I.a,V=I.b,N=I.c,q=I.d,O=0,k=0,P=0;if(a?O=b[S-1]:f[v+1]===0?O=b[S+2]:O=Math.atan2(E,F),O-=Math.atan2(N,X),y){k=Math.cos(O),P=Math.sin(O);const U=I.bone.data.length;x+=(U*(k*X-P*N)-F)*r,w+=(U*(P*X+k*N)-E)*r}else O+=T;O>R.PI?O-=R.PI2:O<-R.PI&&(O+=R.PI2),O*=r,k=Math.cos(O),P=Math.sin(O),I.a=k*X-P*N,I.b=k*V-P*q,I.c=P*X+k*N,I.d=P*V+k*q}I.modifyWorld(A)}}computeWorldPositions(e,s,n,i){const r=this.slot;let o=this.appliedPose.position,c=this.spaces,l=B.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,m=d/6,u=Yt.NONE;if(!s.constantSpeed){const k=s.lengths;m-=h?1:2;const P=k[m];this.data.positionMode===1&&(o*=P);let U;switch(this.data.spacingMode){case 2:U=P;break;case 3:U=P/n;break;default:U=1}a=B.setArraySize(this.world,8);for(let D=0,W=0,L=0;D<n;D++,W+=3){const _=c[D]*U;o+=_;let $=o;if(h)$%=P,$<0&&($+=P),L=0;else if($<0){u!==Yt.BEFORE&&(u=Yt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition($,a,0,l,W);continue}else if($>P){u!==Yt.AFTER&&(u=Yt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition($-P,a,0,l,W);continue}for(;;L++){const J=k[L];if(!($>J)){if(L===0)$/=J;else{const tt=k[L-1];$=($-tt)/(J-tt)}break}}L!==u&&(u=L,h&&L===m?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*6+2,8,a,0,2)),this.addCurvePosition($,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],l,W,i||D>0&&_===0)}return l}h?(d+=2,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(m--,d-=4,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const f=B.setArraySize(this.curves,m);let p=0,g=a[0],b=a[1],x=0,w=0,T=0,y=0,v=0,S=0,A=0,I=0,M=0,Y=0,F=0,E=0,X=0,V=0;for(let k=0,P=2;k<m;k++,P+=6)x=a[P],w=a[P+1],T=a[P+2],y=a[P+3],v=a[P+4],S=a[P+5],A=(g-x*2+T)*.1875,I=(b-w*2+y)*.1875,M=((x-T)*3-g+v)*.09375,Y=((w-y)*3-b+S)*.09375,F=A*2+M,E=I*2+Y,X=(x-g)*.75+A+M*.16666667,V=(w-b)*.75+I+Y*.16666667,p+=Math.sqrt(X*X+V*V),X+=F,V+=E,F+=M,E+=Y,p+=Math.sqrt(X*X+V*V),X+=F,V+=E,p+=Math.sqrt(X*X+V*V),X+=F+M,V+=E+Y,p+=Math.sqrt(X*X+V*V),f[k]=p,g=v,b=S;this.data.positionMode===1&&(o*=p);let N;switch(this.data.spacingMode){case 2:N=p;break;case 3:N=p/n;break;default:N=1}const q=this.segments;let O=0;for(let k=0,P=0,U=0,D=0;k<n;k++,P+=3){const W=c[k]*N;o+=W;let L=o;if(h)L%=p,L<0&&(L+=p),U=0,D=0;else if(L<0){this.addBeforePosition(L,a,0,l,P);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,l,P);continue}for(;;U++){const _=f[U];if(!(L>_)){if(U===0)L/=_;else{const $=f[U-1];L=(L-$)/(_-$)}break}}if(U!==u){u=U;let _=U*6;for(g=a[_],b=a[_+1],x=a[_+2],w=a[_+3],T=a[_+4],y=a[_+5],v=a[_+6],S=a[_+7],A=(g-x*2+T)*.03,I=(b-w*2+y)*.03,M=((x-T)*3-g+v)*.006,Y=((w-y)*3-b+S)*.006,F=A*2+M,E=I*2+Y,X=(x-g)*.3+A+M*.16666667,V=(w-b)*.3+I+Y*.16666667,O=Math.sqrt(X*X+V*V),q[0]=O,_=1;_<8;_++)X+=F,V+=E,F+=M,E+=Y,O+=Math.sqrt(X*X+V*V),q[_]=O;X+=F,V+=E,O+=Math.sqrt(X*X+V*V),q[8]=O,X+=F+M,V+=E+Y,O+=Math.sqrt(X*X+V*V),q[9]=O,D=0}for(L*=O;;D++){const _=q[D];if(!(L>_)){if(D===0)L/=_;else{const $=q[D-1];L=D+(L-$)/(_-$)}break}}this.addCurvePosition(L*.1,g,b,x,w,T,y,v,S,l,P,i||k>0&&W===0)}return l}addBeforePosition(e,s,n,i,r){const o=s[n],c=s[n+1],l=s[n+2]-o,a=s[n+3]-c,h=Math.atan2(a,l);i[r]=o+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const o=s[n+2],c=s[n+3],l=o-s[n],a=c-s[n+1],h=Math.atan2(a,l);i[r]=o+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,o,c,l,a,h,d,m){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const u=e*e,f=u*e,p=1-e,g=p*p,b=g*p,x=p*e,w=x*3,T=p*w,y=w*e,v=s*b+i*T+o*y+l*f,S=n*b+r*T+c*y+a*f;h[d]=v,h[d+1]=S,m&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*x*2+c*u),v-(s*g+i*x*2+o*u)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let o=0;o<r;o++){const c=i[o].bone;e.sortBone(c),e.constrained(c)}e._updateCache.push(this);for(let o=0;o<r;o++)e.sortReset(i[o].bone.children);for(let o=0;o<r;o++)i[o].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let o=0,c=r.length;o<c;o++){const l=r[o];l.slotIndex===n&&this.sortPath(e,l.attachment,i)}}sortPath(e,s,n){if(!(s instanceof te))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let o=0,c=i.length;o<c;){let l=i[o++];for(l+=o;o<l;)e.sortBone(r[i[o++]])}}}isSourceActive(){return this.slot.bone.active}},cn=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(cn||{}),le=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){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}},he=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof bt)||!(this.attachment instanceof bt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},ln=class kn extends ps{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new he,new he),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new kn(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},hn=class Se{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Se.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Se.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new ie(n,null);else{const r=this.bones[n.parent.index];i=new ie(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new ln(s,this));this.drawOrder=new rn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof Ts&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let o=0,c=e.length;o<c;o++)e[o].unconstrained();const s=this.bones,n=s.length;for(let o=0,c=n;o<c;o++){const l=s[o];l.sorted=l.data.skinRequired,l.active=!l.sorted,l.unconstrained()}if(this.skin){const o=this.skin.bones;for(let c=0,l=this.skin.bones.length;c<l;c++){let a=this.bones[o[c].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let o=0;o<r;o++)i[o].unconstrained();for(let o=0;o<r;o++){const c=i[o];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let o=0;o<n;o++)this.sortBone(s[o]);r=this._updateCache.length;for(let o=0;o<r;o++){const c=this._updateCache[o];c instanceof ie&&(this._updateCache[o]=c.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],o=r.data.attachmentName;if(o){const c=e.getAttachment(n,o);c&&r.pose.setAttachment(c)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const o=n[i];if(o instanceof s&&o.data.name===e)return o}return null}getBoundsRect(e){const s=new Ie,n=new Ie;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.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.");const r=this.drawOrder.appliedPose,o=r;let c=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,m=r.length;d<m;d++){const u=o[d];if(!u.bone.active)continue;let f=0,p=null,g=null;const b=u.appliedPose.attachment;if(b){if(b instanceof Pt)f=8,p=B.setArraySize(n,f,0),b.computeWorldVertices(u,b.getOffsets(u.appliedPose),p,0,2),g=Se.quadTriangles;else if(b instanceof Tt)f=b.worldVerticesLength,p=B.setArraySize(n,f,0),b.computeWorldVertices(this,u,0,f,p,0,2),g=b.triangles;else if(b instanceof _t&&i){i.clipEnd(u),i.clipStart(this,u,b);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,f=i.clippedVertices.length);for(let x=0,w=p.length;x<w;x+=2){const T=p[x],y=p[x+1];c=Math.min(c,T),l=Math.min(l,y),a=Math.max(a,T),h=Math.max(h,y)}}}i&&i.clipEnd(u)}i&&i.clipEnd(),e.set(c,l),s.set(a-c,h-l)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,o=i.length;r<o;r++)i[r].rotate(e,s,n)}},Ts=class Fn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new le,new le),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new Fn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*R.degRad,r=Math.cos(i),o=Math.sin(i),c=this.cx-e,l=this.cy-s;this.translate(c*r-l*o-c,c*o+l*r-l)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,o=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,m=0;switch(s){case 0:return;case 1:this.reset(e);case 2:{const u=Math.max(e.time-this.lastTime,0),f=this.remaining;this.remaining+=u,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let b=this.remaining,x=n.inertia,w=e.data.referenceScale,T=-1,y=0,v=0,S=this.data.limit*u,A=S*Math.abs(e.scaleY);if(S*=Math.abs(e.scaleX),r||o){if(r){const I=(this.ux-p)*x;this.xOffset+=I>S?S:I<-S?-S:I,this.ux=p}if(o){const I=(this.uy-g)*x;this.yOffset+=I>A?A:I<-A?-A:I,this.uy=g}if(b>=d){const I=this.xOffset,M=this.yOffset;T=n.damping**(60*d),y=d*n.massInverse,v=n.strength;const Y=w*n.wind,F=w*n.gravity,E=(Y*e.windX+F*e.gravityX)*e.scaleX,X=(Y*e.windY+F*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*v)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=T),o&&(this.yVelocity-=(X+this.yOffset*v)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=T),b-=d;while(b>=d);this.xLag=this.xOffset-I,this.yLag=this.yOffset-M}m=Math.max(0,1-b/d),r&&(a.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c||l){let I=Math.atan2(a.c,a.a),M=0,Y=0,F=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>S?E=S:E<-S&&(E=-S),X>A?X=A:X<-A&&(X=-A),b=this.remaining,c){F=(this.data.rotate+this.data.shearX)*i,m=this.rotateLag*Math.max(0,1-f/d);let V=Math.atan2(X+this.ty,E+this.tx)-I-(this.rotateOffset-m)*F;this.rotateOffset+=(V-Math.ceil(V*R.invPI2-.5)*R.PI2)*x,V=(this.rotateOffset-m)*F+I,M=Math.cos(V),Y=Math.sin(V),l&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*Y)*x/V))}else{M=Math.cos(I),Y=Math.sin(I);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-f/d);V>0&&(this.scaleOffset+=(E*M+X*Y)*x/V)}if(b>=d){T===-1&&(T=n.damping**(60*d),y=d*n.massInverse,v=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,N=(n.wind*e.windY+n.gravity*e.gravityY)*hn.yDir,q=this.rotateOffset,O=this.scaleOffset,k=h/w;for(;;)if(b-=d,l&&(this.scaleVelocity+=(V*M-N*Y-this.scaleOffset*v)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=T),c){if(this.rotateVelocity-=((V*Y+N*M)*k+this.rotateOffset*v)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=T,b<d)break;const P=this.rotateOffset*F+I;M=Math.cos(P),Y=Math.sin(P)}else if(b<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-O}m=Math.max(0,1-b/d)}this.remaining=b}this.cx=a.worldX,this.cy=a.worldY;break}case 3:m=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c){let u=(this.rotateOffset-this.rotateLag*m)*i,f=0,p=0,g=0;if(this.data.shearX>0){let b=0;this.data.rotate>0&&(b=u*this.data.rotate,f=Math.sin(b),p=Math.cos(b),g=a.b,a.b=p*g-f*a.d,a.d=f*g+p*a.d),b+=u*this.data.shearX,f=Math.sin(b),p=Math.cos(b),g=a.a,a.a=p*g-f*a.c,a.c=f*g+p*a.c}else u*=this.data.rotate,f=Math.sin(u),p=Math.cos(u),g=a.a,a.a=p*g-f*a.c,a.c=f*g+p*a.c,g=a.b,a.b=p*g-f*a.d,a.d=f*g+p*a.d}if(l){let u=1+(this.scaleOffset-this.scaleLag*m)*i*this.data.scaleX;switch(a.a*=u,a.c*=u,this.data.scaleYMode){case 1:a.b*=u,a.d*=u;break;case 2:u=Math.abs(u),u=u>=.7?1/u:4-3.67347*u,a.b*=u,a.d*=u}}s!==3&&(this.tx=h*a.a,this.ty=h*a.c),a.modifyWorld(e._update)}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},Ht=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}constructor(t){super(t,new le)}create(t){return new Ts(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var de=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},dn=class Os extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Os(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,o=this.bone;if(o!==null){if(!o.active)return;i.local&&o.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,o.appliedPose,i.local,Os.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=e.bones,l=r.bones;for(let a=0,h=r.bones.length;a<h;a++)c[l[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,0,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,m=n.animation.bones.length;d<m;d++){const u=i[r[d]];u.sorted=!1,e.sortReset(u.children),e.constrained(u)}const o=n.animation.timelines,c=e.slots,l=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,m=n.animation.timelines.length;d<m;d++){const u=o[d];if(Gs(u))e.constrained(c[u.slotIndex]);else if(u instanceof St||u instanceof $t)e.drawOrder.constrained();else if(u instanceof gt)if(u.constraintIndex===-1)for(let f=0;f<h;f++)e.constrained(a[f]);else e.constrained(l[u.constraintIndex]);else if(Js(u)){const f=u.constraintIndex;f!==-1&&e.constrained(l[f])}}}},yt=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(t){super(t,new de)}create(t){return new dn(this,t)}},Ss=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof yt&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},As=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},fe=class{name;attachments=[];bones=[];constraints=[];color=new z(.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.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof Tt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new As(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new As(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++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const o=e.attachments[s];for(const c in o){const l=o[c];if(r===l){const a=this.getAttachment(s,c);a&&i.pose.setAttachment(a);break}}}s++}}},Is=class extends ee{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new he),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Cs=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Cs||{}),ue=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},fn=class En extends Et{bones;source;constructor(e,s){if(super(e,new ue,new ue),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new En(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,o=i.localTarget,c=i.additive,l=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,m=i.properties.length,u=e._update,f=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const b=f[p];o?b.modifyLocal(e):b.modifyWorld(u);for(let x=0;x<m;x++){const w=d[x],T=w.value(e,h,r,a)-w.offset,y=w.to;for(let v=0,S=w.to.length;v<S;v++){const A=y[v];if(A.mix(n)!==0){let I=A.offset+T*A.scale;l&&(A.offset<A.max?I=R.clamp(I,A.offset,A.max):I=R.clamp(I,A.max,A.offset)),A.apply(e,n,b,I,o,c)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const o=s[r].bone;e.sortReset(o.children),e.constrained(o)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},j=class lt extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new ue)}create(e){return new fn(this,e)}getOffsetRotation(){return this.offsets[lt.ROTATION]}setOffsetRotation(e){this.offsets[lt.ROTATION]=e}getOffsetX(){return this.offsets[lt.X]}setOffsetX(e){this.offsets[lt.X]=e}getOffsetY(){return this.offsets[lt.Y]}setOffsetY(e){this.offsets[lt.Y]=e}getOffsetScaleX(){return this.offsets[lt.SCALEX]}setOffsetScaleX(e){this.offsets[lt.SCALEX]=e}getOffsetScaleY(){return this.offsets[lt.SCALEY]}setOffsetScaleY(e){this.offsets[lt.SCALEY]=e}getOffsetShearY(){return this.offsets[lt.SHEARY]}setOffsetShearY(e){this.offsets[lt.SHEARY]=e}},At=class{offset=0;to=[]},It=class{offset=0;max=0;scale=0},me=class extends At{value(t,e,s,n){if(s)return e.rotation+n[j.ROTATION];const i=t.scaleX,r=t.scaleY;let o=Math.atan2(e.c/r,e.a/i)*R.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[j.ROTATION]:-n[j.ROTATION]);return o<0&&(o+=360),o}},Ms=class extends It{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const o=t.scaleX,c=t.scaleY,l=1/o,a=1/c,h=s.a*l,d=s.b*l,m=s.c*a,u=s.d*a;n*=R.degRad,r||(n-=Math.atan2(m,h)),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2),n*=e.mixRotate;const f=Math.cos(n),p=Math.sin(n);s.a=(f*h-p*m)*o,s.b=(f*d-p*u)*o,s.c=(p*h+f*m)*c,s.d=(p*d+f*u)*c}}},ge=class extends At{value(t,e,s,n){return s?e.x+n[j.X]:(n[j.X]*e.a+n[j.Y]*e.b+e.worldX)/t.scaleX}},Ys=class extends It{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},pe=class extends At{value(t,e,s,n){return s?e.y+n[j.Y]:(n[j.X]*e.c+n[j.Y]*e.d+e.worldY)/t.scaleY}},Ps=class extends It{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},be=class extends At{value(t,e,s,n){if(s)return e.scaleX+n[j.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEX]}},ks=class extends It{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const o=1+(n-1)*e.mixScaleX;s.a*=o,s.c*=o}else{let o=s.a/t.scaleX,c=s.c/t.scaleY,l=Math.sqrt(o*o+c*c);l!==0&&(l=1+(n-l)*e.mixScaleX/l,s.a*=l,s.c*=l)}}},xe=class extends At{value(t,e,s,n){if(s)return e.scaleY+n[j.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEY]}},Fs=class extends It{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const o=1+(n-1)*e.mixScaleY;s.b*=o,s.d*=o}else{let o=s.b/t.scaleX,c=s.d/t.scaleY,l=Math.sqrt(o*o+c*c);l!==0&&(l=1+(n-l)*e.mixScaleY/l,s.b*=l,s.d*=l)}}},we=class extends At{value(t,e,s,n){if(s)return e.shearY+n[j.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*R.radDeg-90+n[j.SHEARY]}},Es=class extends It{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const o=t.scaleX,c=t.scaleY,l=s.b/o,a=s.d/c,h=Math.atan2(a,l);n=(n+90)*R.degRad,r?n-=R.PI/2:(n-=h-Math.atan2(s.c/c,s.a/o),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(l*l+a*a);s.b=Math.cos(n)*d*o,s.d=Math.sin(n)*d*c}}},Kn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ss;s.name="";const n=new un(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const o=n.readBoolean();o&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let u=0;u<c;u++){const f=n.readString();if(!f)throw new Error("String in string table must not be null.");n.strings.push(f)}const l=s.bones;c=n.readInt(!0);for(let u=0;u<c;u++){const f=n.readString();if(!f)throw new Error("Bone name must not be null.");const p=u===0?null:l[n.readInt(!0)],g=new gs(u,f,p),b=g.setupPose;b.rotation=n.readFloat(),b.x=n.readFloat()*e,b.y=n.readFloat()*e,b.scaleX=n.readFloat(),b.scaleY=n.readFloat(),b.shearX=n.readFloat(),b.shearY=n.readFloat(),b.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),o&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),l.push(g)}c=n.readInt(!0);for(let u=0;u<c;u++){const f=n.readString();if(!f)throw new Error("Slot name must not be null.");const p=l[n.readInt(!0)],g=new Is(u,f,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const b=n.readInt32();b!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,b),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),o&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let u=0;u<h;u++){const f=n.readString();if(!f)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case xi:{const g=new zt(f);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[n.readInt(!0)]);g.target=l[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const x=g.setupPose;x.bendDirection=(b&4)!==0?-1:1,x.compress=(b&8)!==0,x.stretch=(b&16)!==0,(b&32)!==0&&(x.mix=(b&64)!==0?n.readFloat():1),(b&128)!==0&&(x.softness=n.readFloat()*e),a.push(g);break}case yi:{const g=new j(f);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[n.readInt(!0)]);g.source=l[n.readInt(!0)];let b=n.readUnsignedByte();g.skinRequired=(b&1)!==0,g.localSource=(b&2)!==0,g.localTarget=(b&4)!==0,g.additive=(b&8)!==0,g.clamp=(b&16)!==0,p=b>>5;for(let w=0,T;w<p;w++){let y=1,v;switch(n.readByte()){case 0:v=new me;break;case 1:{y=e,v=new ge;break}case 2:{y=e,v=new pe;break}case 3:v=new be;break;case 4:v=new xe;break;case 5:v=new we;break;default:v=null}if(v){v.offset=n.readFloat()*y,T=n.readByte();for(let S=0;S<T;S++){let A=1,I;switch(n.readByte()){case 0:I=new Ms;break;case 1:{A=e,I=new Ys;break}case 2:{A=e,I=new Ps;break}case 3:I=new ks;break;case 4:I=new Fs;break;case 5:I=new Es;break;default:I=null}I&&(I.offset=n.readFloat()*A,I.max=n.readFloat()*A,I.scale=n.readFloat()*A/y,v.to[S]=I)}g.properties[w]=v}}b=n.readByte(),(b&1)!==0&&(g.offsets[j.ROTATION]=n.readFloat()),(b&2)!==0&&(g.offsets[j.X]=n.readFloat()*e),(b&4)!==0&&(g.offsets[j.Y]=n.readFloat()*e),(b&8)!==0&&(g.offsets[j.SCALEX]=n.readFloat()),(b&16)!==0&&(g.offsets[j.SCALEY]=n.readFloat()),(b&32)!==0&&(g.offsets[j.SHEARY]=n.readFloat()),b=n.readByte();const x=g.setupPose;(b&1)!==0&&(x.mixRotate=n.readFloat()),(b&2)!==0&&(x.mixX=n.readFloat()),(b&4)!==0&&(x.mixY=n.readFloat()),(b&8)!==0&&(x.mixScaleX=n.readFloat()),(b&16)!==0&&(x.mixScaleY=n.readFloat()),(b&32)!==0&&(x.mixShearY=n.readFloat()),a.push(g);break}case wi:{const g=new Wt(f);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,g.positionMode=b>>1&1,g.spacingMode=b>>2&3,g.rotateMode=b>>4&3,(b&128)!==0&&(g.offsetRotation=n.readFloat());const x=g.setupPose;x.position=n.readFloat(),g.positionMode===0&&(x.position*=e),x.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(x.spacing*=e),x.mixRotate=n.readFloat(),x.mixX=n.readFloat(),x.mixY=n.readFloat(),a.push(g);break}case vi:{const g=new Ht(f);g.bone=l[n.readInt(!0)];let b=n.readByte();if(g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.x=n.readFloat()),(b&4)!==0&&(g.y=n.readFloat()),(b&8)!==0&&(g.rotate=n.readFloat()),(b&16)!==0){let w=n.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(b&32)!==0&&(g.shearX=n.readFloat()),g.limit=((b&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const x=g.setupPose;x.inertia=n.readFloat(),x.strength=n.readFloat(),x.damping=n.readFloat(),x.massInverse=(b&128)!==0?n.readFloat():1,x.wind=n.readFloat(),x.gravity=n.readFloat(),b=n.readByte(),(b&1)!==0&&(g.inertiaGlobal=!0),(b&2)!==0&&(g.strengthGlobal=!0),(b&4)!==0&&(g.dampingGlobal=!0),(b&8)!==0&&(g.massGlobal=!0),(b&16)!==0&&(g.windGlobal=!0),(b&32)!==0&&(g.gravityGlobal=!0),(b&64)!==0&&(g.mixGlobal=!0),x.mix=(b&128)!==0?n.readFloat():1,a.push(g);break}case Ti:{const g=new yt(f),b=n.readByte();if(g.skinRequired=(b&1)!==0,g.loop=(b&2)!==0,g.additive=(b&4)!==0,(b&8)!==0){const x=n.readFloat();o&&(b&64)!==0?g.max=x:g.setupPose.time=x}if((b&16)!==0&&(g.setupPose.mix=(b&32)!==0?n.readFloat():1),(b&64)!==0){g.local=(b&128)!==0,g.bone=l[n.readInt(!0)];const x=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new me;break;case 1:{w=e,g.property=new ge;break}case 2:{w=e,g.property=new pe;break}case 3:g.property=new be;break;case 4:g.property=new xe;break;case 5:g.property=new we;break;default:continue}g.property.offset=x*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,o);d&&(s.defaultSkin=d,s.skins.push(d));{let u=s.skins.length;for(B.setArraySize(s.skins,c=u+n.readInt(!0));u<c;u++){const f=this.readSkin(n,s,!1,o);if(!f)throw new Error("readSkin() should not have returned null.");s.skins[u]=f}}c=this.linkedMeshes.length;for(let u=0;u<c;u++){const f=this.linkedMeshes[u],p=s.skins[f.skinIndex];if(!f.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(f.sourceIndex,f.source);if(!g)throw new Error(`Source mesh not found: ${f.source}`);f.mesh.timelineAttachment=f.inheritTimelines?g:f.mesh,f.mesh.setSourceMesh(g),f.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let u=0;u<c;u++){const f=n.readString();if(!f)throw new Error("Event data name must not be null");const p=new xs(f),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const m=s.animations;c=n.readInt(!0);for(let u=0;u<c;u++){const f=n.readString();if(!f)throw new Error("Animation name must not be null.");m.push(this.readAnimation(n,f,s,o))}for(let u=0;u<h;u++){const f=a[u];f instanceof yt&&(f.animation=m[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new fe("default")}else{const o=t.readString();if(!o)throw new Error("Skin name must not be null.");i=new fe(o),n&&z.rgba8888ToColor(i.color,t.readInt32());let c=t.readInt(!0),l=e.bones,a=i.bones;for(let h=0;h<c;h++)a[h]=l[t.readInt(!0)];c=t.readInt(!0),l=e.constraints,a=i.constraints;for(let h=0;h<c;h++)a[h]=l[t.readInt(!0)];r=t.readInt(!0)}for(let o=0;o<r;o++){const c=t.readInt(!0);for(let l=0,a=t.readInt(!0);l<a;l++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(t,e,s,n,i,r){const o=this.scale,c=t.readByte(),l=(c&8)!==0?t.readStringRef():i;if(!l)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let a=(c&16)!==0?t.readStringRef():null;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),m=(c&128)!==0?t.readFloat():0,u=t.readFloat(),f=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat();a||(a=l);const w=this.attachmentLoader.newRegionAttachment(s,i,l,a,d);return w?(w.path=a,w.x=u*o,w.y=f*o,w.scaleX=p,w.scaleY=g,w.rotation=m,w.width=b*o,w.height=x*o,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(c&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,l);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(c&16)!==0?t.readStringRef():l;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),m=t.readInt(!0),u=this.readVertices(t,(c&128)!==0),f=this.readFloatArray(t,u.length,1),p=this.readShortArray(t,(u.length-m-2)*3),g=t.readInt(!0);let b=null;if(g>0){b=[];for(let v=0;v<g;v++)b[v]=t.readInt(!0)}let x=[],w=0,T=0;r&&(x=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),T=t.readFloat()),a||(a=l);const y=this.attachmentLoader.newMeshAttachment(s,i,l,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=m<<1,y.bones=u.bones,y.vertices=u.vertices,y.worldVerticesLength=u.length,y.regionUVs=f,y.triangles=p,b&&(y.timelineSlots=b),r&&(y.edges=x,y.width=w*o,y.height=T*o),y.updateSequence(),y):null}case 3:{const a=(c&16)!==0?t.readStringRef():l;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),m=(c&128)!==0,u=t.readInt(!0),f=t.readInt(!0),p=t.readStringRef();let g=0,b=0;r&&(g=t.readFloat(),b=t.readFloat());const x=this.attachmentLoader.newMeshAttachment(s,i,l,a,d);return x?(x.path=a,z.rgba8888ToColor(x.color,h),r&&(x.width=g*o,x.height=b*o),this.linkedMeshes.push(new Qn(x,f,n,u,p,m)),x):null}case 4:{const a=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(t,(c&64)!==0),m=this.readFloatArray(t,d.length/6,o),u=r?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,i,l);return f?(f.closed=a,f.constantSpeed=h,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=m,r&&z.rgba8888ToColor(f.color,u),f):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),m=r?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,i,l);return u?(u.x=h*o,u.y=d*o,u.rotation=a,r&&z.rgba8888ToColor(u.color,m),u):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(c&16)!==0),d=r?t.readInt32():0,m=this.attachmentLoader.newClippingAttachment(s,i,l);return m?(m.endSlot=e.slots[a],m.convex=(c&32)!==0,m.inverse=(c&64)!==0,m.worldVerticesLength=h.length,m.vertices=h.vertices,m.bones=h.bones,r&&z.rgba8888ToColor(m.color,d),m):null}}}readSequence(t,e){if(!e)return new Ot(1,!1);const s=new Ot(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new mn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),o=[],c=[];for(let l=0,a=0;l<r;){const h=t.readInt(!0);o[l++]=h;for(let d=0;d<h;d++,a+=3)o[l++]=t.readInt(!0),c[a]=t.readFloat()*s,c[a+1]=t.readFloat()*s,c[a+2]=t.readFloat()}return new mn(o,B.toFloatArray(c),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=x-1;switch(b){case fi:{const T=new kt(x,f);for(let y=0;y<x;y++)T.setFrame(y,t.readFloat(),t.readStringRef());i.push(T);break}case ui:{const T=t.readInt(!0),y=new Ue(x,T,f);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let Y=0,F=0;y.setFrame(Y,v,S,A,I,M),Y!==w;Y++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(Y);break;case ut:H(t,y,F++,Y,0,v,E,S,X,1),H(t,y,F++,Y,1,v,E,A,V,1),H(t,y,F++,Y,2,v,E,I,N,1),H(t,y,F++,Y,3,v,E,M,q,1)}v=E,S=X,A=V,I=N,M=q}i.push(y);break}case mi:{const T=t.readInt(!0),y=new $e(x,T,f);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,Y=0;y.setFrame(M,v,S,A,I),M!==w;M++){const F=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,v,F,S,E,1),H(t,y,Y++,M,1,v,F,A,X,1),H(t,y,Y++,M,2,v,F,I,V,1)}v=F,S=E,A=X,I=V}i.push(y);break}case gi:{const T=t.readInt(!0),y=new _e(x,T,f);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,v,S,A,I,M,Y,F,E),X!==w;X++){const N=t.readFloat(),q=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(X);break;case ut:H(t,y,V++,X,0,v,N,S,q,1),H(t,y,V++,X,1,v,N,A,O,1),H(t,y,V++,X,2,v,N,I,k,1),H(t,y,V++,X,3,v,N,M,P,1),H(t,y,V++,X,4,v,N,Y,U,1),H(t,y,V++,X,5,v,N,F,D,1),H(t,y,V++,X,6,v,N,E,W,1)}v=N,S=q,A=O,I=k,M=P,Y=U,F=D,E=W}i.push(y);break}case pi:{const T=t.readInt(!0),y=new ze(x,T,f);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,v,S,A,I,M,Y,F),E!==w;E++){const V=t.readFloat(),N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(E);break;case ut:H(t,y,X++,E,0,v,V,S,N,1),H(t,y,X++,E,1,v,V,A,q,1),H(t,y,X++,E,2,v,V,I,O,1),H(t,y,X++,E,3,v,V,M,k,1),H(t,y,X++,E,4,v,V,Y,P,1),H(t,y,X++,E,5,v,V,F,U,1)}v=V,S=N,A=q,I=O,M=k,Y=P,F=U}i.push(y);break}case bi:{const T=new qe(x,t.readInt(!0),f);let y=t.readFloat(),v=t.readUnsignedByte()/255;for(let S=0,A=0;T.setFrame(S,y,v),S!==w;S++){const I=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ft:T.setStepped(S);break;case ut:H(t,T,A++,S,0,y,I,v,M,1)}y=I,v=M}i.push(T)}}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===di){const T=new De(x,f);for(let y=0;y<x;y++)T.setFrame(y,t.readFloat(),t.readByte());i.push(T);continue}const w=t.readInt(!0);switch(b){case ei:Z(t,i,new Dt(x,w,f),1);break;case si:Z(t,i,new Fe(x,w,f),r);break;case ni:Z(t,i,new Ee(x,w,f),r);break;case ii:Z(t,i,new Xe(x,w,f),r);break;case ri:Z(t,i,new Ve(x,w,f),1);break;case ai:Z(t,i,new Re(x,w,f),1);break;case oi:Z(t,i,new Le(x,w,f),1);break;case ci:Z(t,i,new Be(x,w,f),1);break;case li:Z(t,i,new Oe(x,w,f),1);break;case hi:Z(t,i,new Ne(x,w,f),1);break}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Ge(p,t.readInt(!0),f);let x=t.readByte(),w=t.readFloat(),T=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,y=(x&4)!==0?t.readFloat()*r:0;for(let v=0,S=0;b.setFrame(v,w,T,y,(x&8)!==0?1:-1,(x&16)!==0,(x&32)!==0),v!==g;v++){x=t.readByte();const A=t.readFloat(),I=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,M=(x&4)!==0?t.readFloat()*r:0;(x&64)!==0?b.setStepped(v):(x&128)!==0&&(H(t,b,S++,v,0,w,A,T,I,1),H(t,b,S++,v,1,w,A,y,M,r)),w=A,T=I,y=M}i.push(b)}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new je(p,t.readInt(!0),f);let x=t.readFloat(),w=t.readFloat(),T=t.readFloat(),y=t.readFloat(),v=t.readFloat(),S=t.readFloat(),A=t.readFloat();for(let I=0,M=0;b.setFrame(I,x,w,T,y,v,S,A),I!==g;I++){const Y=t.readFloat(),F=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat(),q=t.readFloat();switch(t.readByte()){case ft:b.setStepped(I);break;case ut:H(t,b,M++,I,0,x,Y,w,F,1),H(t,b,M++,I,1,x,Y,T,E,1),H(t,b,M++,I,2,x,Y,y,X,1),H(t,b,M++,I,3,x,Y,v,V,1),H(t,b,M++,I,4,x,Y,S,N,1),H(t,b,M++,I,5,x,Y,A,q,1)}x=Y,w=F,T=E,y=X,v=V,S=N,A=q}i.push(b)}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0),p=s.constraints[f];for(let g=0,b=t.readInt(!0);g<b;g++){const x=t.readByte(),w=t.readInt(!0),T=t.readInt(!0);switch(x){case Ii:Z(t,i,new Je(w,T,f),p.positionMode===0?r:1);break;case Ci:Z(t,i,new Ke(w,T,f),p.spacingMode===0||p.spacingMode===1?r:1);break;case Mi:{const y=new Qe(w,T,f);let v=t.readFloat(),S=t.readFloat(),A=t.readFloat(),I=t.readFloat();for(let M=0,Y=0,F=y.getFrameCount()-1;y.setFrame(M,v,S,A,I),M!==F;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat();switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,v,E,S,X,1),H(t,y,Y++,M,1,v,E,A,V,1),H(t,y,Y++,M,2,v,E,I,N,1)}v=E,S=X,A=V,I=N}i.push(y)}}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===Ri){const T=new as(x,f);for(let y=0;y<x;y++)T.setFrame(y,t.readFloat());i.push(T);continue}const w=t.readInt(!0);switch(b){case Yi:Z(t,i,new Ze(x,w,f),1);break;case Pi:Z(t,i,new ts(x,w,f),1);break;case ki:Z(t,i,new es(x,w,f),1);break;case Fi:Z(t,i,new ss(x,w,f),1);break;case Ei:Z(t,i,new ns(x,w,f),1);break;case Xi:Z(t,i,new is(x,w,f),1);break;case Vi:Z(t,i,new rs(x,w,f),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=t.readInt(!0);switch(b){case Li:Z(t,i,new os(x,w,f),1);break;case Bi:Z(t,i,new cs(x,w,f),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readInt(!0);for(let x=0,w=t.readInt(!0);x<w;x++){const T=t.readStringRef();if(!T)throw new Error("attachmentName must not be null.");const y=f.getAttachment(b,T),v=t.readByte(),S=t.readInt(!0),A=S-1;switch(v){case Si:{const I=y,M=I.bones,Y=I.vertices,F=M?Y.length/3*2:Y.length,E=t.readInt(!0),X=new We(S,E,b,I);let V=t.readFloat();for(let N=0,q=0;;N++){let O,k=t.readInt(!0);if(k===0)O=M?B.newFloatArray(F):Y;else{O=B.newFloatArray(F);const U=t.readInt(!0);if(k+=U,r===1)for(let D=U;D<k;D++)O[D]=t.readFloat();else for(let D=U;D<k;D++)O[D]=t.readFloat()*r;if(!M)for(let D=0,W=O.length;D<W;D++)O[D]+=Y[D]}if(X.setFrame(N,V,O),N===A)break;const P=t.readFloat();switch(t.readByte()){case ft:X.setStepped(N);break;case ut:H(t,X,q++,N,0,V,P,0,1,1)}V=P}i.push(X);break}case Ai:{const I=new He(S,b,y);for(let M=0;M<S;M++){const Y=t.readFloat(),F=t.readInt32();I.setFrame(M,Y,ke[F&15],F>>4,t.readFloat())}i.push(I);break}}}}}const o=s.slots.length,c=t.readInt(!0);if(c>0){const m=new St(c);for(let u=0;u<c;u++)m.setFrame(u,t.readFloat(),gn(t,o));i.push(m)}const l=t.readInt(!0);for(let m=0;m<l;m++){const u=t.readInt(!0),f=new Array(u);for(let b=0;b<u;b++)f[b]=t.readInt(!0);const p=t.readInt(!0),g=new $t(p,f,o);for(let b=0;b<p;b++)g.setFrame(b,t.readFloat(),gn(t,u));i.push(g)}const a=t.readInt(!0);if(a>0){const m=new Zt(a);for(let u=0;u<a;u++){const f=t.readFloat(),p=s.events[t.readInt(!0)],g=new ae(f,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),m.setFrame(u,g)}i.push(m)}let h=0;for(let m=0,u=i.length;m<u;m++)h=Math.max(h,i[m].getDuration());const d=new Kt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},un=class{constructor(t,e=[],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(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},Qn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},mn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s,n){s instanceof Nt?Zn(t,e,s,n):ti(t,e,s,n)}function Zn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let o=0,c=0,l=s.getFrameCount()-1;s.setFrame(o,i,r),o!==l;o++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(o);break;case ut:H(t,s,c++,o,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function ti(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,o=t.readFloat()*n;for(let c=0,l=0,a=s.getFrameCount()-1;s.setFrame(c,i,r,o),c!==a;c++){const h=t.readFloat(),d=t.readFloat()*n,m=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(c);break;case ut:H(t,s,l++,c,0,i,h,r,d,n),H(t,s,l++,c,1,i,h,o,m,n)}i=h,r=d,o=m}e.push(s)}function gn(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,o=0;for(let c=0;c<s;c++){const l=t.readInt(!0);for(;r!==l;)i[o++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[o++]=r++;for(let c=e-1;c>=0;c--)n[c]===-1&&(n[c]=i[--o]);return n}function H(t,e,s,n,i,r,o,c,l,a){e.setBezier(s,n,i,r,c,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,o,l)}var ei=0,si=1,ni=2,ii=3,ri=4,ai=5,oi=6,ci=7,li=8,hi=9,di=10,fi=0,ui=1,mi=2,gi=3,pi=4,bi=5,xi=0,wi=1,yi=2,vi=3,Ti=4,Si=0,Ai=1,Ii=0,Ci=1,Mi=2,Yi=0,Pi=1,ki=2,Fi=4,Ei=5,Xi=6,Vi=7,Ri=8,Li=0,Bi=1,ft=1,ut=2,Oi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Bt(()=>B.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,o=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<o;c++){const l=r[c];if(!l.bone.active)continue;const a=l.appliedPose.attachment;if(a instanceof ms){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=B.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,l,0,a.worldVerticesLength,h,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;const i=this.polygons;for(let r=0,o=i.length;r<o;r++){const c=i[r],l=c;for(let a=0,h=c.length;a<h;a+=2){const d=l[a],m=l[a+1];t=Math.min(t,d),e=Math.min(e,m),s=Math.max(s,d),n=Math.max(n,m)}}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){const i=this.minX,r=this.minY,o=this.maxX,c=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=o&&s>=o||e>=c&&n>=c)return!1;const l=(n-e)/(s-t);let a=l*(i-t)+e;if(a>r&&a<c||(a=l*(o-t)+e,a>r&&a<c))return!0;let h=(r-e)/l+t;return h>i&&h<o||(h=(c-e)/l+t,h>i&&h<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const 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){const n=t,i=t.length;let r=i-2,o=!1;for(let c=0;c<i;c+=2){const l=n[c+1],a=n[r+1];if(l<s&&a>=s||a<s&&l>=s){const h=n[c];h+(s-l)/(a-l)*(n[r]-h)<e&&(o=!o)}r=c}return o}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,o=i.length;r<o;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,o=t.length,c=e-n,l=s-i,a=e*i-s*n;let h=r[o-2],d=r[o-1];for(let m=0;m<o;m+=2){const u=r[m],f=r[m+1],p=h*f-d*u,g=h-u,b=d-f,x=c*b-l*g,w=(a*g-c*p)/x;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const T=(a*b-l*p)/x;if((T>=d&&T<=f||T>=f&&T<=d)&&(T>=s&&T<=i||T>=i&&T<=s))return!0}h=u,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},pn=class at{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Bt(()=>[]);polygonIndicesPool=new Bt(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=at.isConcave(c,n,s,i);const o=this.triangles;for(o.length=0;n>3;){let c=n-1,l=0,a=1;for(;;){t:if(!r[l]){const m=i[c]<<1,u=i[l]<<1,f=i[a]<<1,p=s[m],g=s[m+1],b=s[u],x=s[u+1],w=s[f],T=s[f+1];for(let y=a+1<n?a+1:0;y!==c;){if(r[y]){const v=i[y]<<1,S=s[v],A=s[v+1];if(at.positiveArea(w,T,p,g,S,A)&&at.positiveArea(p,g,b,x,S,A)&&at.positiveArea(b,x,w,T,S,A))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[l])break;l--}while(l>0);c=l>0?l-1:n-1,a=l+1<n?l+1:0;break}c=l,l=a,++a===n&&(a=0)}o.push(i[c],i[l],i[a]),i.splice(l,1),r.splice(l,1),n--;const h=l>0?l-1:n-1,d=l<n?l:0;r[h]=at.isConcave(h,n,s,i),r[d]=at.isConcave(d,n,s,i)}return n===3&&o.push(i[2],i[0],i[1]),o}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let c=this.polygonPool.obtain();c.length=0;let l=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const m=s[h]<<1,u=s[h+1]<<1,f=s[h+2]<<1,p=n[m],g=n[m+1],b=n[u],x=n[u+1],w=n[f],T=n[f+1];if(l===m){const y=c.length-4;if(at.winding(c[y],c[y+1],c[y+2],c[y+3],w,T)===a&&at.winding(w,T,c[0],c[1],c[2],c[3])===a){c.push(w,T),o.push(f);continue}}c.length>0&&(i.push(c),r.push(o),c=this.polygonPool.obtain(),o=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,b,x),c.push(w,T),o.length=0,o.push(m,u,f),a=at.winding(p,g,b,x,w,T),l=m}c.length>0&&(i.push(c),r.push(o));for(let h=0,d=i.length;h<d;h++){if(o=r[h],o.length===0)continue;const m=o[0];let u=o[o.length-1];c=i[h];const f=c.length-4;let p=c[f],g=c[f+1],b=c[f+2],x=c[f+3];const w=c[0],T=c[1],y=c[2],v=c[3],S=at.winding(p,g,b,x,w,T);for(let A=0;A<d;A++){if(A===h)continue;const I=r[A];if(I.length!==3)continue;const M=I[0],Y=I[1],F=I[2],E=i[A],X=E[E.length-2],V=E[E.length-1];M!==m||Y!==u||at.winding(p,g,b,x,X,V)===S&&at.winding(X,V,w,T,y,v)===S&&(E.length=0,I.length=0,c.push(X,V),o.push(F),u=F,p=b,g=x,b=X,x=V,A=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),o=r[h],r.splice(h,1),this.polygonIndicesPool.free(o)):c.push(c[0],c[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,o=i[e]<<1,c=i[e+1<s?e+1:0]<<1;return!at.positiveArea(n[r],n[r+1],n[o],n[o+1],n[c],n[c+1])}static positiveArea(e,s,n,i,r,o){return e*(o-i)+n*(s-o)+r*(i-s)>=0}static winding(e,s,n,i,r,o){return e*(o-i)+n*(s-o)+r*(i-s)>=0?1:-1}},bn=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=B.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,o=this.makeClockwise(r);o||this.inverse||s.convex?(o||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new pn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,o,c){return n&&i&&r&&typeof o=="boolean"&&typeof c=="number"?this.clipTrianglesRender(t,e,s,n,i,r,o,c):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let m=e[d]<<1;const u=t[m],f=t[m+1];m=e[d+1]<<1;const p=t[m],g=t[m+1];m=e[d+2]<<1;const b=t[m],x=t[m+1];this.clipInverse(u,f,p,g,b,x,h);const w=this.inverseVertices;for(let T=0,y=this.inverseVertices.length;T<y;){const v=w[T++];let S=v>>1,A=n.length;const I=B.setArraySize(n,A+v);B.arrayCopy(w,T,I,A,v),A=i.length;const M=B.setArraySize(i,A+3*(S-2));for(let Y=1;Y<S-1;Y++,A+=3)M[A]=r,M[A+1]=r+Y,M[A+2]=r+Y+1;r+=S,T+=v}}return!0}const o=this.clipOutput,c=this.clippingPolygons,l=c.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const m=t[d],u=t[d+1];d=e[h+1]<<1;const f=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],b=t[d+1];for(let x=0;x<l;x++){let w=n.length;if(this.clip(m,u,f,p,g,b,c[x])){a=this.clipOutput;const T=o.length;if(T===0)continue;let y=T>>1;const v=B.setArraySize(n,w+T);B.arrayCopy(a,0,v,w,T),w=i.length;const S=B.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)S[w]=r,S[w+1]=r+A,S[w+2]=r+A+1;r+=y}else{const T=B.setArraySize(n,w+6);T[w]=m,T[w+1]=u,T[w+2]=f,T[w+3]=p,T[w+4]=g,T[w+5]=b,w=i.length;const y=B.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,o,c){const l=this.clippedVertices;l.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let b=e[g],x=e[g+1],w=e[g+2];const T=t[b*c],y=t[b*c+1],v=t[x*c],S=t[x*c+1],A=t[w*c],I=t[w*c+1];this.clipInverse(T,y,v,S,A,I,p);const M=this.inverseVertices.length;if(M===0)continue;const Y=n[b<<=1],F=n[b+1],E=n[x<<=1],X=n[x+1],V=n[w<<=1],N=n[w+1],q=S-I,O=A-v,k=T-A,P=I-y,U=1/(q*k+O*(y-I)),D=this.inverseVertices;for(let W=0;W<M;){const L=D[W++],_=L>>1;let $=l.length;const J=B.setArraySize(l,$+_*c);for(let K=0;K<L;K+=2,$+=c){const et=D[W+K],nt=D[W+K+1];J[$]=et,J[$+1]=nt,J[$+2]=i.r,J[$+3]=i.g,J[$+4]=i.b,J[$+5]=i.a;const st=et-A,ht=nt-I,it=(q*st+O*ht)*U,rt=(P*st+k*ht)*U,dt=1-it-rt;J[$+6]=Y*it+E*rt+V*dt,J[$+7]=F*it+X*rt+N*dt,o&&(J[$+8]=r.r,J[$+9]=r.g,J[$+10]=r.b,J[$+11]=r.a)}$=a.length;const tt=B.setArraySize(a,$+3*(_-2));for(let K=1;K<_-1;K++,$+=3)tt[$]=h,tt[$+1]=h+K,tt[$+2]=h+K+1;h+=_,W+=L}}return!0}const d=this.clipOutput,m=this.clippingPolygons,u=this.clippingPolygons.length;let f=null;for(let p=0;p<s;p+=3){let g=e[p];const b=t[g*c],x=t[g*c+1],w=n[g<<1],T=n[(g<<1)+1];g=e[p+1];const y=t[g*c],v=t[g*c+1],S=n[g<<1],A=n[(g<<1)+1];g=e[p+2];const I=t[g*c],M=t[g*c+1],Y=n[g<<1],F=n[(g<<1)+1],E=v-M,X=I-y,V=b-I,N=M-x,q=1/(E*V+X*(x-M));for(let O=0;O<u;O++){let k=l.length;if(this.clip(b,x,y,v,I,M,m[O])){f=this.clipOutput;const P=d.length;if(P===0)continue;let U=P>>1;const D=B.setArraySize(l,k+U*c);for(let L=0;L<P;L+=2,k+=c){const _=f[L],$=f[L+1];D[k]=_,D[k+1]=$,D[k+2]=i.r,D[k+3]=i.g,D[k+4]=i.b,D[k+5]=i.a;const J=_-I,tt=$-M,K=(E*J+X*tt)*q,et=(N*J+V*tt)*q,nt=1-K-et;D[k+6]=w*K+S*et+Y*nt,D[k+7]=T*K+A*et+F*nt,o&&(D[k+8]=r.r,D[k+9]=r.g,D[k+10]=r.b,D[k+11]=r.a)}k=a.length;const W=B.setArraySize(a,k+3*(U-2));U--;for(let L=1;L<U;L++,k+=3)W[k]=h,W[k+1]=h+L,W[k+2]=h+L+1;h+=U+1}else{const P=B.setArraySize(l,k+3*c);P[k]=b,P[k+1]=x,P[k+2]=i.r,P[k+3]=i.g,P[k+4]=i.b,P[k+5]=i.a,o?(P[k+6]=w,P[k+7]=T,P[k+8]=r.r,P[k+9]=r.g,P[k+10]=r.b,P[k+11]=r.a,P[k+12]=y,P[k+13]=v,P[k+14]=i.r,P[k+15]=i.g,P[k+16]=i.b,P[k+17]=i.a,P[k+18]=S,P[k+19]=A,P[k+20]=r.r,P[k+21]=r.g,P[k+22]=r.b,P[k+23]=r.a,P[k+24]=I,P[k+25]=M,P[k+26]=i.r,P[k+27]=i.g,P[k+28]=i.b,P[k+29]=i.a,P[k+30]=Y,P[k+31]=F,P[k+32]=r.r,P[k+33]=r.g,P[k+34]=r.b,P[k+35]=r.a):(P[k+6]=w,P[k+7]=T,P[k+8]=y,P[k+9]=v,P[k+10]=i.r,P[k+11]=i.g,P[k+12]=i.b,P[k+13]=i.a,P[k+14]=S,P[k+15]=A,P[k+16]=I,P[k+17]=M,P[k+18]=i.r,P[k+19]=i.g,P[k+20]=i.b,P[k+21]=i.a,P[k+22]=Y,P[k+23]=F),k=a.length;const U=B.setArraySize(a,k+3);U[k]=h,U[k+1]=h+1,U[k+2]=h+2,h+=3;break}}}return f!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let o=this._clippedVerticesTyped,c=this._clippedUVsTyped,l=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const f=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const b=t[e+g],x=t[e+g+1];let w=s[p]<<1;const T=i[w],y=i[w+1];g=s[p+1]*r;const v=t[e+g],S=t[e+g+1];w=s[p+1]<<1;const A=i[w],I=i[w+1];g=s[p+2]*r;const M=t[e+g],Y=t[e+g+1];w=s[p+2]<<1;const F=i[w],E=i[w+1];this.clipInverse(b,x,v,S,M,Y,f);const X=this.inverseVertices.length;if(X===0)continue;const V=S-Y,N=M-v,q=b-M,O=Y-x,k=1/(V*q+N*(x-Y)),P=this.inverseVertices;for(let U=0;U<X;){const D=P[U++],W=D>>1;let L=this.clippedVerticesLength;const _=L+W*r,$=this.clippedUVsLength+W*2;o.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(o.subarray(0,L)),o=this._clippedVerticesTyped),c.length<$&&(this._clippedUVsTyped=new Float32Array($*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=$;const J=this._clippedVerticesTyped,tt=this._clippedUVsTyped;let K=$-W*2;for(let st=0;st<D;st+=2,L+=r,K+=2){const ht=P[U+st],it=P[U+st+1];J[L]=ht,J[L+1]=it;const rt=ht-M,dt=it-Y,mt=(V*rt+N*dt)*k,pt=(O*rt+q*dt)*k,Gt=1-mt-pt;tt[K]=T*mt+A*pt+F*Gt,tt[K+1]=y*mt+I*pt+E*Gt}L=this.clippedTrianglesLength;const et=L+3*(W-2);l.length<et&&(this._clippedTrianglesTyped=new Uint16Array(et*2),this._clippedTrianglesTyped.set(l.subarray(0,L)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=et;const nt=l;for(let st=1;st<W-1;st++,L+=3)nt[L]=a,nt[L+1]=a+st,nt[L+2]=a+st+1;a+=W,U+=D}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const h=this.clipOutput,d=this.clippingPolygons,m=this.clippingPolygons.length;let u=null;for(let f=0;f<n;f+=3){let p=s[f],g=p*r;const b=t[e+g],x=t[e+g+1];let w=p<<1;const T=i[w],y=i[w+1];p=s[f+1],g=p*r;const v=t[e+g],S=t[e+g+1];w=p<<1;const A=i[w],I=i[w+1];p=s[f+2],g=p*r;const M=t[e+g],Y=t[e+g+1];w=p<<1;const F=i[w],E=i[w+1],X=S-Y,V=M-v,N=b-M,q=Y-x,O=1/(X*N+V*(x-Y));for(let k=0;k<m;k++){let P=this.clippedVerticesLength;if(this.clip(b,x,v,S,M,Y,d[k])){u=h;const U=h.length;if(U===0)continue;let D=U>>1;const W=P+D*r;o.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(o.subarray(0,P)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+D*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),o=this._clippedVerticesTyped,c=this._clippedUVsTyped);const L=o,_=c;this.clippedVerticesLength=W;let $=this.clippedUVsLength;this.clippedUVsLength=$+D*2;for(let K=0;K<U;K+=2,P+=r,$+=2){const et=u[K],nt=u[K+1];L[P]=et,L[P+1]=nt;const st=et-M,ht=nt-Y,it=(X*st+V*ht)*O,rt=(q*st+N*ht)*O,dt=1-it-rt;_[$]=T*it+A*rt+F*dt,_[$+1]=y*it+I*rt+E*dt}P=this.clippedTrianglesLength;const J=P+3*(D-2);l.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(l.subarray(0,P)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const tt=l;D--;for(let K=1;K<D;K++,P+=3)tt[P]=a,tt[P+1]=a+K,tt[P+2]=a+K+1;a+=D+1}else{let U=P+3*r;o.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(o.subarray(0,P)),o=this._clippedVerticesTyped),o[P]=b,o[P+1]=x,o[P+r]=v,o[P+r+1]=S,o[P+r*2]=M,o[P+r*2+1]=Y;const D=this.clippedUVsLength+6;c.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const W=this.clippedUVsLength;c[W]=T,c[W+1]=y,c[W+2]=A,c[W+3]=I,c[W+4]=F,c[W+5]=E,this.clippedVerticesLength=U,this.clippedUVsLength=D,P=this.clippedTrianglesLength,U=P+3,l.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(l.subarray(0,P)),l=this._clippedTrianglesTyped);const L=l;L[P]=a,L[P+1]=a+1,L[P+2]=a+2,a+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),u!==null}clip(t,e,s,n,i,r,o){const c=this.clipOutput;let l=!1,a,h;o.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=o;a.length=8;const m=a;m[0]=t,m[1]=e,m[2]=s,m[3]=n,m[4]=i,m[5]=r,m[6]=t,m[7]=e,h.length=0;const u=o.length-4;for(let f=0;;f+=2){const p=d[f],g=d[f+1],b=p-d[f+2],x=g-d[f+3],w=h.length,T=a;for(let v=0,S=a.length-2;v<S;){t=T[v],e=T[v+1],v+=2,s=T[v],n=T[v+1];const A=x*(p-s)>b*(g-n),I=x*(p-t)-b*(g-e);if(I>0)if(A)h.push(s,n);else{const M=s-t,Y=n-e,F=I/(M*x-Y*b);F>=0&&F<=1?(h.push(t+M*F,e+Y*F),l=!0):h.push(s,n)}else if(A){const M=s-t,Y=n-e,F=I/(M*x-Y*b);F>=0&&F<=1?(h.push(t+M*F,e+Y*F,s,n),l=!0):h.push(s,n)}else l=!0}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),f===u)break;const y=h;h=a,h.length=0,a=y}if(c!==h){c.length=0;for(let f=0,p=h.length-2;f<p;f++)c[f]=h[f]}else c.length=c.length-2;return l}clipInverse(t,e,s,n,i,r,o){this.inverseVertices.length=0;const c=o.length-4;let l,a;o.length%4>=2?(l=this.clipOutput,a=this.scratch):(l=this.scratch,a=this.clipOutput),l.length=8;let h=o,d=l;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let m=0;;m+=2){const u=h[m],f=h[m+1],p=u-h[m+2],g=f-h[m+3],b=a.length,x=this.inverseVertices.length;this.inverseVertices.push(0),d=l;for(let y=0,v=l.length-2;y<v;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const S=g*(u-s)>p*(f-n),A=g*(u-t)-p*(f-e);if(A>0)if(S)a.push(s,n);else{const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const F=t+I*Y,E=e+M*Y;a.push(F,E),this.inverseVertices.push(F,E,s,n)}else a.push(s,n)}else if(S){const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const F=t+I*Y,E=e+M*Y;this.inverseVertices.push(F,E),a.push(F,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-x-1;if(w>=6?this.inverseVertices[x]=w:this.inverseVertices.length=x,b===a.length||(a.push(a[0],a[1]),m===c))break;const T=a;a=l,a.length=0,l=T}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,o=e[s-2],c=e[s-1],l=e[0],a=e[1];for(let d=2;d<s;d+=2){const m=e[d],u=e[d+1];r+=l*u-m*a;const f=(l-o)*(u-a)-(a-c)*(m-l);i=i&&f<=0,n=n&&f>=0,o=l,c=a,l=m,a=u}r+=l*e[1]-e[0]*a;const h=(l-o)*(e[1]-a)-(a-c)*(e[0]-l);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,m=s-2,u=s>>1;d<u;d+=2){const f=e[d],p=e[d+1],g=m-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=f,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let o=2;o<e;o+=2){const c=s[o],l=s[o+1];let a=o-2;for(;a>=0&&(n[a]>c||n[a]===c&&n[a+1]>l);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=c,n[a+3]=l}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let o=4;o<e;o+=2,i+=2){const c=n[o],l=n[o+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=l}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let o=e-6;o>=0;o-=2,i+=2){const c=n[o],l=n[o+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=l}t.length=i-2}},Ni=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ss,n=typeof t=="string"?JSON.parse(t):t,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=C(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const o=n.bones[r];let c=null;const l=C(o,"parent",null);l&&(c=s.findBone(l));const a=new gs(s.bones.length,o.name,c);a.length=C(o,"length",0)*e;const h=a.setupPose;h.x=C(o,"x",0)*e,h.y=C(o,"y",0)*e,h.rotation=C(o,"rotation",0),h.scaleX=C(o,"scaleX",1),h.scaleY=C(o,"scaleY",1),h.shearX=C(o,"shearX",0),h.shearY=C(o,"shearY",0),h.inherit=B.enumValue(se,C(o,"inherit","Normal")),a.skinRequired=C(o,"skin",!1);const d=C(o,"color",null);d&&a.color.setFromString(d),a.icon=C(o,"icon",void 0),a.iconSize=C(o,"iconSize",1),a.iconRotation=C(o,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const o=n.slots[r],c=o.name,l=s.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${c}`);const a=new Is(s.slots.length,c,l),h=C(o,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(o,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(o,"attachment",null),a.blendMode=B.enumValue(Cs,C(o,"blend","normal")),a.visible=C(o,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const o=r.name,c=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const l=new zt(o);l.skinRequired=c;for(let u=0;u<r.bones.length;u++){const f=s.findBone(r.bones[u]);if(!f)throw new Error(`Couldn't find bone ${r.bones[u]} for IK constraint ${o}.`);l.bones.push(f)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${o}.`);l.target=h;const d=C(r,"scaleY",null);d!=null&&(l.scaleYMode=B.enumValue(re,d));const m=l.setupPose;m.mix=C(r,"mix",1),m.softness=C(r,"softness",0)*e,m.bendDirection=C(r,"bendPositive",!0)?1:-1,m.compress=C(r,"compress",!1),m.stretch=C(r,"stretch",!1),s.constraints.push(l);break}case"transform":{const l=new j(o);l.skinRequired=c;for(let w=0;w<r.bones.length;w++){const T=r.bones[w],y=s.findBone(T);if(!y)throw new Error(`Couldn't find bone ${T} for transform constraint ${r.name}.`);l.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);l.source=h,l.localSource=C(r,"localSource",!1),l.localTarget=C(r,"localTarget",!1),l.additive=C(r,"additive",!1),l.clamp=C(r,"clamp",!1);let d=!1,m=!1,u=!1,f=!1,p=!1,g=!1;const b=Object.entries(C(r,"properties",{}));for(const[w,T]of b){const y=this.fromProperty(w),v=this.propertyScale(w,e);y.offset=C(T,"offset",0)*v;const S=Object.entries(C(T,"to",{}));for(const[A,I]of S){let M=1,Y;switch(A){case"rotate":{d=!0,Y=new Ms;break}case"x":{m=!0,Y=new Ys,M=e;break}case"y":{u=!0,Y=new Ps,M=e;break}case"scaleX":{f=!0,Y=new ks;break}case"scaleY":{p=!0,Y=new Fs;break}case"shearY":{g=!0,Y=new Es;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}Y.offset=C(I,"offset",0)*M,Y.max=C(I,"max",1)*M,Y.scale=C(I,"scale",1)*M/v,y.to.push(Y)}y.to.length>0&&l.properties.push(y)}l.offsets[j.ROTATION]=C(r,"rotation",0),l.offsets[j.X]=C(r,"x",0)*e,l.offsets[j.Y]=C(r,"y",0)*e,l.offsets[j.SCALEX]=C(r,"scaleX",0),l.offsets[j.SCALEY]=C(r,"scaleY",0),l.offsets[j.SHEARY]=C(r,"shearY",0);const x=l.setupPose;d&&(x.mixRotate=C(r,"mixRotate",1)),m&&(x.mixX=C(r,"mixX",1)),u&&(x.mixY=C(r,"mixY",x.mixX)),f&&(x.mixScaleX=C(r,"mixScaleX",1)),p&&(x.mixScaleY=C(r,"mixScaleY",x.mixScaleX)),g&&(x.mixShearY=C(r,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new Wt(o);l.skinRequired=c;for(let m=0;m<r.bones.length;m++){const u=r.bones[m],f=s.findBone(u);if(!f)throw new Error(`Couldn't find bone ${u} for path constraint ${r.name}.`);l.bones.push(f)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);l.slot=h,l.positionMode=B.enumValue(ws,C(r,"positionMode","Percent")),l.spacingMode=B.enumValue(ys,C(r,"spacingMode","Length")),l.rotateMode=B.enumValue(vs,C(r,"rotateMode","Tangent")),l.offsetRotation=C(r,"rotation",0);const d=l.setupPose;d.position=C(r,"position",0),l.positionMode===0&&(d.position*=e),d.spacing=C(r,"spacing",0),(l.spacingMode===0||l.spacingMode===1)&&(d.spacing*=e),d.mixRotate=C(r,"mixRotate",1),d.mixX=C(r,"mixX",1),d.mixY=C(r,"mixY",d.mixX),s.constraints.push(l);break}case"physics":{const l=new Ht(o);l.skinRequired=c;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);l.bone=h,l.x=C(r,"x",0),l.y=C(r,"y",0),l.rotate=C(r,"rotate",0),l.scaleX=C(r,"scaleX",0);const d=C(r,"scaleY",null);d!=null&&(l.scaleYMode=B.enumValue(re,d)),l.shearX=C(r,"shearX",0),l.limit=C(r,"limit",5e3)*e,l.step=1/C(r,"fps",60);const m=l.setupPose;m.inertia=C(r,"inertia",.5),m.strength=C(r,"strength",100),m.damping=C(r,"damping",.85),m.massInverse=1/C(r,"mass",1),m.wind=C(r,"wind",0),m.gravity=C(r,"gravity",0),m.mix=C(r,"mix",1),l.inertiaGlobal=C(r,"inertiaGlobal",!1),l.strengthGlobal=C(r,"strengthGlobal",!1),l.dampingGlobal=C(r,"dampingGlobal",!1),l.massGlobal=C(r,"massGlobal",!1),l.windGlobal=C(r,"windGlobal",!1),l.gravityGlobal=C(r,"gravityGlobal",!1),l.mixGlobal=C(r,"mixGlobal",!1),s.constraints.push(l);break}case"slider":{const l=new yt(o);l.skinRequired=c,l.additive=C(r,"additive",!1),l.loop=C(r,"loop",!1),l.setupPose.mix=C(r,"mix",1);const a=r.bone;if(a){if(l.bone=s.findBone(a),!l.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;l.property=this.fromProperty(h);const d=this.propertyScale(h,e);l.property.offset=C(r,"from",0)*d,l.offset=C(r,"to",0),l.scale=C(r,"scale",1)/d,l.max=C(r,"max",0),l.local=C(r,"local",!1)}else l.setupPose.time=C(r,"time",0);s.constraints.push(l);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const o=n.skins[r],c=new fe(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){const a=o.bones[l],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${o.name}.`);c.bones.push(h)}if(o.ik)for(let l=0;l<o.ik.length;l++){const a=o.ik[l],h=s.findConstraint(a,zt);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${o.name}.`);c.constraints.push(h)}if(o.transform)for(let l=0;l<o.transform.length;l++){const a=o.transform[l],h=s.findConstraint(a,j);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${o.name}.`);c.constraints.push(h)}if(o.path)for(let l=0;l<o.path.length;l++){const a=o.path[l],h=s.findConstraint(a,Wt);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${o.name}.`);c.constraints.push(h)}if(o.physics)for(let l=0;l<o.physics.length;l++){const a=o.physics[l],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${o.name}.`);c.constraints.push(h)}if(o.slider)for(let l=0;l<o.slider.length;l++){const a=o.slider[l],h=s.findConstraint(a,yt);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${o.name}.`);c.constraints.push(h)}for(const l in o.attachments){const a=s.findSlot(l);if(!a)throw new Error(`Couldn't find skin slot ${l} for skin ${o.name}.`);const h=o.attachments[l];for(const d in h){const m=this.readAttachment(h[d],c,a.index,d,s);m&&c.setAttachment(a.index,d,m)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,o=this.linkedMeshes.length;r<o;r++){const c=this.linkedMeshes[r],l=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${c.skin}`);const a=l.getAttachment(c.sourceIndex,c.source);if(!a)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?a:c.mesh,c.mesh.setSourceMesh(a),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=a.timelineSlots;for(const m of h)if(m===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const o=n.events[r],c=new xs(r),l=c.setupPose;l.intValue=C(o,"int",0),l.floatValue=C(o,"float",0),l.stringValue=C(o,"string",""),c._audioPath=C(o,"audio",null),c.audioPath&&(l.volume=C(o,"volume",l.volume),l.balance=C(o,"balance",l.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const o=n.animations[r];this.readAnimation(o,r,s)}if(n.constraints)for(const r in n.constraints){const o=n.constraints[r];if(o.type==="slider"){const c=s.findConstraint(o.name,yt),l=o.animation,a=s.findAnimation(l);if(!a)throw new Error(`Slider animation not found: ${l}`);c.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new me;break;case"x":e=new ge;break;case"y":e=new pe;break;case"scaleX":e=new be;break;case"scaleY":e=new xe;break;case"shearY":e=new we;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,o=C(t,"name",n);switch(C(t,"type","region")){case"region":{const c=C(t,"path",o),l=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,o,c,l);if(!a)return null;a.path=c,a.x=C(t,"x",0)*r,a.y=C(t,"y",0)*r,a.scaleX=C(t,"scaleX",1),a.scaleY=C(t,"scaleY",1),a.rotation=C(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=C(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(e,n,o);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);const l=C(t,"color",null);return l&&c.color.setFromString(l),c}case"mesh":case"linkedmesh":{const c=C(t,"path",o),l=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,o,c,l);if(!a)return null;a.path=c;const h=C(t,"color",null);h&&a.color.setFromString(h),a.width=C(t,"width",0)*r,a.height=C(t,"height",0)*r;const d=C(t,"source",null);if(d){let u=s;const f=C(t,"slot",null);if(f){const p=i.findSlot(f);if(!p)throw new Error(`Source mesh slot not found: ${f}`);u=p.index}return this.linkedMeshes.push(new Di(a,C(t,"skin",null),s,u,d,C(t,"timelines",!0))),a}const m=t.uvs;return this.readVertices(t,a,m.length),a.triangles=t.triangles,a.regionUVs=m,a.edges=C(t,"edges",null),a.hullLength=C(t,"hull",0)*2,a.updateSequence(),a}case"path":{const c=this.attachmentLoader.newPathAttachment(e,n,o);if(!c)return null;c.closed=C(t,"closed",!1),c.constantSpeed=C(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,c,l<<1);const a=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;c.lengths=a;const h=C(t,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(e,n,o);if(!c)return null;c.x=C(t,"x",0)*r,c.y=C(t,"y",0)*r,c.rotation=C(t,"rotation",0);const l=C(t,"color",null);return l&&c.color.setFromString(l),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(e,n,o);if(!c)return null;const l=C(t,"end",null);l&&(c.endSlot=i.findSlot(l)),c.convex=C(t,"convex",!1),c.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,c,a<<1);const h=C(t,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(t){if(t==null)return new Ot(1,!1);const e=new Ot(C(t,"count",0),!0);return e.start=C(t,"start",1),e.digits=C(t,"digits",0),e.setupIndex=C(t,"setup",0),e}readVertices(t,e,s){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const c=B.toFloatArray(i);if(n!==1)for(let l=0,a=i.length;l<a;l++)c[l]*=n;e.vertices=c;return}const r=[],o=[];for(let c=0,l=i.length;c<l;){const a=i[c++];o.push(a);for(let h=c+a*4;c<h;c+=4)o.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}e.bones=o,e.vertices=B.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const l in t.slots){const a=t.slots[l],h=s.findSlot(l);if(!h)throw new Error(`Slot not found: ${l}`);const d=h.index;for(const m in a){const u=a[m];if(!u)continue;const f=u.length;switch(m){case"attachment":{const p=new kt(f,d);for(let g=0;g<f;g++){const b=u[g];p.setFrame(g,C(b,"time",0),C(b,"name",null))}i.push(p);break}case"rgba":{const p=new Ue(f,f<<2,d);let g=u[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,T=0;;w++){p.setFrame(w,b,x.r,x.g,x.b,x.a);const y=u[w+1];if(!y){p.shrink(T);break}const v=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(T=G(A,p,T,w,0,b,v,x.r,S.r,1),T=G(A,p,T,w,1,b,v,x.g,S.g,1),T=G(A,p,T,w,2,b,v,x.b,S.b,1),T=G(A,p,T,w,3,b,v,x.a,S.a,1)),b=v,x=S,g=y}i.push(p);break}case"rgb":{const p=new $e(f,f*3,d);let g=u[0],b=C(g,"time",0),x=z.fromString(g.color);for(let w=0,T=0;;w++){p.setFrame(w,b,x.r,x.g,x.b);const y=u[w+1];if(!y){p.shrink(T);break}const v=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(T=G(A,p,T,w,0,b,v,x.r,S.r,1),T=G(A,p,T,w,1,b,v,x.g,S.g,1),T=G(A,p,T,w,2,b,v,x.b,S.b,1)),b=v,x=S,g=y}i.push(p);break}case"alpha":{ot(i,u,new qe(f,f,d),0,1);break}case"rgba2":{const p=new _e(f,f*7,d);let g=u[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let T=0,y=0;;T++){p.setFrame(T,b,x.r,x.g,x.b,x.a,w.r,w.g,w.b);const v=u[T+1];if(!v){p.shrink(y);break}const S=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,T,0,b,S,x.r,A.r,1),y=G(M,p,y,T,1,b,S,x.g,A.g,1),y=G(M,p,y,T,2,b,S,x.b,A.b,1),y=G(M,p,y,T,3,b,S,x.a,A.a,1),y=G(M,p,y,T,4,b,S,w.r,I.r,1),y=G(M,p,y,T,5,b,S,w.g,I.g,1),y=G(M,p,y,T,6,b,S,w.b,I.b,1)),b=S,x=A,w=I,g=v}i.push(p);break}case"rgb2":{const p=new ze(f,f*6,d);let g=u[0],b=C(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let T=0,y=0;;T++){p.setFrame(T,b,x.r,x.g,x.b,w.r,w.g,w.b);const v=u[T+1];if(!v){p.shrink(y);break}const S=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,T,0,b,S,x.r,A.r,1),y=G(M,p,y,T,1,b,S,x.g,A.g,1),y=G(M,p,y,T,2,b,S,x.b,A.b,1),y=G(M,p,y,T,3,b,S,w.r,I.r,1),y=G(M,p,y,T,4,b,S,w.g,I.g,1),y=G(M,p,y,T,5,b,S,w.b,I.b,1)),b=S,x=A,w=I,g=v}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${u.name} (${a.name})`)}}}if(t.bones)for(const l in t.bones){const a=t.bones[l],h=s.findBone(l);if(!h)throw new Error(`Bone not found: ${l}`);const d=h.index;for(const m in a){const u=a[m],f=u.length;if(f!==0)switch(m){case"rotate":ot(i,u,new Dt(f,f,d),0,1);break;case"translate":Xs(i,u,new Fe(f,f<<1,d),"x","y",0,n);break;case"translatex":ot(i,u,new Ee(f,f,d),0,n);break;case"translatey":ot(i,u,new Xe(f,f,d),0,n);break;case"scale":Xs(i,u,new Ve(f,f<<1,d),"x","y",1,1);break;case"scalex":ot(i,u,new Re(f,f,d),1,1);break;case"scaley":ot(i,u,new Le(f,f,d),1,1);break;case"shear":Xs(i,u,new Be(f,f<<1,d),"x","y",0,1);break;case"shearx":ot(i,u,new Oe(f,f,d),0,1);break;case"sheary":ot(i,u,new Ne(f,f,d),0,1);break;case"inherit":{const p=new De(f,h.index);for(let g=0;g<u.length;g++){const b=u[g];p.setFrame(g,C(b,"time",0),B.enumValue(se,C(b,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${u.name} (${a.name})`)}}}if(t.ik)for(const l in t.ik){const a=t.ik[l];let h=a[0];if(!h)continue;const d=s.findConstraint(l,zt);if(!d)throw new Error(`IK Constraint not found: ${l}`);const m=new Ge(a.length,a.length<<1,s.constraints.indexOf(d));let u=C(h,"time",0),f=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,b=0;;g++){m.setFrame(g,u,f,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const x=a[g+1];if(!x){m.shrink(b);break}const w=C(x,"time",0),T=C(x,"mix",1),y=C(x,"softness",0)*n,v=h.curve;v&&(b=G(v,m,b,g,0,u,w,f,T,1),b=G(v,m,b,g,1,u,w,p,y,n)),u=w,f=T,p=y,h=x}i.push(m)}if(t.transform)for(const l in t.transform){const a=t.transform[l];let h=a[0];if(!h)continue;const d=s.findConstraint(l,j);if(!d)throw new Error(`Transform constraint not found: ${l}`);const m=new je(a.length,a.length*6,s.constraints.indexOf(d));let u=C(h,"time",0),f=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),b=C(h,"mixScaleX",1),x=C(h,"mixScaleY",1),w=C(h,"mixShearY",1);for(let T=0,y=0;;T++){m.setFrame(T,u,f,p,g,b,x,w);const v=a[T+1];if(!v){m.shrink(y);break}const S=C(v,"time",0),A=C(v,"mixRotate",1),I=C(v,"mixX",1),M=C(v,"mixY",I),Y=C(v,"mixScaleX",1),F=C(v,"mixScaleY",1),E=C(v,"mixShearY",1),X=h.curve;X&&(y=G(X,m,y,T,0,u,S,f,A,1),y=G(X,m,y,T,1,u,S,p,I,1),y=G(X,m,y,T,2,u,S,g,M,1),y=G(X,m,y,T,3,u,S,b,Y,1),y=G(X,m,y,T,4,u,S,x,F,1),y=G(X,m,y,T,5,u,S,w,E,1)),u=S,f=A,p=I,g=M,b=Y,x=F,w=E,h=v}i.push(m)}if(t.path)for(const l in t.path){const a=t.path[l],h=s.findConstraint(l,Wt);if(!h)throw new Error(`Path constraint not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in a){const u=a[m];let f=u[0];if(!f)continue;const p=u.length;switch(m){case"position":{const g=new Je(p,p,d);ot(i,u,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Ke(p,p,d);ot(i,u,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new Qe(p,p*3,d);let b=C(f,"time",0),x=C(f,"mixRotate",1),w=C(f,"mixX",1),T=C(f,"mixY",w);for(let y=0,v=0;;y++){g.setFrame(y,b,x,w,T);const S=u[y+1];if(!S){g.shrink(v);break}const A=C(S,"time",0),I=C(S,"mixRotate",1),M=C(S,"mixX",1),Y=C(S,"mixY",M),F=f.curve;F&&(v=G(F,g,v,y,0,b,A,x,I,1),v=G(F,g,v,y,1,b,A,w,M,1),v=G(F,g,v,y,2,b,A,T,Y,1)),b=A,x=I,w=M,T=Y,f=S}i.push(g);break}}}}if(t.physics)for(const l in t.physics){const a=t.physics[l];let h=-1;if(l.length>0){const d=s.findConstraint(l,Ht);if(!d)throw new Error(`Physics constraint not found: ${l}`);h=s.constraints.indexOf(d)}for(const d in a){const m=a[d];let u=m[0];if(!u)continue;const f=m.length;let p,g=0;if(d==="reset"){const b=new as(f,h);for(let x=0;u!=null;u=m[x+1],x++)b.setFrame(x,C(u,"time",0));i.push(b);continue}switch(d){case"inertia":p=new Ze(f,f,h);break;case"strength":p=new ts(f,f,h);break;case"damping":p=new es(f,f,h);break;case"mass":p=new ss(f,f,h);break;case"wind":p=new ns(f,f,h);break;case"gravity":p=new is(f,f,h);break;case"mix":{g=1,p=new rs(f,f,h);break}default:continue}ot(i,m,p,g,1)}}if(t.slider)for(const l in t.slider){const a=t.slider[l],h=s.findConstraint(l,yt);if(!h)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in a){const u=a[m];if(!u[0])continue;const p=u.length;switch(m){case"time":ot(i,u,new os(p,p,d),1,1);break;case"mix":ot(i,u,new cs(p,p,d),1,1);break}}}if(t.attachments)for(const l in t.attachments){const a=t.attachments[l],h=s.findSkin(l);if(!h)throw new Error(`Skin not found: ${l}`);for(const d in a){const m=a[d],u=s.findSlot(d);if(!u)throw new Error(`Attachment slot not found: ${d}`);const f=u.index;for(const p in m){const g=m[p],b=h.getAttachment(f,p);if(!b)throw new Error(`Timeline attachment not found: ${p}`);for(const x in g){const w=g[x];let T=w[0];if(T){if(x==="deform"){const y=b.bones,v=b.vertices,S=y?v.length/3*2:v.length,A=new We(w.length,w.length,f,b);let I=C(T,"time",0);for(let M=0,Y=0;;M++){let F;const E=C(T,"vertices",null);if(!E)F=y?B.newFloatArray(S):v;else{F=B.newFloatArray(S);const q=C(T,"offset",0);if(B.arrayCopy(E,0,F,q,E.length),n!==1)for(let O=q,k=O+E.length;O<k;O++)F[O]*=n;if(!y)for(let O=0;O<S;O++)F[O]+=v[O]}A.setFrame(M,I,F);const X=w[M+1];if(!X){A.shrink(Y);break}const V=C(X,"time",0),N=T.curve;N&&(Y=G(N,A,Y,M,0,I,V,0,1,1)),I=V,T=X}i.push(A)}else if(x==="sequence"){const y=new He(w.length,f,b);let v=0;for(let S=0;S<w.length;S++){const A=C(T,"delay",v),I=C(T,"time",0),M=Pe[C(T,"mode","hold")],Y=C(T,"index",0);y.setFrame(S,I,M,Y,A),v=A,T=w[S+1]}i.push(y)}}}}}}if(t.drawOrder){const l=new St(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)l.setFrame(h++,C(d,"time",0),xn(s,d,a,null));i.push(l)}if(t.drawOrderFolder)for(const l of t.drawOrderFolder){const a=C(l,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const m=C(l,"keys",[]),u=new $t(m.length,h,s.slots.length);let f=0;for(const p of m)u.setFrame(f++,C(p,"time",0),xn(s,p,h.length,h));i.push(u)}if(t.events){const l=new Zt(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],m=s.findEvent(d.name);if(!m)throw new Error(`Event not found: ${d.name}`);const u=m.setupPose,f=new ae(B.toSinglePrecision(C(d,"time",0)),m);f.intValue=C(d,"int",u.intValue),f.floatValue=C(d,"float",u.floatValue),f.stringValue=C(d,"string",u.stringValue),f.data.audioPath&&(f.volume=C(d,"volume",u.volume),f.balance=C(d,"balance",u.volume)),l.setFrame(a,f)}i.push(l)}let r=0;for(let l=0,a=i.length;l<a;l++)r=Math.max(r,i[l].getDuration());const o=new Kt(e,i,r),c=C(t,"color",null);c!==null&&o.color.setFromString(c),s.animations.push(o)}},Di=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ot(t,e,s,n,i){let r=e[0],o=r.time??0,c=(r.value??n)*i,l=0;for(let a=0;;a++){s.setFrame(a,o,c);const h=e[a+1];if(!h){s.shrink(l),t.push(s);return}const d=h.time??0,m=(h.value??n)*i;r.curve&&(l=G(r.curve,s,l,a,0,o,d,c,m,i)),o=d,c=m,r=h}}function Xs(t,e,s,n,i,r,o){let c=e[0],l=c.time??0,a=(c[n]??r)*o,h=(c[i]??r)*o,d=0;for(let m=0;;m++){s.setFrame(m,l,a,h);const u=e[m+1];if(!u){s.shrink(d),t.push(s);return}const f=u.time??0,p=(u[n]??r)*o,g=(u[i]??r)*o,b=c.curve;b&&(d=G(b,s,d,m,0,l,f,a,p,o),d=G(b,s,d,m,1,l,f,h,g,o)),l=f,a=p,h=g,c=u}}function xn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),o=new Array(s-i.length);let c=0,l=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let m=0;m<s;m++)if(n[m]===h.index){d=m;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;c!==d;)o[l++]=c++;r[c+a.offset]=c++}for(;c<s;)o[l++]=c++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=o[--l]);return r}function G(t,e,s,n,i,r,o,c,l,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],m=t[h+1]*a,u=t[h+2],f=t[h+3]*a;return e.setBezier(s,n,i,r,c,d,m,u,f,o,l),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var Ui=class{commandPool=new $i;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new bn;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let o=0;o<t.slots.length;o++){const c=r[o],l=c.appliedPose.attachment;if(!l){i.clipEnd(c);continue}const a=c.appliedPose,h=a.color;if((h.a===0||!c.bone.active)&&!(l instanceof _t)){i.clipEnd(c);continue}let m,u,f,p,g,b,x;if(l instanceof Pt){if(b=l.color,b.a===0){i.clipEnd(c);continue}const S=l.sequence,A=S.resolveIndex(a);l.computeWorldVertices(c,l.getOffsets(a),this.worldVertices,0,n),m=this.worldVertices,u=4,f=S.getUVs(A),p=this.quadIndices,g=6,x=S.regions[A]?.texture}else if(l instanceof Tt){if(b=l.color,b.a===0){i.clipEnd(c);continue}this.worldVertices.length<l.worldVerticesLength&&(this.worldVertices=new Float32Array(l.worldVerticesLength)),l.computeWorldVertices(t,c,0,l.worldVerticesLength,this.worldVertices,0,n),m=this.worldVertices,u=l.worldVerticesLength>>1;const S=l.sequence,A=S.resolveIndex(a);f=S.getUVs(A),p=l.triangles,g=p.length,x=S.regions[A]?.texture}else if(l instanceof _t){i.clipStart(t,c,l);continue}else continue;const w=t.color;let T,y;if(e){let S;if(s){S=Math.floor(s[3]*w.a*h.a*b.a*255);const A=Math.floor(S*s[0]*w.r*h.r*b.r),I=Math.floor(S*s[1]*w.g*h.g*b.g),M=Math.floor(S*s[2]*w.b*h.b*b.b);T=S<<24|A<<16|I<<8|M}else{S=Math.floor(w.a*h.a*b.a*255);const A=Math.floor(S*w.r*h.r*b.r),I=Math.floor(S*w.g*h.g*b.g),M=Math.floor(S*w.b*h.b*b.b);T=S<<24|A<<16|I<<8|M}if(y=4278190080,a.darkColor){const{r:A,g:I,b:M}=a.darkColor;y=4278190080|Math.floor(A*S)<<16|Math.floor(I*S)<<8|Math.floor(M*S)}}else{if(s){const S=Math.floor(s[3]*w.a*h.a*b.a*255),A=Math.floor(s[0]*w.r*h.r*b.r*255),I=Math.floor(s[1]*w.g*h.g*b.g*255),M=Math.floor(s[2]*w.b*h.b*b.b*255);T=S<<24|A<<16|I<<8|M}else{const S=Math.floor(w.a*h.a*b.a*255),A=Math.floor(w.r*h.r*b.r*255),I=Math.floor(w.g*h.g*b.g*255),M=Math.floor(w.b*h.b*b.b*255);T=S<<24|A<<16|I<<8|M}if(y=0,a.darkColor){const{r:S,g:A,b:I}=a.darkColor;y=Math.floor(S*255)<<16|Math.floor(A*255)<<8|Math.floor(I*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(m,0,p,g,f,n),m=i.clippedVerticesTyped,u=i.clippedVerticesLength/n,f=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const v=this.commandPool.getCommand(u,g,n);v.blendMode=c.data.blendMode,v.texture=x,v.positions.set(m.subarray(0,u*n)),v.uvs.set(f.subarray(0,u<<1));for(let S=0;S<u;S++)v.colors[S]=T,v.darkColors[S]=y;p instanceof Uint16Array?v.indices.set(p.subarray(0,g)):v.indices.set(p.slice(0,g)),this.renderCommands.push(v),i.clipEnd(c)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const o=t[e],c=this.commandPool.getCommand(n,i,r);c.blendMode=o.blendMode,c.texture=o.texture;let l=0,a=0,h=0,d=0,m=0;for(let u=e;u<=s;u++){const f=t[u];c.positions.set(f.positions,l),l+=f.numVertices*r,c.uvs.set(f.uvs,a),a+=f.numVertices<<1,c.colors.set(f.colors,h),c.darkColors.set(f.darkColors,h),h+=f.numVertices;for(let p=0;p<f.numIndices;p++)c.indices[d+p]=f.indices[p]+m;d+=f.numIndices,m+=f.numVertices}return c}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,o=n.numVertices,c=n.numIndices;for(;r<=this.renderCommands.length;){const l=r<this.renderCommands.length?this.renderCommands[r]:null;if(l&&l.numVertices===0&&l.numIndices===0){r++;continue}if(l!==null&&l.texture===n.texture&&l.blendMode===n.blendMode&&l.colors[0]===n.colors[0]&&l.darkColors[0]===n.darkColors[0]&&c+l.numIndices<65535)o+=l.numVertices,c+=l.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,o,c,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,o=n.numVertices,c=n.numIndices}r++}return e}},$i=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),o=new Uint32Array(t),c=new Uint32Array(t),l=new Uint16Array(e);n={positions:i,uvs:r,colors:o,darkColors:c,indices:l,_positions:i,_uvs:r,_colors:o,_darkColors:c,_indices:l,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};return On(Ns)})();
1
+ "use strict";var spine=(()=>{var Ae=Object.defineProperty,Xn=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyNames,Rn=Object.prototype.hasOwnProperty,Ln=(t,e)=>{for(var s in e)Ae(t,s,{get:e[s],enumerable:!0})},Bn=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vn(e))!Rn.call(t,i)&&i!==s&&Ae(t,i,{get:()=>e[i],enumerable:!(n=Xn(e,i))||n.enumerable});return t},On=t=>Bn(Ae({},"__esModule",{value:!0}),t),Ns={};Ln(Ns,{ATTACH_RETAIN:()=>us,ATTACH_SETUP:()=>fs,AlphaTimeline:()=>qe,Animation:()=>Kt,AnimationState:()=>Wn,AnimationStateAdapter:()=>Hn,AnimationStateData:()=>Gn,AssetCache:()=>en,AssetManagerBase:()=>jn,AtlasAttachmentLoader:()=>Jn,Attachment:()=>Ye,AttachmentTimeline:()=>kt,BinaryInput:()=>un,BlendMode:()=>Cs,Bone:()=>ie,BoneData:()=>gs,BonePose:()=>ne,BoneTimeline1:()=>wt,BoneTimeline2:()=>Qt,BoundingBoxAttachment:()=>ms,CURRENT:()=>ls,ClippingAttachment:()=>_t,Color:()=>z,Constraint:()=>Et,ConstraintData:()=>Xt,ConstraintTimeline1:()=>Ft,CurveTimeline:()=>xt,CurveTimeline1:()=>Nt,DebugUtils:()=>Un,DeformTimeline:()=>We,Downloader:()=>sn,DrawOrder:()=>rn,DrawOrderFolderTimeline:()=>$t,DrawOrderTimeline:()=>St,Event:()=>ae,EventData:()=>xs,EventQueue:()=>Qs,EventTimeline:()=>Zt,EventType:()=>Zs,FIRST:()=>hs,FakeTexture:()=>_n,FromProperty:()=>At,FromRotate:()=>me,FromScaleX:()=>be,FromScaleY:()=>xe,FromShearY:()=>we,FromX:()=>ge,FromY:()=>pe,HOLD:()=>qt,IkConstraint:()=>an,IkConstraintData:()=>zt,IkConstraintPose:()=>oe,IkConstraintTimeline:()=>Ge,Inherit:()=>se,InheritTimeline:()=>De,IntSet:()=>Nn,Interpolation:()=>Lt,MODE:()=>ds,MathUtils:()=>R,MeshAttachment:()=>Tt,MixFrom:()=>Ws,PathAttachment:()=>te,PathConstraint:()=>on,PathConstraintData:()=>Wt,PathConstraintMixTimeline:()=>Qe,PathConstraintPose:()=>ce,PathConstraintPositionTimeline:()=>Je,PathConstraintSpacingTimeline:()=>Ke,Physics:()=>cn,PhysicsConstraint:()=>Ts,PhysicsConstraintDampingTimeline:()=>es,PhysicsConstraintData:()=>Ht,PhysicsConstraintGravityTimeline:()=>is,PhysicsConstraintInertiaTimeline:()=>Ze,PhysicsConstraintMassTimeline:()=>ss,PhysicsConstraintMixTimeline:()=>rs,PhysicsConstraintPose:()=>le,PhysicsConstraintResetTimeline:()=>as,PhysicsConstraintStrengthTimeline:()=>ts,PhysicsConstraintTimeline:()=>gt,PhysicsConstraintWindTimeline:()=>ns,PointAttachment:()=>nn,Pool:()=>Bt,Posed:()=>ps,PosedActive:()=>bs,PosedData:()=>ee,PositionMode:()=>ws,Pow:()=>Us,PowOut:()=>Dn,Property:()=>Hs,RGB2Timeline:()=>ze,RGBA2Timeline:()=>_e,RGBATimeline:()=>Ue,RGBTimeline:()=>$e,RegionAttachment:()=>Pt,RotateMode:()=>vs,RotateTimeline:()=>Dt,SETUP:()=>tn,ScaleTimeline:()=>Ve,ScaleXTimeline:()=>Re,ScaleYMode:()=>re,ScaleYTimeline:()=>Le,Sequence:()=>Ot,SequenceMode:()=>Pe,SequenceModeValues:()=>ke,SequenceTimeline:()=>He,ShearTimeline:()=>Be,ShearXTimeline:()=>Oe,ShearYTimeline:()=>Ne,Skeleton:()=>hn,SkeletonBinary:()=>Kn,SkeletonBounds:()=>Oi,SkeletonClipping:()=>bn,SkeletonData:()=>Ss,SkeletonJson:()=>Ni,SkeletonRendererCore:()=>Ui,Skin:()=>fe,SkinEntry:()=>As,Slider:()=>dn,SliderData:()=>yt,SliderMixTimeline:()=>cs,SliderPose:()=>de,SliderTimeline:()=>os,Slot:()=>ln,SlotCurveTimeline:()=>Ut,SlotData:()=>Is,SlotPose:()=>he,SpacingMode:()=>ys,StringSet:()=>Ds,Texture:()=>$s,TextureAtlas:()=>Ce,TextureAtlasPage:()=>zs,TextureAtlasRegion:()=>Me,TextureFilter:()=>Jt,TextureRegion:()=>_s,TextureWrap:()=>qs,TimeKeeper:()=>$n,Timeline:()=>Q,ToProperty:()=>It,ToRotate:()=>Ms,ToScaleX:()=>ks,ToScaleY:()=>Fs,ToShearY:()=>Es,ToX:()=>Ys,ToY:()=>Ps,TrackEntry:()=>Ks,TransformConstraint:()=>fn,TransformConstraintData:()=>j,TransformConstraintPose:()=>ue,TransformConstraintTimeline:()=>je,TranslateTimeline:()=>Fe,TranslateXTimeline:()=>Ee,TranslateYTimeline:()=>Xe,Triangulator:()=>pn,Utils:()=>B,Vector2:()=>Ie,VertexAttachment:()=>bt,WindowedMean:()=>qn,isBoneTimeline:()=>js,isConstraintTimeline:()=>Js,isSlotTimeline:()=>Gs});var Nn=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}},Ds=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 ct{static epsilon=1e-5;static epsilon2=ct.epsilon*ct.epsilon;static PI=3.1415927;static PI2=ct.PI*2;static invPI2=1/ct.PI2;static radiansToDegrees=180/ct.PI;static radDeg=ct.radiansToDegrees;static degreesToRadians=ct.PI/180;static degRad=ct.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*ct.degRad)}static sinDeg(e){return Math.sin(e*ct.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*ct.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 ct.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}},Lt=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)}},Us=class extends Lt{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}},Dn=class extends Us{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 o=s,l=i;o<s+r;o++,l++)n[l]=e[o]}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)]}},Un=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}`)}}},Bt=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}},Ie=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}},$n=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)}},qn=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}},$s=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Jt=(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))(Jt||{}),qs=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(qs||{}),_s=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},_n=class extends $s{setFilters(t,e){}setWraps(t,e){}dispose(){}},Ce=class{pages=[];regions=[];constructor(t){const e=new zn(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(Jt,s[1]),a.magFilter=B.enumValue(Jt,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 o=null,l=null,c=null;for(;r!==null;)if(r.trim().length===0)o=null,r=e.readLine();else if(o){const a=new Me(o,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{l||(l=[]),c||(c=[]),l.push(s[0]);const m=[];for(let u=0;u<h;u++)m.push(parseInt(s[u+1]));c.push(m)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),l&&l.length>0&&c&&c.length>0&&(a.names=l,a.values=c,l=null,c=null),a.u=a.x/o.width,a.v=a.y/o.height,a.degrees===90?(a.u2=(a.x+a.height)/o.width,a.v2=(a.y+a.width)/o.height):(a.u2=(a.x+a.width)/o.width,a.v2=(a.y+a.height)/o.height),this.regions.push(a)}else{for(o=new zs(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(o)}this.pages.push(o)}}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()}},zn=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}}},zs=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}},Me=class extends _s{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)}},Ye=class wn{static empty=[];name;timelineAttachment;timelineSlots=wn.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,o=this.timelineSlots.length;r<o;r++){if(i=e[this.timelineSlots[r]],!i.bone.isActive())continue;const l=(n?i.getAppliedPose():i.getPose()).getAttachment();if(l!=null&&l.timelineAttachment===this)return!0}return!1}},bt=class yn extends Ye{static nextID=0;id=yn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,o,l){i=o+(i>>1)*l;const c=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){c.length>0&&(a=c);const f=s.bone.appliedPose,p=f.worldX,g=f.worldY,b=f.a,x=f.b,w=f.c,v=f.d;for(let y=n,T=o;T<i;y+=2,T+=l){const S=a[y],A=a[y+1];r[T]=S*b+A*x+p,r[T+1]=S*w+A*v+g}return}let d=0,m=0;for(let f=0;f<n;f+=2){const p=h[d];d+=p+1,m+=p}const u=e.bones;if(c.length===0)for(let f=o,p=m*3;f<i;f+=l){let g=0,b=0,x=h[d++];for(x+=d;d<x;d++,p+=3){const w=u[h[d]].appliedPose,v=a[p],y=a[p+1],T=a[p+2];g+=(v*w.a+y*w.b+w.worldX)*T,b+=(v*w.c+y*w.d+w.worldY)*T}r[f]=g,r[f+1]=b}else{const f=c;for(let p=o,g=m*3,b=m<<1;p<i;p+=l){let x=0,w=0,v=h[d++];for(v+=d;d<v;d++,g+=3,b+=2){const y=u[h[d]].appliedPose,T=a[g]+f[b],S=a[g+1]+f[b+1],A=a[g+2];x+=(T*y.a+S*y.b+y.worldX)*A,w+=(T*y.c+S*y.d+y.worldY)*A}r[p]=x,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}},Tt=class Vs extends bt{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 Vs(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 Vs(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,o=e.v,l=0,c=0;if(e instanceof Me){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,o-=(e.originalWidth-e.offsetX-e.width)/d,l=e.originalHeight/h,c=e.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+s[m+1]*l,n[m+1]=o+(1-s[m])*c;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,o-=e.offsetY/d,l=e.originalWidth/h,c=e.originalHeight/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m])*l,n[m+1]=o+(1-s[m+1])*c;return;case 270:r-=e.offsetY/h,o-=e.offsetX/d,l=e.originalHeight/h,c=e.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m+1])*l,n[m+1]=o+s[m]*c;return;default:r-=e.offsetX/h,o-=(e.originalHeight-e.offsetY-e.height)/d,l=e.originalWidth/h,c=e.originalHeight/d}}else e?(l=e.u2-r,c=e.v2-o):(r=o=0,l=c=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*l,n[a+1]=o+s[a+1]*c}},Pt=class vn extends Ye{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 vn(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 o=e.bone.appliedPose,l=o.worldX,c=o.worldY,a=o.a,h=o.b,d=o.c,m=o.d;let u=s[0],f=s[1];n[i]=u*a+f*h+l,n[i+1]=u*d+f*m+c,i+=r,u=s[2],f=s[3],n[i]=u*a+f*h+l,n[i+1]=u*d+f*m+c,i+=r,u=s[4],f=s[5],n[i]=u*a+f*h+l,n[i+1]=u*d+f*m+c,i+=r,u=s[6],f=s[7],n[i]=u*a+f*h+l,n[i+1]=u*d+f*m+c}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,o,l,c,a,h){if(!e)throw new Error("Region not set.");const d=l/e.originalWidth*i,m=c/e.originalHeight*r,u=-l/2*i+e.offsetX*d,f=-c/2*r+e.offsetY*m,p=u+e.width*d,g=f+e.height*m,b=o*R.degRad,x=Math.cos(b),w=Math.sin(b),v=u*x+s,y=u*w,T=f*x+n,S=f*w,A=p*x+s,C=p*w,M=g*x+n,Y=g*w;a[0]=v-S,a[1]=T+y,a[2]=v-Y,a[3]=M+y,a[4]=A-Y,a[5]=M+C,a[6]=A-S,a[7]=T+C,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},Ot=class ve{static _nextID=0;id=ve.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 ve(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 Pt){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Pt.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 Tt){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),Tt.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 ve._nextID++}},Pe=(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))(Pe||{}),ke=[0,1,2,3,4,5,6],Kt=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 Ds,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),js(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,o,l,c,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,m=h.length;d<m;d++)h[d].apply(t,e,s,i,r,o,l,c,a)}},Ws=(t=>(t[t.current=0]="current",t[t.setup=1]="setup",t[t.first=2]="first",t))(Ws||{}),Hs=(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.drawOrderFolder=15]="drawOrderFolder",t[t.ikConstraint=16]="ikConstraint",t[t.transformConstraint=17]="transformConstraint",t[t.pathConstraintPosition=18]="pathConstraintPosition",t[t.pathConstraintSpacing=19]="pathConstraintSpacing",t[t.pathConstraintMix=20]="pathConstraintMix",t[t.physicsConstraintInertia=21]="physicsConstraintInertia",t[t.physicsConstraintStrength=22]="physicsConstraintStrength",t[t.physicsConstraintDamping=23]="physicsConstraintDamping",t[t.physicsConstraintMass=24]="physicsConstraintMass",t[t.physicsConstraintWind=25]="physicsConstraintWind",t[t.physicsConstraintGravity=26]="physicsConstraintGravity",t[t.physicsConstraintMix=27]="physicsConstraintMix",t[t.physicsConstraintReset=28]="physicsConstraintReset",t[t.sequence=29]="sequence",t[t.sliderTime=30]="sliderTime",t[t.sliderMix=31]="sliderMix",t))(Hs||{}),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 Gs(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var xt=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,o,l,c,a,h){const d=this.curves;let m=this.getFrameCount()+t*18;s===0&&(d[e]=2+m);const u=(n-r*2+l)*.03,f=(i-o*2+c)*.03,p=((r-l)*3-n+a)*.006,g=((o-c)*3-i+h)*.006;let b=u*2+p,x=f*2+g,w=(r-n)*.3+u+p*.16666667,v=(o-i)*.3+f+g*.16666667,y=n+w,T=i+v;for(let S=m+18;m<S;m+=2)d[m]=y,d[m+1]=T,w+=b,v+=x,b+=p,x+=g,y+=w,T+=v}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const c=this.frames[e],a=this.frames[e+s];return a+(t-c)/(i[n]-c)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const c=i[n-2],a=i[n-1];return a+(t-c)/(i[n]-c)*(i[n+1]-a)}e+=this.getFrameEntries();const o=i[r-2],l=i[r-1];return l+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-l)}},Nt=class jt extends xt{constructor(e,s,n){super(e,s,n)}getFrameEntries(){return 2}setFrame(e,s,n){e<<=1,this.frames[e]=s,this.frames[e+1]=n}getCurveValue(e){const s=this.frames;let n=s.length-2;for(let r=2;r<=n;r+=2)if(s[r]>e){n=r-2;break}const i=this.curves[n>>1];switch(i){case 0:{const r=s[n],o=s[n+1];return o+(e-r)/(s[n+2]-r)*(s[n+2+1]-o)}case 1:return s[n+1]}return this.getBezierValue(e,n,1,i-2)}getRelativeValue(e,s,n,i,r,o){if(e<this.frames[0])return jt.beforeFirstKey(n,s,r,o);const l=this.getCurveValue(e);return n===1?o+l*s:r+(i?l:l+o-r)*s}getAbsoluteValue(e,s,n,i,r,o,l){return l===void 0?this.getAbsoluteValue1(e,s,n,i,r,o):this.getAbsoluteValue2(e,s,n,i,r,o,l)}getAbsoluteValue1(e,s,n,i,r,o){if(e<this.frames[0])return jt.beforeFirstKey(n,s,r,o);const l=this.getCurveValue(e);return n===1?o+(i?l:l-o)*s:r+(i?l:l-r)*s}getAbsoluteValue2(e,s,n,i,r,o,l){return e<this.frames[0]?jt.beforeFirstKey(n,s,r,o):n===1?o+(i?l:l-o)*s:r+(i?l:l-r)*s}getScaleValue(e,s,n,i,r,o,l){if(e<this.frames[0])return jt.beforeFirstKey(n,s,o,l);const c=this.getCurveValue(e)*l;if(s===1&&!i)return c;let a=n===1?l:o;return i?a+(c-l)*s:r?a+(Math.abs(c)*Math.sign(a)-a)*s:(a=Math.abs(a)*Math.sign(c),a+(c-a)*s)}static beforeFirstKey(e,s,n,i){switch(e){case 1:return i;case 2:return n+(i-n)*s;case 0:return n}}};function js(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var wt=class extends Nt{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,o,l,c){const a=t.bones[this.boneIndex];a.active&&this.apply1(c?a.appliedPose:a.pose,a.data.setupPose,s,i,r,o,l)}},Qt=class extends xt{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,o,l,c){const a=t.bones[this.boneIndex];a.active&&this.apply1(c?a.appliedPose:a.pose,a.data.setupPose,s,i,r,o,l)}},Dt=class extends wt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,o){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Fe=class extends Qt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,o){const l=this.frames;if(s<l[0]){switch(i){case 1:t.x=e.x,t.y=e.y;break;case 2:t.x+=(e.x-t.x)*n,t.y+=(e.y-t.y)*n;break}return}let c=0,a=0;const h=Q.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const m=l[h];c=l[h+1],a=l[h+2];const u=(s-m)/(l[h+3]-m);c+=(l[h+3+1]-c)*u,a+=(l[h+3+2]-a)*u;break}case 1:c=l[h+1],a=l[h+2];break;default:c=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i===1?(t.x=e.x+c*n,t.y=e.y+a*n):r?(t.x+=c*n,t.y+=a*n):(t.x+=(e.x+c-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Ee=class extends wt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,o){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Xe=class extends wt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,o){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Ve=class extends Qt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,o){const l=this.frames;if(s<l[0]){switch(i){case 1:t.scaleX=e.scaleX,t.scaleY=e.scaleY;break;case 2:t.scaleX+=(e.scaleX-t.scaleX)*n,t.scaleY+=(e.scaleY-t.scaleY)*n;break}return}let c,a;const h=Q.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const m=l[h];c=l[h+1],a=l[h+2];const u=(s-m)/(l[h+3]-m);c+=(l[h+3+1]-c)*u,a+=(l[h+3+2]-a)*u;break}case 1:c=l[h+1],a=l[h+2];break;default:c=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(c*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=c,t.scaleY=a;else{let m=0,u=0;i===1?(m=e.scaleX,u=e.scaleY):(m=t.scaleX,u=t.scaleY),r?(t.scaleX=m+(c-e.scaleX)*n,t.scaleY=u+(a-e.scaleY)*n):o?(t.scaleX=m+(Math.abs(c)*Math.sign(m)-m)*n,t.scaleY=u+(Math.abs(a)*Math.sign(u)-u)*n):(m=Math.abs(m)*Math.sign(c),u=Math.abs(u)*Math.sign(a),t.scaleX=m+(c-m)*n,t.scaleY=u+(a-u)*n)}}},Re=class extends wt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,o){t.scaleX=this.getScaleValue(s,n,i,r,o,t.scaleX,e.scaleX)}},Le=class extends wt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,o){t.scaleY=this.getScaleValue(s,n,i,r,o,t.scaleY,e.scaleY)}},Be=class extends Qt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,o){const l=this.frames;if(s<l[0]){switch(i){case 1:t.shearX=e.shearX,t.shearY=e.shearY;break;case 2:t.shearX+=(e.shearX-t.shearX)*n,t.shearY+=(e.shearY-t.shearY)*n;break}return}let c=0,a=0;const h=Q.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const m=l[h];c=l[h+1],a=l[h+2];const u=(s-m)/(l[h+3]-m);c+=(l[h+3+1]-c)*u,a+=(l[h+3+2]-a)*u;break}case 1:c=l[h+1],a=l[h+2];break;default:c=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i===1?(t.shearX=e.shearX+c*n,t.shearY=e.shearY+a*n):r?(t.shearX+=c*n,t.shearY+=a*n):(t.shearX+=(e.shearX+c-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},Oe=class extends wt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,o){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},Ne=class extends wt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,o){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},De=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,o,l,c){const a=t.bones[this.boneIndex];if(!a.active)return;const h=c?a.appliedPose:a.pose;if(l)r!==0&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r!==0&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Ut=class extends xt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,o,l,c){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,c?a.appliedPose:a.pose,s,i,r,o)}},Ue=class extends Ut{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 o=e.color,l=this.frames;if(s<l[0]){const f=t.data.setupPose.color;switch(i){case 1:o.setFromColor(f);break;case 2:o.add((f.r-o.r)*n,(f.g-o.g)*n,(f.b-o.b)*n,(f.a-o.a)*n);break}return}let c=0,a=0,h=0,d=0;const m=Q.search(l,s,5),u=this.curves[m/5];switch(u){case 0:{const f=l[m];c=l[m+1],a=l[m+2],h=l[m+3],d=l[m+4];const p=(s-f)/(l[m+5]-f);c+=(l[m+5+1]-c)*p,a+=(l[m+5+2]-a)*p,h+=(l[m+5+3]-h)*p,d+=(l[m+5+4]-d)*p;break}case 1:c=l[m+1],a=l[m+2],h=l[m+3],d=l[m+4];break;default:c=this.getBezierValue(s,m,1,u-2),a=this.getBezierValue(s,m,2,u+18-2),h=this.getBezierValue(s,m,3,u+36-2),d=this.getBezierValue(s,m,4,u+54-2)}if(n===1)o.set(c,a,h,d);else if(i===1){const f=t.data.setupPose.color;o.set(f.r+(c-f.r)*n,f.g+(a-f.g)*n,f.b+(h-f.b)*n,f.a+(d-f.a)*n)}else o.add((c-o.r)*n,(a-o.g)*n,(h-o.b)*n,(d-o.a)*n)}},$e=class extends Ut{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 o=e.color;let l=0,c=0,a=0;const h=this.frames;if(s<h[0]){const u=t.data.setupPose.color;switch(i){case 1:{o.r=u.r,o.g=u.g,o.b=u.b;break}case 2:{o.r+=(u.r-o.r)*n,o.g+=(u.g-o.g)*n,o.b+=(u.b-o.b)*n;break}}return}const d=Q.search(h,s,4),m=this.curves[d>>2];switch(m){case 0:{const u=h[d];l=h[d+1],c=h[d+2],a=h[d+3];const f=(s-u)/(h[d+4]-u);l+=(h[d+4+1]-l)*f,c+=(h[d+4+2]-c)*f,a+=(h[d+4+3]-a)*f;break}case 1:l=h[d+1],c=h[d+2],a=h[d+3];break;default:l=this.getBezierValue(s,d,1,m-2),c=this.getBezierValue(s,d,2,m+18-2),a=this.getBezierValue(s,d,3,m+36-2)}if(n!==1)if(i===1){const u=t.data.setupPose.color;l=u.r+(l-u.r)*n,c=u.g+(c-u.g)*n,a=u.b+(a-u.b)*n}else l=o.r+(l-o.r)*n,c=o.g+(c-o.g)*n,a=o.b+(a-o.b)*n;o.r=l<0?0:l>1?1:l,o.g=c<0?0:c>1?1:c,o.b=a<0?0:a>1?1:a}},qe=class extends Nt{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,o,l,c){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(c?a.appliedPose:a.pose).color;let d=0;const m=this.frames;if(s<m[0]){const u=a.data.setupPose.color.a;switch(r){case 1:h.a=u;break;case 2:h.a+=(u-h.a)*i;break}return}if(d=this.getCurveValue(s),i!==1)if(r===1){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}},_e=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,o,l,c){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]=o,this.frames[t+6]=l,this.frames[t+7]=c}apply1(t,e,s,n,i,r){const o=e.color,l=e.darkColor;let c=0,a=0,h=0;const d=this.frames;if(s<d[0]){const x=t.data.setupPose,w=x.color,v=x.darkColor;switch(i){case 1:{o.setFromColor(w),l.r=v.r,l.g=v.g,l.b=v.b;break}case 2:{o.add((w.r-o.r)*n,(w.g-o.g)*n,(w.b-o.b)*n,(w.a-o.a)*n),l.r+=(v.r-l.r)*n,l.g+=(v.g-l.g)*n,l.b+=(v.b-l.b)*n;break}}return}let m=0,u=0,f=0,p=0;const g=Q.search(d,s,8),b=this.curves[g>>3];switch(b){case 0:{const x=d[g];m=d[g+1],u=d[g+2],f=d[g+3],p=d[g+4],c=d[g+5],a=d[g+6],h=d[g+7];const w=(s-x)/(d[g+8]-x);m+=(d[g+8+1]-m)*w,u+=(d[g+8+2]-u)*w,f+=(d[g+8+3]-f)*w,p+=(d[g+8+4]-p)*w,c+=(d[g+8+5]-c)*w,a+=(d[g+8+6]-a)*w,h+=(d[g+8+7]-h)*w;break}case 1:m=d[g+1],u=d[g+2],f=d[g+3],p=d[g+4],c=d[g+5],a=d[g+6],h=d[g+7];break;default:m=this.getBezierValue(s,g,1,b-2),u=this.getBezierValue(s,g,2,b+18-2),f=this.getBezierValue(s,g,3,b+36-2),p=this.getBezierValue(s,g,4,b+54-2),c=this.getBezierValue(s,g,5,b+72-2),a=this.getBezierValue(s,g,6,b+90-2),h=this.getBezierValue(s,g,7,b+108-2)}if(n===1)o.set(m,u,f,p);else if(i===1){const x=t.data.setupPose;let w=x.color;o.set(w.r+(m-w.r)*n,w.g+(u-w.g)*n,w.b+(f-w.b)*n,w.a+(p-w.a)*n),w=x.darkColor,c=w.r+(c-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else o.add((m-o.r)*n,(u-o.g)*n,(f-o.b)*n,(p-o.a)*n),c=l.r+(c-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n;l.r=c<0?0:c>1?1:c,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h}},ze=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,o,l){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]=o,this.frames[t+6]=l}apply1(t,e,s,n,i,r){const o=e.color,l=e.darkColor;let c=0,a=0,h=0,d=0,m=0,u=0;const f=this.frames;if(s<f[0]){const b=t.data.setupPose,x=b.color,w=b.darkColor;switch(i){case 1:o.r=x.r,o.g=x.g,o.b=x.b,l.r=w.r,l.g=w.g,l.b=w.b;break;case 2:o.r+=(x.r-o.r)*n,o.g+=(x.g-o.g)*n,o.b+=(x.b-o.b)*n,l.r+=(w.r-l.r)*n,l.g+=(w.g-l.g)*n,l.b+=(w.b-l.b)*n;break}return}const p=Q.search(f,s,7),g=this.curves[p/7];switch(g){case 0:{const b=f[p];c=f[p+1],a=f[p+2],h=f[p+3],d=f[p+4],m=f[p+5],u=f[p+6];const x=(s-b)/(f[p+7]-b);c+=(f[p+7+1]-c)*x,a+=(f[p+7+2]-a)*x,h+=(f[p+7+3]-h)*x,d+=(f[p+7+4]-d)*x,m+=(f[p+7+5]-m)*x,u+=(f[p+7+6]-u)*x;break}case 1:c=f[p+1],a=f[p+2],h=f[p+3],d=f[p+4],m=f[p+5],u=f[p+6];break;default:c=this.getBezierValue(s,p,1,g-2),a=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),m=this.getBezierValue(s,p,5,g+72-2),u=this.getBezierValue(s,p,6,g+90-2)}if(n!==1)if(i===1){const b=t.data.setupPose;let x=b.color;c=x.r+(c-x.r)*n,a=x.g+(a-x.g)*n,h=x.b+(h-x.b)*n,x=b.darkColor,d=x.r+(d-x.r)*n,m=x.g+(m-x.g)*n,u=x.b+(u-x.b)*n}else c=o.r+(c-o.r)*n,a=o.g+(a-o.g)*n,h=o.b+(h-o.b)*n,d=l.r+(d-l.r)*n,m=l.g+(m-l.g)*n,u=l.b+(u-l.b)*n;o.r=c<0?0:c>1?1:c,o.g=a<0?0:a>1?1:a,o.b=h<0?0:h>1?1:h,l.r=d<0?0:d>1?1:d,l.g=m<0?0:m>1?1:m,l.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,o,l,c){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=c?a.appliedPose:a.pose;l||s<this.frames[0]?r!==0&&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)}},We=class extends xt{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,o,l,c,a,h){const d=this.curves;let m=this.getFrameCount()+t*18;s===0&&(d[e]=2+m);const u=(n-r*2+l)*.03,f=c*.03-o*.06,p=((r-l)*3-n+a)*.006,g=(o-c+.33333333)*.018;let b=u*2+p,x=f*2+g,w=(r-n)*.3+u+p*.16666667,v=o*.3+f+g*.16666667,y=n+w,T=v;for(let S=m+18;m<S;m+=2)d[m]=y,d[m+1]=T,w+=b,v+=x,b+=p,x+=g,y+=w,T+=v}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const l=this.frames[e];return(t-l)/(this.frames[e+this.getFrameEntries()]-l)}case 1:return 0}if(n-=2,s[n]>t){const l=this.frames[e];return s[n+1]*(t-l)/(s[n]-l)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const l=s[n-2],c=s[n-1];return c+(t-l)/(s[n]-l)*(s[n+1]-c)}const r=s[i-2],o=s[i-1];return o+(1-o)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,o,l,c){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,c))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],c,i,r);for(const g of h)this.applyBeforeFirst(a[g],c,i,r);return}let m,u,f;if(s>=d[d.length-1])f=0,m=this.vertices[d.length-1],u=null;else{const g=Q.search(d,s);f=this.getCurvePercent(s,g),m=this.vertices[g],u=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(a[this.slotIndex],c,m,u,f,p,i,r,o);for(const g of h)this.applyToSlot(a[g],c,m,u,f,p,i,r,o)}applyBeforeFirst(t,e,s,n){if(!t.bone.active)return;const i=e?t.appliedPose:t.pose;if(i.attachment==null||i.attachment.timelineAttachment!==this.attachment)return;const r=i.deform;switch(r.length===0&&(n=1),n){case 1:r.length=0;break;case 2:{if(s===1){r.length=0;return}const o=this.vertices[0].length;r.length=o;const l=r,c=i.attachment;if(c.bones===null){const a=c.vertices;for(let h=0;h<o;h++)l[h]+=(a[h]-l[h])*s}else{s=1-s;for(let a=0;a<o;a++)l[a]*=s}}}}applyToSlot(t,e,s,n,i,r,o,l,c){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;d.length===0&&(l=1);const m=l===1;if(d.length=r,n===null)if(o===1)if(c&&!m)if(h.bones)for(let u=0;u<r;u++)d[u]+=s[u];else{const u=h.vertices;for(let f=0;f<r;f++)d[f]+=s[f]-u[f]}else B.arrayCopy(s,0,d,0,r);else if(m)if(h.bones)for(let u=0;u<r;u++)d[u]=s[u]*o;else{const u=h.vertices;for(let f=0;f<r;f++){const p=u[f];d[f]=p+(s[f]-p)*o}}else if(c)if(h.bones)for(let u=0;u<r;u++)d[u]+=s[u]*o;else{const u=h.vertices;for(let f=0;f<r;f++)d[f]+=(s[f]-u[f])*o}else for(let u=0;u<r;u++)d[u]+=(s[u]-d[u])*o;else if(o===1)if(c&&!m)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=f+(n[u]-f)*i}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f];d[f]+=p+(n[f]-p)*i-u[f]}}else if(i===0)B.arrayCopy(s,0,d,0,r);else for(let u=0;u<r;u++){const f=s[u];d[u]=f+(n[u]-f)*i}else if(m)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]=(f+(n[u]-f)*i)*o}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f],g=u[f];d[f]=g+(p+(n[f]-p)*i-g)*o}}else if(c)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(n[u]-f)*i)*o}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f];d[f]+=(p+(n[f]-p)*i-u[f])*o}}else for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(n[u]-f)*i-d[u])*o}}},He=class vt extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`29|${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 o=this.frames;e*=vt.ENTRIES,o[e]=s,o[e+vt.MODE]=n|i<<4,o[e+vt.DELAY]=r}apply(e,s,n,i,r,o,l,c,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,m=this.frames;if(c||n<m[0]){if(o!==0){this.setupPose(h[this.slotIndex],a);for(const b of d)this.setupPose(h[b],a)}return}const u=Q.search(m,n,vt.ENTRIES),f=m[u],p=m[u+vt.MODE],g=m[u+vt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,f,p,g);for(const b of d)this.applyToSlot(h[b],a,n,f,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,o){if(!e.bone.active)return;const l=s?e.appliedPose:e.pose;if(l.attachment===null||l.attachment.timelineAttachment!==this.attachment)return;let c=r>>4,a=l.attachment.sequence.regions.length;const h=ke[r&15];if(h!==0)switch(c+=(n-i)/o+1e-5|0,h){case 1:c=Math.min(a-1,c);break;case 2:c%=a;break;case 3:{const d=(a<<1)-2;c=d===0?0:c%d,c>=a&&(c=d-c);break}case 4:c=Math.max(a-1-c,0);break;case 5:c=a-1-c%a;break;case 6:{const d=(a<<1)-2;c=d===0?0:(c+a-1)%d,c>=a&&(c=d-c)}}l.sequenceIndex=c}},Zt=class Tn extends Q{static propertyIds=["13"];events;constructor(e){super(e,...Tn.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,o,l,c,a){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,o,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let m=0;if(s<h[0])m=0;else{m=Q.search(h,s)+1;const u=h[m];for(;m>0&&h[m-1]===u;)m--}for(;m<d&&n>=h[m];m++)i.push(this.events[m])}},St=class Rs extends Q{static propertyID="14";static propertyIds=[Rs.propertyID];drawOrders;constructor(e){super(e,...Rs.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,o,l,c,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(c||n<this.frames[0]){o!==0&&B.arrayCopy(d,0,h,0,e.slots.length);return}const m=this.drawOrders[Q.search(this.frames,n)];if(!m)B.arrayCopy(d,0,h,0,e.slots.length);else for(let u=0,f=m.length;u<f;u++)h[u]=d[m[u]]}},$t=class Ls extends Q{static propertyID="15";slots;inFolder;drawOrders;constructor(e,s,n){super(e,...Ls.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]=`${Ls.propertyID}|${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,o,l,c,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(c||n<this.frames[0])o!==0&&this.setup(h,d);else{const m=this.drawOrders[Q.search(this.frames,n)];if(!m)this.setup(h,d);else{const u=this.inFolder,f=this.slots;for(let p=0,g=0,b=f.length;!(u[h[p].data.index]&&(h[p]=d[f[m[g]]],++g===b));p++);}}}setup(e,s){const{inFolder:n,slots:i}=this;for(let r=0,o=0,l=i.length;!(n[e[r].data.index]&&(e[r]=s[i[o]],++o===l));r++);}};function Js(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Ge=class extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,o){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]=o?1:0}apply(t,e,s,n,i,r,o,l,c){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=c?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){const b=a.data.setupPose;switch(r){case 1:{h.mix=b.mix,h.softness=b.softness,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch;break}case 2:{h.mix+=(b.mix-h.mix)*i,h.softness+=(b.softness-h.softness)*i,h.bendDirection=b.bendDirection,h.compress=b.compress,h.stretch=b.stretch;break}}return}let m=0,u=0;const f=Q.search(d,s,6),p=this.curves[f/6];switch(p){case 0:{const b=d[f];m=d[f+1],u=d[f+2];const x=(s-b)/(d[f+6]-b);m+=(d[f+6+1]-m)*x,u+=(d[f+6+2]-u)*x;break}case 1:m=d[f+1],u=d[f+2];break;default:m=this.getBezierValue(s,f,1,p-2),u=this.getBezierValue(s,f,2,p+18-2)}const g=r===1?a.data.setupPose:h;h.mix=g.mix+(m-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,l?r===1&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[f+3],h.compress=d[f+4]!==0,h.stretch=d[f+5]!==0)}},je=class extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,`17|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,o,l){const c=this.frames;t*=7,c[t]=e,c[t+1]=s,c[t+2]=n,c[t+3]=i,c[t+4]=r,c[t+5]=o,c[t+6]=l}apply(t,e,s,n,i,r,o,l,c){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=c?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){const y=a.data.setupPose;switch(r){case 1:{h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY;break}case 2:{h.mixRotate+=(y.mixRotate-h.mixRotate)*i,h.mixX+=(y.mixX-h.mixX)*i,h.mixY+=(y.mixY-h.mixY)*i,h.mixScaleX+=(y.mixScaleX-h.mixScaleX)*i,h.mixScaleY+=(y.mixScaleY-h.mixScaleY)*i,h.mixShearY+=(y.mixShearY-h.mixShearY)*i;break}}return}let m,u,f,p,g,b;const x=Q.search(d,s,7),w=this.curves[x/7];switch(w){case 0:{const y=d[x];m=d[x+1],u=d[x+2],f=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];const T=(s-y)/(d[x+7]-y);m+=(d[x+7+1]-m)*T,u+=(d[x+7+2]-u)*T,f+=(d[x+7+3]-f)*T,p+=(d[x+7+4]-p)*T,g+=(d[x+7+5]-g)*T,b+=(d[x+7+6]-b)*T;break}case 1:m=d[x+1],u=d[x+2],f=d[x+3],p=d[x+4],g=d[x+5],b=d[x+6];break;default:m=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),f=this.getBezierValue(s,x,3,w+36-2),p=this.getBezierValue(s,x,4,w+54-2),g=this.getBezierValue(s,x,5,w+72-2),b=this.getBezierValue(s,x,6,w+90-2)}const v=r===1?a.data.setupPose:h;o?(h.mixRotate=v.mixRotate+m*i,h.mixX=v.mixX+u*i,h.mixY=v.mixY+f*i,h.mixScaleX=v.mixScaleX+p*i,h.mixScaleY=v.mixScaleY+g*i,h.mixShearY=v.mixShearY+b*i):(h.mixRotate=v.mixRotate+(m-v.mixRotate)*i,h.mixX=v.mixX+(u-v.mixX)*i,h.mixY=v.mixY+(f-v.mixY)*i,h.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*i,h.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*i,h.mixShearY=v.mixShearY+(b-v.mixShearY)*i)}},Ft=class extends Nt{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Je=class extends Ft{constructor(t,e,s){super(t,e,s,18),this.additive=!0}apply(t,e,s,n,i,r,o,l,c){const a=t.constraints[this.constraintIndex];if(a.active){const h=c?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,o,h.position,a.data.setupPose.position)}}},Ke=class extends Ft{constructor(t,e,s){super(t,e,s,19)}apply(t,e,s,n,i,r,o,l,c){const a=t.constraints[this.constraintIndex];if(a.active){const h=c?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},Qe=class extends xt{constraintIndex;constructor(t,e,s){super(t,e,`20|${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,o,l,c){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=c?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){const x=a.data.setupPose;switch(r){case 1:{h.mixRotate=x.mixRotate,h.mixX=x.mixX,h.mixY=x.mixY;break}case 2:{h.mixRotate+=(x.mixRotate-h.mixRotate)*i,h.mixX+=(x.mixX-h.mixX)*i,h.mixY+=(x.mixY-h.mixY)*i;break}}return}let m,u,f;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const x=d[p];m=d[p+1],u=d[p+2],f=d[p+3];const w=(s-x)/(d[p+4]-x);m+=(d[p+4+1]-m)*w,u+=(d[p+4+2]-u)*w,f+=(d[p+4+3]-f)*w;break}case 1:m=d[p+1],u=d[p+2],f=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),u=this.getBezierValue(s,p,2,g+18-2),f=this.getBezierValue(s,p,3,g+36-2)}const b=r===1?a.data.setupPose:h;o?(h.mixRotate=b.mixRotate+m*i,h.mixX=b.mixX+u*i,h.mixY=b.mixY+f*i):(h.mixRotate=b.mixRotate+(m-b.mixRotate)*i,h.mixX=b.mixX+(u-b.mixX)*i,h.mixY=b.mixY+(f-b.mixY)*i)}},gt=class extends Ft{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,o,l,c){if(o&&!this.additive&&(o=!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 m=c?d.appliedPose:d.pose;this.set(m,this.getAbsoluteValue(s,i,r,o,this.get(m),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=c?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,o,this.get(h),this.get(a.data.setupPose)))}}}},Ze=class extends gt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ts=class extends gt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},es=class extends gt{constructor(t,e,s){super(t,e,s,23)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ss=class extends gt{constructor(t,e,s){super(t,e,s,24)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},ns=class extends gt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},is=class extends gt{constructor(t,e,s){super(t,e,s,26),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},rs=class extends gt{constructor(t,e,s){super(t,e,s,27)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},as=class Sn extends Q{static propertyIds=["28"];constraintIndex;constructor(e,s){super(e,...Sn.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,o,l,c,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,o,!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 m of e.physics)m.active&&m.reset(e)}},os=class extends Ft{constructor(t,e,s){super(t,e,s,30)}apply(t,e,s,n,i,r,o,l,c){const a=t.constraints[this.constraintIndex];if(a.active){const h=c?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,o,h.time,a.data.setupPose.time)}}},cs=class extends Ft{constructor(t,e,s){super(t,e,s,31),this.additive=!0}apply(t,e,s,n,i,r,o,l,c){const a=t.constraints[this.constraintIndex];if(a.active){const h=c?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,o,h.mix,a.data.setupPose.mix)}}},Wn=class Bs{static emptyAnimation=new Kt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Qs(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new Bt(()=>new Ks);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 o=e*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let l=r.next;if(l){const c=r.trackLast-l.delay;if(c>=0){for(l.delay=0,l.trackTime+=r.timeScale===0?0:(c/r.timeScale+e)*l.timeScale,r.trackTime+=o,this.setTrack(n,l,!0);l.mixingFrom;)l.mixTime+=e,l=l.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 c=r.mixingFrom;for(r.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}r.trackTime+=o}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 l=0,c=n.length;l<c;l++){const a=n[l];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,m=a.getAnimationTime(),u=m,f=s;a.reverse&&(u=a.animation.duration-u,f=null);const p=a.animation.timelines,g=p.length;if(l===0&&h===1)for(let b=0;b<g;b++){B.webkit602BugfixHelper(h);const x=p[b];x instanceof kt?this.applyAttachmentTimeline(x,e,u,1,!0):x.apply(e,d,u,f,h,1,!1,!1,!1)}else{const b=a.timelineMode,x=h>=a.alphaAttachmentThreshold,w=a.additive,v=w||a.shortestRotation,y=!v&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const S=p[T],A=b[T]&ds;!v&&S instanceof Dt?this.applyRotateTimeline(S,e,u,h,A,a.timelinesRotation,T<<1,y):S instanceof kt?this.applyAttachmentTimeline(S,e,u,A,x):(B.webkit602BugfixHelper(h),S.apply(e,d,u,f,h,A,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,m),this.queueEvents(a,m),s.length=0,a.nextAnimationLast=m,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+fs,o=e.slots;for(let l=0,c=e.slots.length;l<c;l++){const a=o[l];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(),o=n.alpha*i,l=1-r*e.alpha,c=o*(1-r),a=l>0?c/l:o,h=n.animation.timelines,d=h.length,m=n.timelineMode,u=n.timelineHoldMix,f=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,b=g||n.shortestRotation,x=!b&&n.timelinesRotation.length!==d<<1;x&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let v=n.animationLast,y=n.getAnimationTime(),T=y,S=null;n.reverse?T=n.animation.duration-T:r<n.eventThreshold&&(S=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const C=h[A],M=m[A],Y=M&ds;let F=0;if((M&qt)!==0){const E=u[A];F=E==null?a:a*(1-E.mix())}else{if(!p&&C instanceof St&&Y===0)continue;F=c}if(n.totalAlpha+=F,!b&&C instanceof Dt)this.applyRotateTimeline(C,s,T,F,Y,w,A<<1,x);else if(C instanceof kt)this.applyAttachmentTimeline(C,s,T,Y,f&&F>=n.alphaAttachmentThreshold);else{const E=!p||!(C instanceof St)||Y===0;C.apply(s,v,T,S,F,Y,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,v,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 o=s.slots[e.slotIndex];if(!o.bone.active||!r&&o.attachmentState===this.unkeyedState+us)return;let l=n<e.frames[0],c=null;if(l||(c=e.attachmentNames[Q.search(e.frames,n)],l=!r&&c==null),l){if(i===0)return;c=o.data.attachmentName}o.pose.setAttachment(c==null?null:s.getAttachment(o.data.index,c)),r?o.attachmentState=this.unkeyedState+us:l||(o.attachmentState=this.unkeyedState+fs)}applyRotateTimeline(e,s,n,i,r,o,l,c){if(c&&(o[l]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,m=e.frames;let u,f;if(n<m[0]){switch(r){case 1:{h.rotation=d.rotation;return}case 0:return}u=h.rotation,f=d.rotation}else u=r===1?d.rotation:h.rotation,f=d.rotation+e.getCurveValue(n);let p=0,g=f-u;if(g-=Math.ceil(g/360-.5)*360,g===0)p=o[l];else{let b=0,x=0;c?(b=0,x=g):(b=o[l],x=o[l+1]);const w=b-b%360;p=g+w;let v=g>=0,y=b>=0;Math.abs(x)<=90&&R.signum(x)!==R.signum(g)&&(Math.abs(b-w)>180?(p+=360*R.signum(b),y=v):w!==0?p-=360*R.signum(b):y=v),y!==v&&(p+=360*R.signum(b)),o[l]=p}o[l+1]=g,h.rotation=u+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,o=e.reverse;let l=e.trackLast%r;o&&(l=r-l);const c=this.events;let a=0,h=c.length;for(;a<h;a++){const m=c[a];if(m.time<l!==o)break;m.time>=n&&m.time<=i&&this.queue.event(e,m)}let d=!1;if(e.loop)if(r===0)d=!0;else{const m=Math.floor(e.trackTime/r);d=m>0&&m>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const m=c[a];m.time>=n&&m.time<=i&&this.queue.event(e,m)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,o=i-n,l=e.animation.timelines;for(let c=0,a=e.animation.timelines.length;c<a;c++){const h=l[c];if(!(h instanceof Zt))continue;const d=h.events,m=h.frames,u=m.length;if(r>=o){for(let f=0;f<u;f++)if(!(m[f]<o)){if(m[f]>=r)break;this.events.push(d[f])}}else{for(let p=0;p<u&&!(m[p]>=r);p++)this.events.push(d[p]);let f=0;for(;f<u&&!(m[f]>=o);f++);for(;f<u;f++)this.events.push(d[f])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const o=this.trackEntry(e,s,n,r);return this.setTrack(e,o,i),this.queue.drain(),o}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const o=this.trackEntry(e,s,n,r);return r?(r.next=o,o.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-o.mixDuration,0))):(this.setTrack(e,o,!0),this.queue.drain(),i<0&&(i=0)),o.delay=i,o}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Bs.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Bs.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){const i=e[s];if(!i)continue;let r=i;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,i),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(e,s){const n=e.animation.timelines,i=e.animation.timelines.length,r=e.timelineMode;r.length=i;const o=e.timelineHoldMix;o.length=0;const l=e.additive,c=e.keepHold,a=e.mixingTo;for(let h=0;h<i;h++){const d=n[h],m=d.propertyIds,u=this.from(s,d,m);if(l&&d.additive){r[h]=u;continue}let f;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(m))f=u;else{f=u|qt;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(m)){p.mixDuration>0&&(o[h]=p);break}}c&&(f=f&~qt|r[h]&qt),r[h]=f}}from(e,s,n){const i=this.propertyIds;let r=tn;for(let o=0,l=n.length;o<l;o++){const c=i.get(n[o]);if(c===void 0)i.set(n[o],e);else{if(c!==e){for(;++o<l;)i.has(n[o])||i.set(n[o],e);return ls}r=hs}}if(s instanceof $t){const o=i.get(St.propertyID);if(o!=null)return o!==e?ls:hs}return r}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ks=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=Lt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Lt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Lt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Qs=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){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const o=i[r];o.start&&o.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const o=i[r];o.interrupt&&o.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const o=i[r];o.end&&o.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const o=i[r];o.dispose&&o.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const o=i[r];o.complete&&o.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let o=0;o<i.length;o++){const l=i[o];l.event&&l.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Zs=(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))(Zs||{}),Hn=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},ls=0,tn=1,hs=2,ds=3,qt=4,fs=1,us=2,Gn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},jn=class{constructor(t,e="",s=new sn,n=new en){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,o)=>{const l=`Couldn't load binary ${t}: status ${r}, ${o}`;this.error(s,t,l),i(l)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,o)=>{const l=`Couldn't load JSON ${t}: status ${r}, ${o}`;this.error(s,t,l),i(l)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(c=>{if(c.ok)return c.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{if(c){const a=this.createTexture(t,n,c);this.success(e,t,a),i(a)}});else{const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{const a=this.createTexture(t,n,c);this.success(e,t,a),i(a)},c.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),c.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,l)=>{this.downloader.downloadText(t,c=>{try{const a=this.createTextureAtlas(c,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),o(a);return}for(const m of a.pages)this.loadTexture(this.texturePath(r,m.name,n),(u,f)=>{d||(m.setTexture(f),--h===0&&(this.success(e,t,a),o(a)))},(u,f)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${u}`;this.error(s,t,p),l(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),l(h)}},(c,a)=>{const h=`Couldn't load texture atlas ${t}: status ${c}, ${a}`;this.error(s,t,h),l(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,o)=>{this.downloader.downloadText(t,l=>{try{const c=this.createTextureAtlas(l,i,t);this.success(e,t,c),r(c)}catch(c){const a=`Couldn't parse texture atlas ${t}: ${c.message}`;this.error(s,t,a),o(a)}},(l,c)=>{const a=`Couldn't load texture atlas ${t}: status ${l}, ${c}`;this.error(s,t,a),o(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
2
+ ${s}`:""}`)}remove(t){t=this.pathPrefix+t;const e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(const t in this.cache.assets){const e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Ce){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,s,n){const i=new Ce(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const o=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+o]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},en=class Te{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Te.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Te;return Te.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},sn=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!==-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let 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(e===-1)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;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(o){this.finish(t,400,JSON.stringify(o))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(o){this.finish(t,400,JSON.stringify(o))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.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){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},ms=class An extends bt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new An(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},_t=class In extends bt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new In(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},te=class Cn extends bt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Cn(this.name);return this.copyTo(e),e.lengths=[],B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},nn=class Mn extends bt{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*R.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,o=n*e.c+i*e.d;return R.atan2Deg(o,r)}copy(){const e=new Mn(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Jn=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Pt(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Tt(s,i)}newBoundingBoxAttachment(t,e,s){return new ms(s)}newPathAttachment(t,e,s){return new te(s)}newPointAttachment(t,e,s){return new nn(s)}newClippingAttachment(t,e,s){return new _t(s)}},ee=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},gs=class Yn extends ee{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new ne),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new Yn(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},se=(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))(se||{}),ne=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");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}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,m=t.scaleY,u=(e+i)*R.degRad,f=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(f)*n*d,this.c=Math.sin(u)*s*m,this.d=Math.sin(f)*n*m,this.worldX=this.x*d+t.x,this.worldY=this.y*m+t.y;return}const o=this.bone.parent.appliedPose;let l=o.a,c=o.b,a=o.c,h=o.d;switch(this.worldX=l*this.x+c*this.y+o.worldX,this.worldY=a*this.x+h*this.y+o.worldY,this.inherit){case 0:{const d=(e+i)*R.degRad,m=(e+90+r)*R.degRad,u=Math.cos(d)*s,f=Math.cos(m)*n,p=Math.sin(d)*s,g=Math.sin(m)*n;this.a=l*u+c*p,this.b=l*f+c*g,this.c=a*u+h*p,this.d=a*f+h*g;return}case 1:{const d=t.scaleX,m=t.scaleY,u=(e+i)*R.degRad,f=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(f)*n*d,this.c=Math.sin(u)*s*m,this.d=Math.sin(f)*n*m;break}case 2:{const d=t.scaleX,m=t.scaleY,u=1/d,f=1/m;l*=u,a*=f;let p=l*l+a*a,g=0;p>R.epsilon2?(p=Math.abs(l*h*f-c*u*a)/p,c=a*p,h=l*p,g=e-R.atan2Deg(a,l)):(l=0,a=0,g=e-90+R.atan2Deg(h,c));const b=(g+i)*R.degRad,x=(g+r+90)*R.degRad,w=Math.cos(b)*s,v=Math.cos(x)*n,y=Math.sin(b)*s,T=Math.sin(x)*n;this.a=(l*w-c*y)*d,this.b=(l*v-c*T)*d,this.c=(a*w+h*y)*m,this.d=(a*v+h*T)*m;break}case 3:case 4:{const d=t.scaleX,m=t.scaleY,u=1/d,f=1/m,p=e*R.degRad,g=Math.cos(p),b=Math.sin(p);let x=(l*g+c*b)*u,w=(a*g+h*b)*f;const v=1/Math.sqrt(x*x+w*w);x*=v,w*=v;let y=-w,T=x;this.inherit===3&&l*h-c*a<0!=(d<0!=m<0)&&(y=-y,T=-T);const S=i*R.degRad,A=(90+r)*R.degRad,C=Math.cos(S)*s,M=Math.cos(A)*n,Y=Math.sin(S)*s,F=Math.sin(A)*n;this.a=(x*C+y*Y)*d,this.b=(x*M+y*F)*d,this.c=(w*C+T*Y)*m,this.d=(w*M+T*F)*m;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;const e=t.scaleX,s=t.scaleY;if(!this.bone.parent){const g=1/e,b=1/s;this.x=(this.worldX-t.x)*g,this.y=(this.worldY-t.y)*b,this.set5(this.a*g,this.b*g,this.c*b,this.d*b,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,o=n.c,l=n.d;const c=i*l-r*o,a=1/(i*l-r*o),h=l*a,d=r*a,m=o*a,u=i*a,f=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=f*h-p*d,this.y=p*u-f*m,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,u*this.c-m*this.a,u*this.d-m*this.b,0);break;case 1:{const g=1/e,b=1/s;this.set5(this.a*g,this.b*g,this.c*b,this.d*b,0);break}case 2:{const g=1/e,b=1/s;i*=g,o*=b;const x=this.a*g,w=this.b*g,v=this.c*b,y=this.d*b,T=1/(i*i+o*o),S=1/Math.abs(c*g*b);this.set5((i*x+o*v)*T,(i*w+o*y)*T,(i*v-o*x)*S,(i*y-o*w)*S,R.atan2Deg(o,i));break}case 3:case 4:{const g=1/e,b=1/s,x=this.a*g,w=this.b*g,v=this.c*b,y=this.d*b;let T=l*this.a-r*this.c,S=i*this.c-o*this.a;c<0&&(T=-T,S=-S);let A=R.atan2Deg(S,T);this.rotation=A,A*=R.degRad;const C=Math.cos(A),M=Math.sin(A);let Y=(i*C+r*M)*g,F=(o*C+l*M)*b;const E=1/Math.sqrt(Y*Y+F*F);Y*=E,F*=E;const X=this.inherit===3&&c<0!=(e<0!=s<0)?-1:1;this.set4(Y*x+F*v,Y*w+F*y,(Y*v-F*x)*X,(Y*y-F*w)*X)}}}set4(t,e,s,n){const i=t*t+s*s,r=e*e+n*n;i>R.epsilon2?(this.shearX=R.atan2Deg(s,t),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,s,n,i){this.shearX=0;const r=t*t+s*s,o=e*e+n*n;if(r>R.epsilon2){const l=R.atan2Deg(s,t);this.rotation=l+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(o),o>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-l):this.shearY-=90+l,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(o),this.shearY=0,this.rotation=o>R.epsilon2?R.atan2Deg(n,e)-90+i:i}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t,t._update)}modifyWorld(t){const e=t._update;this.local=e,this.world=e,this.resetWorld(t,e)}resetWorld(t,e){const s=this.bone.children;for(let n=0,i=s.length;n<i;n++){const r=s[n].appliedPose;r.world===e&&(r.local===e&&r.updateLocalTransform(t),r.world=0,r.resetWorld(t,e))}}getWorldRotationX(){return R.atan2Deg(this.c,this.a)}getWorldRotationY(){return R.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const 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(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},ps=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},bs=class extends ps{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},ie=class Pn extends bs{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new ne,new ne),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Pn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends bs{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},rn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,B.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,B.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends ee{constructor(t,e){super(t,e)}},re=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(re||{}),ae=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},xs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new ae(-1,this);constructor(t){this.name=t}},oe=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},an=class Mt extends Et{bones;target;constructor(e,s){if(super(e,new oe,new oe),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Mt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Mt.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Mt.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,o,l,c,a,h){typeof n=="number"?Mt.apply1(e,s,n,i,r,o,l,c):Mt.apply2(e,s,n,i,r,o,l,c,a,h)}static apply1(e,s,n,i,r,o,l,c){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,m=a.c,u=a.d,f=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*R.signum(e.scaleX),g=(i-s.worldY)*R.signum(e.scaleY);break;case 2:{const b=Math.abs(h*u-d*m)/Math.max(R.epsilon,h*h+m*m),x=h/e.scaleX,w=m/e.scaleY;d=-w*b*e.scaleX,u=x*b*e.scaleY,f+=R.atan2Deg(w,x)}default:{const b=n-a.worldX,x=i-a.worldY,w=h*u-d*m;Math.abs(w)<=R.epsilon?(p=0,g=0):(p=(b*u-x*d)/w-s.x,g=(x*h-b*m)/w-s.y)}}if(f+=R.atan2Deg(g,p),s.scaleX<0&&(f+=180),f>180?f-=360:f<=-180&&(f+=360),s.rotation+=f*c,r||o){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const b=s.bone.data.length*s.scaleX;if(b>R.epsilon){const x=p*p+g*g;if(r&&x<b*b||o&&x>b*b){const w=(Math.sqrt(x)/b-1)*c+1;switch(s.scaleX*=w,l){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(e,s,n,i,r,o,l,c,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,m=s.y,u=s.scaleX,f=s.scaleY,p=n.scaleX,g=0,b=0,x=0;u<0?(u=-u,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,b=180):b=0;let w=0,v=0,y=s.a,T=s.b,S=s.c,A=s.d;const C=Math.abs(u-f)<=R.epsilon;!C||l?(n.y=0,w=y*n.x+s.worldX,v=S*n.x+s.worldY):(w=y*n.x+T*n.y+s.worldX,v=S*n.x+A*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,T=M.b,S=M.c,A=M.d;let Y=y*A-T*S,F=w-M.worldX,E=v-M.worldY;Y=Math.abs(Y)<=R.epsilon?0:1/Y;const X=(F*A-E*T)*Y-d,V=(E*y-F*S)*Y-m;let N=Math.sqrt(X*X+V*V),U=n.bone.data.length*p,O,P;if(N<R.epsilon){Mt.apply(e,s,i,r,!1,l,0,h),n.rotation=0;return}F=i-M.worldX,E=r-M.worldY;let k=(F*A-E*T)*Y-d,$=(E*y-F*S)*Y-m,D=k*k+$*$;if(a!==0){a*=u*(p+1)*.5;const L=Math.sqrt(D),_=L-N-U*u+a;if(_>0){let q=Math.min(1,_/(a*2))-1;q=(_-a*(1-q*q))/L,k-=q*k,$-=q*$,D=k*k+$*$}}t:if(C){U*=u;let L=(D-N*N-U*U)/(2*N*U);if(L<-1)L=-1,P=Math.PI*o;else if(L>1){if(L=1,P=0,l)switch(y=(Math.sqrt(D)/(N+U)-1)*h+1,s.scaleX*=y,c){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else P=Math.acos(L)*o;y=N+U*L,T=U*Math.sin(P),O=Math.atan2($*y-k*T,k*y+$*T)}else{y=u*U,T=f*U;const L=y*y,_=T*T,q=Math.atan2($,k);S=_*N*N+L*D-L*_;const J=-2*_*N,tt=_-L;if(A=J*J-4*tt*S,A>=0){let mt=Math.sqrt(A);J<0&&(mt=-mt),mt=-(J+mt)*.5;let pt=mt/tt,Gt=S/mt;const ye=Math.abs(pt)<Math.abs(Gt)?pt:Gt;if(pt=D-ye*ye,pt>=0){E=Math.sqrt(pt)*o,O=q-Math.atan2(E,ye),P=Math.atan2(E/f,(ye-N)/u);break t}}let K=R.PI,et=N-y,nt=et*et,st=0,ht=0,it=N+y,rt=it*it,dt=0;S=-y*N/(L-_),S>=-1&&S<=1&&(S=Math.acos(S),F=y*Math.cos(S)+N,E=T*Math.sin(S),A=F*F+E*E,A<nt&&(K=S,nt=A,et=F,st=E),A>rt&&(ht=S,rt=A,it=F,dt=E)),D<=(nt+rt)*.5?(O=q-Math.atan2(st*o,et),P=K*o):(O=q-Math.atan2(dt*o,it),P=ht*o)}const W=Math.atan2(n.y,n.x)*x;O=(O-W)*R.radDeg+g-s.rotation,O>180?O-=360:O<=-180&&(O+=360),s.rotation+=O*h,P=((P+W)*R.radDeg-n.shearX)*x+b-n.rotation,P>180?P-=360:P<=-180&&(P+=360),n.rotation+=P*h}},zt=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new oe)}create(t){return new an(this,t)}},ce=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Wt=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new ce)}create(t){return new on(this,t)}},ws=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(ws||{}),ys=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ys||{}),vs=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(vs||{}),on=class Yt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new ce,new ce),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new Yt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof te))return;const i=this.appliedPose,r=i.mixRotate,o=i.mixX,l=i.mixY;if(r===0&&o===0&&l===0)return;const c=this.data,a=c.rotateMode===0,h=c.rotateMode===2,d=this.bones,m=d.length,u=a?m:m+1,f=B.setArraySize(this.spaces,u),p=h?this.lengths=B.setArraySize(this.lengths,m):[],g=i.spacing;switch(c.spacingMode){case 2:if(h)for(let T=0,S=u-1;T<S;T++){const A=d[T],C=A.bone.data.length,M=C*A.a,Y=C*A.c;p[T]=Math.sqrt(M*M+Y*Y)}B.arrayFill(f,1,u,g);break;case 3:{let T=0;for(let S=0,A=u-1;S<A;){const C=d[S],M=C.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),f[++S]=g;else{const Y=M*C.a,F=M*C.c,E=Math.sqrt(Y*Y+F*F);h&&(p[S]=E),f[++S]=E,T+=E}}if(T>0){T=u/T*g;for(let S=1;S<u;S++)f[S]*=T}break}default:{const T=c.spacingMode===0;for(let S=0,A=u-1;S<A;){const C=d[S],M=C.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),f[++S]=g;else{const Y=M*C.a,F=M*C.c,E=Math.sqrt(Y*Y+F*F);h&&(p[S]=E),f[++S]=(T?Math.max(0,M+g):g)*E/M}}}}const b=this.computeWorldPositions(e,n,u,a);let x=b[0],w=b[1],v=c.offsetRotation,y=!1;if(v===0)y=c.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?R.degRad:-R.degRad}for(let T=0,S=3;T<m;T++,S+=3){const A=d[T];A.modifyWorld(e),A.worldX+=(x-A.worldX)*o,A.worldY+=(w-A.worldY)*l;const C=b[S],M=b[S+1],Y=C-x,F=M-w;if(h){const E=p[T];if(E!==0){const X=(Math.sqrt(Y*Y+F*F)/E-1)*r+1;A.a*=X,A.c*=X}}if(x=C,w=M,r>0){let E=A.a,X=A.b,V=A.c,N=A.d,U=0,O=0,P=0;if(a?U=b[S-1]:f[T+1]===0?U=b[S+2]:U=Math.atan2(F,Y),U-=Math.atan2(V,E),y){O=Math.cos(U),P=Math.sin(U);const k=A.bone.data.length;x+=(k*(O*E-P*V)-Y)*r,w+=(k*(P*E+O*V)-F)*r}else U+=v;U>R.PI?U-=R.PI2:U<-R.PI&&(U+=R.PI2),U*=r,O=Math.cos(U),P=Math.sin(U),A.a=O*E-P*V,A.b=O*X-P*N,A.c=P*E+O*V,A.d=P*X+O*N}}}computeWorldPositions(e,s,n,i){const r=this.slot;let o=this.appliedPose.position,l=this.spaces,c=B.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,m=d/6,u=Yt.NONE;if(!s.constantSpeed){const P=s.lengths;m-=h?1:2;const k=P[m];this.data.positionMode===1&&(o*=k);let $;switch(this.data.spacingMode){case 2:$=k;break;case 3:$=k/n;break;default:$=1}a=B.setArraySize(this.world,8);for(let D=0,W=0,L=0;D<n;D++,W+=3){const _=l[D]*$;o+=_;let q=o;if(h)q%=k,q<0&&(q+=k),L=0;else if(q<0){u!==Yt.BEFORE&&(u=Yt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition(q,a,0,c,W);continue}else if(q>k){u!==Yt.AFTER&&(u=Yt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition(q-k,a,0,c,W);continue}for(;;L++){const J=P[L];if(!(q>J)){if(L===0)q/=J;else{const tt=P[L-1];q=(q-tt)/(J-tt)}break}}L!==u&&(u=L,h&&L===m?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*6+2,8,a,0,2)),this.addCurvePosition(q,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],c,W,i||D>0&&_===0)}return c}h?(d+=2,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(m--,d-=4,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const f=B.setArraySize(this.curves,m);let p=0,g=a[0],b=a[1],x=0,w=0,v=0,y=0,T=0,S=0,A=0,C=0,M=0,Y=0,F=0,E=0,X=0,V=0;for(let P=0,k=2;P<m;P++,k+=6)x=a[k],w=a[k+1],v=a[k+2],y=a[k+3],T=a[k+4],S=a[k+5],A=(g-x*2+v)*.1875,C=(b-w*2+y)*.1875,M=((x-v)*3-g+T)*.09375,Y=((w-y)*3-b+S)*.09375,F=A*2+M,E=C*2+Y,X=(x-g)*.75+A+M*.16666667,V=(w-b)*.75+C+Y*.16666667,p+=Math.sqrt(X*X+V*V),X+=F,V+=E,F+=M,E+=Y,p+=Math.sqrt(X*X+V*V),X+=F,V+=E,p+=Math.sqrt(X*X+V*V),X+=F+M,V+=E+Y,p+=Math.sqrt(X*X+V*V),f[P]=p,g=T,b=S;this.data.positionMode===1&&(o*=p);let N;switch(this.data.spacingMode){case 2:N=p;break;case 3:N=p/n;break;default:N=1}const U=this.segments;let O=0;for(let P=0,k=0,$=0,D=0;P<n;P++,k+=3){const W=l[P]*N;o+=W;let L=o;if(h)L%=p,L<0&&(L+=p),$=0,D=0;else if(L<0){this.addBeforePosition(L,a,0,c,k);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,c,k);continue}for(;;$++){const _=f[$];if(!(L>_)){if($===0)L/=_;else{const q=f[$-1];L=(L-q)/(_-q)}break}}if($!==u){u=$;let _=$*6;for(g=a[_],b=a[_+1],x=a[_+2],w=a[_+3],v=a[_+4],y=a[_+5],T=a[_+6],S=a[_+7],A=(g-x*2+v)*.03,C=(b-w*2+y)*.03,M=((x-v)*3-g+T)*.006,Y=((w-y)*3-b+S)*.006,F=A*2+M,E=C*2+Y,X=(x-g)*.3+A+M*.16666667,V=(w-b)*.3+C+Y*.16666667,O=Math.sqrt(X*X+V*V),U[0]=O,_=1;_<8;_++)X+=F,V+=E,F+=M,E+=Y,O+=Math.sqrt(X*X+V*V),U[_]=O;X+=F,V+=E,O+=Math.sqrt(X*X+V*V),U[8]=O,X+=F+M,V+=E+Y,O+=Math.sqrt(X*X+V*V),U[9]=O,D=0}for(L*=O;;D++){const _=U[D];if(!(L>_)){if(D===0)L/=_;else{const q=U[D-1];L=D+(L-q)/(_-q)}break}}this.addCurvePosition(L*.1,g,b,x,w,v,y,T,S,c,k,i||P>0&&W===0)}return c}addBeforePosition(e,s,n,i,r){const o=s[n],l=s[n+1],c=s[n+2]-o,a=s[n+3]-l,h=Math.atan2(a,c);i[r]=o+e*Math.cos(h),i[r+1]=l+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const o=s[n+2],l=s[n+3],c=o-s[n],a=l-s[n+1],h=Math.atan2(a,c);i[r]=o+e*Math.cos(h),i[r+1]=l+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,o,l,c,a,h,d,m){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const u=e*e,f=u*e,p=1-e,g=p*p,b=g*p,x=p*e,w=x*3,v=p*w,y=w*e,T=s*b+i*v+o*y+c*f,S=n*b+r*v+l*y+a*f;h[d]=T,h[d+1]=S,m&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*x*2+l*u),T-(s*g+i*x*2+o*u)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let o=0;o<r;o++){const l=i[o].bone;e.sortBone(l),e.constrained(l)}e._updateCache.push(this);for(let o=0;o<r;o++)e.sortReset(i[o].bone.children);for(let o=0;o<r;o++)i[o].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let o=0,l=r.length;o<l;o++){const c=r[o];c.slotIndex===n&&this.sortPath(e,c.attachment,i)}}sortPath(e,s,n){if(!(s instanceof te))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let o=0,l=i.length;o<l;){let c=i[o++];for(c+=o;o<c;)e.sortBone(r[i[o++]])}}}isSourceActive(){return this.slot.bone.active}},cn=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(cn||{}),le=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){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}},he=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof bt)||!(this.attachment instanceof bt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},ln=class kn extends ps{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new he,new he),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new kn(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},hn=class Se{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Se.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Se.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new ie(n,null);else{const r=this.bones[n.parent.index];i=new ie(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new ln(s,this));this.drawOrder=new rn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof Ts&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let o=0,l=e.length;o<l;o++)e[o].unconstrained();const s=this.bones,n=s.length;for(let o=0,l=n;o<l;o++){const c=s[o];c.sorted=c.data.skinRequired,c.active=!c.sorted,c.unconstrained()}if(this.skin){const o=this.skin.bones;for(let l=0,c=this.skin.bones.length;l<c;l++){let a=this.bones[o[l].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let o=0;o<r;o++)i[o].unconstrained();for(let o=0;o<r;o++){const l=i[o];l.active=l.isSourceActive()&&(!l.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(l.data)),l.active&&l.sort(this)}for(let o=0;o<n;o++)this.sortBone(s[o]);r=this._updateCache.length;for(let o=0;o<r;o++){const l=this._updateCache[o];l instanceof ie&&(this._updateCache[o]=l.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],o=r.data.attachmentName;if(o){const l=e.getAttachment(n,o);l&&r.pose.setAttachment(l)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const o=n[i];if(o instanceof s&&o.data.name===e)return o}return null}getBoundsRect(e){const s=new Ie,n=new Ie;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.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.");const r=this.drawOrder.appliedPose,o=r;let l=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,m=r.length;d<m;d++){const u=o[d];if(!u.bone.active)continue;let f=0,p=null,g=null;const b=u.appliedPose.attachment;if(b){if(b instanceof Pt)f=8,p=B.setArraySize(n,f,0),b.computeWorldVertices(u,b.getOffsets(u.appliedPose),p,0,2),g=Se.quadTriangles;else if(b instanceof Tt)f=b.worldVerticesLength,p=B.setArraySize(n,f,0),b.computeWorldVertices(this,u,0,f,p,0,2),g=b.triangles;else if(b instanceof _t&&i){i.clipEnd(u),i.clipStart(this,u,b);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,f=i.clippedVertices.length);for(let x=0,w=p.length;x<w;x+=2){const v=p[x],y=p[x+1];l=Math.min(l,v),c=Math.min(c,y),a=Math.max(a,v),h=Math.max(h,y)}}}i&&i.clipEnd(u)}i&&i.clipEnd(),e.set(l,c),s.set(a-l,h-c)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,o=i.length;r<o;r++)i[r].rotate(e,s,n)}},Ts=class Fn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new le,new le),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new Fn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*R.degRad,r=Math.cos(i),o=Math.sin(i),l=this.cx-e,c=this.cy-s;this.translate(l*r-c*o-l,l*o+c*r-c)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,o=this.data.y>0,l=this.data.rotate>0||this.data.shearX>0,c=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,m=0;if(s!==0){switch(a.modifyWorld(e),s){case 1:this.reset(e);case 2:{const u=Math.max(e.time-this.lastTime,0),f=this.remaining;this.remaining+=u,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let b=this.remaining,x=n.inertia,w=e.data.referenceScale,v=-1,y=0,T=0,S=this.data.limit*u,A=S*Math.abs(e.scaleY);if(S*=Math.abs(e.scaleX),r||o){if(r){const C=(this.ux-p)*x;this.xOffset+=C>S?S:C<-S?-S:C,this.ux=p}if(o){const C=(this.uy-g)*x;this.yOffset+=C>A?A:C<-A?-A:C,this.uy=g}if(b>=d){const C=this.xOffset,M=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,T=n.strength;const Y=w*n.wind,F=w*n.gravity,E=(Y*e.windX+F*e.gravityX)*e.scaleX,X=(Y*e.windY+F*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),o&&(this.yVelocity-=(X+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),b-=d;while(b>=d);this.xLag=this.xOffset-C,this.yLag=this.yOffset-M}m=Math.max(0,1-b/d),r&&(a.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(l||c){let C=Math.atan2(a.c,a.a),M=0,Y=0,F=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>S?E=S:E<-S&&(E=-S),X>A?X=A:X<-A&&(X=-A),b=this.remaining,l){F=(this.data.rotate+this.data.shearX)*i,m=this.rotateLag*Math.max(0,1-f/d);let V=Math.atan2(X+this.ty,E+this.tx)-C-(this.rotateOffset-m)*F;this.rotateOffset+=(V-Math.ceil(V*R.invPI2-.5)*R.PI2)*x,V=(this.rotateOffset-m)*F+C,M=Math.cos(V),Y=Math.sin(V),c&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*Y)*x/V))}else{M=Math.cos(C),Y=Math.sin(C);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-f/d);V>0&&(this.scaleOffset+=(E*M+X*Y)*x/V)}if(b>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,T=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,N=(n.wind*e.windY+n.gravity*e.gravityY)*hn.yDir,U=this.rotateOffset,O=this.scaleOffset,P=h/w;for(;;)if(b-=d,c&&(this.scaleVelocity+=(V*M-N*Y-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),l){if(this.rotateVelocity-=((V*Y+N*M)*P+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,b<d)break;const k=this.rotateOffset*F+C;M=Math.cos(k),Y=Math.sin(k)}else if(b<d)break;this.rotateLag=this.rotateOffset-U,this.scaleLag=this.scaleOffset-O}m=Math.max(0,1-b/d)}this.remaining=b}this.cx=a.worldX,this.cy=a.worldY;break}case 3:m=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),o&&(a.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(l){let u=(this.rotateOffset-this.rotateLag*m)*i,f=0,p=0,g=0;if(this.data.shearX>0){let b=0;this.data.rotate>0&&(b=u*this.data.rotate,f=Math.sin(b),p=Math.cos(b),g=a.b,a.b=p*g-f*a.d,a.d=f*g+p*a.d),b+=u*this.data.shearX,f=Math.sin(b),p=Math.cos(b),g=a.a,a.a=p*g-f*a.c,a.c=f*g+p*a.c}else u*=this.data.rotate,f=Math.sin(u),p=Math.cos(u),g=a.a,a.a=p*g-f*a.c,a.c=f*g+p*a.c,g=a.b,a.b=p*g-f*a.d,a.d=f*g+p*a.d}if(c){let u=1+(this.scaleOffset-this.scaleLag*m)*i*this.data.scaleX;switch(a.a*=u,a.c*=u,this.data.scaleYMode){case 1:a.b*=u,a.d*=u;break;case 2:u=Math.abs(u),u=u>=.7?1/u:4-3.67347*u,a.b*=u,a.d*=u}}s!==3&&(this.tx=h*a.a,this.ty=h*a.c)}}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},Ht=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}constructor(t){super(t,new le)}create(t){return new Ts(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var de=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},dn=class Os extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Os(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,o=this.bone;if(o!==null){if(!o.active)return;i.local&&o.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,o.appliedPose,i.local,Os.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const l=e.bones,c=r.bones;for(let a=0,h=r.bones.length;a<h;a++)l[c[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,0,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,m=n.animation.bones.length;d<m;d++){const u=i[r[d]];u.sorted=!1,e.sortReset(u.children),e.constrained(u)}const o=n.animation.timelines,l=e.slots,c=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,m=n.animation.timelines.length;d<m;d++){const u=o[d];if(Gs(u))e.constrained(l[u.slotIndex]);else if(u instanceof St||u instanceof $t)e.drawOrder.constrained();else if(u instanceof gt)if(u.constraintIndex===-1)for(let f=0;f<h;f++)e.constrained(a[f]);else e.constrained(c[u.constraintIndex]);else if(Js(u)){const f=u.constraintIndex;f!==-1&&e.constrained(c[f])}}}},yt=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(t){super(t,new de)}create(t){return new dn(this,t)}},Ss=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof yt&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},As=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},fe=class{name;attachments=[];bones=[];constraints=[];color=new z(.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.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof Tt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new As(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new As(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++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const o=e.attachments[s];for(const l in o){const c=o[l];if(r===c){const a=this.getAttachment(s,l);a&&i.pose.setAttachment(a);break}}}s++}}},Is=class extends ee{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new he),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Cs=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Cs||{}),ue=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},fn=class En extends Et{bones;source;constructor(e,s){if(super(e,new ue,new ue),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new En(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,o=i.localTarget,l=i.additive,c=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,m=i.properties.length,u=this.bones;for(let f=0,p=this.bones.length;f<p;f++){const g=u[f];o?g.modifyLocal(e):g.modifyWorld(e);for(let b=0;b<m;b++){const x=d[b],w=x.value(e,h,r,a)-x.offset,v=x.to;for(let y=0,T=x.to.length;y<T;y++){const S=v[y];if(S.mix(n)!==0){let A=S.offset+w*S.scale;c&&(S.offset<S.max?A=R.clamp(A,S.offset,S.max):A=R.clamp(A,S.max,S.offset)),S.apply(e,n,g,A,o,l)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const o=s[r].bone;e.sortReset(o.children),e.constrained(o)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},j=class lt extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new ue)}create(e){return new fn(this,e)}getOffsetRotation(){return this.offsets[lt.ROTATION]}setOffsetRotation(e){this.offsets[lt.ROTATION]=e}getOffsetX(){return this.offsets[lt.X]}setOffsetX(e){this.offsets[lt.X]=e}getOffsetY(){return this.offsets[lt.Y]}setOffsetY(e){this.offsets[lt.Y]=e}getOffsetScaleX(){return this.offsets[lt.SCALEX]}setOffsetScaleX(e){this.offsets[lt.SCALEX]=e}getOffsetScaleY(){return this.offsets[lt.SCALEY]}setOffsetScaleY(e){this.offsets[lt.SCALEY]=e}getOffsetShearY(){return this.offsets[lt.SHEARY]}setOffsetShearY(e){this.offsets[lt.SHEARY]=e}},At=class{offset=0;to=[]},It=class{offset=0;max=0;scale=0},me=class extends At{value(t,e,s,n){if(s)return e.rotation+n[j.ROTATION];const i=t.scaleX,r=t.scaleY;let o=Math.atan2(e.c/r,e.a/i)*R.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[j.ROTATION]:-n[j.ROTATION]);return o<0&&(o+=360),o}},Ms=class extends It{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const o=t.scaleX,l=t.scaleY,c=1/o,a=1/l,h=s.a*c,d=s.b*c,m=s.c*a,u=s.d*a;n*=R.degRad,r||(n-=Math.atan2(m,h)),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2),n*=e.mixRotate;const f=Math.cos(n),p=Math.sin(n);s.a=(f*h-p*m)*o,s.b=(f*d-p*u)*o,s.c=(p*h+f*m)*l,s.d=(p*d+f*u)*l}}},ge=class extends At{value(t,e,s,n){return s?e.x+n[j.X]:(n[j.X]*e.a+n[j.Y]*e.b+e.worldX)/t.scaleX}},Ys=class extends It{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},pe=class extends At{value(t,e,s,n){return s?e.y+n[j.Y]:(n[j.X]*e.c+n[j.Y]*e.d+e.worldY)/t.scaleY}},Ps=class extends It{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},be=class extends At{value(t,e,s,n){if(s)return e.scaleX+n[j.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEX]}},ks=class extends It{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const o=1+(n-1)*e.mixScaleX;s.a*=o,s.c*=o}else{let o=s.a/t.scaleX,l=s.c/t.scaleY,c=Math.sqrt(o*o+l*l);c!==0&&(c=1+(n-c)*e.mixScaleX/c,s.a*=c,s.c*=c)}}},xe=class extends At{value(t,e,s,n){if(s)return e.scaleY+n[j.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEY]}},Fs=class extends It{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const o=1+(n-1)*e.mixScaleY;s.b*=o,s.d*=o}else{let o=s.b/t.scaleX,l=s.d/t.scaleY,c=Math.sqrt(o*o+l*l);c!==0&&(c=1+(n-c)*e.mixScaleY/c,s.b*=c,s.d*=c)}}},we=class extends At{value(t,e,s,n){if(s)return e.shearY+n[j.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*R.radDeg-90+n[j.SHEARY]}},Es=class extends It{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const o=t.scaleX,l=t.scaleY,c=s.b/o,a=s.d/l,h=Math.atan2(a,c);n=(n+90)*R.degRad,r?n-=R.PI/2:(n-=h-Math.atan2(s.c/l,s.a/o),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(c*c+a*a);s.b=Math.cos(n)*d*o,s.d=Math.sin(n)*d*l}}},Kn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ss;s.name="";const n=new un(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const o=n.readBoolean();o&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let u=0;u<l;u++){const f=n.readString();if(!f)throw new Error("String in string table must not be null.");n.strings.push(f)}const c=s.bones;l=n.readInt(!0);for(let u=0;u<l;u++){const f=n.readString();if(!f)throw new Error("Bone name must not be null.");const p=u===0?null:c[n.readInt(!0)],g=new gs(u,f,p),b=g.setupPose;b.rotation=n.readFloat(),b.x=n.readFloat()*e,b.y=n.readFloat()*e,b.scaleX=n.readFloat(),b.scaleY=n.readFloat(),b.shearX=n.readFloat(),b.shearY=n.readFloat(),b.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),o&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),c.push(g)}l=n.readInt(!0);for(let u=0;u<l;u++){const f=n.readString();if(!f)throw new Error("Slot name must not be null.");const p=c[n.readInt(!0)],g=new Is(u,f,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const b=n.readInt32();b!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,b),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),o&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let u=0;u<h;u++){const f=n.readString();if(!f)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case xi:{const g=new zt(f);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(c[n.readInt(!0)]);g.target=c[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const x=g.setupPose;x.bendDirection=(b&4)!==0?-1:1,x.compress=(b&8)!==0,x.stretch=(b&16)!==0,(b&32)!==0&&(x.mix=(b&64)!==0?n.readFloat():1),(b&128)!==0&&(x.softness=n.readFloat()*e),a.push(g);break}case yi:{const g=new j(f);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(c[n.readInt(!0)]);g.source=c[n.readInt(!0)];let b=n.readUnsignedByte();g.skinRequired=(b&1)!==0,g.localSource=(b&2)!==0,g.localTarget=(b&4)!==0,g.additive=(b&8)!==0,g.clamp=(b&16)!==0,p=b>>5;for(let w=0,v;w<p;w++){let y=1,T;switch(n.readByte()){case 0:T=new me;break;case 1:{y=e,T=new ge;break}case 2:{y=e,T=new pe;break}case 3:T=new be;break;case 4:T=new xe;break;case 5:T=new we;break;default:T=null}if(T){T.offset=n.readFloat()*y,v=n.readByte();for(let S=0;S<v;S++){let A=1,C;switch(n.readByte()){case 0:C=new Ms;break;case 1:{A=e,C=new Ys;break}case 2:{A=e,C=new Ps;break}case 3:C=new ks;break;case 4:C=new Fs;break;case 5:C=new Es;break;default:C=null}C&&(C.offset=n.readFloat()*A,C.max=n.readFloat()*A,C.scale=n.readFloat()*A/y,T.to[S]=C)}g.properties[w]=T}}b=n.readByte(),(b&1)!==0&&(g.offsets[j.ROTATION]=n.readFloat()),(b&2)!==0&&(g.offsets[j.X]=n.readFloat()*e),(b&4)!==0&&(g.offsets[j.Y]=n.readFloat()*e),(b&8)!==0&&(g.offsets[j.SCALEX]=n.readFloat()),(b&16)!==0&&(g.offsets[j.SCALEY]=n.readFloat()),(b&32)!==0&&(g.offsets[j.SHEARY]=n.readFloat()),b=n.readByte();const x=g.setupPose;(b&1)!==0&&(x.mixRotate=n.readFloat()),(b&2)!==0&&(x.mixX=n.readFloat()),(b&4)!==0&&(x.mixY=n.readFloat()),(b&8)!==0&&(x.mixScaleX=n.readFloat()),(b&16)!==0&&(x.mixScaleY=n.readFloat()),(b&32)!==0&&(x.mixShearY=n.readFloat()),a.push(g);break}case wi:{const g=new Wt(f);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(c[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const b=n.readByte();g.skinRequired=(b&1)!==0,g.positionMode=b>>1&1,g.spacingMode=b>>2&3,g.rotateMode=b>>4&3,(b&128)!==0&&(g.offsetRotation=n.readFloat());const x=g.setupPose;x.position=n.readFloat(),g.positionMode===0&&(x.position*=e),x.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(x.spacing*=e),x.mixRotate=n.readFloat(),x.mixX=n.readFloat(),x.mixY=n.readFloat(),a.push(g);break}case vi:{const g=new Ht(f);g.bone=c[n.readInt(!0)];let b=n.readByte();if(g.skinRequired=(b&1)!==0,(b&2)!==0&&(g.x=n.readFloat()),(b&4)!==0&&(g.y=n.readFloat()),(b&8)!==0&&(g.rotate=n.readFloat()),(b&16)!==0){let w=n.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(b&32)!==0&&(g.shearX=n.readFloat()),g.limit=((b&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const x=g.setupPose;x.inertia=n.readFloat(),x.strength=n.readFloat(),x.damping=n.readFloat(),x.massInverse=(b&128)!==0?n.readFloat():1,x.wind=n.readFloat(),x.gravity=n.readFloat(),b=n.readByte(),(b&1)!==0&&(g.inertiaGlobal=!0),(b&2)!==0&&(g.strengthGlobal=!0),(b&4)!==0&&(g.dampingGlobal=!0),(b&8)!==0&&(g.massGlobal=!0),(b&16)!==0&&(g.windGlobal=!0),(b&32)!==0&&(g.gravityGlobal=!0),(b&64)!==0&&(g.mixGlobal=!0),x.mix=(b&128)!==0?n.readFloat():1,a.push(g);break}case Ti:{const g=new yt(f),b=n.readByte();if(g.skinRequired=(b&1)!==0,g.loop=(b&2)!==0,g.additive=(b&4)!==0,(b&8)!==0){const x=n.readFloat();o&&(b&64)!==0?g.max=x:g.setupPose.time=x}if((b&16)!==0&&(g.setupPose.mix=(b&32)!==0?n.readFloat():1),(b&64)!==0){g.local=(b&128)!==0,g.bone=c[n.readInt(!0)];const x=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new me;break;case 1:{w=e,g.property=new ge;break}case 2:{w=e,g.property=new pe;break}case 3:g.property=new be;break;case 4:g.property=new xe;break;case 5:g.property=new we;break;default:continue}g.property.offset=x*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,o);d&&(s.defaultSkin=d,s.skins.push(d));{let u=s.skins.length;for(B.setArraySize(s.skins,l=u+n.readInt(!0));u<l;u++){const f=this.readSkin(n,s,!1,o);if(!f)throw new Error("readSkin() should not have returned null.");s.skins[u]=f}}l=this.linkedMeshes.length;for(let u=0;u<l;u++){const f=this.linkedMeshes[u],p=s.skins[f.skinIndex];if(!f.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(f.sourceIndex,f.source);if(!g)throw new Error(`Source mesh not found: ${f.source}`);f.mesh.timelineAttachment=f.inheritTimelines?g:f.mesh,f.mesh.setSourceMesh(g),f.mesh.updateSequence()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let u=0;u<l;u++){const f=n.readString();if(!f)throw new Error("Event data name must not be null");const p=new xs(f),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const m=s.animations;l=n.readInt(!0);for(let u=0;u<l;u++){const f=n.readString();if(!f)throw new Error("Animation name must not be null.");m.push(this.readAnimation(n,f,s,o))}for(let u=0;u<h;u++){const f=a[u];f instanceof yt&&(f.animation=m[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new fe("default")}else{const o=t.readString();if(!o)throw new Error("Skin name must not be null.");i=new fe(o),n&&z.rgba8888ToColor(i.color,t.readInt32());let l=t.readInt(!0),c=e.bones,a=i.bones;for(let h=0;h<l;h++)a[h]=c[t.readInt(!0)];l=t.readInt(!0),c=e.constraints,a=i.constraints;for(let h=0;h<l;h++)a[h]=c[t.readInt(!0)];r=t.readInt(!0)}for(let o=0;o<r;o++){const l=t.readInt(!0);for(let c=0,a=t.readInt(!0);c<a;c++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,l,h,n);d&&i.setAttachment(l,h,d)}}return i}readAttachment(t,e,s,n,i,r){const o=this.scale,l=t.readByte(),c=(l&8)!==0?t.readStringRef():i;if(!c)throw new Error("Attachment name must not be null");switch(l&7){case 0:{let a=(l&16)!==0?t.readStringRef():null;const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),m=(l&128)!==0?t.readFloat():0,u=t.readFloat(),f=t.readFloat(),p=t.readFloat(),g=t.readFloat(),b=t.readFloat(),x=t.readFloat();a||(a=c);const w=this.attachmentLoader.newRegionAttachment(s,i,c,a,d);return w?(w.path=a,w.x=u*o,w.y=f*o,w.scaleX=p,w.scaleY=g,w.rotation=m,w.width=b*o,w.height=x*o,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(l&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,c);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(l&16)!==0?t.readStringRef():c;const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),m=t.readInt(!0),u=this.readVertices(t,(l&128)!==0),f=this.readFloatArray(t,u.length,1),p=this.readShortArray(t,(u.length-m-2)*3),g=t.readInt(!0);let b=null;if(g>0){b=[];for(let T=0;T<g;T++)b[T]=t.readInt(!0)}let x=[],w=0,v=0;r&&(x=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),v=t.readFloat()),a||(a=c);const y=this.attachmentLoader.newMeshAttachment(s,i,c,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=m<<1,y.bones=u.bones,y.vertices=u.vertices,y.worldVerticesLength=u.length,y.regionUVs=f,y.triangles=p,b&&(y.timelineSlots=b),r&&(y.edges=x,y.width=w*o,y.height=v*o),y.updateSequence(),y):null}case 3:{const a=(l&16)!==0?t.readStringRef():c;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(l&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(l&64)!==0),m=(l&128)!==0,u=t.readInt(!0),f=t.readInt(!0),p=t.readStringRef();let g=0,b=0;r&&(g=t.readFloat(),b=t.readFloat());const x=this.attachmentLoader.newMeshAttachment(s,i,c,a,d);return x?(x.path=a,z.rgba8888ToColor(x.color,h),r&&(x.width=g*o,x.height=b*o),this.linkedMeshes.push(new Qn(x,f,n,u,p,m)),x):null}case 4:{const a=(l&16)!==0,h=(l&32)!==0,d=this.readVertices(t,(l&64)!==0),m=this.readFloatArray(t,d.length/6,o),u=r?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(s,i,c);return f?(f.closed=a,f.constantSpeed=h,f.worldVerticesLength=d.length,f.vertices=d.vertices,f.bones=d.bones,f.lengths=m,r&&z.rgba8888ToColor(f.color,u),f):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),m=r?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,i,c);return u?(u.x=h*o,u.y=d*o,u.rotation=a,r&&z.rgba8888ToColor(u.color,m),u):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(l&16)!==0),d=r?t.readInt32():0,m=this.attachmentLoader.newClippingAttachment(s,i,c);return m?(m.endSlot=e.slots[a],m.convex=(l&32)!==0,m.inverse=(l&64)!==0,m.worldVerticesLength=h.length,m.vertices=h.vertices,m.bones=h.bones,r&&z.rgba8888ToColor(m.color,d),m):null}}}readSequence(t,e){if(!e)return new Ot(1,!1);const s=new Ot(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new mn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),o=[],l=[];for(let c=0,a=0;c<r;){const h=t.readInt(!0);o[c++]=h;for(let d=0;d<h;d++,a+=3)o[c++]=t.readInt(!0),l[a]=t.readFloat()*s,l[a+1]=t.readFloat()*s,l[a+2]=t.readFloat()}return new mn(o,B.toFloatArray(l),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=x-1;switch(b){case fi:{const v=new kt(x,f);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readStringRef());i.push(v);break}case ui:{const v=t.readInt(!0),y=new Ue(x,v,f);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let Y=0,F=0;y.setFrame(Y,T,S,A,C,M),Y!==w;Y++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(Y);break;case ut:H(t,y,F++,Y,0,T,E,S,X,1),H(t,y,F++,Y,1,T,E,A,V,1),H(t,y,F++,Y,2,T,E,C,N,1),H(t,y,F++,Y,3,T,E,M,U,1)}T=E,S=X,A=V,C=N,M=U}i.push(y);break}case mi:{const v=t.readInt(!0),y=new $e(x,v,f);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let M=0,Y=0;y.setFrame(M,T,S,A,C),M!==w;M++){const F=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,T,F,S,E,1),H(t,y,Y++,M,1,T,F,A,X,1),H(t,y,Y++,M,2,T,F,C,V,1)}T=F,S=E,A=X,C=V}i.push(y);break}case gi:{const v=t.readInt(!0),y=new _e(x,v,f);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,T,S,A,C,M,Y,F,E),X!==w;X++){const N=t.readFloat(),U=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(X);break;case ut:H(t,y,V++,X,0,T,N,S,U,1),H(t,y,V++,X,1,T,N,A,O,1),H(t,y,V++,X,2,T,N,C,P,1),H(t,y,V++,X,3,T,N,M,k,1),H(t,y,V++,X,4,T,N,Y,$,1),H(t,y,V++,X,5,T,N,F,D,1),H(t,y,V++,X,6,T,N,E,W,1)}T=N,S=U,A=O,C=P,M=k,Y=$,F=D,E=W}i.push(y);break}case pi:{const v=t.readInt(!0),y=new ze(x,v,f);let T=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,T,S,A,C,M,Y,F),E!==w;E++){const V=t.readFloat(),N=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(E);break;case ut:H(t,y,X++,E,0,T,V,S,N,1),H(t,y,X++,E,1,T,V,A,U,1),H(t,y,X++,E,2,T,V,C,O,1),H(t,y,X++,E,3,T,V,M,P,1),H(t,y,X++,E,4,T,V,Y,k,1),H(t,y,X++,E,5,T,V,F,$,1)}T=V,S=N,A=U,C=O,M=P,Y=k,F=$}i.push(y);break}case bi:{const v=new qe(x,t.readInt(!0),f);let y=t.readFloat(),T=t.readUnsignedByte()/255;for(let S=0,A=0;v.setFrame(S,y,T),S!==w;S++){const C=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ft:v.setStepped(S);break;case ut:H(t,v,A++,S,0,y,C,T,M,1)}y=C,T=M}i.push(v)}}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===di){const v=new De(x,f);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat(),t.readByte());i.push(v);continue}const w=t.readInt(!0);switch(b){case ei:Z(t,i,new Dt(x,w,f),1);break;case si:Z(t,i,new Fe(x,w,f),r);break;case ni:Z(t,i,new Ee(x,w,f),r);break;case ii:Z(t,i,new Xe(x,w,f),r);break;case ri:Z(t,i,new Ve(x,w,f),1);break;case ai:Z(t,i,new Re(x,w,f),1);break;case oi:Z(t,i,new Le(x,w,f),1);break;case ci:Z(t,i,new Be(x,w,f),1);break;case li:Z(t,i,new Oe(x,w,f),1);break;case hi:Z(t,i,new Ne(x,w,f),1);break}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new Ge(p,t.readInt(!0),f);let x=t.readByte(),w=t.readFloat(),v=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,y=(x&4)!==0?t.readFloat()*r:0;for(let T=0,S=0;b.setFrame(T,w,v,y,(x&8)!==0?1:-1,(x&16)!==0,(x&32)!==0),T!==g;T++){x=t.readByte();const A=t.readFloat(),C=(x&1)!==0?(x&2)!==0?t.readFloat():1:0,M=(x&4)!==0?t.readFloat()*r:0;(x&64)!==0?b.setStepped(T):(x&128)!==0&&(H(t,b,S++,T,0,w,A,v,C,1),H(t,b,S++,T,1,w,A,y,M,r)),w=A,v=C,y=M}i.push(b)}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0),p=t.readInt(!0),g=p-1,b=new je(p,t.readInt(!0),f);let x=t.readFloat(),w=t.readFloat(),v=t.readFloat(),y=t.readFloat(),T=t.readFloat(),S=t.readFloat(),A=t.readFloat();for(let C=0,M=0;b.setFrame(C,x,w,v,y,T,S,A),C!==g;C++){const Y=t.readFloat(),F=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat(),U=t.readFloat();switch(t.readByte()){case ft:b.setStepped(C);break;case ut:H(t,b,M++,C,0,x,Y,w,F,1),H(t,b,M++,C,1,x,Y,v,E,1),H(t,b,M++,C,2,x,Y,y,X,1),H(t,b,M++,C,3,x,Y,T,V,1),H(t,b,M++,C,4,x,Y,S,N,1),H(t,b,M++,C,5,x,Y,A,U,1)}x=Y,w=F,v=E,y=X,T=V,S=N,A=U}i.push(b)}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0),p=s.constraints[f];for(let g=0,b=t.readInt(!0);g<b;g++){const x=t.readByte(),w=t.readInt(!0),v=t.readInt(!0);switch(x){case Ii:Z(t,i,new Je(w,v,f),p.positionMode===0?r:1);break;case Ci:Z(t,i,new Ke(w,v,f),p.spacingMode===0||p.spacingMode===1?r:1);break;case Mi:{const y=new Qe(w,v,f);let T=t.readFloat(),S=t.readFloat(),A=t.readFloat(),C=t.readFloat();for(let M=0,Y=0,F=y.getFrameCount()-1;y.setFrame(M,T,S,A,C),M!==F;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat();switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,T,E,S,X,1),H(t,y,Y++,M,1,T,E,A,V,1),H(t,y,Y++,M,2,T,E,C,N,1)}T=E,S=X,A=V,C=N}i.push(y)}}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0);if(b===Ri){const v=new as(x,f);for(let y=0;y<x;y++)v.setFrame(y,t.readFloat());i.push(v);continue}const w=t.readInt(!0);switch(b){case Yi:Z(t,i,new Ze(x,w,f),1);break;case Pi:Z(t,i,new ts(x,w,f),1);break;case ki:Z(t,i,new es(x,w,f),1);break;case Fi:Z(t,i,new ss(x,w,f),1);break;case Ei:Z(t,i,new ns(x,w,f),1);break;case Xi:Z(t,i,new is(x,w,f),1);break;case Vi:Z(t,i,new rs(x,w,f),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readByte(),x=t.readInt(!0),w=t.readInt(!0);switch(b){case Li:Z(t,i,new os(x,w,f),1);break;case Bi:Z(t,i,new cs(x,w,f),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let m=0,u=t.readInt(!0);m<u;m++){const f=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const b=t.readInt(!0);for(let x=0,w=t.readInt(!0);x<w;x++){const v=t.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=f.getAttachment(b,v),T=t.readByte(),S=t.readInt(!0),A=S-1;switch(T){case Si:{const C=y,M=C.bones,Y=C.vertices,F=M?Y.length/3*2:Y.length,E=t.readInt(!0),X=new We(S,E,b,C);let V=t.readFloat();for(let N=0,U=0;;N++){let O,P=t.readInt(!0);if(P===0)O=M?B.newFloatArray(F):Y;else{O=B.newFloatArray(F);const $=t.readInt(!0);if(P+=$,r===1)for(let D=$;D<P;D++)O[D]=t.readFloat();else for(let D=$;D<P;D++)O[D]=t.readFloat()*r;if(!M)for(let D=0,W=O.length;D<W;D++)O[D]+=Y[D]}if(X.setFrame(N,V,O),N===A)break;const k=t.readFloat();switch(t.readByte()){case ft:X.setStepped(N);break;case ut:H(t,X,U++,N,0,V,k,0,1,1)}V=k}i.push(X);break}case Ai:{const C=new He(S,b,y);for(let M=0;M<S;M++){const Y=t.readFloat(),F=t.readInt32();C.setFrame(M,Y,ke[F&15],F>>4,t.readFloat())}i.push(C);break}}}}}const o=s.slots.length,l=t.readInt(!0);if(l>0){const m=new St(l);for(let u=0;u<l;u++)m.setFrame(u,t.readFloat(),gn(t,o));i.push(m)}const c=t.readInt(!0);for(let m=0;m<c;m++){const u=t.readInt(!0),f=new Array(u);for(let b=0;b<u;b++)f[b]=t.readInt(!0);const p=t.readInt(!0),g=new $t(p,f,o);for(let b=0;b<p;b++)g.setFrame(b,t.readFloat(),gn(t,u));i.push(g)}const a=t.readInt(!0);if(a>0){const m=new Zt(a);for(let u=0;u<a;u++){const f=t.readFloat(),p=s.events[t.readInt(!0)],g=new ae(f,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),m.setFrame(u,g)}i.push(m)}let h=0;for(let m=0,u=i.length;m<u;m++)h=Math.max(h,i[m].getDuration());const d=new Kt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},un=class{constructor(t,e=[],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(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},Qn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},mn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s,n){s instanceof Nt?Zn(t,e,s,n):ti(t,e,s,n)}function Zn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let o=0,l=0,c=s.getFrameCount()-1;s.setFrame(o,i,r),o!==c;o++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(o);break;case ut:H(t,s,l++,o,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function ti(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,o=t.readFloat()*n;for(let l=0,c=0,a=s.getFrameCount()-1;s.setFrame(l,i,r,o),l!==a;l++){const h=t.readFloat(),d=t.readFloat()*n,m=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(l);break;case ut:H(t,s,c++,l,0,i,h,r,d,n),H(t,s,c++,l,1,i,h,o,m,n)}i=h,r=d,o=m}e.push(s)}function gn(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,o=0;for(let l=0;l<s;l++){const c=t.readInt(!0);for(;r!==c;)i[o++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[o++]=r++;for(let l=e-1;l>=0;l--)n[l]===-1&&(n[l]=i[--o]);return n}function H(t,e,s,n,i,r,o,l,c,a){e.setBezier(s,n,i,r,l,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,o,c)}var ei=0,si=1,ni=2,ii=3,ri=4,ai=5,oi=6,ci=7,li=8,hi=9,di=10,fi=0,ui=1,mi=2,gi=3,pi=4,bi=5,xi=0,wi=1,yi=2,vi=3,Ti=4,Si=0,Ai=1,Ii=0,Ci=1,Mi=2,Yi=0,Pi=1,ki=2,Fi=4,Ei=5,Xi=6,Vi=7,Ri=8,Li=0,Bi=1,ft=1,ut=2,Oi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Bt(()=>B.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,o=r.length;s.length=0,i.freeAll(n),n.length=0;for(let l=0;l<o;l++){const c=r[l];if(!c.bone.active)continue;const a=c.appliedPose.attachment;if(a instanceof ms){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=B.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,c,0,a.worldVerticesLength,h,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;const i=this.polygons;for(let r=0,o=i.length;r<o;r++){const l=i[r],c=l;for(let a=0,h=l.length;a<h;a+=2){const d=c[a],m=c[a+1];t=Math.min(t,d),e=Math.min(e,m),s=Math.max(s,d),n=Math.max(n,m)}}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){const i=this.minX,r=this.minY,o=this.maxX,l=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=o&&s>=o||e>=l&&n>=l)return!1;const c=(n-e)/(s-t);let a=c*(i-t)+e;if(a>r&&a<l||(a=c*(o-t)+e,a>r&&a<l))return!0;let h=(r-e)/c+t;return h>i&&h<o||(h=(l-e)/c+t,h>i&&h<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const 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){const n=t,i=t.length;let r=i-2,o=!1;for(let l=0;l<i;l+=2){const c=n[l+1],a=n[r+1];if(c<s&&a>=s||a<s&&c>=s){const h=n[l];h+(s-c)/(a-c)*(n[r]-h)<e&&(o=!o)}r=l}return o}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,o=i.length;r<o;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,o=t.length,l=e-n,c=s-i,a=e*i-s*n;let h=r[o-2],d=r[o-1];for(let m=0;m<o;m+=2){const u=r[m],f=r[m+1],p=h*f-d*u,g=h-u,b=d-f,x=l*b-c*g,w=(a*g-l*p)/x;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const v=(a*b-c*p)/x;if((v>=d&&v<=f||v>=f&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=u,d=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},pn=class at{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Bt(()=>[]);polygonIndicesPool=new Bt(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let l=0;l<n;l++)i[l]=l;const r=this.isConcaveArray;r.length=0;for(let l=0;l<n;l++)r[l]=at.isConcave(l,n,s,i);const o=this.triangles;for(o.length=0;n>3;){let l=n-1,c=0,a=1;for(;;){t:if(!r[c]){const m=i[l]<<1,u=i[c]<<1,f=i[a]<<1,p=s[m],g=s[m+1],b=s[u],x=s[u+1],w=s[f],v=s[f+1];for(let y=a+1<n?a+1:0;y!==l;){if(r[y]){const T=i[y]<<1,S=s[T],A=s[T+1];if(at.positiveArea(w,v,p,g,S,A)&&at.positiveArea(p,g,b,x,S,A)&&at.positiveArea(b,x,w,v,S,A))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[c])break;c--}while(c>0);l=c>0?c-1:n-1,a=c+1<n?c+1:0;break}l=c,c=a,++a===n&&(a=0)}o.push(i[l],i[c],i[a]),i.splice(c,1),r.splice(c,1),n--;const h=c>0?c-1:n-1,d=c<n?c:0;r[h]=at.isConcave(h,n,s,i),r[d]=at.isConcave(d,n,s,i)}return n===3&&o.push(i[2],i[0],i[1]),o}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let l=this.polygonPool.obtain();l.length=0;let c=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const m=s[h]<<1,u=s[h+1]<<1,f=s[h+2]<<1,p=n[m],g=n[m+1],b=n[u],x=n[u+1],w=n[f],v=n[f+1];if(c===m){const y=l.length-4;if(at.winding(l[y],l[y+1],l[y+2],l[y+3],w,v)===a&&at.winding(w,v,l[0],l[1],l[2],l[3])===a){l.push(w,v),o.push(f);continue}}l.length>0&&(i.push(l),r.push(o),l=this.polygonPool.obtain(),o=this.polygonIndicesPool.obtain()),l.length=0,l.push(p,g,b,x),l.push(w,v),o.length=0,o.push(m,u,f),a=at.winding(p,g,b,x,w,v),c=m}l.length>0&&(i.push(l),r.push(o));for(let h=0,d=i.length;h<d;h++){if(o=r[h],o.length===0)continue;const m=o[0];let u=o[o.length-1];l=i[h];const f=l.length-4;let p=l[f],g=l[f+1],b=l[f+2],x=l[f+3];const w=l[0],v=l[1],y=l[2],T=l[3],S=at.winding(p,g,b,x,w,v);for(let A=0;A<d;A++){if(A===h)continue;const C=r[A];if(C.length!==3)continue;const M=C[0],Y=C[1],F=C[2],E=i[A],X=E[E.length-2],V=E[E.length-1];M!==m||Y!==u||at.winding(p,g,b,x,X,V)===S&&at.winding(X,V,w,v,y,T)===S&&(E.length=0,C.length=0,l.push(X,V),o.push(F),u=F,p=b,g=x,b=X,x=V,A=-1)}}for(let h=i.length-1;h>=0;h--)l=i[h],l.length===0?(i.splice(h,1),this.polygonPool.free(l),o=r[h],r.splice(h,1),this.polygonIndicesPool.free(o)):l.push(l[0],l[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,o=i[e]<<1,l=i[e+1<s?e+1:0]<<1;return!at.positiveArea(n[r],n[r+1],n[o],n[o+1],n[l],n[l+1])}static positiveArea(e,s,n,i,r,o){return e*(o-i)+n*(s-o)+r*(i-s)>=0}static winding(e,s,n,i,r,o){return e*(o-i)+n*(s-o)+r*(i-s)>=0?1:-1}},bn=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=B.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,o=this.makeClockwise(r);o||this.inverse||s.convex?(o||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new pn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,o,l){return n&&i&&r&&typeof o=="boolean"&&typeof l=="number"?this.clipTrianglesRender(t,e,s,n,i,r,o,l):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let m=e[d]<<1;const u=t[m],f=t[m+1];m=e[d+1]<<1;const p=t[m],g=t[m+1];m=e[d+2]<<1;const b=t[m],x=t[m+1];this.clipInverse(u,f,p,g,b,x,h);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=w[v++];let S=T>>1,A=n.length;const C=B.setArraySize(n,A+T);B.arrayCopy(w,v,C,A,T),A=i.length;const M=B.setArraySize(i,A+3*(S-2));for(let Y=1;Y<S-1;Y++,A+=3)M[A]=r,M[A+1]=r+Y,M[A+2]=r+Y+1;r+=S,v+=T}}return!0}const o=this.clipOutput,l=this.clippingPolygons,c=l.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const m=t[d],u=t[d+1];d=e[h+1]<<1;const f=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],b=t[d+1];for(let x=0;x<c;x++){let w=n.length;if(this.clip(m,u,f,p,g,b,l[x])){a=this.clipOutput;const v=o.length;if(v===0)continue;let y=v>>1;const T=B.setArraySize(n,w+v);B.arrayCopy(a,0,T,w,v),w=i.length;const S=B.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)S[w]=r,S[w+1]=r+A,S[w+2]=r+A+1;r+=y}else{const v=B.setArraySize(n,w+6);v[w]=m,v[w+1]=u,v[w+2]=f,v[w+3]=p,v[w+4]=g,v[w+5]=b,w=i.length;const y=B.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,o,l){const c=this.clippedVertices;c.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let b=e[g],x=e[g+1],w=e[g+2];const v=t[b*l],y=t[b*l+1],T=t[x*l],S=t[x*l+1],A=t[w*l],C=t[w*l+1];this.clipInverse(v,y,T,S,A,C,p);const M=this.inverseVertices.length;if(M===0)continue;const Y=n[b<<=1],F=n[b+1],E=n[x<<=1],X=n[x+1],V=n[w<<=1],N=n[w+1],U=S-C,O=A-T,P=v-A,k=C-y,$=1/(U*P+O*(y-C)),D=this.inverseVertices;for(let W=0;W<M;){const L=D[W++],_=L>>1;let q=c.length;const J=B.setArraySize(c,q+_*l);for(let K=0;K<L;K+=2,q+=l){const et=D[W+K],nt=D[W+K+1];J[q]=et,J[q+1]=nt,J[q+2]=i.r,J[q+3]=i.g,J[q+4]=i.b,J[q+5]=i.a;const st=et-A,ht=nt-C,it=(U*st+O*ht)*$,rt=(k*st+P*ht)*$,dt=1-it-rt;J[q+6]=Y*it+E*rt+V*dt,J[q+7]=F*it+X*rt+N*dt,o&&(J[q+8]=r.r,J[q+9]=r.g,J[q+10]=r.b,J[q+11]=r.a)}q=a.length;const tt=B.setArraySize(a,q+3*(_-2));for(let K=1;K<_-1;K++,q+=3)tt[q]=h,tt[q+1]=h+K,tt[q+2]=h+K+1;h+=_,W+=L}}return!0}const d=this.clipOutput,m=this.clippingPolygons,u=this.clippingPolygons.length;let f=null;for(let p=0;p<s;p+=3){let g=e[p];const b=t[g*l],x=t[g*l+1],w=n[g<<1],v=n[(g<<1)+1];g=e[p+1];const y=t[g*l],T=t[g*l+1],S=n[g<<1],A=n[(g<<1)+1];g=e[p+2];const C=t[g*l],M=t[g*l+1],Y=n[g<<1],F=n[(g<<1)+1];let E=0,X=0,V=0,N=0,U=0;for(let O=0;O<u;O++){let P=c.length;if(this.clip(b,x,y,T,C,M,m[O])){f=this.clipOutput;const k=d.length;if(k===0)continue;let $=k>>1;U===0&&(E=T-M,X=C-y,V=b-C,N=M-x,U=1/(E*V-X*N));const D=B.setArraySize(c,P+$*l);for(let L=0;L<k;L+=2,P+=l){const _=f[L],q=f[L+1];D[P]=_,D[P+1]=q,D[P+2]=i.r,D[P+3]=i.g,D[P+4]=i.b,D[P+5]=i.a;const J=_-C,tt=q-M,K=(E*J+X*tt)*U,et=(N*J+V*tt)*U,nt=1-K-et;D[P+6]=w*K+S*et+Y*nt,D[P+7]=v*K+A*et+F*nt,o&&(D[P+8]=r.r,D[P+9]=r.g,D[P+10]=r.b,D[P+11]=r.a)}P=a.length;const W=B.setArraySize(a,P+3*($-2));$--;for(let L=1;L<$;L++,P+=3)W[P]=h,W[P+1]=h+L,W[P+2]=h+L+1;h+=$+1}else{const k=B.setArraySize(c,P+3*l);k[P]=b,k[P+1]=x,k[P+2]=i.r,k[P+3]=i.g,k[P+4]=i.b,k[P+5]=i.a,o?(k[P+6]=w,k[P+7]=v,k[P+8]=r.r,k[P+9]=r.g,k[P+10]=r.b,k[P+11]=r.a,k[P+12]=y,k[P+13]=T,k[P+14]=i.r,k[P+15]=i.g,k[P+16]=i.b,k[P+17]=i.a,k[P+18]=S,k[P+19]=A,k[P+20]=r.r,k[P+21]=r.g,k[P+22]=r.b,k[P+23]=r.a,k[P+24]=C,k[P+25]=M,k[P+26]=i.r,k[P+27]=i.g,k[P+28]=i.b,k[P+29]=i.a,k[P+30]=Y,k[P+31]=F,k[P+32]=r.r,k[P+33]=r.g,k[P+34]=r.b,k[P+35]=r.a):(k[P+6]=w,k[P+7]=v,k[P+8]=y,k[P+9]=T,k[P+10]=i.r,k[P+11]=i.g,k[P+12]=i.b,k[P+13]=i.a,k[P+14]=S,k[P+15]=A,k[P+16]=C,k[P+17]=M,k[P+18]=i.r,k[P+19]=i.g,k[P+20]=i.b,k[P+21]=i.a,k[P+22]=Y,k[P+23]=F),P=a.length;const $=B.setArraySize(a,P+3);$[P]=h,$[P+1]=h+1,$[P+2]=h+2,h+=3;break}}}return f!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let o=this._clippedVerticesTyped,l=this._clippedUVsTyped,c=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const f=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const b=t[e+g],x=t[e+g+1];let w=s[p]<<1;const v=i[w],y=i[w+1];g=s[p+1]*r;const T=t[e+g],S=t[e+g+1];w=s[p+1]<<1;const A=i[w],C=i[w+1];g=s[p+2]*r;const M=t[e+g],Y=t[e+g+1];w=s[p+2]<<1;const F=i[w],E=i[w+1];this.clipInverse(b,x,T,S,M,Y,f);const X=this.inverseVertices.length;if(X===0)continue;const V=S-Y,N=M-T,U=b-M,O=Y-x,P=1/(V*U+N*(x-Y)),k=this.inverseVertices;for(let $=0;$<X;){const D=k[$++],W=D>>1;let L=this.clippedVerticesLength;const _=L+W*r,q=this.clippedUVsLength+W*2;o.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(o.subarray(0,L)),o=this._clippedVerticesTyped),l.length<q&&(this._clippedUVsTyped=new Float32Array(q*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),l=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=q;const J=this._clippedVerticesTyped,tt=this._clippedUVsTyped;let K=q-W*2;for(let st=0;st<D;st+=2,L+=r,K+=2){const ht=k[$+st],it=k[$+st+1];J[L]=ht,J[L+1]=it;const rt=ht-M,dt=it-Y,mt=(V*rt+N*dt)*P,pt=(O*rt+U*dt)*P,Gt=1-mt-pt;tt[K]=v*mt+A*pt+F*Gt,tt[K+1]=y*mt+C*pt+E*Gt}L=this.clippedTrianglesLength;const et=L+3*(W-2);c.length<et&&(this._clippedTrianglesTyped=new Uint16Array(et*2),this._clippedTrianglesTyped.set(c.subarray(0,L)),c=this._clippedTrianglesTyped),this.clippedTrianglesLength=et;const nt=c;for(let st=1;st<W-1;st++,L+=3)nt[L]=a,nt[L+1]=a+st,nt[L+2]=a+st+1;a+=W,$+=D}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const h=this.clipOutput,d=this.clippingPolygons,m=this.clippingPolygons.length;let u=null;for(let f=0;f<n;f+=3){let p=s[f],g=p*r;const b=t[e+g],x=t[e+g+1];let w=p<<1;const v=i[w],y=i[w+1];p=s[f+1],g=p*r;const T=t[e+g],S=t[e+g+1];w=p<<1;const A=i[w],C=i[w+1];p=s[f+2],g=p*r;const M=t[e+g],Y=t[e+g+1];w=p<<1;const F=i[w],E=i[w+1];let X=0,V=0,N=0,U=0,O=0;for(let P=0;P<m;P++){let k=this.clippedVerticesLength;if(this.clip(b,x,T,S,M,Y,d[P])){u=h;const $=h.length;if($===0)continue;let D=$>>1;O===0&&(X=S-Y,V=M-T,N=b-M,U=Y-x,O=1/(X*N-V*U));const W=k+D*r;o.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(o.subarray(0,k)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+D*2)*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),o=this._clippedVerticesTyped,l=this._clippedUVsTyped);const L=o,_=l;this.clippedVerticesLength=W;let q=this.clippedUVsLength;this.clippedUVsLength=q+D*2;for(let K=0;K<$;K+=2,k+=r,q+=2){const et=u[K],nt=u[K+1];L[k]=et,L[k+1]=nt;const st=et-M,ht=nt-Y,it=(X*st+V*ht)*O,rt=(U*st+N*ht)*O,dt=1-it-rt;_[q]=v*it+A*rt+F*dt,_[q+1]=y*it+C*rt+E*dt}k=this.clippedTrianglesLength;const J=k+3*(D-2);c.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(c.subarray(0,k)),c=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const tt=c;D--;for(let K=1;K<D;K++,k+=3)tt[k]=a,tt[k+1]=a+K,tt[k+2]=a+K+1;a+=D+1}else{let $=k+3*r;o.length<$&&(this._clippedVerticesTyped=new Float32Array($*2),this._clippedVerticesTyped.set(o.subarray(0,k)),o=this._clippedVerticesTyped),o[k]=b,o[k+1]=x,o[k+r]=T,o[k+r+1]=S,o[k+r*2]=M,o[k+r*2+1]=Y;const D=this.clippedUVsLength+6;l.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(l.subarray(0,this.clippedUVsLength)),l=this._clippedUVsTyped);const W=this.clippedUVsLength;l[W]=v,l[W+1]=y,l[W+2]=A,l[W+3]=C,l[W+4]=F,l[W+5]=E,this.clippedVerticesLength=$,this.clippedUVsLength=D,k=this.clippedTrianglesLength,$=k+3,c.length<$&&(this._clippedTrianglesTyped=new Uint16Array($*2),this._clippedTrianglesTyped.set(c.subarray(0,k)),c=this._clippedTrianglesTyped);const L=c;L[k]=a,L[k+1]=a+1,L[k+2]=a+2,a+=3,this.clippedTrianglesLength=$;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),u!==null}clip(t,e,s,n,i,r,o){const l=this.clipOutput;let c=!1,a,h;o.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=o;a.length=8;const m=a;m[0]=t,m[1]=e,m[2]=s,m[3]=n,m[4]=i,m[5]=r,m[6]=t,m[7]=e,h.length=0;const u=o.length-4;for(let f=0;;f+=2){const p=d[f],g=d[f+1],b=p-d[f+2],x=g-d[f+3],w=h.length,v=a;t=v[0],e=v[1];let y=x*(p-t)-b*(g-e);for(let S=2,A=a.length-2;S<=A;S+=2){s=v[S],n=v[S+1];const C=x*(p-s)-b*(g-n);if(y>0)if(C>0)h.push(s,n);else{const M=s-t,Y=n-e,F=y/(M*x-Y*b);F>=0&&F<=1?(h.push(t+M*F,e+Y*F),c=!0):h.push(s,n)}else if(C>0){const M=s-t,Y=n-e,F=y/(M*x-Y*b);F>=0&&F<=1?(h.push(t+M*F,e+Y*F,s,n),c=!0):h.push(s,n)}else c=!0;t=s,e=n,y=C}if(w===h.length)return l.length=0,!0;if(h.push(h[0],h[1]),f===u)break;const T=h;h=a,h.length=0,a=T}if(l!==h){l.length=0;for(let f=0,p=h.length-2;f<p;f++)l[f]=h[f]}else l.length=l.length-2;return c}clipInverse(t,e,s,n,i,r,o){this.inverseVertices.length=0;const l=o.length-4;let c,a;o.length%4>=2?(c=this.clipOutput,a=this.scratch):(c=this.scratch,a=this.clipOutput),c.length=8;let h=o,d=c;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let m=0;;m+=2){const u=h[m],f=h[m+1],p=u-h[m+2],g=f-h[m+3],b=a.length,x=this.inverseVertices.length;this.inverseVertices.push(0),d=c,t=d[0],e=d[1];let w=g*(u-t)-p*(f-e);for(let T=2,S=c.length-2;T<=S;T+=2){s=d[T],n=d[T+1];const A=g*(u-s)-p*(f-n);if(w>0)if(A>0)a.push(s,n);else{const C=s-t,M=n-e,Y=w/(C*g-M*p);if(Y>=0&&Y<=1){const F=t+C*Y,E=e+M*Y;a.push(F,E),this.inverseVertices.push(F,E,s,n)}else a.push(s,n)}else if(A>0){const C=s-t,M=n-e,Y=w/(C*g-M*p);if(Y>=0&&Y<=1){const F=t+C*Y,E=e+M*Y;this.inverseVertices.push(F,E),a.push(F,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n);t=s,e=n,w=A}const v=this.inverseVertices.length-x-1;if(v>=6?this.inverseVertices[x]=v:this.inverseVertices.length=x,b===a.length||(a.push(a[0],a[1]),m===l))break;const y=a;a=c,a.length=0,c=y}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,o=e[s-2],l=e[s-1],c=e[0],a=e[1];for(let d=2;d<s;d+=2){const m=e[d],u=e[d+1];r+=c*u-m*a;const f=(c-o)*(u-a)-(a-l)*(m-c);i=i&&f<=0,n=n&&f>=0,o=c,l=a,c=m,a=u}r+=c*e[1]-e[0]*a;const h=(c-o)*(e[1]-a)-(a-l)*(e[0]-c);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,m=s-2,u=s>>1;d<u;d+=2){const f=e[d],p=e[d+1],g=m-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=f,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let o=2;o<e;o+=2){const l=s[o],c=s[o+1];let a=o-2;for(;a>=0&&(n[a]>l||n[a]===l&&n[a+1]>c);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=l,n[a+3]=c}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let o=4;o<e;o+=2,i+=2){const l=n[o],c=n[o+1];for(;(s[i-2]-s[i-4])*(c-s[i-3])-(s[i-1]-s[i-3])*(l-s[i-4])>=0&&(i-=2,i!==2););s[i]=l,s[i+1]=c}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let o=e-6;o>=0;o-=2,i+=2){const l=n[o],c=n[o+1];for(;(s[i-2]-s[i-4])*(c-s[i-3])-(s[i-1]-s[i-3])*(l-s[i-4])>=0&&(i-=2,i!==r););s[i]=l,s[i+1]=c}t.length=i-2}},Ni=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ss,n=typeof t=="string"?JSON.parse(t):t,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=I(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const o=n.bones[r];let l=null;const c=I(o,"parent",null);c&&(l=s.findBone(c));const a=new gs(s.bones.length,o.name,l);a.length=I(o,"length",0)*e;const h=a.setupPose;h.x=I(o,"x",0)*e,h.y=I(o,"y",0)*e,h.rotation=I(o,"rotation",0),h.scaleX=I(o,"scaleX",1),h.scaleY=I(o,"scaleY",1),h.shearX=I(o,"shearX",0),h.shearY=I(o,"shearY",0),h.inherit=B.enumValue(se,I(o,"inherit","Normal")),a.skinRequired=I(o,"skin",!1);const d=I(o,"color",null);d&&a.color.setFromString(d),a.icon=I(o,"icon",void 0),a.iconSize=I(o,"iconSize",1),a.iconRotation=I(o,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const o=n.slots[r],l=o.name,c=s.findBone(o.bone);if(!c)throw new Error(`Couldn't find bone ${o.bone} for slot ${l}`);const a=new Is(s.slots.length,l,c),h=I(o,"color",null);h&&a.setupPose.color.setFromString(h);const d=I(o,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=I(o,"attachment",null),a.blendMode=B.enumValue(Cs,I(o,"blend","normal")),a.visible=I(o,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const o=r.name,l=I(r,"skin",!1);switch(I(r,"type",!1)){case"ik":{const c=new zt(o);c.skinRequired=l;for(let u=0;u<r.bones.length;u++){const f=s.findBone(r.bones[u]);if(!f)throw new Error(`Couldn't find bone ${r.bones[u]} for IK constraint ${o}.`);c.bones.push(f)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${o}.`);c.target=h;const d=I(r,"scaleY",null);d!=null&&(c.scaleYMode=B.enumValue(re,d));const m=c.setupPose;m.mix=I(r,"mix",1),m.softness=I(r,"softness",0)*e,m.bendDirection=I(r,"bendPositive",!0)?1:-1,m.compress=I(r,"compress",!1),m.stretch=I(r,"stretch",!1),s.constraints.push(c);break}case"transform":{const c=new j(o);c.skinRequired=l;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);c.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);c.source=h,c.localSource=I(r,"localSource",!1),c.localTarget=I(r,"localTarget",!1),c.additive=I(r,"additive",!1),c.clamp=I(r,"clamp",!1);let d=!1,m=!1,u=!1,f=!1,p=!1,g=!1;const b=Object.entries(I(r,"properties",{}));for(const[w,v]of b){const y=this.fromProperty(w),T=this.propertyScale(w,e);y.offset=I(v,"offset",0)*T;const S=Object.entries(I(v,"to",{}));for(const[A,C]of S){let M=1,Y;switch(A){case"rotate":{d=!0,Y=new Ms;break}case"x":{m=!0,Y=new Ys,M=e;break}case"y":{u=!0,Y=new Ps,M=e;break}case"scaleX":{f=!0,Y=new ks;break}case"scaleY":{p=!0,Y=new Fs;break}case"shearY":{g=!0,Y=new Es;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}Y.offset=I(C,"offset",0)*M,Y.max=I(C,"max",1)*M,Y.scale=I(C,"scale",1)*M/T,y.to.push(Y)}y.to.length>0&&c.properties.push(y)}c.offsets[j.ROTATION]=I(r,"rotation",0),c.offsets[j.X]=I(r,"x",0)*e,c.offsets[j.Y]=I(r,"y",0)*e,c.offsets[j.SCALEX]=I(r,"scaleX",0),c.offsets[j.SCALEY]=I(r,"scaleY",0),c.offsets[j.SHEARY]=I(r,"shearY",0);const x=c.setupPose;d&&(x.mixRotate=I(r,"mixRotate",1)),m&&(x.mixX=I(r,"mixX",1)),u&&(x.mixY=I(r,"mixY",x.mixX)),f&&(x.mixScaleX=I(r,"mixScaleX",1)),p&&(x.mixScaleY=I(r,"mixScaleY",x.mixScaleX)),g&&(x.mixShearY=I(r,"mixShearY",1)),s.constraints.push(c);break}case"path":{const c=new Wt(o);c.skinRequired=l;for(let m=0;m<r.bones.length;m++){const u=r.bones[m],f=s.findBone(u);if(!f)throw new Error(`Couldn't find bone ${u} for path constraint ${r.name}.`);c.bones.push(f)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);c.slot=h,c.positionMode=B.enumValue(ws,I(r,"positionMode","Percent")),c.spacingMode=B.enumValue(ys,I(r,"spacingMode","Length")),c.rotateMode=B.enumValue(vs,I(r,"rotateMode","Tangent")),c.offsetRotation=I(r,"rotation",0);const d=c.setupPose;d.position=I(r,"position",0),c.positionMode===0&&(d.position*=e),d.spacing=I(r,"spacing",0),(c.spacingMode===0||c.spacingMode===1)&&(d.spacing*=e),d.mixRotate=I(r,"mixRotate",1),d.mixX=I(r,"mixX",1),d.mixY=I(r,"mixY",d.mixX),s.constraints.push(c);break}case"physics":{const c=new Ht(o);c.skinRequired=l;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);c.bone=h,c.x=I(r,"x",0),c.y=I(r,"y",0),c.rotate=I(r,"rotate",0),c.scaleX=I(r,"scaleX",0);const d=I(r,"scaleY",null);d!=null&&(c.scaleYMode=B.enumValue(re,d)),c.shearX=I(r,"shearX",0),c.limit=I(r,"limit",5e3)*e,c.step=1/I(r,"fps",60);const m=c.setupPose;m.inertia=I(r,"inertia",.5),m.strength=I(r,"strength",100),m.damping=I(r,"damping",.85),m.massInverse=1/I(r,"mass",1),m.wind=I(r,"wind",0),m.gravity=I(r,"gravity",0),m.mix=I(r,"mix",1),c.inertiaGlobal=I(r,"inertiaGlobal",!1),c.strengthGlobal=I(r,"strengthGlobal",!1),c.dampingGlobal=I(r,"dampingGlobal",!1),c.massGlobal=I(r,"massGlobal",!1),c.windGlobal=I(r,"windGlobal",!1),c.gravityGlobal=I(r,"gravityGlobal",!1),c.mixGlobal=I(r,"mixGlobal",!1),s.constraints.push(c);break}case"slider":{const c=new yt(o);c.skinRequired=l,c.additive=I(r,"additive",!1),c.loop=I(r,"loop",!1),c.setupPose.mix=I(r,"mix",1);const a=r.bone;if(a){if(c.bone=s.findBone(a),!c.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;c.property=this.fromProperty(h);const d=this.propertyScale(h,e);c.property.offset=I(r,"from",0)*d,c.offset=I(r,"to",0),c.scale=I(r,"scale",1)/d,c.max=I(r,"max",0),c.local=I(r,"local",!1)}else c.setupPose.time=I(r,"time",0);s.constraints.push(c);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const o=n.skins[r],l=new fe(o.name);if(o.bones)for(let c=0;c<o.bones.length;c++){const a=o.bones[c],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${o.name}.`);l.bones.push(h)}if(o.ik)for(let c=0;c<o.ik.length;c++){const a=o.ik[c],h=s.findConstraint(a,zt);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${o.name}.`);l.constraints.push(h)}if(o.transform)for(let c=0;c<o.transform.length;c++){const a=o.transform[c],h=s.findConstraint(a,j);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${o.name}.`);l.constraints.push(h)}if(o.path)for(let c=0;c<o.path.length;c++){const a=o.path[c],h=s.findConstraint(a,Wt);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${o.name}.`);l.constraints.push(h)}if(o.physics)for(let c=0;c<o.physics.length;c++){const a=o.physics[c],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${o.name}.`);l.constraints.push(h)}if(o.slider)for(let c=0;c<o.slider.length;c++){const a=o.slider[c],h=s.findConstraint(a,yt);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${o.name}.`);l.constraints.push(h)}for(const c in o.attachments){const a=s.findSlot(c);if(!a)throw new Error(`Couldn't find skin slot ${c} for skin ${o.name}.`);const h=o.attachments[c];for(const d in h){const m=this.readAttachment(h[d],l,a.index,d,s);m&&l.setAttachment(a.index,d,m)}}s.skins.push(l),l.name==="default"&&(s.defaultSkin=l)}for(let r=0,o=this.linkedMeshes.length;r<o;r++){const l=this.linkedMeshes[r],c=l.skin?s.findSkin(l.skin):s.defaultSkin;if(!c)throw new Error(`Skin not found: ${l.skin}`);const a=c.getAttachment(l.sourceIndex,l.source);if(!a)throw new Error(`Source mesh not found: ${l.source}`);l.mesh.timelineAttachment=l.inheritTimelines?a:l.mesh,l.mesh.setSourceMesh(a),l.mesh.updateSequence();t:if(l.inheritTimelines&&l.slotIndex!==l.sourceIndex){const h=a.timelineSlots;for(const m of h)if(m===l.slotIndex)break t;const d=[...h];d[h.length]=l.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const o=n.events[r],l=new xs(r),c=l.setupPose;c.intValue=I(o,"int",0),c.floatValue=I(o,"float",0),c.stringValue=I(o,"string",""),l._audioPath=I(o,"audio",null),l.audioPath&&(c.volume=I(o,"volume",c.volume),c.balance=I(o,"balance",c.balance)),s.events.push(l)}if(n.animations)for(const r in n.animations){const o=n.animations[r];this.readAnimation(o,r,s)}if(n.constraints)for(const r in n.constraints){const o=n.constraints[r];if(o.type==="slider"){const l=s.findConstraint(o.name,yt),c=o.animation,a=s.findAnimation(c);if(!a)throw new Error(`Slider animation not found: ${c}`);l.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new me;break;case"x":e=new ge;break;case"y":e=new pe;break;case"scaleX":e=new be;break;case"scaleY":e=new xe;break;case"shearY":e=new we;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,o=I(t,"name",n);switch(I(t,"type","region")){case"region":{const l=I(t,"path",o),c=this.readSequence(I(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,o,l,c);if(!a)return null;a.path=l,a.x=I(t,"x",0)*r,a.y=I(t,"y",0)*r,a.scaleX=I(t,"scaleX",1),a.scaleY=I(t,"scaleY",1),a.rotation=I(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=I(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const l=this.attachmentLoader.newBoundingBoxAttachment(e,n,o);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);const c=I(t,"color",null);return c&&l.color.setFromString(c),l}case"mesh":case"linkedmesh":{const l=I(t,"path",o),c=this.readSequence(I(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,o,l,c);if(!a)return null;a.path=l;const h=I(t,"color",null);h&&a.color.setFromString(h),a.width=I(t,"width",0)*r,a.height=I(t,"height",0)*r;const d=I(t,"source",null);if(d){let u=s;const f=I(t,"slot",null);if(f){const p=i.findSlot(f);if(!p)throw new Error(`Source mesh slot not found: ${f}`);u=p.index}return this.linkedMeshes.push(new Di(a,I(t,"skin",null),s,u,d,I(t,"timelines",!0))),a}const m=t.uvs;return this.readVertices(t,a,m.length),a.triangles=t.triangles,a.regionUVs=m,a.edges=I(t,"edges",null),a.hullLength=I(t,"hull",0)*2,a.updateSequence(),a}case"path":{const l=this.attachmentLoader.newPathAttachment(e,n,o);if(!l)return null;l.closed=I(t,"closed",!1),l.constantSpeed=I(t,"constantSpeed",!0);const c=t.vertexCount;this.readVertices(t,l,c<<1);const a=B.newArray(c/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;l.lengths=a;const h=I(t,"color",null);return h&&l.color.setFromString(h),l}case"point":{const l=this.attachmentLoader.newPointAttachment(e,n,o);if(!l)return null;l.x=I(t,"x",0)*r,l.y=I(t,"y",0)*r,l.rotation=I(t,"rotation",0);const c=I(t,"color",null);return c&&l.color.setFromString(c),l}case"clipping":{const l=this.attachmentLoader.newClippingAttachment(e,n,o);if(!l)return null;const c=I(t,"end",null);c&&(l.endSlot=i.findSlot(c)),l.convex=I(t,"convex",!1),l.inverse=I(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,l,a<<1);const h=I(t,"color",null);return h&&l.color.setFromString(h),l}}return null}readSequence(t){if(t==null)return new Ot(1,!1);const e=new Ot(I(t,"count",0),!0);return e.start=I(t,"start",1),e.digits=I(t,"digits",0),e.setupIndex=I(t,"setup",0),e}readVertices(t,e,s){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const l=B.toFloatArray(i);if(n!==1)for(let c=0,a=i.length;c<a;c++)l[c]*=n;e.vertices=l;return}const r=[],o=[];for(let l=0,c=i.length;l<c;){const a=i[l++];o.push(a);for(let h=l+a*4;l<h;l+=4)o.push(i[l]),r.push(i[l+1]*n),r.push(i[l+2]*n),r.push(i[l+3])}e.bones=o,e.vertices=B.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const c in t.slots){const a=t.slots[c],h=s.findSlot(c);if(!h)throw new Error(`Slot not found: ${c}`);const d=h.index;for(const m in a){const u=a[m];if(!u)continue;const f=u.length;switch(m){case"attachment":{const p=new kt(f,d);for(let g=0;g<f;g++){const b=u[g];p.setFrame(g,I(b,"time",0),I(b,"name",null))}i.push(p);break}case"rgba":{const p=new Ue(f,f<<2,d);let g=u[0],b=I(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b,x.a);const y=u[w+1];if(!y){p.shrink(v);break}const T=I(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(v=G(A,p,v,w,0,b,T,x.r,S.r,1),v=G(A,p,v,w,1,b,T,x.g,S.g,1),v=G(A,p,v,w,2,b,T,x.b,S.b,1),v=G(A,p,v,w,3,b,T,x.a,S.a,1)),b=T,x=S,g=y}i.push(p);break}case"rgb":{const p=new $e(f,f*3,d);let g=u[0],b=I(g,"time",0),x=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,b,x.r,x.g,x.b);const y=u[w+1];if(!y){p.shrink(v);break}const T=I(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(v=G(A,p,v,w,0,b,T,x.r,S.r,1),v=G(A,p,v,w,1,b,T,x.g,S.g,1),v=G(A,p,v,w,2,b,T,x.b,S.b,1)),b=T,x=S,g=y}i.push(p);break}case"alpha":{ot(i,u,new qe(f,f,d),0,1);break}case"rgba2":{const p=new _e(f,f*7,d);let g=u[0],b=I(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,x.a,w.r,w.g,w.b);const T=u[v+1];if(!T){p.shrink(y);break}const S=I(T,"time",0),A=z.fromString(T.light),C=z.fromString(T.dark),M=g.curve;M&&(y=G(M,p,y,v,0,b,S,x.r,A.r,1),y=G(M,p,y,v,1,b,S,x.g,A.g,1),y=G(M,p,y,v,2,b,S,x.b,A.b,1),y=G(M,p,y,v,3,b,S,x.a,A.a,1),y=G(M,p,y,v,4,b,S,w.r,C.r,1),y=G(M,p,y,v,5,b,S,w.g,C.g,1),y=G(M,p,y,v,6,b,S,w.b,C.b,1)),b=S,x=A,w=C,g=T}i.push(p);break}case"rgb2":{const p=new ze(f,f*6,d);let g=u[0],b=I(g,"time",0),x=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,b,x.r,x.g,x.b,w.r,w.g,w.b);const T=u[v+1];if(!T){p.shrink(y);break}const S=I(T,"time",0),A=z.fromString(T.light),C=z.fromString(T.dark),M=g.curve;M&&(y=G(M,p,y,v,0,b,S,x.r,A.r,1),y=G(M,p,y,v,1,b,S,x.g,A.g,1),y=G(M,p,y,v,2,b,S,x.b,A.b,1),y=G(M,p,y,v,3,b,S,w.r,C.r,1),y=G(M,p,y,v,4,b,S,w.g,C.g,1),y=G(M,p,y,v,5,b,S,w.b,C.b,1)),b=S,x=A,w=C,g=T}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${u.name} (${a.name})`)}}}if(t.bones)for(const c in t.bones){const a=t.bones[c],h=s.findBone(c);if(!h)throw new Error(`Bone not found: ${c}`);const d=h.index;for(const m in a){const u=a[m],f=u.length;if(f!==0)switch(m){case"rotate":ot(i,u,new Dt(f,f,d),0,1);break;case"translate":Xs(i,u,new Fe(f,f<<1,d),"x","y",0,n);break;case"translatex":ot(i,u,new Ee(f,f,d),0,n);break;case"translatey":ot(i,u,new Xe(f,f,d),0,n);break;case"scale":Xs(i,u,new Ve(f,f<<1,d),"x","y",1,1);break;case"scalex":ot(i,u,new Re(f,f,d),1,1);break;case"scaley":ot(i,u,new Le(f,f,d),1,1);break;case"shear":Xs(i,u,new Be(f,f<<1,d),"x","y",0,1);break;case"shearx":ot(i,u,new Oe(f,f,d),0,1);break;case"sheary":ot(i,u,new Ne(f,f,d),0,1);break;case"inherit":{const p=new De(f,h.index);for(let g=0;g<u.length;g++){const b=u[g];p.setFrame(g,I(b,"time",0),B.enumValue(se,I(b,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${u.name} (${a.name})`)}}}if(t.ik)for(const c in t.ik){const a=t.ik[c];let h=a[0];if(!h)continue;const d=s.findConstraint(c,zt);if(!d)throw new Error(`IK Constraint not found: ${c}`);const m=new Ge(a.length,a.length<<1,s.constraints.indexOf(d));let u=I(h,"time",0),f=I(h,"mix",1),p=I(h,"softness",0)*n;for(let g=0,b=0;;g++){m.setFrame(g,u,f,p,I(h,"bendPositive",!0)?1:-1,I(h,"compress",!1),I(h,"stretch",!1));const x=a[g+1];if(!x){m.shrink(b);break}const w=I(x,"time",0),v=I(x,"mix",1),y=I(x,"softness",0)*n,T=h.curve;T&&(b=G(T,m,b,g,0,u,w,f,v,1),b=G(T,m,b,g,1,u,w,p,y,n)),u=w,f=v,p=y,h=x}i.push(m)}if(t.transform)for(const c in t.transform){const a=t.transform[c];let h=a[0];if(!h)continue;const d=s.findConstraint(c,j);if(!d)throw new Error(`Transform constraint not found: ${c}`);const m=new je(a.length,a.length*6,s.constraints.indexOf(d));let u=I(h,"time",0),f=I(h,"mixRotate",1),p=I(h,"mixX",1),g=I(h,"mixY",p),b=I(h,"mixScaleX",1),x=I(h,"mixScaleY",1),w=I(h,"mixShearY",1);for(let v=0,y=0;;v++){m.setFrame(v,u,f,p,g,b,x,w);const T=a[v+1];if(!T){m.shrink(y);break}const S=I(T,"time",0),A=I(T,"mixRotate",1),C=I(T,"mixX",1),M=I(T,"mixY",C),Y=I(T,"mixScaleX",1),F=I(T,"mixScaleY",1),E=I(T,"mixShearY",1),X=h.curve;X&&(y=G(X,m,y,v,0,u,S,f,A,1),y=G(X,m,y,v,1,u,S,p,C,1),y=G(X,m,y,v,2,u,S,g,M,1),y=G(X,m,y,v,3,u,S,b,Y,1),y=G(X,m,y,v,4,u,S,x,F,1),y=G(X,m,y,v,5,u,S,w,E,1)),u=S,f=A,p=C,g=M,b=Y,x=F,w=E,h=T}i.push(m)}if(t.path)for(const c in t.path){const a=t.path[c],h=s.findConstraint(c,Wt);if(!h)throw new Error(`Path constraint not found: ${c}`);const d=s.constraints.indexOf(h);for(const m in a){const u=a[m];let f=u[0];if(!f)continue;const p=u.length;switch(m){case"position":{const g=new Je(p,p,d);ot(i,u,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Ke(p,p,d);ot(i,u,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new Qe(p,p*3,d);let b=I(f,"time",0),x=I(f,"mixRotate",1),w=I(f,"mixX",1),v=I(f,"mixY",w);for(let y=0,T=0;;y++){g.setFrame(y,b,x,w,v);const S=u[y+1];if(!S){g.shrink(T);break}const A=I(S,"time",0),C=I(S,"mixRotate",1),M=I(S,"mixX",1),Y=I(S,"mixY",M),F=f.curve;F&&(T=G(F,g,T,y,0,b,A,x,C,1),T=G(F,g,T,y,1,b,A,w,M,1),T=G(F,g,T,y,2,b,A,v,Y,1)),b=A,x=C,w=M,v=Y,f=S}i.push(g);break}}}}if(t.physics)for(const c in t.physics){const a=t.physics[c];let h=-1;if(c.length>0){const d=s.findConstraint(c,Ht);if(!d)throw new Error(`Physics constraint not found: ${c}`);h=s.constraints.indexOf(d)}for(const d in a){const m=a[d];let u=m[0];if(!u)continue;const f=m.length;let p,g=0;if(d==="reset"){const b=new as(f,h);for(let x=0;u!=null;u=m[x+1],x++)b.setFrame(x,I(u,"time",0));i.push(b);continue}switch(d){case"inertia":p=new Ze(f,f,h);break;case"strength":p=new ts(f,f,h);break;case"damping":p=new es(f,f,h);break;case"mass":p=new ss(f,f,h);break;case"wind":p=new ns(f,f,h);break;case"gravity":p=new is(f,f,h);break;case"mix":{g=1,p=new rs(f,f,h);break}default:continue}ot(i,m,p,g,1)}}if(t.slider)for(const c in t.slider){const a=t.slider[c],h=s.findConstraint(c,yt);if(!h)throw new Error(`Slider not found: ${c}`);const d=s.constraints.indexOf(h);for(const m in a){const u=a[m];if(!u[0])continue;const p=u.length;switch(m){case"time":ot(i,u,new os(p,p,d),1,1);break;case"mix":ot(i,u,new cs(p,p,d),1,1);break}}}if(t.attachments)for(const c in t.attachments){const a=t.attachments[c],h=s.findSkin(c);if(!h)throw new Error(`Skin not found: ${c}`);for(const d in a){const m=a[d],u=s.findSlot(d);if(!u)throw new Error(`Attachment slot not found: ${d}`);const f=u.index;for(const p in m){const g=m[p],b=h.getAttachment(f,p);if(!b)throw new Error(`Timeline attachment not found: ${p}`);for(const x in g){const w=g[x];let v=w[0];if(v){if(x==="deform"){const y=b.bones,T=b.vertices,S=y?T.length/3*2:T.length,A=new We(w.length,w.length,f,b);let C=I(v,"time",0);for(let M=0,Y=0;;M++){let F;const E=I(v,"vertices",null);if(!E)F=y?B.newFloatArray(S):T;else{F=B.newFloatArray(S);const U=I(v,"offset",0);if(B.arrayCopy(E,0,F,U,E.length),n!==1)for(let O=U,P=O+E.length;O<P;O++)F[O]*=n;if(!y)for(let O=0;O<S;O++)F[O]+=T[O]}A.setFrame(M,C,F);const X=w[M+1];if(!X){A.shrink(Y);break}const V=I(X,"time",0),N=v.curve;N&&(Y=G(N,A,Y,M,0,C,V,0,1,1)),C=V,v=X}i.push(A)}else if(x==="sequence"){const y=new He(w.length,f,b);let T=0;for(let S=0;S<w.length;S++){const A=I(v,"delay",T),C=I(v,"time",0),M=Pe[I(v,"mode","hold")],Y=I(v,"index",0);y.setFrame(S,C,M,Y,A),T=A,v=w[S+1]}i.push(y)}}}}}}if(t.drawOrder){const c=new St(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)c.setFrame(h++,I(d,"time",0),xn(s,d,a,null));i.push(c)}if(t.drawOrderFolder)for(const c of t.drawOrderFolder){const a=I(c,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const m=I(c,"keys",[]),u=new $t(m.length,h,s.slots.length);let f=0;for(const p of m)u.setFrame(f++,I(p,"time",0),xn(s,p,h.length,h));i.push(u)}if(t.events){const c=new Zt(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],m=s.findEvent(d.name);if(!m)throw new Error(`Event not found: ${d.name}`);const u=m.setupPose,f=new ae(B.toSinglePrecision(I(d,"time",0)),m);f.intValue=I(d,"int",u.intValue),f.floatValue=I(d,"float",u.floatValue),f.stringValue=I(d,"string",u.stringValue),f.data.audioPath&&(f.volume=I(d,"volume",u.volume),f.balance=I(d,"balance",u.volume)),c.setFrame(a,f)}i.push(c)}let r=0;for(let c=0,a=i.length;c<a;c++)r=Math.max(r,i[c].getDuration());const o=new Kt(e,i,r),l=I(t,"color",null);l!==null&&o.color.setFromString(l),s.animations.push(o)}},Di=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ot(t,e,s,n,i){let r=e[0],o=r.time??0,l=(r.value??n)*i,c=0;for(let a=0;;a++){s.setFrame(a,o,l);const h=e[a+1];if(!h){s.shrink(c),t.push(s);return}const d=h.time??0,m=(h.value??n)*i;r.curve&&(c=G(r.curve,s,c,a,0,o,d,l,m,i)),o=d,l=m,r=h}}function Xs(t,e,s,n,i,r,o){let l=e[0],c=l.time??0,a=(l[n]??r)*o,h=(l[i]??r)*o,d=0;for(let m=0;;m++){s.setFrame(m,c,a,h);const u=e[m+1];if(!u){s.shrink(d),t.push(s);return}const f=u.time??0,p=(u[n]??r)*o,g=(u[i]??r)*o,b=l.curve;b&&(d=G(b,s,d,m,0,c,f,a,p,o),d=G(b,s,d,m,1,c,f,h,g,o)),c=f,a=p,h=g,l=u}}function xn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),o=new Array(s-i.length);let l=0,c=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let m=0;m<s;m++)if(n[m]===h.index){d=m;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;l!==d;)o[c++]=l++;r[l+a.offset]=l++}for(;l<s;)o[c++]=l++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=o[--c]);return r}function G(t,e,s,n,i,r,o,l,c,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],m=t[h+1]*a,u=t[h+2],f=t[h+3]*a;return e.setBezier(s,n,i,r,l,d,m,u,f,o,c),s+1}function I(t,e,s){return t[e]!==void 0?t[e]:s}var Ui=class{commandPool=new $i;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new bn;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let o=0,l=r.length;o<l;o++){const c=r[o];if(!c.bone.active){i.clipEnd(c);continue}const a=c.appliedPose,h=a.attachment;if(!h){i.clipEnd(c);continue}const d=a.color;if(d.a===0&&!(h instanceof _t)){i.clipEnd(c);continue}let u,f,p,g,b,x,w;if(h instanceof Pt){if(x=h.color,x.a===0){i.clipEnd(c);continue}const A=h.sequence,C=A.resolveIndex(a);h.computeWorldVertices(c,h.getOffsets(a),this.worldVertices,0,n),u=this.worldVertices,f=4,p=A.getUVs(C),g=this.quadIndices,b=6,w=A.regions[C]?.texture}else if(h instanceof Tt){if(x=h.color,x.a===0){i.clipEnd(c);continue}this.worldVertices.length<h.worldVerticesLength&&(this.worldVertices=new Float32Array(h.worldVerticesLength)),h.computeWorldVertices(t,c,0,h.worldVerticesLength,this.worldVertices,0,n),u=this.worldVertices,f=h.worldVerticesLength>>1;const A=h.sequence,C=A.resolveIndex(a);p=A.getUVs(C),g=h.triangles,b=g.length,w=A.regions[C]?.texture}else if(h instanceof _t){i.clipEnd(c),i.clipStart(t,c,h);continue}else{i.clipEnd(c);continue}if(!w){i.clipEnd(c);continue}const v=t.color;let y,T;if(e){let A;if(s){A=Math.floor(s[3]*v.a*d.a*x.a*255);const C=Math.floor(A*s[0]*v.r*d.r*x.r),M=Math.floor(A*s[1]*v.g*d.g*x.g),Y=Math.floor(A*s[2]*v.b*d.b*x.b);y=A<<24|C<<16|M<<8|Y}else{A=Math.floor(v.a*d.a*x.a*255);const C=Math.floor(A*v.r*d.r*x.r),M=Math.floor(A*v.g*d.g*x.g),Y=Math.floor(A*v.b*d.b*x.b);y=A<<24|C<<16|M<<8|Y}if(T=4278190080,a.darkColor){const{r:C,g:M,b:Y}=a.darkColor;T=4278190080|Math.floor(C*A)<<16|Math.floor(M*A)<<8|Math.floor(Y*A)}}else{if(s){const A=Math.floor(s[3]*v.a*d.a*x.a*255),C=Math.floor(s[0]*v.r*d.r*x.r*255),M=Math.floor(s[1]*v.g*d.g*x.g*255),Y=Math.floor(s[2]*v.b*d.b*x.b*255);y=A<<24|C<<16|M<<8|Y}else{const A=Math.floor(v.a*d.a*x.a*255),C=Math.floor(v.r*d.r*x.r*255),M=Math.floor(v.g*d.g*x.g*255),Y=Math.floor(v.b*d.b*x.b*255);y=A<<24|C<<16|M<<8|Y}if(T=0,a.darkColor){const{r:A,g:C,b:M}=a.darkColor;T=Math.floor(A*255)<<16|Math.floor(C*255)<<8|Math.floor(M*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(u,0,g,b,p,n),u=i.clippedVerticesTyped,f=i.clippedVerticesLength/n,p=i.clippedUVsTyped,g=i.clippedTrianglesTyped,b=i.clippedTrianglesLength);const S=this.commandPool.getCommand(f,b,n);S.blendMode=c.data.blendMode,S.texture=w,S.positions.set(u.subarray(0,f*n)),S.uvs.set(p.subarray(0,f<<1));for(let A=0;A<f;A++)S.colors[A]=y,S.darkColors[A]=T;g instanceof Uint16Array?S.indices.set(g.subarray(0,b)):S.indices.set(g.slice(0,b)),this.renderCommands.push(S),i.clipEnd(c)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const o=t[e],l=this.commandPool.getCommand(n,i,r);l.blendMode=o.blendMode,l.texture=o.texture;let c=0,a=0,h=0,d=0,m=0;for(let u=e;u<=s;u++){const f=t[u];l.positions.set(f.positions,c),c+=f.numVertices*r,l.uvs.set(f.uvs,a),a+=f.numVertices<<1,l.colors.set(f.colors,h),l.darkColors.set(f.darkColors,h),h+=f.numVertices;for(let p=0;p<f.numIndices;p++)l.indices[d+p]=f.indices[p]+m;d+=f.numIndices,m+=f.numVertices}return l}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,o=n.numVertices,l=n.numIndices;for(;r<=this.renderCommands.length;){const c=r<this.renderCommands.length?this.renderCommands[r]:null;if(c&&c.numVertices===0&&c.numIndices===0){r++;continue}if(c!==null&&c.texture===n.texture&&c.blendMode===n.blendMode&&c.colors[0]===n.colors[0]&&c.darkColors[0]===n.darkColors[0]&&l+c.numIndices<65535)o+=c.numVertices,l+=c.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,o,l,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,o=n.numVertices,l=n.numIndices}r++}return e}},$i=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),o=new Uint32Array(t),l=new Uint32Array(t),c=new Uint16Array(e);n={positions:i,uvs:r,colors:o,darkColors:l,indices:c,_positions:i,_uvs:r,_colors:o,_darkColors:l,_indices:c,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};return On(Ns)})();