lyb-pixi-js 1.3.4 → 1.3.6
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.
|
@@ -113,7 +113,16 @@ export class LibPixiScrollNum extends LibPixiContainer {
|
|
|
113
113
|
if (!this._isDragging)
|
|
114
114
|
return;
|
|
115
115
|
const moveY = event.pageY - this._startY;
|
|
116
|
-
|
|
116
|
+
let newY = this._offsetY + moveY;
|
|
117
|
+
// 限制滑动区域的上下边界
|
|
118
|
+
const minY = this._scrollHeight / 2;
|
|
119
|
+
const maxY = -this._pageNum * this._slideHeight + this._scrollHeight / 2;
|
|
120
|
+
// 如果超出上下边界,禁止拖动
|
|
121
|
+
if (newY > minY)
|
|
122
|
+
newY = minY;
|
|
123
|
+
if (newY < maxY)
|
|
124
|
+
newY = maxY;
|
|
125
|
+
this._slideArea.y = newY;
|
|
117
126
|
(_a = this._scrollCallback) === null || _a === void 0 ? void 0 : _a.call(this, this._slideArea.y, this._currentIndex);
|
|
118
127
|
}
|
|
119
128
|
/** @description 结束拖动 */
|
package/lyb-pixi.js
CHANGED
|
@@ -1168,7 +1168,7 @@ void main(void)\r
|
|
|
1168
1168
|
* http://www.opensource.org/licenses/mit-license
|
|
1169
1169
|
*/class ir{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:m_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let r;const{value:n,time:a}=s[0],h=r=new ir(typeof n=="string"?pl(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];r.next=new ir(typeof l=="string"?pl(l):l,u),r=r.next}return h.isStepped=!!t.isStepped,h}const e=new ir(typeof t.start=="string"?pl(t.start):t.start,0);return t.end!==t.start&&(e.next=new ir(typeof t.end=="string"?pl(t.end):t.end,1)),e}}let So=q.from;const nr=Math.PI/180;function Ar(i,t){if(!i)return;const e=Math.sin(i),s=Math.cos(i),r=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=r,t.y=n}function fl(i,t,e){return i<<16|t<<8|e}function f_(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function AS(i){const t=1/f_(i);i.x*=t,i.y*=t}function p_(i,t){i.x*=t,i.y*=t}function pl(i,t){t||(t={}),i.charAt(0)==="#"?i=i.substr(1):i.indexOf("0x")===0&&(i=i.substr(2));let e;return i.length===8&&(e=i.substr(0,2),i=i.substr(2)),t.r=parseInt(i.substr(0,2),16),t.g=parseInt(i.substr(2,2),16),t.b=parseInt(i.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function m_(i){const t=i.length,e=1/t;return function(s){const r=t*s|0,n=(s-r*e)*t,a=i[r]||i[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function SS(i){return i?(i=i.toUpperCase().replace(/ /g,"_"),W[i]||W.NORMAL):W.NORMAL}class cu extends qe{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var Ft;(function(i){i[i.Spawn=0]="Spawn",i[i.Normal=2]="Normal",i[i.Late=5]="Late"})(Ft||(Ft={}));const uu=Tt.shared,Vi=Symbol("Position particle per emitter position");class wt{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){wt.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:m_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const r=wt.knownBehaviors[s.type];return r?new r(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vi),e.sort((s,r)=>s===Vi?r.order===Ft.Spawn?1:-1:r===Vi?s.order===Ft.Spawn?-1:1:s.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vi&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vi&&s.recycleParticle)}getBehavior(t){return wt.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof wt.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new cu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Ar(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?uu.remove(this.update,this):!this._autoUpdate&&t&&uu.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=uu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const r=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(r-e)*u+e,h=(n-s)*u+s}else a=r,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new cu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vi)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ar(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,r=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new cu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(r.next=h,h.prev=r,r=h):r=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=s,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vi)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ar(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}wt.knownBehaviors={};class du{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}du.type="rect",du.editorConfig=null;class ml{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Ar(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ml.type="torus",ml.editorConfig=null;class fu{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let r=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const r=t[s];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:r}=this.segments[e],n=Math.sqrt((r.x-s.x)*(r.x-s.x)+(r.y-s.y)*(r.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,r;if(this.segments.length===1)s=this.segments[0],r=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],r=h===0?e:e-this.countingLengths[h-1];break}r/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}fu.type="polygonalChain",fu.editorConfig=null;class pu{constructor(t){var e;this.order=Ft.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,r=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=f_(s);a>this.maxSpeed&&p_(s,this.maxSpeed/a)}t.x+=(r+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}pu.type="moveAcceleration",pu.editorConfig=null;function CS(i){return this.ease&&(i=this.ease(i)),(this.first.next.value-this.first.value)*i+this.first.value}function IS(i){this.ease&&(i=this.ease(i));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*i+t.r,r=(e.g-t.g)*i+t.g,n=(e.b-t.b)*i+t.b;return fl(s,r,n)}function PS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;return i=(i-t.time)/(e.time-t.time),(e.value-t.value)*i+t.value}function RS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;i=(i-t.time)/(e.time-t.time);const s=t.value,r=e.value,n=(r.r-s.r)*i+s.r,a=(r.g-s.g)*i+s.g,h=(r.b-s.b)*i+s.b;return fl(n,a,h)}function MS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;return t.value}function FS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;const e=t.value;return fl(e.r,e.g,e.b)}class Co{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t,t.next&&t.next.time>=1?this.interpolate=this.isColor?IS:CS:t.isStepped?this.interpolate=this.isColor?FS:MS:this.interpolate=this.isColor?RS:PS,this.ease=this.first.ease}}class mu{constructor(t){this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}mu.type="alpha",mu.editorConfig=null;class gu{constructor(t){this.order=Ft.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}gu.type="alphaStatic",gu.editorConfig=null;function g_(i){const t=[];for(let e=0;e<i.length;++e){let s=i[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let r=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;r>0;--r)t.push(s)}}return t}class _u{constructor(t){this.order=Ft.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],r=g_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[s];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const s=t.config,r=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||q.EMPTY}}_u.type="animatedRandom",_u.editorConfig=null;class yu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=g_(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:r>0?s.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(s.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}yu.type="animatedSingle",yu.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=SS(this.value),e=e.next}}xu.type="blendMode",xu.editorConfig=null;class vu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*nr,this.start=t.start*nr,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,s.rotation=r,this.distance&&(s.position.x=this.distance,Ar(r,s.position)),s=s.next,++e}}}vu.type="spawnBurst",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal,this.list=new Co(!0),this.list.reset(ir.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,r=fl(s.r,s.g,s.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}bu.type="color",bu.editorConfig=null;class wu{constructor(t){this.order=Ft.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}wu.type="colorStatic",wu.editorConfig=null;class Eu{constructor(t){this.order=Ft.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Eu.type="textureOrdered",Eu.editorConfig=null;const In=new st,__=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],kS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(__).join("|"),"g");function BS(i){const t=i.match(kS);for(let e=t.length-1;e>=0;--e)__.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return i=t.join(""),new Function("x",`return ${i};`)}class Tu{constructor(t){var e;if(this.order=Ft.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=BS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ar(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Tu.type="movePath",Tu.editorConfig=null;class Au{constructor(){this.order=Ft.Spawn}initParticles(t){}}Au.type="spawnPoint",Au.editorConfig=null;class Su{constructor(t){this.order=Ft.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Su.type="textureRandom",Su.editorConfig=null;class Cu{constructor(t){this.order=Ft.Normal,this.minStart=t.minStart*nr,this.maxStart=t.maxStart*nr,this.minSpeed=t.minSpeed*nr,this.maxSpeed=t.maxSpeed*nr,this.accel=t.accel*nr}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Cu.type="rotation",Cu.editorConfig=null;class Iu{constructor(t){this.order=Ft.Normal,this.min=t.min*nr,this.max=t.max*nr}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Iu.type="rotationStatic",Iu.editorConfig=null;class Pu{constructor(t){this.order=Ft.Late+1,this.rotation=(t.rotation||0)*nr}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Pu.type="noRotation",Pu.editorConfig=null;class Ru{constructor(t){var e;this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ru.type="scale",Ru.editorConfig=null;class Mu{constructor(t){this.order=Ft.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Mu.type="scaleStatic",Mu.editorConfig=null;class Ss{constructor(t){this.order=Ft.Spawn;const e=Ss.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){Ss.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Ss.type="spawnShape",Ss.editorConfig=null,Ss.shapes={},Ss.registerShape(fu),Ss.registerShape(du),Ss.registerShape(ml),Ss.registerShape(ml,"circle");class Fu{constructor(t){this.order=Ft.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Fu.type="textureSingle",Fu.editorConfig=null;class ku{constructor(t){var e;this.order=Ft.Late,this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;AS(r),p_(r,s),t.x+=r.x*e,t.y+=r.y*e}}ku.type="moveSpeed",ku.editorConfig=null;class Bu{constructor(t){this.order=Ft.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Bu.type="moveSpeedStatic",Bu.editorConfig=null,wt.registerBehavior(pu),wt.registerBehavior(mu),wt.registerBehavior(gu),wt.registerBehavior(_u),wt.registerBehavior(yu),wt.registerBehavior(xu),wt.registerBehavior(vu),wt.registerBehavior(bu),wt.registerBehavior(wu),wt.registerBehavior(Eu),wt.registerBehavior(Tu),wt.registerBehavior(Au),wt.registerBehavior(Su),wt.registerBehavior(Cu),wt.registerBehavior(Iu),wt.registerBehavior(Pu),wt.registerBehavior(Ru),wt.registerBehavior(Mu),wt.registerBehavior(Ss),wt.registerBehavior(Fu),wt.registerBehavior(ku),wt.registerBehavior(Bu);class Du extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="Arial",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vr({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:r,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class DS extends Bt{constructor(t){super();const{start:e,control:s,end:r,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new kT,this.addChild(this._particleContainer);const u=new wt(this._particleContainer,n),c=this._createBezierPoints([e,...s,r],100,o),d={pathThrough:0};xt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{xt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new Tt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const r=[];s&&t.forEach((n,a)=>{const h=new Du({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const s=t.length;let r=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);r+=o.x*c*u*l,n+=o.y*c*u*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let r=1;r<=e;r++)s=s*(t-r+1)/r;return s}}var at=(i=>(i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping",i))(at||{});class gl{constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){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&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(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 r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(i=>(i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add",i))(S||{}),At=(i=>(i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",i))(At||{}),ne=(i=>(i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent",i))(ne||{}),Fe=(i=>(i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale",i))(Fe||{}),vt=(i=>(i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection",i))(vt||{});function y_(i){switch(i.toLowerCase()){case"nearest":return Ye.Nearest;case"linear":return Ye.Linear;case"mipmap":return Ye.MipMap;case"mipmapnearestnearest":return Ye.MipMapNearestNearest;case"mipmaplinearnearest":return Ye.MipMapLinearNearest;case"mipmapnearestlinear":return Ye.MipMapNearestLinear;case"mipmaplinearlinear":return Ye.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${i}`)}}var Ye=(i=>(i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear",i))(Ye||{}),Ui=(i=>(i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat",i))(Ui||{});class Ou{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class OS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Lu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let r=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){r=s[a];break}if(r===null){r=new x_,r.name="texturePage";const a=e.baseTexture;r.width=a.realWidth,r.height=a.realHeight,r.baseTexture=a,r.minFilter=r.magFilter=Ye.Nearest,r.uWrap=Ui.ClampToEdge,r.vWrap=Ui.ClampToEdge,s.push(r)}const n=new v_;return n.name=t,n.page=r,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const r=new LS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=y_(n[1]),a.magFilter=y_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ui.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ui.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=r.readLine();for(;u!=null&&u.trim().length==0;)u=r.readLine();for(;!(u==null||u.trim().length==0||r.readEntry(n,u)==0);)u=r.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=r.readLine();else if(a===null){for(a=new x_,a.name=u.trim();r.readEntry(n,u=r.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new OS;const d=new v_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=r.readEntry(n,u=r.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new rt(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new rt(0,0,o.originalWidth,o.originalHeight),y=new rt(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class LS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(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 r=1,n=s+1;;r++){const a=e.indexOf(",",n);if(a==-1)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,a-n).trim(),n=a+1,r==4)return 4}}}class x_{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ui.ClampToEdge,this.vWrap=Ui.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ye.Linear?t.scaleMode=je.LINEAR:this.minFilter==Ye.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=xs.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class v_ extends Ou{}class NS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class VS{constructor(){this.entries={},this.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,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gi=class{constructor(i=0,t=0,e=0,s=0){this.r=i,this.g=t,this.b=e,this.a=s}set(i,t,e,s){return this.r=i,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(i){return this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this}setFromString(i){return i=i.charAt(0)=="#"?i.substr(1):i,this.r=parseInt(i.substr(0,2),16)/255,this.g=parseInt(i.substr(2,2),16)/255,this.b=parseInt(i.substr(4,2),16)/255,this.a=i.length!=8?1:parseInt(i.substr(6,2),16)/255,this}add(i,t,e,s){return this.r+=i,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(i,t){i.r=((t&4278190080)>>>24)/255,i.g=((t&16711680)>>>16)/255,i.b=((t&65280)>>>8)/255,i.a=(t&255)/255}static rgb888ToColor(i,t){i.r=((t&16711680)>>>16)/255,i.g=((t&65280)>>>8)/255,i.b=(t&255)/255}static fromString(i){return new Gi().setFromString(i)}};let X=Gi;X.WHITE=new Gi(1,1,1,1),X.RED=new Gi(1,0,0,1),X.GREEN=new Gi(0,1,0,1),X.BLUE=new Gi(0,0,1,1),X.MAGENTA=new Gi(1,0,1,1);const Sr=class{static clamp(i,t,e){return i<t?t:i>e?e:i}static cosDeg(i){return Math.cos(i*Sr.degRad)}static sinDeg(i){return Math.sin(i*Sr.degRad)}static signum(i){return Math.sign(i)}static toInt(i){return i>0?Math.floor(i):Math.ceil(i)}static cbrt(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t}static randomTriangular(i,t){return Sr.randomTriangularWith(i,t,(i+t)*.5)}static randomTriangularWith(i,t,e){const s=Math.random(),r=t-i;return s<=(e-i)/r?i+Math.sqrt(s*r*(e-i)):t-Math.sqrt((1-s)*r*(t-e))}static isPowerOfTwo(i){return i&&(i&i-1)===0}};let D=Sr;D.PI=3.1415927,D.PI2=Sr.PI*2,D.radiansToDegrees=180/Sr.PI,D.radDeg=Sr.radiansToDegrees,D.degreesToRadians=Sr.PI/180,D.degRad=Sr.degreesToRadians;class US{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class GS extends US{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class b_ extends GS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(i,t,e,s,r){for(let n=t,a=s;n<t+r;n++,a++)e[a]=i[n]}static arrayFill(i,t,e,s){for(let r=t;r<e;r++)i[r]=s}static setArraySize(i,t,e=0){const s=i.length;if(s==t)return i;if(i.length=t,s<t)for(let r=s;r<t;r++)i[r]=e;return i}static ensureArrayCapacity(i,t,e=0){return i.length>=t?i:Pn.setArraySize(i,t,e)}static newArray(i,t){const e=new Array(i);for(let s=0;s<i;s++)e[s]=t;return e}static newFloatArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(i){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(i):i}static toSinglePrecision(i){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(i):i}static webkit602BugfixHelper(i,t){}static contains(i,t,e=!0){for(let s=0;s<i.length;s++)if(i[s]==t)return!0;return!1}static enumValue(i,t){return i[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class XS{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class $S{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}}const YS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},ti=[0,0,0];class HS extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class WS extends FT{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const w_=class extends Bt{constructor(i){if(super(),!i)throw new Error("The spineData param is required.");if(typeof i=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=i,this.createSkeleton(i),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],r=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===at.Region){const a=r.name,h=this.createSprite(s,r,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(r.type===at.Mesh){const a=this.createMesh(s,r);s.currentMesh=a,s.currentMeshId=r.id,s.currentMeshName=r.name,n.addChild(a)}else r.type===at.Clipping&&(this.createGraphics(s,r),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(i){var t;i!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),i==null||i.registerSpine(this),this._debug=i)}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,this.updateTransform=i?w_.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(i){this.tintRgb=Kf(i,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:YS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(i){var l;const t=this.delayLimit;if(i>t&&(i=t),this.state.update(i),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let r=null,n=null;s?(r=s.light,n=s.dark):r=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentSprite.tint=eo(ti)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentMesh.tint=eo(ti)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,t.rotation=i.rotation*D.degRad,t.position.x=i.x,t.position.y=i.y,t.alpha=i.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=i.scaleX*i.width/e.originalWidth,t.scale.y=-i.scaleY*i.height/e.originalHeight))}setMeshRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(i.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const i=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(i)}Bt.prototype.updateTransform.call(this)}createSprite(i,t,e){let s=t.region;i.hackAttachment===t&&(s=i.hackRegion);const r=s?s.texture:null,n=this.newSprite(r);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),i.sprites=i.sprites||{},i.sprites[e]=n,n}createMesh(i,t){let e=t.region;i.hackAttachment===t&&(e=i.hackRegion,i.hackAttachment=null,i.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),ys.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),i.meshes=i.meshes||{},i.meshes[t.id]=s,s}createGraphics(i,t){const e=this.newGraphics(),s=new Nr([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,i.currentGraphics=e,i.clippingContainer=this.newContainer(),i.clippingContainer.mask=i.currentGraphics,e}updateGraphics(i,t){const e=i.currentGraphics.geometry,s=e.graphicsData[0].shape.points,r=t.worldVerticesLength;s.length=r,t.computeWorldVertices(i,0,r,s,0,2),e.invalidate()}hackTextureBySlotIndex(i,t=null,e=null){const s=this.skeleton.slots[i];if(!s)return!1;const r=s.getAttachment();let n=r.region;return t?(n=new Ou,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=r):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(r,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(r,s.currentMesh,n),!0}hackTextureBySlotName(i,t=null,e=null){const s=this.skeleton.findSlotIndex(i);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(i,t,e,s=null){const r=this.skeleton.findSlotIndex(i),n=this.skeleton.getAttachmentByName(i,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Ou,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new Bt}newSprite(i){return new HS(i)}newGraphics(){return new Ks}newMesh(i,t,e,s,r){return new WS(i,t,e,s,r)}transformHack(){return 1}hackAttachmentGroups(i,t,e){if(!i)return;const s=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(i)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,r]}destroy(i){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const r in s.meshes)s.meshes[r].destroy(i);s.meshes=null;for(const r in s.sprites)s.sprites[r].destroy(i);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(i);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(i)}};let Nu=w_;Nu.clippingPolygon=[],Object.defineProperty(Nu.prototype,"visible",{get(){return this._visible},set(i){i!==this._visible&&(this._visible=i,i&&(this.lastTime=0))}});let E_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const T_=class extends E_{constructor(t){super(t),this.id=(T_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xi=T_;Xi.nextID=0;let zS=class sy extends Xi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new sy(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},jS=class ry extends Xi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ry(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Vu=class xd extends Xi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new xd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new xd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},_l=class iy extends Xi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new iy(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},qS=class ny extends Xi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new ny(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},A_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends E_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof A_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let it=_e;it.OX1=0,it.OY1=1,it.OX2=2,it.OY2=3,it.OX3=4,it.OY3=5,it.OX4=6,it.OY4=7,it.X1=0,it.Y1=1,it.C1R=2,it.C1G=3,it.C1B=4,it.C1A=5,it.U1=6,it.V1=7,it.X2=8,it.Y2=9,it.C2R=10,it.C2G=11,it.C2B=12,it.C2A=13,it.U2=14,it.V2=15,it.X3=16,it.Y3=17,it.C3R=18,it.C3G=19,it.C3B=20,it.C3A=21,it.U3=22,it.V3=23,it.X4=24,it.Y4=25,it.C4R=26,it.C4G=27,it.C4B=28,it.C4A=29,it.U4=30,it.V4=31,new b_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,r,n){const a=(-e*2+r)*.03,h=(-s*2+n)*.03,o=((e-r)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let r=t*ee.BEZIER_SIZE;const n=s[r];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;r++;let a=0;for(let o=r,l=r+ee.BEZIER_SIZE-1;r<l;r+=2)if(a=s[r],a>=e){let u,c;return r==o?(u=0,c=0):(u=s[r-2],c=s[r-1]),c+(s[r+1]-c)*(e-u)/(a-u)}const h=s[r-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const ei=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+ei.ROTATION]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-ei.ENTRIES]){let m=o[o.length+ei.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,ei.ENTRIES),c=o[u+ei.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+ei.PREV_TIME]-d));let p=o[u+ei.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=ei;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let fs=ke;fs.ENTRIES=3,fs.PREV_TIME=-3,fs.PREV_X=-2,fs.PREV_Y=-1,fs.X=1,fs.Y=2;let S_=class ks extends fs{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-ks.ENTRIES])u=o[o.length+ks.PREV_X]*l.data.scaleX,c=o[o.length+ks.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,ks.ENTRIES);u=o[d+ks.PREV_X],c=o[d+ks.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ks.ENTRIES-1,1-(s-f)/(o[d+ks.PREV_TIME]-f));u=(u+(o[d+ks.X]-u)*p)*l.data.scaleX,c=(c+(o[d+ks.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},C_=class Bs extends fs{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X],c=o[o.length+Bs.PREV_Y];else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=u+(o[d+Bs.X]-u)*p,c=c+(o[d+Bs.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=r,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let He=Xt;He.ENTRIES=5,He.PREV_TIME=-5,He.PREV_R=-4,He.PREV_G=-3,He.PREV_B=-2,He.PREV_A=-1,He.R=1,He.G=2,He.B=3,He.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=r,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},I_=null,P_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),I_==null&&(I_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xi)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},Uu=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,r,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=r,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=r,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Cs=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Cs.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Cs.ENTRIES,this.frames[t]=e,this.frames[t+Cs.VALUE]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Cs.ENTRIES])u=o[o.length+Cs.PREV_VALUE];else{const c=oe.binarySearch(o,s,Cs.ENTRIES);u=o[c+Cs.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Cs.ENTRIES-1,1-(s-d)/(o[c+Cs.PREV_TIME]-d));u+=(o[c+Cs.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Cr=Cs;Cr.ENTRIES=2,Cr.PREV_TIME=-2,Cr.PREV_VALUE=-1,Cr.VALUE=1;let R_=class ci extends Cr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ci.ENTRIES])u=o[o.length+ci.PREV_VALUE];else{const c=oe.binarySearch(o,s,ci.ENTRIES);u=o[c+ci.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ci.ENTRIES-1,1-(s-d)/(o[c+ci.PREV_TIME]-d));u+=(o[c+ci.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let or=Be;or.ENTRIES=3,or.PREV_TIME=-3,or.PREV_ROTATE=-2,or.PREV_TRANSLATE=-1,or.ROTATE=1,or.TRANSLATE=2;const Yt=class{constructor(i){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new M_(this),this.propertyIDs=new NS,this.animationsChanged=!1,this.trackEntryPool=new XS(()=>new Gu),this.data=i}update(i){i*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=i*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+i)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=i,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,i)){let h=r.mixingFrom;for(r.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(i,t){const e=i.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,i.mixTime>0&&i.mixTime>=i.mixDuration?((e.totalAlpha==0||i.mixDuration==0)&&(i.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=i),i.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,i.mixTime+=t,!1)}apply(i){if(i==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,i,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,i,d,l,!0):g.apply(i,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Yt.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,i,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,i,d,l,!0):y.apply(i,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Yt.SETUP,n=i.slots;for(let a=0,h=i.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==r){const l=o.data.attachmentName;o.setAttachment(l==null?null:i.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(i,t,e){const s=i.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let r=0;i.mixDuration==0?(r=1,e==S.first&&(e=S.setup)):(r=i.mixTime/i.mixDuration,r>1&&(r=1),e!=S.first&&(e=s.mixBlend));const n=r<s.eventThreshold?this.events:null,a=r<s.attachmentThreshold,h=r<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*i.interruptAlpha,f=d*(1-r);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Yt.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=d;break;case Yt.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return i.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(i,t,e,s,r){const n=t.slots[i.slotIndex];if(!n.bone.active)return;const a=i.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,i.attachmentNames[h],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(i,t,e,s){t.setAttachment(e==null?null:i.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(i,t,e,s,r,n,a,h){if(h&&(n[a]=0),s==1){i.apply(t,0,e,null,1,r,At.mixIn);return}const o=i,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(r){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=r==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(i,t){const e=i.animationStart,s=i.animationEnd,r=s-e,n=i.trackLast%r,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(i,u)}let l=!1;for(i.loop?l=r==0||n>i.trackTime%r:l=t>=s&&i.animationLast<s,l&&this.queue.complete(i);h<o;h++)a[h].time<e||this.queue.event(i,a[h])}clearTracks(){const i=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=i,this.queue.drain()}clearTrack(i){if(i>=this.tracks.length)return;const t=this.tracks[i];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(i,t,e){const s=this.expandToIndex(i);this.tracks[i]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(i,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(i,s,e)}setAnimationWith(i,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,r=this.expandToIndex(i);r!=null&&(r.nextTrackLast==-1?(this.tracks[i]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,s=!1):this.disposeNext(r));const n=this.trackEntry(i,t,e,r);return this.setCurrent(i,n,s),this.queue.drain(),n}addAnimation(i,t,e,s){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(i,r,e,s)}addAnimationWith(i,t,e,s){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(i);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(i,t,e,r);if(r==null)this.setCurrent(i,n,!0),this.queue.drain();else if(r.next=n,s<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?s+=a*(1+(r.trackTime/a|0)):s+=Math.max(a,r.trackTime),s-=this.data.getMix(r.animation,t)):s=r.trackTime}return n.delay=s,n}setEmptyAnimation(i,t){const e=this.setAnimationWith(i,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(i,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(i,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(i){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,i)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(i){return i<this.tracks.length?this.tracks[i]:(B.ensureArrayCapacity(this.tracks,i+1,null),this.tracks.length=i+1,null)}trackEntry(i,t,e,s){const r=this.trackEntryPool.obtain();return r.trackIndex=i,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.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.interruptAlpha=1,r.mixTime=0,r.mixDuration=s==null?0:this.data.getMix(s.animation,t),r.mixBlend=S.replace,r}disposeNext(i){let t=i.next;for(;t!=null;)this.queue.dispose(t),t=t.next;i.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let i=0,t=this.tracks.length;i<t;i++){let e=this.tracks[i];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(i){const t=i.mixingTo,e=i.animation.timelines,s=i.animation.timelines.length,r=B.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;const n=B.setArraySize(i.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=a.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))r[h]=Yt.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof Uu||!t.animation.hasTimeline(l))r[h]=Yt.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(i.mixDuration>0){r[h]=Yt.HOLD_MIX,n[h]=u;continue t}break}r[h]=Yt.HOLD_FIRST}}}getCurrent(i){return i>=this.tracks.length?null:this.tracks[i]}addListener(i){if(i==null)throw new Error("listener cannot be null.");this.listeners.push(i)}removeListener(i){const t=this.listeners.indexOf(i);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(i,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(i,t,e)}addAnimationByName(i,t,e,s){Yt.deprecatedWarning2||(Yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(i,t,e,s)}hasAnimation(i){return this.data.skeletonData.findAnimation(i)!==null}hasAnimationByName(i){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(i)}};let ps=Yt;ps.emptyAnimation=new oe("<empty>",[],0),ps.SUBSEQUENT=0,ps.FIRST=1,ps.HOLD_SUBSEQUENT=2,ps.HOLD_FIRST=3,ps.HOLD_MIX=4,ps.SETUP=1,ps.CURRENT=2,ps.deprecatedWarning1=!1,ps.deprecatedWarning2=!1,ps.deprecatedWarning3=!1;const Ir=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const i=this.animationEnd-this.animationStart;return i==0?this.animationStart:this.trackTime%i+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(i){this.animationLast=i,this.nextAnimationLast=i}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(i){Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=i}get endTime(){return Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(i){Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=i}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Gu=Ir;Gu.deprecatedWarning1=!1,Gu.deprecatedWarning2=!1;const Xu=class{constructor(i){this.objects=[],this.drainDisabled=!1,this.animState=i}start(i){this.objects.push(ss.start),this.objects.push(i),this.animState.animationsChanged=!0}interrupt(i){this.objects.push(ss.interrupt),this.objects.push(i)}end(i){this.objects.push(ss.end),this.objects.push(i),this.animState.animationsChanged=!0}dispose(i){this.objects.push(ss.dispose),this.objects.push(i)}complete(i){this.objects.push(ss.complete),this.objects.push(i)}event(i,t){this.objects.push(ss.event),this.objects.push(i),this.objects.push(t)}deprecateStuff(){return Xu.deprecatedWarning1||(Xu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const i=this.objects,t=this.animState.listeners;for(let e=0;e<i.length;e+=2){const s=i[e],r=i[e+1];switch(s){case ss.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ss.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(r);break;case ss.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ss.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(r);this.animState.trackEntryPool.free(r);break;case ss.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(r);const n=D.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case ss.event:const a=i[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let M_=Xu;M_.deprecatedWarning1=!1;var ss=(i=>(i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event",i))(ss||{});const $u=class{constructor(i){if(this.animationToMixTime={},this.defaultMix=0,i==null)throw new Error("skeletonData cannot be null.");this.skeletonData=i}setMix(i,t,e){const s=this.skeletonData.findAnimation(i);if(s==null)throw new Error(`Animation not found: ${i}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,r,e)}setMixByName(i,t,e){$u.deprecatedWarning1||($u.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(i,t,e)}setMixWith(i,t,e){if(i==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${i.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(i,t){const e=`${i.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let F_=$u;F_.deprecatedWarning1=!1;let k_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new it(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Vu(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new zS(e)}newPathAttachment(t,e){return new _l(e)}newPointAttachment(t,e){return new qS(e)}newClippingAttachment(t,e){return new jS(e)}};class B_{constructor(t,e,s){if(this.matrix=new Rt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*r*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*r*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case vt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*r,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*r,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case vt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*r,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*r,l.d=D.sinDeg(g)*n;break}case vt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*r,b=D.cosDeg(y)*n,w=D.sinDeg(x)*r,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case vt.NoScale:case vt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==vt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*r,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*r,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,r=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*r-a*s.c*r,this.ay=a*s.a*r-n*s.b*r;const h=r*s.d,o=r*s.a,l=r*s.c,u=r*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=1/(s*a-r*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*r*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,r=t.y;return t.x=s*e.a+r*e.c+e.tx,t.y=s*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*r-o*a,e.b=o*s+h*n,e.d=o*r+h*a,this.appliedValid=!1}}let D_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Yu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},O_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},L_=class{constructor(t){this.name=t}};class ZS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,r,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case vt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case vt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(r||n){switch(t.data.transformMode){case vt.NoScale:case vt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(r&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,r,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=r-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,H=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*c+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,H=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(H)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,kt=T*T,zt=Math.atan2(Q,Z);A=kt*L*L+_t*H-_t*kt;const Qt=-2*kt*L,Pt=kt-_t;if(I=Qt*Qt-4*Pt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const Z0=Bn/Pt,K0=A/Bn,Dn=Math.abs(Z0)<Math.abs(K0)?Z0:K0;if(Dn*Dn<=H){k=Math.sqrt(H-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,is=0,li=0,kn=L+E,hi=kn*kn,q0=0;A=-E*L/(_t-kt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,is=k),I>hi&&(li=A,hi=I,kn=P,q0=k)),H<=(ze+hi)/2?(O=zt-Math.atan2(is*n,Ot),N=jt*n):(O=zt-Math.atan2(q0*n,kn),N=li*n)}const lt=Math.atan2(v,y)*x;let Et=t.arotation;O=(O-lt)*D.radDeg+g-Et,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Et+O*o,d,t.ascaleY,0,0),Et=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Et,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Et+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let N_=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},V_=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(be||{});const $i=class{constructor(i,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,i==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=i,this.bones=new Array;for(let e=0,s=i.bones.length;e<s;e++)this.bones.push(t.findBone(i.bones[e].name));this.target=t.findSlot(i.target.name),this.position=i.position,this.spacing=i.spacing,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix}isActive(){return this.active}apply(){this.update()}update(){const i=this.target.getAttachment();if(!(i instanceof _l))return;const t=this.rotateMix,e=this.translateMix,s=e>0,r=t>0;if(!s&&!r)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$i.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(i,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,r){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(i,t,e,s,r){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=i.closed;let c=i.worldVerticesLength,d=c/6,f=$i.NONE;if(!i.constantSpeed){const L=i.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),r)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let H=a;if(u)H%=$,H<0&&(H+=$),Z=0;else if(H<0){f!=$i.BEFORE&&(f=$i.BEFORE,i.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,o,N);continue}else if(H>$){f!=$i.AFTER&&(f=$i.AFTER,i.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(H>lt)){if(Z==0)H/=lt;else{const Et=L[Z-1];H=(H-Et)/(lt-Et)}break}}Z!=f&&(f=Z,u&&Z==d?(i.computeWorldVertices(n,c-4,4,l,0,2),i.computeWorldVertices(n,0,4,l,4,2)):i.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(H,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c-4,l,0,2),i.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),r)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const lt=p[O-1];Q=(Q-lt)/(H-lt)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],_=l[H+1],x=l[H+2],y=l[H+3],v=l[H+4],b=l[H+5],w=l[H+6],E=l[H+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[H]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const H=U[N];if(!(Q>H)){if(N==0)Q/=H;else{const lt=U[N-1];Q=N+(Q-lt)/(H-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(i,t,e,s,r){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addAfterPosition(i,t,e,s,r){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addCurvePosition(i,t,e,s,r,n,a,h,o,l,u,c){(i==0||isNaN(i))&&(i=1e-4);const d=i*i,f=d*i,p=1-i,m=p*p,g=m*p,_=p*i,x=_*3,y=p*x,v=x*i,b=t*g+s*y+n*v+h*f,w=e*g+r*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+r*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$i;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class KS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new $S,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(r>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*r;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(r>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*r;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(r>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*r}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(i){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,i==null)throw new Error("data cannot be null.");this.data=i,this.bones=new Array;for(let t=0;t<i.bones.length;t++){const e=i.bones[t];let s;if(e.parent==null)s=new B_(e,this,null);else{const r=this.bones[e.parent.index];s=new B_(e,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<i.slots.length;t++){const e=i.slots[t],s=this.bones[e.boneData.index],r=new A_(e,s);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<i.ikConstraints.length;t++){const e=i.ikConstraints[t];this.ikConstraints.push(new ZS(e,this))}this.transformConstraints=new Array;for(let t=0;t<i.transformConstraints.length;t++){const e=i.transformConstraints[t];this.transformConstraints.push(new KS(e,this))}this.pathConstraints=new Array;for(let t=0;t<i.pathConstraints.length;t++){const e=i.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const i=this._updateCache;i.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,n=e.length,a=s.length,h=r.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=r[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target;this.sortBone(t);const e=i.bones,s=e[0];if(this.sortBone(s),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(i),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(i){if(i.active=i.target.bone.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const r=t.getAttachment();r instanceof _l&&this.sortPathConstraintAttachmentWith(r,s);const n=i.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(i);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;this.sortBone(i.target);const t=i.bones,e=t.length;if(i.data.local)for(let s=0;s<e;s++){const r=t[s];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(i);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(i,t,e){const s=i.attachments[t];if(s)for(const r in s)this.sortPathConstraintAttachmentWith(s[r],e)}sortPathConstraintAttachmentWith(i,t){if(!(i instanceof _l))return;const e=i.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const h=e[r];this.sortBone(s[h])}}}}sortBone(i){if(i.sorted)return;const t=i.parent;t!=null&&this.sortBone(t),i.sorted=!0,this._updateCache.push(i)}sortReset(i){for(let t=0,e=i.length;t<e;t++){const s=i[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const i=this.updateCacheReset;for(let e=0,s=i.length;e<s;e++){const r=i[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const i=this.bones;for(let r=0,n=i.length;r<n;r++)i[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let r=0,n=e.length;r<n;r++){const a=e[r],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let r=0,n=s.length;r<n;r++){const a=s[r],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const i=this.slots;B.arrayCopy(i,0,this.drawOrder,0,i.length);for(let t=0,e=i.length;t<e;t++)i[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findBoneIndex(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}findSlot(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findSlotIndex(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}setSkinByName(i){const t=this.data.findSkin(i);if(t==null)throw new Error(`Skin not found: ${i}`);this.setSkin(t)}setSkin(i){if(i!=this.skin){if(i!=null)if(this.skin!=null)i.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=i.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=i,this.updateCache()}}getAttachmentByName(i,t){return this.getAttachment(this.data.findSlotIndex(i),t)}getAttachment(i,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(i,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(i,t):null}setAttachment(i,t){if(i==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.data.name==i){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${i}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${i}`)}findIkConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findTransformConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findPathConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}getBounds(i,t,e=new Array(2)){if(i==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof it)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Vu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];r=Math.min(r,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}i.set(r,n),t.set(a-r,h-n)}update(i){this.time+=i}get flipX(){return this.scaleX==-1}set flipX(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=i?1:-1}get flipY(){return this.scaleY==-1}set flipY(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=i?1:-1}};let U_=Ro;U_.deprecatedWarning1=!1;let G_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},X_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},$_=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Y_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Hu=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment!=null&&(r.attachment instanceof Vu?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new Y_(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new Y_(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(i){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=i}readSkeletonData(i){const t=this.scale,e=new G_;e.name="";const s=new gl(i);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const r=s.readBoolean();r&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new D_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),r&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new X_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new N_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new $_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new V_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,r);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,r)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new L_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(i,t,e,s){let r=null,n=0;if(e){if(n=i.readInt(!0),n==0)return null;r=new Hu("default")}else{r=new Hu(i.readStringRef()),r.bones.length=i.readInt(!0);for(let a=0,h=r.bones.length;a<h;a++)r.bones[a]=t.bones[i.readInt(!0)];for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.ikConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.transformConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.pathConstraints[i.readInt(!0)]);n=i.readInt(!0)}for(let a=0;a<n;a++){const h=i.readInt(!0);for(let o=0,l=i.readInt(!0);o<l;o++){const u=i.readStringRef(),c=this.readAttachment(i,t,r,h,u,s);c!=null&&r.setAttachment(h,u,c)}}return r}readAttachment(i,t,e,s,r,n){const a=this.scale;let h=i.readStringRef();h==null&&(h=r);const o=i.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=i.readStringRef();const c=i.readFloat(),d=i.readFloat(),f=i.readFloat(),p=i.readFloat(),m=i.readFloat(),g=i.readFloat(),_=i.readFloat(),x=i.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=i.readInt(!0),c=this.readVertices(i,u),d=n?i.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readInt(!0),f=this.readFloatArray(i,d<<1,1),p=this.readShortArray(i),m=this.readVertices(i,d),g=i.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(i),x=i.readFloat(),y=i.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readStringRef(),f=i.readStringRef(),p=i.readBoolean();let m=0,g=0;n&&(m=i.readFloat(),g=i.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new QS(_,d,s,f,p)),_)}case at.Path:{const u=i.readBoolean(),c=i.readBoolean(),d=i.readInt(!0),f=this.readVertices(i,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=i.readFloat()*a;const m=n?i.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=i.readFloat(),c=i.readFloat(),d=i.readFloat(),f=n?i.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=i.readInt(!0),c=i.readInt(!0),d=this.readVertices(i,c),f=n?i.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(i,t){const e=t<<1,s=new JS,r=this.scale;if(!i.readBoolean())return s.vertices=this.readFloatArray(i,e,r),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=i.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(i.readInt(!0)),n.push(i.readFloat()*r),n.push(i.readFloat()*r),n.push(i.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(i,t,e){const s=new Array(t);if(e==1)for(let r=0;r<t;r++)s[r]=i.readFloat();else for(let r=0;r<t;r++)s[r]=i.readFloat()*e;return s}readShortArray(i){const t=i.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=i.readShort();return e}readAnimation(i,t,e){const s=new Array,r=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new He(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*He.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),X.rgb888ToColor(h,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readFloat()),x<g-1&&this.readCurve(i,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new S_(g):m==Kt.BONE_SHEAR?_=new C_(g):(_=new fs(g),x=r),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,i.readFloat(),i.readFloat()*x,i.readFloat()*x),y<g-1&&this.readCurve(i,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*fs.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat()*r,i.readByte(),i.readBoolean(),i.readBoolean()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=i.readInt(!0);p<m;p++){const g=i.readByte(),_=i.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new R_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=r)):(x=new Cr(_),f.positionMode==ne.Fixed&&(y=r)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,i.readFloat(),i.readFloat()*y),v<_-1&&this.readCurve(i,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Cr.ENTRIES]);break}case Kt.PATH_MIX:{const x=new or(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,i.readFloat(),i.readFloat(),i.readFloat()),y<_-1&&this.readCurve(i,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*or.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=e.skins[i.readInt(!0)];for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readInt(!0);for(let g=0,_=i.readInt(!0);g<_;g++){const x=d.getAttachment(m,i.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=i.readInt(!0),E=new P_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=i.readFloat();let I,M=i.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=i.readInt(!0);if(M+=R,r==1)for(let C=R;C<M;C++)I[C]=i.readFloat();else for(let C=R;C<M;C++)I[C]=i.readFloat()*r;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(i,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=i.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=i.readFloat(),p=i.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=i.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+i.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=i.readInt(!0);if(l>0){const u=new Uu(l);for(let c=0;c<l;c++){const d=i.readFloat(),f=e.events[i.readInt(!0)],p=new O_(d,f);p.intValue=i.readInt(!1),p.floatValue=i.readFloat(),p.stringValue=i.readBoolean()?i.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=i.readFloat(),p.balance=i.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(i,t,e){switch(i.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat());break}}setCurve(i,t,e,s,r,n){i.setCurve(t,e,s,r,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[vt.Normal,vt.OnlyTranslation,vt.NoRotationOrReflection,vt.NoScale,vt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let QS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}},JS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},tC=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new G_,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new D_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new X_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new N_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new $_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new V_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new Hu(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new L_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new eC(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new He(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*He.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new S_(d.length),m=1):c==="shear"?f=new C_(d.length):(f=new fs(d.length),p=r),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*fs.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*r,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new R_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=r)):(p=new Cr(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Cr.ENTRIES])}else if(d==="mix"){const p=new or(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*or.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new P_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new Uu(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new O_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const r=t.curve;e.setCurve(s,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},eC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}};class sC extends Nu{createSkeleton(t){this.skeleton=new U_(t),this.skeleton.updateWorldTransform(),this.stateData=new F_(t),this.state=new ps(this.stateData)}}const rC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(i){return Le(i,".atlas")},async load(i){return await(await z.ADAPTER.fetch(i)).text()},testParse(i,t){const e=Le(t.src,".atlas"),s=typeof i=="string";return Promise.resolve(e&&s)},async parse(i,t,e){const s=t.data;let r=bt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
|
|
1170
1170
|
Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Lu(i,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Lu(i,H_(e,r,s.imageMetadata),l);return await h},unload(i){i.dispose()}}},H_=(i,t,e)=>async(s,r)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await i.load({src:n,data:e});r(a.baseTexture)};K.add(rC);function W_(i){return i.hasOwnProperty("bones")}function iC(i){return i instanceof ArrayBuffer}class nC{constructor(){}installLoader(){const t=this,e={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,r){var o;const n=Le(r.src,".json")&&W_(s),a=Le(r.src,".skel")&&iC(s),h=((o=r.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,r,n){const a=bt.extname(r.src).toLowerCase(),h=bt.basename(r.src,a);let o=bt.dirname(r.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(r.src,".json")&&W_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=r.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Lu(m,H_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
|
|
1171
|
-
Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let z_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const j_=class extends z_{constructor(t){super(t),this.id=(j_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=j_;Yi.nextID=0;let oC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},lC=class extends Yi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},hC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},cC=class extends Yi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class uC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends z_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof uC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new b_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=i*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let dC=class Ds extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X]*l.data.scaleX,c=o[o.length+Ds.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=(u+(o[d+Ds.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Ds.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},fC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X],c=o[o.length+Os.PREV_Y];else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=u+(o[d+Os.X]-u)*p,c=c+(o[d+Os.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let ms=Ht;ms.ENTRIES=5,ms.PREV_TIME=-5,ms.PREV_R=-4,ms.PREV_G=-3,ms.PREV_B=-2,ms.PREV_A=-1,ms.R=1,ms.G=2,ms.B=3,ms.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(r==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let pC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},q_=null,mC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),q_==null&&(q_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},gC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},_C=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let gs=St;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_MIX=-4,gs.PREV_BEND_DIRECTION=-3,gs.PREV_COMPRESS=-2,gs.PREV_STRETCH=-1,gs.MIX=1,gs.BEND_DIRECTION=2,gs.COMPRESS=3,gs.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let _s=Wt;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_ROTATE=-4,_s.PREV_TRANSLATE=-3,_s.PREV_SCALE=-2,_s.PREV_SHEAR=-1,_s.ROTATE=1,_s.TRANSLATE=2,_s.SCALE=3,_s.SHEAR=4;const Is=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Is.ENTRIES,this.frames[i]=t,this.frames[i+Is.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*r}return}let l=0;if(e>=h[h.length-Is.ENTRIES])l=h[h.length+Is.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Is.ENTRIES);l=h[u+Is.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Is.ENTRIES-1,1-(e-c)/(h[u+Is.PREV_TIME]-c));l+=(h[u+Is.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Is;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let yC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let xC=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new lC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new oC(e)}newPathAttachment(t,e){return new hC(e)}newPointAttachment(t,e){return new cC(e)}newClippingAttachment(t,e){return new aC(e)}},vC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},bC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},wC=class{constructor(t){this.name=t}},EC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},TC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let AC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},SC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},CC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},IC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},PC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new AC,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new vC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new SC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new EC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new CC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new TC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new IC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new wC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new RC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new pC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new ms(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ms.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new dC(d.length):c==="shear"?f=new fC(d.length):(f=new ar(d.length),p=r),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ar.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new gs(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*gs.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new _s(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new yC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ri.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new mC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new _C(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new gC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new bC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},RC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class Z_{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const K_=class extends Z_{constructor(i){super(i),this.id=K_.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=r,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=r,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=K_;ni.nextID=0;class Wu extends ni{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new Wu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class zu extends ni{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends ni{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class ju extends ni{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new ju(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class qu extends ni{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const Q_=class extends Z_{constructor(i,t){super(i),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const i=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=r*o+c,m=r*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const i=new Q_(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};let gt=Q_;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Zu=yl;Zu._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const J_=[0,1,2,3,4,5,6];class Ku{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new VS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{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 search1(t,e){const s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr extends he{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,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hr extends lr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const r=this.curves[s>>1];switch(r){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class Qu extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class t0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class e0 extends Qu{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class s0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class r0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class i0 extends Qu{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class o0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class a0 extends Qu{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class l0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class h0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class c0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class u0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class d0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class f0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class p0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class m0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class g0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const _0=class extends he{constructor(i){super(i,_0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let Ju=_0;Ju.propertyIds=[`${yt.event}`];const y0=class extends he{constructor(i){super(i,y0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let td=y0;td.propertyIds=[`${yt.drawOrder}`];class x0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class v0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class b0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class w0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class E0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=J_[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new Ku("<empty>",[],0);class T0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new Wu(e)}newPathAttachment(t,e){return new ju(e)}newPointAttachment(t,e){return new qu(e)}newClippingAttachment(t,e){return new zu(e)}}class A0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class ed{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let S0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class C0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class I0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class P0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Ps.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Ps=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Ps||{});class R0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class M0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class F0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class k0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class sd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.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=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new k0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new k0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class B0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new R0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new A0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new M0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new I0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new F0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new P0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Ps.Length||p.spacingMode==Ps.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new C0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new sd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new sd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new MC(_,c,r,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Zu(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?D0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new FC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case $C:{const _=new m0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case YC:{const _=t.readInt(!0),x=new c0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(T);break;case Ms:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}r.push(x);break}case HC:{const _=t.readInt(!0),x=new u0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(E);break;case Ms:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}r.push(x);break}case WC:{const _=t.readInt(!0),x=new f0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(M);break;case Ms:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}r.push(x);break}case zC:{const _=t.readInt(!0),x=new p0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(I);break;case Ms:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}r.push(x);break}case jC:{const _=new d0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:_.setStepped(v);break;case Ms:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case kC:r.push(Rr(t,new t0(m,g,c),1));break;case BC:r.push(rd(t,new e0(m,g,c),n));break;case DC:r.push(Rr(t,new s0(m,g,c),n));break;case OC:r.push(Rr(t,new r0(m,g,c),n));break;case LC:r.push(rd(t,new i0(m,g,c),1));break;case NC:r.push(Rr(t,new n0(m,g,c),1));break;case VC:r.push(Rr(t,new o0(m,g,c),1));break;case UC:r.push(rd(t,new a0(m,g,c),1));break;case GC:r.push(Rr(t,new l0(m,g,c),1));break;case XC:r.push(Rr(t,new h0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new x0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Rs:p.setStepped(x);break;case Ms:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new v0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Rs:p.setStepped(w);break;case Ms:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case ZC:r.push(Rr(t,new b0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case KC:r.push(Rr(t,new w0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Ps.Length||d.spacingMode==Ps.Fixed?n:1));break;case QC:const m=new E0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Rs:m.setStepped(v);break;case Ms:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}r.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case D0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new g0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Rs:M.setStepped(C);break;case Ms:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.push(M);break}case qC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,J_[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new td(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}r.push(l)}const h=t.readInt(!0);if(h>0){const l=new Ju(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new S0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new Ku(e,r,o)}}B0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let MC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class FC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(n);break;case Ms:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function rd(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(a);break;case Ms:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const kC=0,BC=1,DC=2,OC=3,LC=4,NC=5,VC=6,UC=7,GC=8,XC=9,$C=0,YC=1,HC=2,WC=3,zC=4,jC=5,D0=0,qC=1,ZC=0,KC=1,QC=2,Rs=1,Ms=2;class id{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new R0,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new A0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new M0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=id.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new I0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new F0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new P0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Ps,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Ps.Length||o.spacingMode==Ps.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new sd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new C0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new JC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,r);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,r);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,r);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Zu(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new m0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new c0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new u0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(cr(d,new d0(f,f,u),0,1));else if(c=="rgba2"){const p=new f0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new p0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(cr(d,new t0(f,f,u),0,1));else if(c==="translate"){const p=new e0(f,f<<1,u);n.push(nd(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new s0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new r0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new i0(f,f<<1,u);n.push(nd(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new n0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new o0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new a0(f,f<<1,u);n.push(nd(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new l0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new h0(f,f,u);n.push(cr(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new x0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new v0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new b0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new w0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Ps.Length||l.spacingMode==Ps.Fixed?r:1))}else if(c==="mix"){const m=new E0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new g0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pr[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new td(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new Ju(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new S0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ku(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class JC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function nd(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function od(i){const t=i.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class tI{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=od(r);if(n===ai.VER38&&(s=new le(new k_(t))),r=this.readVersionNewFormat(e),n=od(r),(n===ai.VER40||n===ai.VER41)&&(s=new B0(new T0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class eI{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=od(s);let n=null;if(r===ai.VER37&&(n=new PC(new xC(t))),r===ai.VER38&&(n=new tC(new k_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new id(new T0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class sI extends nC{createBinaryParser(){return new tI}createJsonParser(){return new eI}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new sI().installLoader();class rI extends sC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),Tt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){Tt.system.remove(this._loopFn),this.destroy({children:!0})}_loop(){this.update(Tt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class iI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class nI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mr(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class oI extends Bt{constructor(t){super(),this._maskUI=new hu({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class aI extends Bt{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._paramTxts=[];for(let e=0;e<3;e++){const s=new Du({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},Tt.shared.add(()=>{const t=Tt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,Math.floor(t).toFixed(0)),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class lI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(s-n)/2;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class hI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new Ks,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class cI extends Ao{constructor(t){const{width:e,height:s,content:r,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t,e=!0){var s;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var s;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(s=this._scrollCallback)==null||s.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const O0=i=>{const t=new Ks;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class uI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,O0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class dI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class fI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new dI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const L0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class pI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:h=3,lineColor:o="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=h,this._lineColor=o,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new Ks;s.lineStyle(this._lineWidth,this._lineColor),s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const r=new za(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),L0(r,this._cellWidth*.9)}}var ad={};/*!
|
|
1171
|
+
Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let z_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const j_=class extends z_{constructor(t){super(t),this.id=(j_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=j_;Yi.nextID=0;let oC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},lC=class extends Yi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},hC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},cC=class extends Yi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class uC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends z_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof uC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new b_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=i*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let dC=class Ds extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X]*l.data.scaleX,c=o[o.length+Ds.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=(u+(o[d+Ds.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Ds.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},fC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X],c=o[o.length+Os.PREV_Y];else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=u+(o[d+Os.X]-u)*p,c=c+(o[d+Os.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let ms=Ht;ms.ENTRIES=5,ms.PREV_TIME=-5,ms.PREV_R=-4,ms.PREV_G=-3,ms.PREV_B=-2,ms.PREV_A=-1,ms.R=1,ms.G=2,ms.B=3,ms.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(r==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let pC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},q_=null,mC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),q_==null&&(q_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},gC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},_C=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let gs=St;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_MIX=-4,gs.PREV_BEND_DIRECTION=-3,gs.PREV_COMPRESS=-2,gs.PREV_STRETCH=-1,gs.MIX=1,gs.BEND_DIRECTION=2,gs.COMPRESS=3,gs.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let _s=Wt;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_ROTATE=-4,_s.PREV_TRANSLATE=-3,_s.PREV_SCALE=-2,_s.PREV_SHEAR=-1,_s.ROTATE=1,_s.TRANSLATE=2,_s.SCALE=3,_s.SHEAR=4;const Is=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Is.ENTRIES,this.frames[i]=t,this.frames[i+Is.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*r}return}let l=0;if(e>=h[h.length-Is.ENTRIES])l=h[h.length+Is.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Is.ENTRIES);l=h[u+Is.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Is.ENTRIES-1,1-(e-c)/(h[u+Is.PREV_TIME]-c));l+=(h[u+Is.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Is;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let yC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let xC=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new lC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new oC(e)}newPathAttachment(t,e){return new hC(e)}newPointAttachment(t,e){return new cC(e)}newClippingAttachment(t,e){return new aC(e)}},vC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},bC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},wC=class{constructor(t){this.name=t}},EC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},TC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let AC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},SC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},CC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},IC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},PC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new AC,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new vC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new SC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new EC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new CC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new TC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new IC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new wC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new RC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new pC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new ms(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ms.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new dC(d.length):c==="shear"?f=new fC(d.length):(f=new ar(d.length),p=r),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ar.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new gs(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*gs.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new _s(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new yC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ri.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new mC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new _C(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new gC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new bC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},RC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class Z_{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const K_=class extends Z_{constructor(i){super(i),this.id=K_.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=r,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=r,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=K_;ni.nextID=0;class Wu extends ni{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new Wu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class zu extends ni{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends ni{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class ju extends ni{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new ju(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class qu extends ni{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const Q_=class extends Z_{constructor(i,t){super(i),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const i=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=r*o+c,m=r*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const i=new Q_(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};let gt=Q_;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Zu=yl;Zu._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const J_=[0,1,2,3,4,5,6];class Ku{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new VS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{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 search1(t,e){const s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr extends he{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,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hr extends lr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const r=this.curves[s>>1];switch(r){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class Qu extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class t0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class e0 extends Qu{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class s0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class r0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class i0 extends Qu{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class o0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class a0 extends Qu{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class l0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class h0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class c0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class u0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class d0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class f0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class p0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class m0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class g0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const _0=class extends he{constructor(i){super(i,_0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let Ju=_0;Ju.propertyIds=[`${yt.event}`];const y0=class extends he{constructor(i){super(i,y0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let td=y0;td.propertyIds=[`${yt.drawOrder}`];class x0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class v0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class b0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class w0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class E0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=J_[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new Ku("<empty>",[],0);class T0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new Wu(e)}newPathAttachment(t,e){return new ju(e)}newPointAttachment(t,e){return new qu(e)}newClippingAttachment(t,e){return new zu(e)}}class A0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class ed{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let S0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class C0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class I0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class P0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Ps.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Ps=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Ps||{});class R0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class M0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class F0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class k0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class sd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.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=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new k0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new k0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class B0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new R0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new A0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new M0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new I0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new F0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new P0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Ps.Length||p.spacingMode==Ps.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new C0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new sd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new sd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new MC(_,c,r,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Zu(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?D0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new FC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case $C:{const _=new m0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case YC:{const _=t.readInt(!0),x=new c0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(T);break;case Ms:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}r.push(x);break}case HC:{const _=t.readInt(!0),x=new u0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(E);break;case Ms:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}r.push(x);break}case WC:{const _=t.readInt(!0),x=new f0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(M);break;case Ms:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}r.push(x);break}case zC:{const _=t.readInt(!0),x=new p0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(I);break;case Ms:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}r.push(x);break}case jC:{const _=new d0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:_.setStepped(v);break;case Ms:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case kC:r.push(Rr(t,new t0(m,g,c),1));break;case BC:r.push(rd(t,new e0(m,g,c),n));break;case DC:r.push(Rr(t,new s0(m,g,c),n));break;case OC:r.push(Rr(t,new r0(m,g,c),n));break;case LC:r.push(rd(t,new i0(m,g,c),1));break;case NC:r.push(Rr(t,new n0(m,g,c),1));break;case VC:r.push(Rr(t,new o0(m,g,c),1));break;case UC:r.push(rd(t,new a0(m,g,c),1));break;case GC:r.push(Rr(t,new l0(m,g,c),1));break;case XC:r.push(Rr(t,new h0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new x0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Rs:p.setStepped(x);break;case Ms:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new v0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Rs:p.setStepped(w);break;case Ms:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case ZC:r.push(Rr(t,new b0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case KC:r.push(Rr(t,new w0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Ps.Length||d.spacingMode==Ps.Fixed?n:1));break;case QC:const m=new E0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Rs:m.setStepped(v);break;case Ms:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}r.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case D0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new g0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Rs:M.setStepped(C);break;case Ms:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.push(M);break}case qC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,J_[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new td(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}r.push(l)}const h=t.readInt(!0);if(h>0){const l=new Ju(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new S0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new Ku(e,r,o)}}B0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let MC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class FC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(n);break;case Ms:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function rd(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Rs:t.setStepped(a);break;case Ms:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const kC=0,BC=1,DC=2,OC=3,LC=4,NC=5,VC=6,UC=7,GC=8,XC=9,$C=0,YC=1,HC=2,WC=3,zC=4,jC=5,D0=0,qC=1,ZC=0,KC=1,QC=2,Rs=1,Ms=2;class id{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new R0,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new A0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new M0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=id.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new I0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new F0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new P0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Ps,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Ps.Length||o.spacingMode==Ps.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new sd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new C0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new JC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,r);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,r);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,r);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Zu(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new m0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new c0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new u0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(cr(d,new d0(f,f,u),0,1));else if(c=="rgba2"){const p=new f0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new p0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(cr(d,new t0(f,f,u),0,1));else if(c==="translate"){const p=new e0(f,f<<1,u);n.push(nd(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new s0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new r0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new i0(f,f<<1,u);n.push(nd(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new n0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new o0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new a0(f,f<<1,u);n.push(nd(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new l0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new h0(f,f,u);n.push(cr(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new x0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new v0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new b0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new w0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Ps.Length||l.spacingMode==Ps.Fixed?r:1))}else if(c==="mix"){const m=new E0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new g0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pr[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new td(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new Ju(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new S0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ku(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class JC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function nd(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function od(i){const t=i.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class tI{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=od(r);if(n===ai.VER38&&(s=new le(new k_(t))),r=this.readVersionNewFormat(e),n=od(r),(n===ai.VER40||n===ai.VER41)&&(s=new B0(new T0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class eI{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=od(s);let n=null;if(r===ai.VER37&&(n=new PC(new xC(t))),r===ai.VER38&&(n=new tC(new k_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new id(new T0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class sI extends nC{createBinaryParser(){return new tI}createJsonParser(){return new eI}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new sI().installLoader();class rI extends sC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),Tt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){Tt.system.remove(this._loopFn),this.destroy()}_loop(){this.update(Tt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class iI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class nI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mr(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class oI extends Bt{constructor(t){super(),this._maskUI=new hu({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class aI extends Bt{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._paramTxts=[];for(let e=0;e<3;e++){const s=new Du({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},Tt.shared.add(()=>{const t=Tt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,Math.floor(t).toFixed(0)),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class lI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(s-n)/2;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class hI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new Ks,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class cI extends Ao{constructor(t){const{width:e,height:s,content:r,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new Ks;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t,e=!0){var s;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var a;if(!this._isDragging)return;const e=t.pageY-this._startY;let s=this._offsetY+e;const r=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;s>r&&(s=r),s<n&&(s=n),this._slideArea.y=s,(a=this._scrollCallback)==null||a.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const O0=i=>{const t=new Ks;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class uI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,O0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class dI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class fI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new dI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const L0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class pI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:h=3,lineColor:o="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=h,this._lineColor=o,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new Ks;s.lineStyle(this._lineWidth,this._lineColor),s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const r=new za(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),L0(r,this._cellWidth*.9)}}var ad={};/*!
|
|
1172
1172
|
* howler.js v2.2.4
|
|
1173
1173
|
* howlerjs.com
|
|
1174
1174
|
*
|