lyb-pixi-js 1.1.15 → 1.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,4 @@
1
- import type { Container } from "pixi.js";
2
1
  export interface LibPixiSubAddMinMaxParams {
3
- /** 最小按钮 */
4
- minBtn: Container;
5
- /** 最大按钮 */
6
- maxBtn: Container;
7
- /** 增加按钮 */
8
- subBtn: Container;
9
- /** 减少按钮 */
10
- addBtn: Container;
11
2
  /** 初始下注索引 */
12
3
  initialBetIndex: number;
13
4
  /** 下注金额列表 */
@@ -30,9 +21,9 @@ export declare class LibPixiSubAddMinMax {
30
21
  /** 金额列表数量 */
31
22
  private _betAmountListLength;
32
23
  /** 金额更新回调 */
33
- private onAmountIndex;
24
+ private _onAmountIndex;
34
25
  /** 按钮置灰状态回调 */
35
- private onDisabled;
26
+ private _onDisabled;
36
27
  constructor(params: LibPixiSubAddMinMaxParams);
37
28
  /** @description 点击最小按钮 */
38
29
  min(): void;
@@ -7,12 +7,12 @@ export class LibPixiSubAddMinMax {
7
7
  /** 金额列表数量 */
8
8
  this._betAmountListLength = 0;
9
9
  const { initialBetIndex, betAmountListLength, onAmountIndex, onDisabled } = params;
10
- this.onAmountIndex = onAmountIndex;
11
- this.onDisabled = onDisabled;
10
+ this._onAmountIndex = onAmountIndex;
11
+ this._onDisabled = onDisabled;
12
12
  this._betAmountListLength = betAmountListLength;
13
13
  //金额增减步进器
14
14
  this._baseNumSteper = new LibJsNumberStepper(betAmountListLength, (index) => {
15
- this.onAmountIndex(index);
15
+ this._onAmountIndex(index);
16
16
  this.minMaxUpdateIndex(index);
17
17
  });
18
18
  //设置初始状态
@@ -22,13 +22,13 @@ export class LibPixiSubAddMinMax {
22
22
  /** @description 点击最小按钮 */
23
23
  min() {
24
24
  this.minMaxUpdateIndex(0);
25
- this.onAmountIndex(0);
25
+ this._onAmountIndex(0);
26
26
  }
27
27
  /** @description 点击最大按钮 */
28
28
  max() {
29
29
  const index = this._betAmountListLength - 1;
30
30
  this.minMaxUpdateIndex(index);
31
- this.onAmountIndex(index);
31
+ this._onAmountIndex(index);
32
32
  }
33
33
  /** @description 点击减少按钮 */
34
34
  sub() {
@@ -43,13 +43,13 @@ export class LibPixiSubAddMinMax {
43
43
  */
44
44
  minMaxUpdateIndex(index) {
45
45
  if (index === 0) {
46
- this.onDisabled("min");
46
+ this._onDisabled("min");
47
47
  }
48
48
  else if (index === this._betAmountListLength - 1) {
49
- this.onDisabled("max");
49
+ this._onDisabled("max");
50
50
  }
51
51
  else {
52
- this.onDisabled();
52
+ this._onDisabled();
53
53
  }
54
54
  this._baseNumSteper.updateIndex(index);
55
55
  }
package/README.md CHANGED
@@ -479,10 +479,6 @@ import { LibPixiSubAddMinMax } from "lyb-pixi-js";
479
479
 
480
480
  //创建按钮实例
481
481
  const betControl = new LibPixiSubAddMinMax({
482
- minBtn: minButton, //最小按钮
483
- maxBtn: maxButton, //最大按钮
484
- subBtn: subButton, //减少按钮
485
- addBtn: addButton, //增加按钮
486
482
  initialBetIndex: 0, //初始下注索引
487
483
  betAmountListLength: 10, //下注金额列表长度
488
484
  onAmountIndex: (index) => {
package/lyb-pixi.js CHANGED
@@ -1166,7 +1166,7 @@ void main(void)\r
1166
1166
  *
1167
1167
  * @pixi/particle-emitter is licensed under the MIT License.
1168
1168
  * http://www.opensource.org/licenses/mit-license
1169
- */class _i{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,i?this.ease=typeof i=="function"?i:Km(i):this.ease=null}static createList(t){if("list"in t){const i=t.list;let r;const{value:n,time:a}=i[0],o=r=new _i(typeof n=="string"?lo(n):n,a,t.ease);if(i.length>2||i.length===2&&i[1].value!==n)for(let h=1;h<i.length;++h){const{value:l,time:c}=i[h];r.next=new _i(typeof l=="string"?lo(l):l,c),r=r.next}return o.isStepped=!!t.isStepped,o}const e=new _i(typeof t.start=="string"?lo(t.start):t.start,0);return t.end!==t.start&&(e.next=new _i(typeof t.end=="string"?lo(t.end):t.end,1)),e}}let wn=X.from;const gi=Math.PI/180;function Li(s,t){if(!s)return;const e=Math.sin(s),i=Math.cos(s),r=t.x*i-t.y*e,n=t.x*e+t.y*i;t.x=r,t.y=n}function ho(s,t,e){return s<<16|t<<8|e}function jm(s){return Math.sqrt(s.x*s.x+s.y*s.y)}function Gw(s){const t=1/jm(s);s.x*=t,s.y*=t}function qm(s,t){s.x*=t,s.y*=t}function lo(s,t){t||(t={}),s.charAt(0)==="#"?s=s.substr(1):s.indexOf("0x")===0&&(s=s.substr(2));let e;return s.length===8&&(e=s.substr(0,2),s=s.substr(2)),t.r=parseInt(s.substr(0,2),16),t.g=parseInt(s.substr(2,2),16),t.b=parseInt(s.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function Km(s){const t=s.length,e=1/t;return function(i){const r=t*i|0,n=(i-r*e)*t,a=s[r]||s[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function Hw(s){return s?(s=s.toUpperCase().replace(/ /g,"_"),K[s]||K.NORMAL):K.NORMAL}class cc extends _e{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 xt;(function(s){s[s.Spawn=0]="Spawn",s[s.Normal=2]="Normal",s[s.Late=5]="Late"})(xt||(xt={}));const uc=ft.shared,Us=Symbol("Position particle per emitter position");class ut{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 tt,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new tt,this._prevEmitterPos=new tt,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){ut.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:Km(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(i=>{const r=ut.knownBehaviors[i.type];return r?new r(i.config):(console.error(`Unknown behavior: ${i.type}`),null)}).filter(i=>!!i);e.push(Us),e.sort((i,r)=>i===Us?r.order===xt.Spawn?1:-1:r===Us?i.order===xt.Spawn?-1:1:i.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(i=>i!==Us&&i.updateParticle),this.recycleBehaviors=e.filter(i=>i!==Us&&i.recycleParticle)}getBehavior(t){return ut.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof ut.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new cc(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let i=0;i<this.recycleBehaviors.length;++i)this.recycleBehaviors[i].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,Li(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?uc.remove(this.update,this):!this._autoUpdate&&t&&uc.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=uc.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,o;a;a=o)if(o=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let h=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?h=this.customEase(h,0,1,1):h=this.customEase(h)),a.agePercent=h;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,i;this._prevPosIsValid&&(e=this._prevEmitterPos.x,i=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,o;if(this._prevPosIsValid&&this._posChanged){const c=1+this._spawnTimer/t;a=(r-e)*c+e,o=(n-i)*c+i}else a=r,o=n;let h=null,l=null;for(let c=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),d=0;d<c;++d){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let u;if(this.minLifetime===this.maxLifetime?u=this.minLifetime:u=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=u)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new cc(this),f.init(u),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),h?(l.next=f,f.prev=l,l=f):l=h=f,++this.particleCount}if(h){this._activeParticlesLast?(this._activeParticlesLast.next=h,h.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=h,this._activeParticlesLast=l);for(let c=0;c<this.initBehaviors.length;++c){const d=this.initBehaviors[c];if(d===Us)for(let u=h,f;u;u=f){f=u.next,this.rotation!==0&&(Li(this.rotation,u.position),u.rotation+=this.rotation),u.position.x+=a,u.position.y+=o,u.age+=-this._spawnTimer;let p=u.age*u.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),u.agePercent=p}else d.initParticles(h)}for(let c=h,d;c;c=d){d=c.next;for(let u=0;u<this.updateBehaviors.length;++u)if(this.updateBehaviors[u].updateParticle(c,-this._spawnTimer)){this.recycle(c);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 i=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 o;this._poolFirst?(o=this._poolFirst,this._poolFirst=this._poolFirst.next,o.next=null):o=new cc(this);let h;this.minLifetime===this.maxLifetime?h=this.minLifetime:h=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,o.init(h),this.addAtBack?this._parent.addChildAt(o,0):this._parent.addChild(o),i?(r.next=o,o.prev=r,r=o):r=i=o,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=i,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Us)for(let o=i,h;o;o=h)h=o.next,this.rotation!==0&&(Li(this.rotation,o.position),o.rotation+=this.rotation),o.position.x+=t,o.position.y+=e;else a.initParticles(i)}}}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}}ut.knownBehaviors={};class dc{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}}dc.type="rect",dc.editorConfig=null;class co{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),Li(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}co.type="torus",co.editorConfig=null;class fc{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 i=t[e];let r=i[0];for(let n=1;n<i.length;++n){const a=i[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let i=1;i<t.length;++i){const r=t[i];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:i,p2:r}=this.segments[e],n=Math.sqrt((r.x-i.x)*(r.x-i.x)+(r.y-i.y)*(r.y-i.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let i,r;if(this.segments.length===1)i=this.segments[0],r=e;else for(let o=0;o<this.countingLengths.length;++o)if(e<this.countingLengths[o]){i=this.segments[o],r=o===0?e:e-this.countingLengths[o-1];break}r/=i.l||1;const{p1:n,p2:a}=i;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}fc.type="polygonalChain",fc.editorConfig=null;class pc{constructor(t){var e;this.order=xt.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 i=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,r=i.x,n=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const a=jm(i);a>this.maxSpeed&&qm(i,this.maxSpeed/a)}t.x+=(r+i.x)/2*e,t.y+=(n+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}pc.type="moveAcceleration",pc.editorConfig=null;function Vw(s){return this.ease&&(s=this.ease(s)),(this.first.next.value-this.first.value)*s+this.first.value}function Ww(s){this.ease&&(s=this.ease(s));const t=this.first.value,e=this.first.next.value,i=(e.r-t.r)*s+t.r,r=(e.g-t.g)*s+t.g,n=(e.b-t.b)*s+t.b;return ho(i,r,n)}function Xw(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;return s=(s-t.time)/(e.time-t.time),(e.value-t.value)*s+t.value}function $w(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;s=(s-t.time)/(e.time-t.time);const i=t.value,r=e.value,n=(r.r-i.r)*s+i.r,a=(r.g-i.g)*s+i.g,o=(r.b-i.b)*s+i.b;return ho(n,a,o)}function zw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;return t.value}function Yw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;const e=t.value;return ho(e.r,e.g,e.b)}class En{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?Ww:Vw:t.isStepped?this.interpolate=this.isColor?Yw:zw:this.interpolate=this.isColor?$w:Xw,this.ease=this.first.ease}}class mc{constructor(t){this.order=xt.Normal,this.list=new En(!1),this.list.reset(_i.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)}}mc.type="alpha",mc.editorConfig=null;class _c{constructor(t){this.order=xt.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}_c.type="alphaStatic",_c.editorConfig=null;function Zm(s){const t=[];for(let e=0;e<s.length;++e){let i=s[e];if(typeof i=="string")t.push(wn(i));else if(i instanceof X)t.push(i);else{let r=i.count||1;for(typeof i.texture=="string"?i=wn(i.texture):i=i.texture;r>0;--r)t.push(i)}}return t}class gc{constructor(t){this.order=xt.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],r=Zm(i.textures),n=i.framerate<0?-1:i.framerate>0?i.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!i.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[i];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 i=t.config,r=i.anim;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(i.anim.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||X.EMPTY}}gc.type="animatedRandom",gc.editorConfig=null;class yc{constructor(t){this.order=xt.Normal;const e=t.anim,i=Zm(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:r>0?i.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const i=this.anim;for(;e;)e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}updateParticle(t,e){const i=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(i.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=i.textures[n]||i.textures[i.textures.length-1]||X.EMPTY}}yc.type="animatedSingle",yc.editorConfig=null;class xc{constructor(t){this.order=xt.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=Hw(this.value),e=e.next}}xc.type="blendMode",xc.editorConfig=null;class vc{constructor(t){this.order=xt.Spawn,this.spacing=t.spacing*gi,this.start=t.start*gi,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,i.rotation=r,this.distance&&(i.position.x=this.distance,Li(r,i.position)),i=i.next,++e}}}vc.type="spawnBurst",vc.editorConfig=null;class bc{constructor(t){this.order=xt.Normal,this.list=new En(!0),this.list.reset(_i.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,r=ho(i.r,i.g,i.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}bc.type="color",bc.editorConfig=null;class Tc{constructor(t){this.order=xt.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}}Tc.type="colorStatic",Tc.editorConfig=null;class wc{constructor(t){this.order=xt.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?wn(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}}wc.type="textureOrdered",wc.editorConfig=null;const Ar=new tt,Qm=["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"],jw=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(Qm).join("|"),"g");function qw(s){const t=s.match(jw);for(let e=t.length-1;e>=0;--e)Qm.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return s=t.join(""),new Function("x",`return ${s};`)}class Ec{constructor(t){var e;if(this.order=xt.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=qw(t.path)}catch{this.path=null}else this.path=i=>i;this.list=new En(!1),this.list.reset(_i.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 tt(e.x,e.y),e.config.movement=0;const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=i*e,Ar.x=t.config.movement,Ar.y=this.path(Ar.x),Li(t.config.initRotation,Ar),t.position.x=t.config.initPosition.x+Ar.x,t.position.y=t.config.initPosition.y+Ar.y}}Ec.type="movePath",Ec.editorConfig=null;class Ac{constructor(){this.order=xt.Spawn}initParticles(t){}}Ac.type="spawnPoint",Ac.editorConfig=null;class Sc{constructor(t){this.order=xt.Normal,this.textures=t.textures.map(e=>typeof e=="string"?wn(e):e)}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[i],e=e.next}}}Sc.type="textureRandom",Sc.editorConfig=null;class Cc{constructor(t){this.order=xt.Normal,this.minStart=t.minStart*gi,this.maxStart=t.maxStart*gi,this.minSpeed=t.minSpeed*gi,this.maxSpeed=t.maxSpeed*gi,this.accel=t.accel*gi}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 i=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+i)/2*e}else t.rotation+=t.config.rotSpeed*e}}Cc.type="rotation",Cc.editorConfig=null;class Pc{constructor(t){this.order=xt.Normal,this.min=t.min*gi,this.max=t.max*gi}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}}Pc.type="rotationStatic",Pc.editorConfig=null;class Rc{constructor(t){this.order=xt.Late+1,this.rotation=(t.rotation||0)*gi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Rc.type="noRotation",Rc.editorConfig=null;class Ic{constructor(t){var e;this.order=xt.Normal,this.list=new En(!1),this.list.reset(_i.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=i,e.scale.x=e.scale.y=this.list.first.value*i,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ic.type="scale",Ic.editorConfig=null;class Mc{constructor(t){this.order=xt.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=i,e=e.next}}}Mc.type="scaleStatic",Mc.editorConfig=null;class ze{constructor(t){this.order=xt.Spawn;const e=ze.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){ze.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}ze.type="spawnShape",ze.editorConfig=null,ze.shapes={},ze.registerShape(fc),ze.registerShape(dc),ze.registerShape(co),ze.registerShape(co,"circle");class Dc{constructor(t){this.order=xt.Normal,this.texture=typeof t.texture=="string"?wn(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Dc.type="textureSingle",Dc.editorConfig=null;class Bc{constructor(t){var e;this.order=xt.Late,this.list=new En(!1),this.list.reset(_i.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e.config.velocity?e.config.velocity.set(this.list.first.value*i,0):e.config.velocity=new tt(this.list.first.value*i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;Gw(r),qm(r,i),t.x+=r.x*e,t.y+=r.y*e}}Bc.type="moveSpeed",Bc.editorConfig=null;class Oc{constructor(t){this.order=xt.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity;t.x+=i.x*e,t.y+=i.y*e}}Oc.type="moveSpeedStatic",Oc.editorConfig=null,ut.registerBehavior(pc),ut.registerBehavior(mc),ut.registerBehavior(_c),ut.registerBehavior(gc),ut.registerBehavior(yc),ut.registerBehavior(xc),ut.registerBehavior(vc),ut.registerBehavior(bc),ut.registerBehavior(Tc),ut.registerBehavior(wc),ut.registerBehavior(Ec),ut.registerBehavior(Ac),ut.registerBehavior(Sc),ut.registerBehavior(Cc),ut.registerBehavior(Pc),ut.registerBehavior(Rc),ut.registerBehavior(Ic),ut.registerBehavior(Mc),ut.registerBehavior(ze),ut.registerBehavior(Dc),ut.registerBehavior(Bc),ut.registerBehavior(Oc);class Fc extends Va{constructor(t){const{text:e,fontSize:i=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:o,fontFamily:h="MicrosoftYaHei",fontWeight:l="normal",wordWrap:c=!1,wordWrapWidth:d=100,lineHeight:u=1.25,align:f="left",indent:p=0,shadow:m}=t,_=new Mi({fontSize:i,wordWrap:c,wordWrapWidth:d,fontWeight:l,lineHeight:u*i,breakWords:c,fill:r,align:f,fontFamily:h,stroke:n?a:"transparent",strokeThickness:n?o:0,lineJoin:"round"});m&&(_.dropShadow=!0,_.dropShadowColor=m[0],_.dropShadowAngle=m[1]*(Math.PI/180),_.dropShadowBlur=m[2],_.dropShadowDistance=m[3]),super(e,_),this.position.x=p*i}}class Kw extends bt{constructor(t){super();const{start:e,control:i,end:r,json:n,duration:a,ease:o="power1.out",showControl:h=!1,loop:l=!1}=t;this._particleContainer=new jb,this.addChild(this._particleContainer);const c=new ut(this._particleContainer,n),d=this._createBezierPoints([e,...i,r],100,h),u={pathThrough:0};ct.to(u,{duration:a,pathThrough:d.length-1,repeat:l?-1:0,ease:o,onStart:()=>{c.emit=!0},onUpdate:()=>{const p=Math.floor(u.pathThrough),m=d[p];c.updateOwnerPos(m.x,m.y)},onComplete:()=>{ct.to(this,{alpha:0,duration:.5,onComplete:()=>{c.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new ft;f.add(()=>{c.update(1/75)}),f.start()}_createBezierPoints(t,e,i){const r=[];i&&t.forEach((n,a)=>{const o=new Fc({text:a+1,fontSize:16});o.position.set(n.x,n.y),this.addChild(o)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const i=t.length;let r=0,n=0;const a=[];for(let o=0;o<i;o++)a[o]=this._binomial(i-1,o);for(let o=0;o<i;o++){const h=t[o],l=a[o],c=Math.pow(e,o),d=Math.pow(1-e,i-1-o);r+=h.x*d*c*l,n+=h.y*d*c*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let i=1;for(let r=1;r<=e;r++)i=i*(t-r+1)/r;return i}}var yi=(s=>(s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping",s))(yi||{}),j=(s=>(s[s.setup=0]="setup",s[s.first=1]="first",s[s.replace=2]="replace",s[s.add=3]="add",s))(j||{}),Te=(s=>(s[s.mixIn=0]="mixIn",s[s.mixOut=1]="mixOut",s))(Te||{}),uo=(s=>(s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent",s))(uo||{}),Gs=(s=>(s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale",s))(Gs||{}),se=(s=>(s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",s))(se||{});class Jm{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 Zw{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}}const Hs=class{constructor(s=0,t=0,e=0,i=0){this.r=s,this.g=t,this.b=e,this.a=i}set(s,t,e,i){return this.r=s,this.g=t,this.b=e,this.a=i,this.clamp()}setFromColor(s){return this.r=s.r,this.g=s.g,this.b=s.b,this.a=s.a,this}setFromString(s){return s=s.charAt(0)=="#"?s.substr(1):s,this.r=parseInt(s.substr(0,2),16)/255,this.g=parseInt(s.substr(2,2),16)/255,this.b=parseInt(s.substr(4,2),16)/255,this.a=s.length!=8?1:parseInt(s.substr(6,2),16)/255,this}add(s,t,e,i){return this.r+=s,this.g+=t,this.b+=e,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(s,t){s.r=((t&4278190080)>>>24)/255,s.g=((t&16711680)>>>16)/255,s.b=((t&65280)>>>8)/255,s.a=(t&255)/255}static rgb888ToColor(s,t){s.r=((t&16711680)>>>16)/255,s.g=((t&65280)>>>8)/255,s.b=(t&255)/255}static fromString(s){return new Hs().setFromString(s)}};let we=Hs;we.WHITE=new Hs(1,1,1,1),we.RED=new Hs(1,0,0,1),we.GREEN=new Hs(0,1,0,1),we.BLUE=new Hs(0,0,1,1),we.MAGENTA=new Hs(1,0,1,1);const ki=class{static clamp(s,t,e){return s<t?t:s>e?e:s}static cosDeg(s){return Math.cos(s*ki.degRad)}static sinDeg(s){return Math.sin(s*ki.degRad)}static signum(s){return Math.sign(s)}static toInt(s){return s>0?Math.floor(s):Math.ceil(s)}static cbrt(s){const t=Math.pow(Math.abs(s),.3333333333333333);return s<0?-t:t}static randomTriangular(s,t){return ki.randomTriangularWith(s,t,(s+t)*.5)}static randomTriangularWith(s,t,e){const i=Math.random(),r=t-s;return i<=(e-s)/r?s+Math.sqrt(i*r*(e-s)):t-Math.sqrt((1-i)*r*(t-e))}static isPowerOfTwo(s){return s&&(s&s-1)===0}};let k=ki;k.PI=3.1415927,k.PI2=ki.PI*2,k.radiansToDegrees=180/ki.PI,k.radDeg=ki.radiansToDegrees,k.degreesToRadians=ki.PI/180,k.degRad=ki.degreesToRadians;class Qw{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}}class Jw extends Qw{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 tE extends Jw{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Sr=class{static arrayCopy(s,t,e,i,r){for(let n=t,a=i;n<t+r;n++,a++)e[a]=s[n]}static arrayFill(s,t,e,i){for(let r=t;r<e;r++)s[r]=i}static setArraySize(s,t,e=0){const i=s.length;if(i==t)return s;if(s.length=t,i<t)for(let r=i;r<t;r++)s[r]=e;return s}static ensureArrayCapacity(s,t,e=0){return s.length>=t?s:Sr.setArraySize(s,t,e)}static newArray(s,t){const e=new Array(s);for(let i=0;i<s;i++)e[i]=t;return e}static newFloatArray(s){if(Sr.SUPPORTS_TYPED_ARRAYS)return new Float32Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(s){if(Sr.SUPPORTS_TYPED_ARRAYS)return new Int16Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(s){return Sr.SUPPORTS_TYPED_ARRAYS?new Float32Array(s):s}static toSinglePrecision(s){return Sr.SUPPORTS_TYPED_ARRAYS?Math.fround(s):s}static webkit602BugfixHelper(s,t){}static contains(s,t,e=!0){for(let i=0;i<s.length;i++)if(s[i]==t)return!0;return!1}static enumValue(s,t){return s[t[0].toUpperCase()+t.slice(1)]}};let Q=Sr;Q.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class eE{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 iE{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 sE={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},hs=[0,0,0];class rE extends _e{constructor(){super(...arguments),this.region=null,this.attachment=null}}class nE extends Yb{constructor(t,e,i,r,n){super(t,e,i,r,n),this.region=null,this.attachment=null}}const t_=class extends bt{constructor(s){if(super(),!s)throw new Error("The spineData param is required.");if(typeof s=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=s,this.createSkeleton(s),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t],r=i.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===yi.Region){const a=r.name,o=this.createSprite(i,r,a);i.currentSprite=o,i.currentSpriteName=a,n.addChild(o)}else if(r.type===yi.Mesh){const a=this.createMesh(i,r);i.currentMesh=a,i.currentMeshId=r.id,i.currentMeshName=r.name,n.addChild(a)}else r.type===yi.Clipping&&(this.createGraphics(i,r),n.addChild(i.clippingContainer),n.addChild(i.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(s){var t;s!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),s==null||s.registerSpine(this),this._debug=s)}get autoUpdate(){return this._autoUpdate}set autoUpdate(s){s!==this._autoUpdate&&(this._autoUpdate=s,this.updateTransform=s?t_.prototype.autoUpdateTransform:bt.prototype.updateTransform)}get tint(){return Qr(this.tintRgb)}set tint(s){this.tintRgb=Md(s,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:sE.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(s){var l;const t=this.delayLimit;if(s>t&&(s=t),this.state.update(s),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,i=this.color;let r=null,n=null;i?(r=i.light,n=i.dark):r=this.tintRgb;for(let c=0,d=e.length;c<d;c++){const u=e[c],f=u.getAttachment(),p=this.slotContainers[c];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(u,f);let _=f.region;const y=f.color;switch(f!=null&&f.type){case yi.Region:if(p.transform.setFromMatrix(u.bone.matrix),_=f.region,u.currentMesh&&(u.currentMesh.visible=!1,u.currentMesh=null,u.currentMeshId=void 0,u.currentMeshName=void 0),!_){u.currentSprite&&(u.currentSprite.renderable=!1);break}if(!u.currentSpriteName||u.currentSpriteName!==f.name){const x=f.name;if(u.currentSprite&&(u.currentSprite.visible=!1),u.sprites=u.sprites||{},u.sprites[x]!==void 0)u.sprites[x].visible=!0;else{const b=this.createSprite(u,f,x);p.addChild(b)}u.currentSprite=u.sprites[x],u.currentSpriteName=x}u.currentSprite.renderable=!0,u.hackRegion||this.setSpriteRegion(f,u.currentSprite,_),u.currentSprite.color?m=u.currentSprite.color:(hs[0]=r[0]*u.color.r*y.r,hs[1]=r[1]*u.color.g*y.g,hs[2]=r[2]*u.color.b*y.b,u.currentSprite.tint=Qr(hs)),u.currentSprite.blendMode=u.blendMode;break;case yi.Mesh:if(u.currentSprite){u.currentSprite.visible=!1,u.currentSprite=null,u.currentSpriteName=void 0;const x=new ca;x._parentID=-1,x._worldID=p.transform._worldID,p.transform=x}if(!_){u.currentMesh&&(u.currentMesh.renderable=!1);break}const g=f.id;if(u.currentMeshId===void 0||u.currentMeshId!==g){const x=g;if(u.currentMesh&&(u.currentMesh.visible=!1),u.meshes=u.meshes||{},u.meshes[x]!==void 0)u.meshes[x].visible=!0;else{const b=this.createMesh(u,f);p.addChild(b)}u.currentMesh=u.meshes[x],u.currentMeshName=f.name,u.currentMeshId=x}u.currentMesh.renderable=!0,f.computeWorldVerticesOld(u,u.currentMesh.vertices),u.currentMesh.color?m=u.currentMesh.color:(hs[0]=r[0]*u.color.r*y.r,hs[1]=r[1]*u.color.g*y.g,hs[2]=r[2]*u.color.b*y.b,u.currentMesh.tint=Qr(hs)),u.currentMesh.blendMode=u.blendMode,u.hackRegion||this.setMeshRegion(f,u.currentMesh,_);break;case yi.Clipping:u.currentGraphics||(this.createGraphics(u,f),p.addChild(u.clippingContainer),p.addChild(u.currentGraphics)),this.updateGraphics(u,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let v=u.color.r*y.r,g=u.color.g*y.g,x=u.color.b*y.b;m.setLight(r[0]*v+n[0]*(1-v),r[1]*g+n[1]*(1-g),r[2]*x+n[2]*(1-x)),u.darkColor?(v=u.darkColor.r,g=u.darkColor.g,x=u.darkColor.b):(v=0,g=0,x=0),m.setDark(r[0]*v+n[0]*(1-v),r[1]*g+n[1]*(1-g),r[2]*x+n[2]*(1-x))}p.alpha=u.color.a}const a=this.skeleton.drawOrder;let o=null,h=null;for(let c=0,d=a.length;c<d;c++){const u=e[a[c].data.index],f=this.slotContainers[a[c].data.index];if(h||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),u.currentGraphics&&u.getAttachment())h=u.clippingContainer,o=u.getAttachment(),h.children.length=0,this.children[c]=f,o.endSlot===u.data&&(o.endSlot=null);else if(h){let p=this.tempClipContainers[c];p||(p=this.tempClipContainers[c]=this.newContainer(),p.visible=!1),this.children[c]=p,f.parent=null,h.addChild(f),o.endSlot==u.data&&(h.renderable=!0,h=null,o=null)}else this.children[c]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,t.rotation=s.rotation*k.degRad,t.position.x=s.x,t.position.y=s.y,t.alpha=s.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=s.scaleX*s.width/e.originalWidth,t.scale.y=-s.scaleY*s.height/e.originalHeight))}setMeshRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(s.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const s=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(s)}bt.prototype.updateTransform.call(this)}createSprite(s,t,e){let i=t.region;s.hackAttachment===t&&(i=s.hackRegion);const r=i?i.texture:null,n=this.newSprite(r);return n.anchor.set(.5),i&&this.setSpriteRegion(t,n,t.region),s.sprites=s.sprites||{},s.sprites[e]=n,n}createMesh(s,t){let e=t.region;s.hackAttachment===t&&(e=s.hackRegion,s.hackAttachment=null,s.hackRegion=null);const i=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),Ue.TRIANGLES);return typeof i._canvasPadding<"u"&&(i._canvasPadding=1.5),i.alpha=t.color.a,i.region=t.region,e&&this.setMeshRegion(t,i,e),s.meshes=s.meshes||{},s.meshes[t.id]=i,i}createGraphics(s,t){const e=this.newGraphics(),i=new $i([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(i),e.renderable=!1,s.currentGraphics=e,s.clippingContainer=this.newContainer(),s.clippingContainer.mask=s.currentGraphics,e}updateGraphics(s,t){const e=s.currentGraphics.geometry,i=e.graphicsData[0].shape.points,r=t.worldVerticesLength;i.length=r,t.computeWorldVertices(s,0,r,i,0,2),e.invalidate()}hackTextureBySlotIndex(s,t=null,e=null){const i=this.skeleton.slots[s];if(!i)return!1;const r=i.getAttachment();let n=r.region;return t?(n=new Jm,n.texture=t,n.size=e,i.hackRegion=n,i.hackAttachment=r):(i.hackRegion=null,i.hackAttachment=null),i.currentSprite?this.setSpriteRegion(r,i.currentSprite,n):i.currentMesh&&this.setMeshRegion(r,i.currentMesh,n),!0}hackTextureBySlotName(s,t=null,e=null){const i=this.skeleton.findSlotIndex(s);return i==-1?!1:this.hackTextureBySlotIndex(i,t,e)}hackTextureAttachment(s,t,e,i=null){const r=this.skeleton.findSlotIndex(s),n=this.skeleton.getAttachmentByName(s,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const o=a.getAttachment();if(t===o.name){let h=n.region;return e?(h=new Jm,h.texture=e,h.size=i,a.hackRegion=h,a.hackAttachment=o):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=h?(this.setSpriteRegion(o,a.currentSprite,h),a.currentSprite.region=h):a.currentMesh&&a.currentMesh.region!=h&&this.setMeshRegion(o,a.currentMesh,h),!0}return!1}newContainer(){return new bt}newSprite(s){return new rE(s)}newGraphics(){return new li}newMesh(s,t,e,i,r){return new nE(s,t,e,i,r)}transformHack(){return 1}hackAttachmentGroups(s,t,e){if(!s)return;const i=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const o=this.skeleton.slots[n],h=o.currentSpriteName||o.currentMeshName||"",l=o.currentSprite||o.currentMesh;h.endsWith(s)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,i.push(l))}return[i,r]}destroy(s){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t];for(const r in i.meshes)i.meshes[r].destroy(s);i.meshes=null;for(const r in i.sprites)i.sprites[r].destroy(s);i.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(s);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(s)}};let Lc=t_;Lc.clippingPolygon=[],Object.defineProperty(Lc.prototype,"visible",{get(){return this._visible},set(s){s!==this._visible&&(this._visible=s,s&&(this.lastTime=0))}});class e_{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}}const i_=class extends e_{constructor(s){super(s),this.id=(i_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(s,t){this.computeWorldVertices(s,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(s,t,e,i,r,n){e=r+(e>>1)*n;const a=s.bone.skeleton,o=s.deform;let h=this.vertices;const l=this.bones;if(l==null){o.length>0&&(h=o);const f=s.bone.matrix,p=f.tx,m=f.ty,_=f.a,y=f.c,v=f.b,g=f.d;for(let x=t,b=r;b<e;x+=2,b+=n){const w=h[x],T=h[x+1];i[b]=w*_+T*y+p,i[b+1]=w*v+T*g+m}return}let c=0,d=0;for(let f=0;f<t;f+=2){const p=l[c];c+=p+1,d+=p}const u=a.bones;if(o.length==0)for(let f=r,p=d*3;f<e;f+=n){let m=0,_=0,y=l[c++];for(y+=c;c<y;c++,p+=3){const v=u[l[c]].matrix,g=h[p],x=h[p+1],b=h[p+2];m+=(g*v.a+x*v.c+v.tx)*b,_+=(g*v.b+x*v.d+v.ty)*b}i[f]=m,i[f+1]=_}else{const f=o;for(let p=r,m=d*3,_=d<<1;p<e;p+=n){let y=0,v=0,g=l[c++];for(g+=c;c<g;c++,m+=3,_+=2){const x=u[l[c]].matrix,b=h[m]+f[_],w=h[m+1]+f[_+1],T=h[m+2];y+=(b*x.a+w*x.c+x.tx)*T,v+=(b*x.b+w*x.d+x.ty)*T}i[p]=y,i[p+1]=v}}}copyTo(s){this.bones!=null?(s.bones=new Array(this.bones.length),Q.arrayCopy(this.bones,0,s.bones,0,this.bones.length)):s.bones=null,this.vertices!=null?(s.vertices=Q.newFloatArray(this.vertices.length),Q.arrayCopy(this.vertices,0,s.vertices,0,this.vertices.length)):s.vertices=null,s.worldVerticesLength=this.worldVerticesLength,s.deformAttachment=this.deformAttachment}};let kc=i_;kc.nextID=0;class fo extends kc{constructor(t){super(t),this.type=yi.Mesh,this.color=new we(1,1,1,1),this.tempColor=new we(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 fo(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),Q.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),Q.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),Q.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new fo(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}}class An extends kc{constructor(t){super(t),this.type=yi.Path,this.closed=!1,this.constantSpeed=!1,this.color=new we(1,1,1,1)}copy(){const t=new An(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Q.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class s_{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 we,this.darkColor=t.darkColor==null?null:new we,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 Kt=class extends e_{constructor(s){super(s),this.type=yi.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 we(1,1,1,1),this.offset=Q.newFloatArray(8),this.uvs=Q.newFloatArray(8),this.tempColor=new we(1,1,1,1)}updateOffset(){const s=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,e=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*t,r=e+this.region.width*s,n=i+this.region.height*t,a=this.rotation*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=e*o+this.x,c=e*h,d=i*o+this.y,u=i*h,f=r*o+this.x,p=r*h,m=n*o+this.y,_=n*h,y=this.offset;y[Kt.OX1]=l-u,y[Kt.OY1]=d+c,y[Kt.OX2]=l-_,y[Kt.OY2]=m+c,y[Kt.OX3]=f-_,y[Kt.OY3]=m+p,y[Kt.OX4]=f-u,y[Kt.OY4]=d+p}setRegion(s){this.region=s;const t=this.uvs;s.rotate?(t[2]=s.u,t[3]=s.v2,t[4]=s.u,t[5]=s.v,t[6]=s.u2,t[7]=s.v,t[0]=s.u2,t[1]=s.v2):(t[0]=s.u,t[1]=s.v2,t[2]=s.u,t[3]=s.v,t[4]=s.u2,t[5]=s.v,t[6]=s.u2,t[7]=s.v2)}computeWorldVertices(s,t,e,i){const r=this.offset,n=s instanceof s_?s.bone.matrix:s.matrix,a=n.tx,o=n.ty,h=n.a,l=n.c,c=n.b,d=n.d;let u=0,f=0;u=r[Kt.OX1],f=r[Kt.OY1],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX2],f=r[Kt.OY2],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX3],f=r[Kt.OY3],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX4],f=r[Kt.OY4],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o}copy(){const s=new Kt(this.name);return s.region=this.region,s.rendererObject=this.rendererObject,s.path=this.path,s.x=this.x,s.y=this.y,s.scaleX=this.scaleX,s.scaleY=this.scaleY,s.rotation=this.rotation,s.width=this.width,s.height=this.height,Q.arrayCopy(this.uvs,0,s.uvs,0,8),Q.arrayCopy(this.offset,0,s.offset,0,8),s.color.setFromColor(this.color),s}};let et=Kt;et.OX1=0,et.OY1=1,et.OX2=2,et.OY2=3,et.OX3=4,et.OY3=5,et.OX4=6,et.OY4=7,et.X1=0,et.Y1=1,et.C1R=2,et.C1G=3,et.C1B=4,et.C1A=5,et.U1=6,et.V1=7,et.X2=8,et.Y2=9,et.C2R=10,et.C2G=11,et.C2B=12,et.C2A=13,et.U2=14,et.V2=15,et.X3=16,et.Y3=17,et.C3R=18,et.C3G=19,et.C3B=20,et.C3A=21,et.U3=22,et.V3=23,et.X4=24,et.Y4=25,et.C4R=26,et.C4G=27,et.C4B=28,et.C4A=29,et.U4=30,et.V4=31,new tE(2);class pe{constructor(t,e,i){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=i}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,i,r,n,a,o,h){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let c=0,d=l.length;c<d;c++)l[c].apply(t,e,i,n,a,o,h)}static binarySearch(t,e,i=1){let r=0,n=t.length/i-2;if(n==0)return i;let a=n>>>1;for(;;){if(t[(a+1)*i]<=e?r=a+1:n=a,r==n)return(r+1)*i;a=r+n>>>1}}static linearSearch(t,e,i){for(let r=0,n=t.length-i;r<=n;r+=i)if(t[r]>e)return r;return-1}}const Gt=class{constructor(s){if(s<=0)throw new Error(`frameCount must be > 0: ${s}`);this.curves=Q.newFloatArray((s-1)*Gt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/Gt.BEZIER_SIZE+1}setLinear(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.LINEAR}setStepped(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.STEPPED}getCurveType(s){const t=s*Gt.BEZIER_SIZE;if(t==this.curves.length)return Gt.LINEAR;const e=this.curves[t];return e==Gt.LINEAR?Gt.LINEAR:e==Gt.STEPPED?Gt.STEPPED:Gt.BEZIER}setCurve(s,t,e,i,r){const n=(-t*2+i)*.03,a=(-e*2+r)*.03,o=((t-i)*3+1)*.006,h=((e-r)*3+1)*.006;let l=n*2+o,c=a*2+h,d=t*.3+n+o*.16666667,u=e*.3+a+h*.16666667,f=s*Gt.BEZIER_SIZE;const p=this.curves;p[f++]=Gt.BEZIER;let m=d,_=u;for(let y=f+Gt.BEZIER_SIZE-1;f<y;f+=2)p[f]=m,p[f+1]=_,d+=l,u+=c,l+=o,c+=h,m+=d,_+=u}getCurvePercent(s,t){t=k.clamp(t,0,1);const e=this.curves;let i=s*Gt.BEZIER_SIZE;const r=e[i];if(r==Gt.LINEAR)return t;if(r==Gt.STEPPED)return 0;i++;let n=0;for(let o=i,h=i+Gt.BEZIER_SIZE-1;i<h;i+=2)if(n=e[i],n>=t){let l,c;return i==o?(l=0,c=0):(l=e[i-2],c=e[i-1]),c+(e[i+1]-c)*(t-l)/(n-l)}const a=e[i-1];return a+(1-a)*(t-n)/(1-n)}};let Fe=Gt;Fe.LINEAR=0,Fe.STEPPED=1,Fe.BEZIER=2,Fe.BEZIER_SIZE=10*2-1;const ls=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(s,t,e){s<<=1,this.frames[s]=t,this.frames[s+ls.ROTATION]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotation=h.data.rotation;return;case j.first:const p=h.data.rotation-h.rotation;h.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=o[o.length-ls.ENTRIES]){let p=o[o.length+ls.PREV_ROTATION];switch(n){case j.setup:h.rotation=h.data.rotation+p*r;break;case j.first:case j.replace:p+=h.data.rotation-h.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case j.add:h.rotation+=p*r}return}const l=pe.binarySearch(o,e,ls.ENTRIES),c=o[l+ls.PREV_ROTATION],d=o[l],u=this.getCurvePercent((l>>1)-1,1-(e-d)/(o[l+ls.PREV_TIME]-d));let f=o[l+ls.ROTATION]-c;switch(f=c+(f-(16384-(16384.499999999996-f/360|0))*360)*u,n){case j.setup:h.rotation=h.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case j.first:case j.replace:f+=h.data.rotation-h.rotation;case j.add:h.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Le=ls;Le.ENTRIES=2,Le.PREV_TIME=-2,Le.PREV_ROTATION=-1,Le.ROTATION=1;const ae=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ae.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(s,t,e,i){s*=ae.ENTRIES,this.frames[s]=t,this.frames[s+ae.X]=e,this.frames[s+ae.Y]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.x=h.data.x,h.y=h.data.y;return;case j.first:h.x+=(h.data.x-h.x)*r,h.y+=(h.data.y-h.y)*r}return}let l=0,c=0;if(e>=o[o.length-ae.ENTRIES])l=o[o.length+ae.PREV_X],c=o[o.length+ae.PREV_Y];else{const d=pe.binarySearch(o,e,ae.ENTRIES);l=o[d+ae.PREV_X],c=o[d+ae.PREV_Y];const u=o[d],f=this.getCurvePercent(d/ae.ENTRIES-1,1-(e-u)/(o[d+ae.PREV_TIME]-u));l+=(o[d+ae.X]-l)*f,c+=(o[d+ae.Y]-c)*f}switch(n){case j.setup:h.x=h.data.x+l*r,h.y=h.data.y+c*r;break;case j.first:case j.replace:h.x+=(h.data.x+l-h.x)*r,h.y+=(h.data.y+c-h.y)*r;break;case j.add:h.x+=l*r,h.y+=c*r}}};let Cr=ae;Cr.ENTRIES=3,Cr.PREV_TIME=-3,Cr.PREV_X=-2,Cr.PREV_Y=-1,Cr.X=1,Cr.Y=2;const Rt=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Rt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(s,t,e,i,r,n){s*=Rt.ENTRIES,this.frames[s]=t,this.frames[s+Rt.R]=e,this.frames[s+Rt.G]=i,this.frames[s+Rt.B]=r,this.frames[s+Rt.A]=n}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color);return;case j.first:const f=o.color,p=o.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,c=0,d=0,u=0;if(e>=h[h.length-Rt.ENTRIES]){const f=h.length;l=h[f+Rt.PREV_R],c=h[f+Rt.PREV_G],d=h[f+Rt.PREV_B],u=h[f+Rt.PREV_A]}else{const f=pe.binarySearch(h,e,Rt.ENTRIES);l=h[f+Rt.PREV_R],c=h[f+Rt.PREV_G],d=h[f+Rt.PREV_B],u=h[f+Rt.PREV_A];const p=h[f],m=this.getCurvePercent(f/Rt.ENTRIES-1,1-(e-p)/(h[f+Rt.PREV_TIME]-p));l+=(h[f+Rt.R]-l)*m,c+=(h[f+Rt.G]-c)*m,d+=(h[f+Rt.B]-d)*m,u+=(h[f+Rt.A]-u)*m}if(r==1)o.color.set(l,c,d,u);else{const f=o.color;n==j.setup&&f.setFromColor(o.data.color),f.add((l-f.r)*r,(c-f.g)*r,(d-f.b)*r,(u-f.a)*r)}}};let xi=Rt;xi.ENTRIES=5,xi.PREV_TIME=-5,xi.PREV_R=-4,xi.PREV_G=-3,xi.PREV_B=-2,xi.PREV_A=-1,xi.R=1,xi.G=2,xi.B=3,xi.A=4;const ot=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ot.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(s,t,e,i,r,n,a,o,h){s*=ot.ENTRIES,this.frames[s]=t,this.frames[s+ot.R]=e,this.frames[s+ot.G]=i,this.frames[s+ot.B]=r,this.frames[s+ot.A]=n,this.frames[s+ot.R2]=a,this.frames[s+ot.G2]=o,this.frames[s+ot.B2]=h}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case j.first:const _=o.color,y=o.darkColor,v=o.data.color,g=o.data.darkColor;_.add((v.r-_.r)*r,(v.g-_.g)*r,(v.b-_.b)*r,(v.a-_.a)*r),y.add((g.r-y.r)*r,(g.g-y.g)*r,(g.b-y.b)*r,0)}return}let l=0,c=0,d=0,u=0,f=0,p=0,m=0;if(e>=h[h.length-ot.ENTRIES]){const _=h.length;l=h[_+ot.PREV_R],c=h[_+ot.PREV_G],d=h[_+ot.PREV_B],u=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2]}else{const _=pe.binarySearch(h,e,ot.ENTRIES);l=h[_+ot.PREV_R],c=h[_+ot.PREV_G],d=h[_+ot.PREV_B],u=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2];const y=h[_],v=this.getCurvePercent(_/ot.ENTRIES-1,1-(e-y)/(h[_+ot.PREV_TIME]-y));l+=(h[_+ot.R]-l)*v,c+=(h[_+ot.G]-c)*v,d+=(h[_+ot.B]-d)*v,u+=(h[_+ot.A]-u)*v,f+=(h[_+ot.R2]-f)*v,p+=(h[_+ot.G2]-p)*v,m+=(h[_+ot.B2]-m)*v}if(r==1)o.color.set(l,c,d,u),o.darkColor.set(f,p,m,1);else{const _=o.color,y=o.darkColor;n==j.setup&&(_.setFromColor(o.data.color),y.setFromColor(o.data.darkColor)),_.add((l-_.r)*r,(c-_.g)*r,(d-_.b)*r,(u-_.a)*r),y.add((f-y.r)*r,(p-y.g)*r,(m-y.b)*r,0)}}};let re=ot;re.ENTRIES=8,re.PREV_TIME=-8,re.PREV_R=-7,re.PREV_G=-6,re.PREV_B=-5,re.PREV_A=-4,re.PREV_R2=-3,re.PREV_G2=-2,re.PREV_B2=-1,re.R=1,re.G=2,re.B=3,re.A=4,re.R2=5,re.G2=6,re.B2=7;class po{constructor(t){this.frames=Q.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i}apply(t,e,i,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;if(o==Te.mixOut){a==j.setup&&this.setAttachment(t,h,h.data.attachmentName);return}const l=this.frames;if(i<l[0]){(a==j.setup||a==j.first)&&this.setAttachment(t,h,h.data.attachmentName);return}let c=0;i>=l[l.length-1]?c=l.length-1:c=pe.binarySearch(l,i,1)-1;const d=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}setAttachment(t,e,i){e.setAttachment(i==null?null:t.getAttachment(this.slotIndex,i))}}class aE{constructor(t){this.frames=Q.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,i,r,n,a,o){if(r==null)return;const h=this.frames,l=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,r,n,a,o),e=-1;else if(e>=h[l-1])return;if(i<h[0])return;let c=0;if(e<h[0])c=0;else{c=pe.binarySearch(h,e);const d=h[c];for(;c>0&&h[c-1]==d;)c--}for(;c<l&&i>=h[c];c++)r.push(this.events[c])}}class Nc{constructor(t){this.frames=Q.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.drawOrders[t]=i}apply(t,e,i,r,n,a,o){const h=t.drawOrder,l=t.slots;if(o==Te.mixOut&&a==j.setup){Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const c=this.frames;if(i<c[0]){(a==j.setup||a==j.first)&&Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let d=0;i>=c[c.length-1]?d=c.length-1:d=pe.binarySearch(c,i)-1;const u=this.drawOrders[d];if(u==null)Q.arrayCopy(l,0,h,0,l.length);else for(let f=0,p=u.length;f<p;f++)h[f]=l[u[f]]}}const ht=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ht.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(s,t,e,i,r,n,a){s*=ht.ENTRIES,this.frames[s]=t,this.frames[s+ht.MIX]=e,this.frames[s+ht.SOFTNESS]=i,this.frames[s+ht.BEND_DIRECTION]=r,this.frames[s+ht.COMPRESS]=n?1:0,this.frames[s+ht.STRETCH]=a?1:0}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.ikConstraints[this.ikConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch;return;case j.first:h.mix+=(h.data.mix-h.mix)*r,h.softness+=(h.data.softness-h.softness)*r,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}return}if(e>=o[o.length-ht.ENTRIES]){n==j.setup?(h.mix=h.data.mix+(o[o.length+ht.PREV_MIX]-h.data.mix)*r,h.softness=h.data.softness+(o[o.length+ht.PREV_SOFTNESS]-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0)):(h.mix+=(o[o.length+ht.PREV_MIX]-h.mix)*r,h.softness+=(o[o.length+ht.PREV_SOFTNESS]-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0));return}const l=pe.binarySearch(o,e,ht.ENTRIES),c=o[l+ht.PREV_MIX],d=o[l+ht.PREV_SOFTNESS],u=o[l],f=this.getCurvePercent(l/ht.ENTRIES-1,1-(e-u)/(o[l+ht.PREV_TIME]-u));n==j.setup?(h.mix=h.data.mix+(c+(o[l+ht.MIX]-c)*f-h.data.mix)*r,h.softness=h.data.softness+(d+(o[l+ht.SOFTNESS]-d)*f-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[l+ht.PREV_BEND_DIRECTION],h.compress=o[l+ht.PREV_COMPRESS]!=0,h.stretch=o[l+ht.PREV_STRETCH]!=0)):(h.mix+=(c+(o[l+ht.MIX]-c)*f-h.mix)*r,h.softness+=(d+(o[l+ht.SOFTNESS]-d)*f-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[l+ht.PREV_BEND_DIRECTION],h.compress=o[l+ht.PREV_COMPRESS]!=0,h.stretch=o[l+ht.PREV_STRETCH]!=0))}};let ke=ht;ke.ENTRIES=6,ke.PREV_TIME=-6,ke.PREV_MIX=-5,ke.PREV_SOFTNESS=-4,ke.PREV_BEND_DIRECTION=-3,ke.PREV_COMPRESS=-2,ke.PREV_STRETCH=-1,ke.MIX=1,ke.SOFTNESS=2,ke.BEND_DIRECTION=3,ke.COMPRESS=4,ke.STRETCH=5;const It=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*It.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(s,t,e,i,r,n){s*=It.ENTRIES,this.frames[s]=t,this.frames[s+It.ROTATE]=e,this.frames[s+It.TRANSLATE]=i,this.frames[s+It.SCALE]=r,this.frames[s+It.SHEAR]=n}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.transformConstraints[this.transformConstraintIndex];if(!h.active)return;if(e<o[0]){const f=h.data;switch(n){case j.setup:h.rotateMix=f.rotateMix,h.translateMix=f.translateMix,h.scaleMix=f.scaleMix,h.shearMix=f.shearMix;return;case j.first:h.rotateMix+=(f.rotateMix-h.rotateMix)*r,h.translateMix+=(f.translateMix-h.translateMix)*r,h.scaleMix+=(f.scaleMix-h.scaleMix)*r,h.shearMix+=(f.shearMix-h.shearMix)*r}return}let l=0,c=0,d=0,u=0;if(e>=o[o.length-It.ENTRIES]){const f=o.length;l=o[f+It.PREV_ROTATE],c=o[f+It.PREV_TRANSLATE],d=o[f+It.PREV_SCALE],u=o[f+It.PREV_SHEAR]}else{const f=pe.binarySearch(o,e,It.ENTRIES);l=o[f+It.PREV_ROTATE],c=o[f+It.PREV_TRANSLATE],d=o[f+It.PREV_SCALE],u=o[f+It.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/It.ENTRIES-1,1-(e-p)/(o[f+It.PREV_TIME]-p));l+=(o[f+It.ROTATE]-l)*m,c+=(o[f+It.TRANSLATE]-c)*m,d+=(o[f+It.SCALE]-d)*m,u+=(o[f+It.SHEAR]-u)*m}if(n==j.setup){const f=h.data;h.rotateMix=f.rotateMix+(l-f.rotateMix)*r,h.translateMix=f.translateMix+(c-f.translateMix)*r,h.scaleMix=f.scaleMix+(d-f.scaleMix)*r,h.shearMix=f.shearMix+(u-f.shearMix)*r}else h.rotateMix+=(l-h.rotateMix)*r,h.translateMix+=(c-h.translateMix)*r,h.scaleMix+=(d-h.scaleMix)*r,h.shearMix+=(u-h.shearMix)*r}};let vi=It;vi.ENTRIES=5,vi.PREV_TIME=-5,vi.PREV_ROTATE=-4,vi.PREV_TRANSLATE=-3,vi.PREV_SCALE=-2,vi.PREV_SHEAR=-1,vi.ROTATE=1,vi.TRANSLATE=2,vi.SCALE=3,vi.SHEAR=4;const Ye=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Ye.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(s,t,e){s*=Ye.ENTRIES,this.frames[s]=t,this.frames[s+Ye.VALUE]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.position=h.data.position;return;case j.first:h.position+=(h.data.position-h.position)*r}return}let l=0;if(e>=o[o.length-Ye.ENTRIES])l=o[o.length+Ye.PREV_VALUE];else{const c=pe.binarySearch(o,e,Ye.ENTRIES);l=o[c+Ye.PREV_VALUE];const d=o[c],u=this.getCurvePercent(c/Ye.ENTRIES-1,1-(e-d)/(o[c+Ye.PREV_TIME]-d));l+=(o[c+Ye.VALUE]-l)*u}n==j.setup?h.position=h.data.position+(l-h.data.position)*r:h.position+=(l-h.position)*r}};let mo=Ye;mo.ENTRIES=2,mo.PREV_TIME=-2,mo.PREV_VALUE=-1,mo.VALUE=1;const oe=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(s,t,e,i){s*=oe.ENTRIES,this.frames[s]=t,this.frames[s+oe.ROTATE]=e,this.frames[s+oe.TRANSLATE]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotateMix=h.data.rotateMix,h.translateMix=h.data.translateMix;return;case j.first:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*r,h.translateMix+=(h.data.translateMix-h.translateMix)*r}return}let l=0,c=0;if(e>=o[o.length-oe.ENTRIES])l=o[o.length+oe.PREV_ROTATE],c=o[o.length+oe.PREV_TRANSLATE];else{const d=pe.binarySearch(o,e,oe.ENTRIES);l=o[d+oe.PREV_ROTATE],c=o[d+oe.PREV_TRANSLATE];const u=o[d],f=this.getCurvePercent(d/oe.ENTRIES-1,1-(e-u)/(o[d+oe.PREV_TIME]-u));l+=(o[d+oe.ROTATE]-l)*f,c+=(o[d+oe.TRANSLATE]-c)*f}n==j.setup?(h.rotateMix=h.data.rotateMix+(l-h.data.rotateMix)*r,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*r):(h.rotateMix+=(l-h.rotateMix)*r,h.translateMix+=(c-h.translateMix)*r)}};let Pr=oe;Pr.ENTRIES=3,Pr.PREV_TIME=-3,Pr.PREV_ROTATE=-2,Pr.PREV_TRANSLATE=-1,Pr.ROTATE=1,Pr.TRANSLATE=2;const Mt=class{constructor(s){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new r_(this),this.propertyIDs=new Zw,this.animationsChanged=!1,this.trackEntryPool=new eE(()=>new Uc),this.data=s}update(s){s*=this.timeScale;const t=this.tracks;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=s*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 o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(o/r.timeScale+s)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=s,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,s)){let o=r.mixingFrom;for(r.mixingFrom=null,o!=null&&(o.mixingTo=null);o!=null;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(s,t){const e=s.mixingFrom;if(e==null)return!0;const i=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,s.mixTime>0&&s.mixTime>=s.mixDuration?((e.totalAlpha==0||s.mixDuration==0)&&(s.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=s),s.interruptAlpha=e.interruptAlpha,this.queue.end(e)),i):(e.trackTime+=t*e.timeScale,s.mixTime+=t,!1)}apply(s){if(s==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let i=!1;for(let a=0,o=e.length;a<o;a++){const h=e[a];if(h==null||h.delay>0)continue;i=!0;const l=a==0?j.first:h.mixBlend;let c=h.alpha;h.mixingFrom!=null?c*=this.applyMixingFrom(h,s,l):h.trackTime>=h.trackEnd&&h.next==null&&(c=0);const d=h.animationLast,u=h.getAnimationTime(),f=h.animation.timelines.length,p=h.animation.timelines;if(a==0&&c==1||l==j.add)for(let m=0;m<f;m++){const _=p[m];_ instanceof po?this.applyAttachmentTimeline(_,s,u,l,!0):_.apply(s,d,u,t,c,l,Te.mixIn)}else{const m=h.timelineMode,_=h.timelinesRotation.length==0;_&&Q.setArraySize(h.timelinesRotation,f<<1,null);const y=h.timelinesRotation;for(let v=0;v<f;v++){const g=p[v],x=m[v]==Mt.SUBSEQUENT?l:j.setup;g instanceof Le?this.applyRotateTimeline(g,s,u,c,x,y,v<<1,_):g instanceof po?this.applyAttachmentTimeline(g,s,u,l,!0):g.apply(s,d,u,t,c,x,Te.mixIn)}}this.queueEvents(h,u),t.length=0,h.nextAnimationLast=u,h.nextTrackLast=h.trackTime}const r=this.unkeyedState+Mt.SETUP,n=s.slots;for(let a=0,o=s.slots.length;a<o;a++){const h=n[a];if(h.attachmentState==r){const l=h.data.attachmentName;h.setAttachment(l==null?null:s.getAttachment(h.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(s,t,e){const i=s.mixingFrom;i.mixingFrom!=null&&this.applyMixingFrom(i,t,e);let r=0;s.mixDuration==0?(r=1,e==j.first&&(e=j.setup)):(r=s.mixTime/s.mixDuration,r>1&&(r=1),e!=j.first&&(e=i.mixBlend));const n=r<i.eventThreshold?this.events:null,a=r<i.attachmentThreshold,o=r<i.drawOrderThreshold,h=i.animationLast,l=i.getAnimationTime(),c=i.animation.timelines.length,d=i.animation.timelines,u=i.alpha*s.interruptAlpha,f=u*(1-r);if(e==j.add)for(let p=0;p<c;p++)d[p].apply(t,h,l,n,f,e,Te.mixOut);else{const p=i.timelineMode,m=i.timelineHoldMix,_=i.timelinesRotation.length==0;_&&Q.setArraySize(i.timelinesRotation,c<<1,null);const y=i.timelinesRotation;i.totalAlpha=0;for(let v=0;v<c;v++){const g=d[v];let x=Te.mixOut,b,w=0;switch(p[v]){case Mt.SUBSEQUENT:if(!o&&g instanceof Nc)continue;b=e,w=f;break;case Mt.FIRST:b=j.setup,w=f;break;case Mt.HOLD_SUBSEQUENT:b=e,w=u;break;case Mt.HOLD_FIRST:b=j.setup,w=u;break;default:b=j.setup;const T=m[v];w=u*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=w,g instanceof Le?this.applyRotateTimeline(g,t,l,w,b,y,v<<1,_):g instanceof po?this.applyAttachmentTimeline(g,t,l,b,a):(o&&g instanceof Nc&&b==j.setup&&(x=Te.mixIn),g.apply(t,h,l,n,w,b,x))}}return s.mixDuration>0&&this.queueEvents(i,l),this.events.length=0,i.nextAnimationLast=l,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(s,t,e,i,r){const n=t.slots[s.slotIndex];if(!n.bone.active)return;const a=s.frames;if(e<a[0])(i==j.setup||i==j.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let o;e>=a[a.length-1]?o=a.length-1:o=pe.binarySearch(a,e)-1,this.setAttachment(t,n,s.attachmentNames[o],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Mt.SETUP)}setAttachment(s,t,e,i){t.setAttachment(e==null?null:s.getAttachment(t.data.index,e)),i&&(t.attachmentState=this.unkeyedState+Mt.CURRENT)}applyRotateTimeline(s,t,e,i,r,n,a,o){if(o&&(n[a]=0),i==1){s.apply(t,0,e,null,1,r,Te.mixIn);return}const h=s,l=h.frames,c=t.bones[h.boneIndex];if(!c.active)return;let d=0,u=0;if(e<l[0])switch(r){case j.setup:c.rotation=c.data.rotation;default:return;case j.first:d=c.rotation,u=c.data.rotation}else if(d=r==j.setup?c.data.rotation:c.rotation,e>=l[l.length-Le.ENTRIES])u=c.data.rotation+l[l.length+Le.PREV_ROTATION];else{const m=pe.binarySearch(l,e,Le.ENTRIES),_=l[m+Le.PREV_ROTATION],y=l[m],v=h.getCurvePercent((m>>1)-1,1-(e-y)/(l[m+Le.PREV_TIME]-y));u=l[m+Le.ROTATION]-_,u-=(16384-(16384.499999999996-u/360|0))*360,u=_+u*v+c.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let f=0,p=u-d;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,_=0;o?(m=0,_=p):(m=n[a],_=n[a+1]);const y=p>0;let v=m>=0;k.signum(_)!=k.signum(p)&&Math.abs(_)<=90&&(Math.abs(m)>180&&(m+=360*k.signum(m)),v=y),f=p+m-m%360,v!=y&&(f+=360*k.signum(m)),n[a]=f}n[a+1]=p,d+=f*i,c.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(s,t){const e=s.animationStart,i=s.animationEnd,r=i-e,n=s.trackLast%r,a=this.events;let o=0;const h=a.length;for(;o<h;o++){const c=a[o];if(c.time<n)break;c.time>i||this.queue.event(s,c)}let l=!1;for(s.loop?l=r==0||n>s.trackTime%r:l=t>=i&&s.animationLast<i,l&&this.queue.complete(s);o<h;o++)a[o].time<e||this.queue.event(s,a[o])}clearTracks(){const s=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=s,this.queue.drain()}clearTrack(s){if(s>=this.tracks.length)return;const t=this.tracks[s];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const i=e.mixingFrom;if(i==null)break;this.queue.end(i),e.mixingFrom=null,e.mixingTo=null,e=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(s,t,e){const i=this.expandToIndex(s);this.tracks[s]=t,i!=null&&(e&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom!=null&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(s,t,e){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(s,i,e)}setAnimationWith(s,t,e){if(t==null)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(s);r!=null&&(r.nextTrackLast==-1?(this.tracks[s]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,i=!1):this.disposeNext(r));const n=this.trackEntry(s,t,e,r);return this.setCurrent(s,n,i),this.queue.drain(),n}addAnimation(s,t,e,i){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(s,r,e,i)}addAnimationWith(s,t,e,i){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(s);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(s,t,e,r);if(r==null)this.setCurrent(s,n,!0),this.queue.drain();else if(r.next=n,i<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?i+=a*(1+(r.trackTime/a|0)):i+=Math.max(a,r.trackTime),i-=this.data.getMix(r.animation,t)):i=r.trackTime}return n.delay=i,n}setEmptyAnimation(s,t){const e=this.setAnimationWith(s,Mt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(s,t,e){e<=0&&(e-=t);const i=this.addAnimationWith(s,Mt.emptyAnimation,!1,e);return i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(s){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,s)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(s){return s<this.tracks.length?this.tracks[s]:(Q.ensureArrayCapacity(this.tracks,s+1,null),this.tracks.length=s+1,null)}trackEntry(s,t,e,i){const r=this.trackEntryPool.obtain();return r.trackIndex=s,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=i==null?0:this.data.getMix(i.animation,t),r.mixBlend=j.replace,r}disposeNext(s){let t=s.next;for(;t!=null;)this.queue.dispose(t),t=t.next;s.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let s=0,t=this.tracks.length;s<t;s++){let e=this.tracks[s];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=j.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(s){const t=s.mixingTo,e=s.animation.timelines,i=s.animation.timelines.length,r=Q.setArraySize(s.timelineMode,i);s.timelineHoldMix.length=0;const n=Q.setArraySize(s.timelineHoldMix,i),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let o=0;o<i;o++)r[o]=a.add(e[o].getPropertyId())?Mt.HOLD_FIRST:Mt.HOLD_SUBSEQUENT;return}t:for(let o=0;o<i;o++){const h=e[o],l=h.getPropertyId();if(!a.add(l))r[o]=Mt.SUBSEQUENT;else if(t==null||h instanceof po||h instanceof Nc||h instanceof aE||!t.animation.hasTimeline(l))r[o]=Mt.FIRST;else{for(let c=t.mixingTo;c!=null;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(s.mixDuration>0){r[o]=Mt.HOLD_MIX,n[o]=c;continue t}break}r[o]=Mt.HOLD_FIRST}}}getCurrent(s){return s>=this.tracks.length?null:this.tracks[s]}addListener(s){if(s==null)throw new Error("listener cannot be null.");this.listeners.push(s)}removeListener(s){const t=this.listeners.indexOf(s);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(s,t,e){Mt.deprecatedWarning1||(Mt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(s,t,e)}addAnimationByName(s,t,e,i){Mt.deprecatedWarning2||(Mt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(s,t,e,i)}hasAnimation(s){return this.data.skeletonData.findAnimation(s)!==null}hasAnimationByName(s){return Mt.deprecatedWarning3||(Mt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(s)}};let Ne=Mt;Ne.emptyAnimation=new pe("<empty>",[],0),Ne.SUBSEQUENT=0,Ne.FIRST=1,Ne.HOLD_SUBSEQUENT=2,Ne.HOLD_FIRST=3,Ne.HOLD_MIX=4,Ne.SETUP=1,Ne.CURRENT=2,Ne.deprecatedWarning1=!1,Ne.deprecatedWarning2=!1,Ne.deprecatedWarning3=!1;const Ni=class{constructor(){this.mixBlend=j.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 s=this.animationEnd-this.animationStart;return s==0?this.animationStart:this.trackTime%s+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(s){this.animationLast=s,this.nextAnimationLast=s}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ni.deprecatedWarning1||(Ni.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(s){Ni.deprecatedWarning1||(Ni.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=s}get endTime(){return Ni.deprecatedWarning2||(Ni.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(s){Ni.deprecatedWarning2||(Ni.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=s}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Uc=Ni;Uc.deprecatedWarning1=!1,Uc.deprecatedWarning2=!1;const Gc=class{constructor(s){this.objects=[],this.drainDisabled=!1,this.animState=s}start(s){this.objects.push(Ee.start),this.objects.push(s),this.animState.animationsChanged=!0}interrupt(s){this.objects.push(Ee.interrupt),this.objects.push(s)}end(s){this.objects.push(Ee.end),this.objects.push(s),this.animState.animationsChanged=!0}dispose(s){this.objects.push(Ee.dispose),this.objects.push(s)}complete(s){this.objects.push(Ee.complete),this.objects.push(s)}event(s,t){this.objects.push(Ee.event),this.objects.push(s),this.objects.push(t)}deprecateStuff(){return Gc.deprecatedWarning1||(Gc.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 s=this.objects,t=this.animState.listeners;for(let e=0;e<s.length;e+=2){const i=s[e],r=s[e+1];switch(i){case Ee.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++)t[o].start&&t[o].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case Ee.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++)t[o].interrupt&&t[o].interrupt(r);break;case Ee.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++)t[o].end&&t[o].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case Ee.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++)t[o].dispose&&t[o].dispose(r);this.animState.trackEntryPool.free(r);break;case Ee.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++)t[o].complete&&t[o].complete(r);const n=k.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 Ee.event:const a=s[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let o=0;o<t.length;o++)t[o].event&&t[o].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 r_=Gc;r_.deprecatedWarning1=!1;var Ee=(s=>(s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event",s))(Ee||{});const Hc=class{constructor(s){if(this.animationToMixTime={},this.defaultMix=0,s==null)throw new Error("skeletonData cannot be null.");this.skeletonData=s}setMix(s,t,e){const i=this.skeletonData.findAnimation(s);if(i==null)throw new Error(`Animation not found: ${s}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(i,r,e)}setMixByName(s,t,e){Hc.deprecatedWarning1||(Hc.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(s,t,e)}setMixWith(s,t,e){if(s==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const i=`${s.name}.${t.name}`;this.animationToMixTime[i]=e}getMix(s,t){const e=`${s.name}.${t.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}};let n_=Hc;n_.deprecatedWarning1=!1;class a_{constructor(t,e,i){if(this.matrix=new gt,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=i,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,i,r,n,a,o){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;const h=this.parent,l=this.matrix,c=this.skeleton.scaleX,d=-this.skeleton.scaleY;if(h==null){const _=this.skeleton,y=i+90+o;l.a=k.cosDeg(i+a)*r*c,l.c=k.cosDeg(y)*n*c,l.b=k.sinDeg(i+a)*r*d,l.d=k.sinDeg(y)*n*d,l.tx=t*c+_.x,l.ty=e*d+_.y;return}let u=h.matrix.a,f=h.matrix.c,p=h.matrix.b,m=h.matrix.d;switch(l.tx=u*t+f*e+h.matrix.tx,l.ty=p*t+m*e+h.matrix.ty,this.data.transformMode){case se.Normal:{const _=i+90+o,y=k.cosDeg(i+a)*r,v=k.cosDeg(_)*n,g=k.sinDeg(i+a)*r,x=k.sinDeg(_)*n;l.a=u*y+f*g,l.c=u*v+f*x,l.b=p*y+m*g,l.d=p*v+m*x;return}case se.OnlyTranslation:{const _=i+90+o;l.a=k.cosDeg(i+a)*r,l.c=k.cosDeg(_)*n,l.b=k.sinDeg(i+a)*r,l.d=k.sinDeg(_)*n;break}case se.NoRotationOrReflection:{let _=u*u+p*p,y=0;_>1e-4?(_=Math.abs(u*m-f*p)/_,u/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*_,m=u*_,y=Math.atan2(p,u)*k.radDeg):(u=0,p=0,y=90-Math.atan2(m,f)*k.radDeg);const v=i+a-y,g=i+o-y+90,x=k.cosDeg(v)*r,b=k.cosDeg(g)*n,w=k.sinDeg(v)*r,T=k.sinDeg(g)*n;l.a=u*x-f*w,l.c=u*b-f*T,l.b=p*x+m*w,l.d=p*b+m*T;break}case se.NoScale:case se.NoScaleOrReflection:{const _=k.cosDeg(i),y=k.sinDeg(i);let v=(u*_+f*y)/c,g=(p*_+m*y)/d,x=Math.sqrt(v*v+g*g);x>1e-5&&(x=1/x),v*=x,g*=x,x=Math.sqrt(v*v+g*g),this.data.transformMode==se.NoScale&&u*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(x=-x);const b=Math.PI/2+Math.atan2(g,v),w=Math.cos(b)*x,T=Math.sin(b)*x,E=k.cosDeg(a)*r,A=k.cosDeg(90+o)*n,P=k.sinDeg(a)*r,L=k.sinDeg(90+o)*n;l.a=v*E+w*P,l.c=v*A+w*L,l.b=g*E+T*P,l.d=g*A+T*L;break}}l.a*=c,l.c*=c,l.b*=d,l.d*=d}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)*k.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*k.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)*k.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)*k.radDeg;return}const i=t.matrix,r=1/(i.a*i.d-i.b*i.c),n=e.tx-i.tx,a=e.ty-i.ty;this.ax=n*i.d*r-a*i.c*r,this.ay=a*i.a*r-n*i.b*r;const o=r*i.d,h=r*i.a,l=r*i.c,c=r*i.b,d=o*e.a-l*e.b,u=o*e.c-l*e.d,f=h*e.b-c*e.a,p=h*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){const m=d*p-u*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(d*u+f*p,m)*k.radDeg,this.arotation=Math.atan2(f,d)*k.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,u)*k.radDeg}worldToLocal(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=1/(i*a-r*n),h=t.x-e.tx,l=t.y-e.ty;return t.x=h*a*o-l*r*o,t.y=l*i*o-h*n*o,t}localToWorld(t){const e=this.matrix,i=t.x,r=t.y;return t.x=i*e.a+r*e.c+e.tx,t.y=i*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=k.sinDeg(t),i=k.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*i,r.d*i-r.c*e)*k.radDeg}localToWorldRotation(t){const e=k.sinDeg(t),i=k.cosDeg(t),r=this.matrix;return Math.atan2(i*r.b+e*r.d,i*r.a+e*r.c)*k.radDeg}rotateWorld(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=k.cosDeg(t),h=k.sinDeg(t);e.a=o*i-h*n,e.c=o*r-h*a,e.b=h*i+o*n,e.d=h*r+o*a,this.appliedValid=!1}}class oE{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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i,r,n,a,o){t.appliedValid||t.updateAppliedTransform();const h=t.parent.matrix,l=h.a;let c=h.c;const d=h.b;let u=h.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case se.OnlyTranslation:p=e-t.worldX,m=i-t.worldY;break;case se.NoRotationOrReflection:const v=Math.abs(l*u-c*d)/(l*l+d*d),g=l/t.skeleton.scaleX,x=d/t.skeleton.scaleY;c=-x*v*t.skeleton.scaleX,u=g*v*t.skeleton.scaleY,f+=Math.atan2(x,g)*k.radDeg;default:const b=e-h.tx,w=i-h.ty,T=l*u-c*d;p=(b*u-w*c)/T-t.ax,m=(w*l-b*d)/T-t.ay}f+=Math.atan2(m,p)*k.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let _=t.ascaleX,y=t.ascaleY;if(r||n){switch(t.data.transformMode){case se.NoScale:case se.NoScaleOrReflection:p=e-t.worldX,m=i-t.worldY}const v=t.data.length*_,g=Math.sqrt(p*p+m*m);if(r&&g<v||n&&g>v&&v>1e-4){const x=(g/v-1)*o+1;_*=x,a&&(y*=x)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,_,y,t.ashearX,t.ashearY)}apply2(t,e,i,r,n,a,o,h){if(h==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,c=t.ay;let d=t.ascaleX,u=d,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let _=0,y=0,v=0;d<0?(d=-d,_=180,v=-1):(_=0,v=1),f<0&&(f=-f,v=-v),p<0?(p=-p,y=180):y=0;const g=e.ax;let x=0,b=0,w=0,T=m.a,E=m.c,A=m.b,P=m.d;const L=Math.abs(d-f)<=1e-4;L?(x=e.ay,b=T*g+E*x+m.tx,w=A*g+P*x+m.ty):(x=0,b=T*g+m.tx,w=A*g+m.ty);const M=t.parent.matrix;T=M.a,E=M.c,A=M.b,P=M.d;const S=1/(T*P-E*A);let C=b-M.tx,R=w-M.ty;const N=(C*P-R*E)*S-l,F=(R*T-C*A)*S-c,B=Math.sqrt(N*N+F*F);let W=e.data.length*p,I,D;if(B<1e-4){this.apply1(t,i,r,!1,a,!1,h),e.updateWorldTransformWith(g,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}C=i-M.tx,R=r-M.ty;let $=(C*P-R*E)*S-l,Y=(R*T-C*A)*S-c,U=$*$+Y*Y;if(o!=0){o*=d*(p+1)/2;const lt=Math.sqrt(U),vt=lt-B-W*d+o;if(vt>0){let Dt=Math.min(1,vt/(o*2))-1;Dt=(vt-o*(1-Dt*Dt))/lt,$-=Dt*$,Y-=Dt*Y,U=$*$+Y*Y}}t:if(L){W*=d;let lt=(U-B*B-W*W)/(2*B*W);lt<-1?lt=-1:lt>1&&(lt=1,a&&(u*=(Math.sqrt(U)/(B+W)-1)*h+1)),D=Math.acos(lt)*n,T=B+W*lt,E=W*Math.sin(D),I=Math.atan2(Y*T-$*E,$*T+Y*E)}else{T=d*W,E=f*W;const lt=T*T,vt=E*E,Dt=Math.atan2(Y,$);A=vt*B*B+lt*U-lt*vt;const kt=-2*vt*B,_t=vt-lt;if(P=kt*kt-4*_t*A,P>=0){let Dr=Math.sqrt(P);kt<0&&(Dr=-Dr),Dr=-(kt+Dr)/2;const T_=Dr/_t,w_=A/Dr,Br=Math.abs(T_)<Math.abs(w_)?T_:w_;if(Br*Br<=U){R=Math.sqrt(U-Br*Br)*n,I=Dt-Math.atan2(R,Br),D=Math.atan2(R/f,(Br-B)/d);break t}}let Bt=k.PI,wt=B-T,me=wt*wt,Ae=0,cs=0,Mr=B+T,us=Mr*Mr,b_=0;A=-T*B/(lt-vt),A>=-1&&A<=1&&(A=Math.acos(A),C=T*Math.cos(A)+B,R=E*Math.sin(A),P=C*C+R*R,P<me&&(Bt=A,me=P,wt=C,Ae=R),P>us&&(cs=A,us=P,Mr=C,b_=R)),U<=(me+us)/2?(I=Dt-Math.atan2(Ae*n,wt),D=Bt*n):(I=Dt-Math.atan2(b_*n,Mr),D=cs*n)}const rt=Math.atan2(x,g)*v;let dt=t.arotation;I=(I-rt)*k.radDeg+_-dt,I>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,c,dt+I*h,u,t.ascaleY,0,0),dt=e.arotation,D=((D+rt)*k.radDeg-e.ashearX)*v+y-dt,D>180?D-=360:D<-180&&(D+=360),e.updateWorldTransformWith(g,x,dt+D*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}var Rr=(s=>(s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s))(Rr||{});const Vs=class{constructor(s,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,s==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=s,this.bones=new Array;for(let e=0,i=s.bones.length;e<i;e++)this.bones.push(t.findBone(s.bones[e].name));this.target=t.findSlot(s.target.name),this.position=s.position,this.spacing=s.spacing,this.rotateMix=s.rotateMix,this.translateMix=s.translateMix}isActive(){return this.active}apply(){this.update()}update(){const s=this.target.getAttachment();if(!(s instanceof An))return;const t=this.rotateMix,e=this.translateMix,i=e>0,r=t>0;if(!i&&!r)return;const n=this.data,a=n.spacingMode,o=a==Rr.Length,h=n.rotateMode,l=h==Gs.Tangent,c=h==Gs.ChainScale,d=this.bones.length,u=l?d:d+1,f=this.bones,p=Q.setArraySize(this.spaces,u);let m=null;const _=this.spacing;if(c||o){c&&(m=Q.setArraySize(this.lengths,d));for(let w=0,T=u-1;w<T;){const E=f[w],A=E.data.length;if(A<Vs.epsilon)c&&(m[w]=0),p[++w]=0;else{const P=A*E.matrix.a,L=A*E.matrix.b,M=Math.sqrt(P*P+L*L);c&&(m[w]=M),p[++w]=(o?A+_:_)*M/A}}}else for(let w=1;w<u;w++)p[w]=_;const y=this.computeWorldPositions(s,u,l,n.positionMode==uo.Percent,a==Rr.Percent);let v=y[0],g=y[1],x=n.offsetRotation,b=!1;if(x==0)b=h==Gs.Chain;else{b=!1;const w=this.target.bone.matrix;x*=w.a*w.d-w.b*w.c>0?k.degRad:-k.degRad}for(let w=0,T=3;w<d;w++,T+=3){const E=f[w],A=E.matrix;A.tx+=(v-A.tx)*e,A.ty+=(g-A.ty)*e;const P=y[T],L=y[T+1],M=P-v,S=L-g;if(c){const C=m[w];if(C!=0){const R=(Math.sqrt(M*M+S*S)/C-1)*t+1;A.a*=R,A.b*=R}}if(v=P,g=L,r){const C=A.a,R=A.c,N=A.b,F=A.d;let B=0,W=0,I=0;if(l&&(l?B=y[T-1]:p[w+1]==0?B=y[T+2]:B=Math.atan2(S,M)),B-=Math.atan2(N,C),b){W=Math.cos(B),I=Math.sin(B);const D=E.data.length;v+=(D*(W*C-I*N)-M)*t,g+=(D*(I*C+W*N)-S)*t}else B+=x;B>k.PI?B-=k.PI2:B<-k.PI&&(B+=k.PI2),B*=t,W=Math.cos(B),I=Math.sin(B),A.a=W*C-I*N,A.c=W*R-I*F,A.b=I*C+W*N,A.d=I*R+W*F}E.appliedValid=!1}}computeWorldPositions(s,t,e,i,r){const n=this.target;let a=this.position;const o=this.spaces,h=Q.setArraySize(this.positions,t*3+2);let l=null;const c=s.closed;let d=s.worldVerticesLength,u=d/6,f=Vs.NONE;if(!s.constantSpeed){const B=s.lengths;u-=c?1:2;const W=B[u];if(i&&(a*=W),r)for(let I=0;I<t;I++)o[I]*=W;l=Q.setArraySize(this.world,8);for(let I=0,D=0,$=0;I<t;I++,D+=3){const Y=o[I];a+=Y;let U=a;if(c)U%=W,U<0&&(U+=W),$=0;else if(U<0){f!=Vs.BEFORE&&(f=Vs.BEFORE,s.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(U,l,0,h,D);continue}else if(U>W){f!=Vs.AFTER&&(f=Vs.AFTER,s.computeWorldVertices(n,d-6,4,l,0,2)),this.addAfterPosition(U-W,l,0,h,D);continue}for(;;$++){const rt=B[$];if(!(U>rt)){if($==0)U/=rt;else{const dt=B[$-1];U=(U-dt)/(rt-dt)}break}}$!=f&&(f=$,c&&$==u?(s.computeWorldVertices(n,d-4,4,l,0,2),s.computeWorldVertices(n,0,4,l,4,2)):s.computeWorldVertices(n,$*6+2,8,l,0,2)),this.addCurvePosition(U,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],h,D,e||I>0&&Y==0)}return h}c?(d+=2,l=Q.setArraySize(this.world,d),s.computeWorldVertices(n,2,d-4,l,0,2),s.computeWorldVertices(n,0,2,l,d-4,2),l[d-2]=l[0],l[d-1]=l[1]):(u--,d-=4,l=Q.setArraySize(this.world,d),s.computeWorldVertices(n,2,d,l,0,2));const p=Q.setArraySize(this.curves,u);let m=0,_=l[0],y=l[1],v=0,g=0,x=0,b=0,w=0,T=0,E=0,A=0,P=0,L=0,M=0,S=0,C=0,R=0;for(let B=0,W=2;B<u;B++,W+=6)v=l[W],g=l[W+1],x=l[W+2],b=l[W+3],w=l[W+4],T=l[W+5],E=(_-v*2+x)*.1875,A=(y-g*2+b)*.1875,P=((v-x)*3-_+w)*.09375,L=((g-b)*3-y+T)*.09375,M=E*2+P,S=A*2+L,C=(v-_)*.75+E+P*.16666667,R=(g-y)*.75+A+L*.16666667,m+=Math.sqrt(C*C+R*R),C+=M,R+=S,M+=P,S+=L,m+=Math.sqrt(C*C+R*R),C+=M,R+=S,m+=Math.sqrt(C*C+R*R),C+=M+P,R+=S+L,m+=Math.sqrt(C*C+R*R),p[B]=m,_=w,y=T;if(i&&(a*=m),r)for(let B=0;B<t;B++)o[B]*=m;const N=this.segments;let F=0;for(let B=0,W=0,I=0,D=0;B<t;B++,W+=3){const $=o[B];a+=$;let Y=a;if(c)Y%=m,Y<0&&(Y+=m),I=0;else if(Y<0){this.addBeforePosition(Y,l,0,h,W);continue}else if(Y>m){this.addAfterPosition(Y-m,l,d-4,h,W);continue}for(;;I++){const U=p[I];if(!(Y>U)){if(I==0)Y/=U;else{const rt=p[I-1];Y=(Y-rt)/(U-rt)}break}}if(I!=f){f=I;let U=I*6;for(_=l[U],y=l[U+1],v=l[U+2],g=l[U+3],x=l[U+4],b=l[U+5],w=l[U+6],T=l[U+7],E=(_-v*2+x)*.03,A=(y-g*2+b)*.03,P=((v-x)*3-_+w)*.006,L=((g-b)*3-y+T)*.006,M=E*2+P,S=A*2+L,C=(v-_)*.3+E+P*.16666667,R=(g-y)*.3+A+L*.16666667,F=Math.sqrt(C*C+R*R),N[0]=F,U=1;U<8;U++)C+=M,R+=S,M+=P,S+=L,F+=Math.sqrt(C*C+R*R),N[U]=F;C+=M,R+=S,F+=Math.sqrt(C*C+R*R),N[8]=F,C+=M+P,R+=S+L,F+=Math.sqrt(C*C+R*R),N[9]=F,D=0}for(Y*=F;;D++){const U=N[D];if(!(Y>U)){if(D==0)Y/=U;else{const rt=N[D-1];Y=D+(Y-rt)/(U-rt)}break}}this.addCurvePosition(Y*.1,_,y,v,g,x,b,w,T,h,W,e||B>0&&$==0)}return h}addBeforePosition(s,t,e,i,r){const n=t[e],a=t[e+1],o=t[e+2]-n,h=t[e+3]-a,l=Math.atan2(h,o);i[r]=n+s*Math.cos(l),i[r+1]=a+s*Math.sin(l),i[r+2]=l}addAfterPosition(s,t,e,i,r){const n=t[e+2],a=t[e+3],o=n-t[e],h=a-t[e+1],l=Math.atan2(h,o);i[r]=n+s*Math.cos(l),i[r+1]=a+s*Math.sin(l),i[r+2]=l}addCurvePosition(s,t,e,i,r,n,a,o,h,l,c,d){(s==0||isNaN(s))&&(s=1e-4);const u=s*s,f=u*s,p=1-s,m=p*p,_=m*p,y=p*s,v=y*3,g=p*v,x=v*s,b=t*_+i*g+n*x+o*f,w=e*_+r*g+a*x+h*f;l[c]=b,l[c+1]=w,d&&(l[c+2]=Math.atan2(w-(e*m+r*y*2+a*u),b-(t*m+i*y*2+n*u)))}};let Sn=Vs;Sn.NONE=-1,Sn.BEFORE=-2,Sn.AFTER=-3,Sn.epsilon=1e-5;class hE{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new iE,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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,d=o*c-h*l>0?k.degRad:-k.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,_=p.length;m<_;m++){const y=p[m];let v=!1;const g=y.matrix;if(t!=0){const x=g.a,b=g.c,w=g.b,T=g.d;let E=Math.atan2(l,o)-Math.atan2(w,x)+u;E>k.PI?E-=k.PI2:E<-k.PI&&(E+=k.PI2),E*=t;const A=Math.cos(E),P=Math.sin(E);g.a=A*x-P*w,g.c=A*b-P*T,g.b=P*x+A*w,g.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.tx+=(x.x-g.tx)*e,g.ty+=(x.y-g.ty)*e,v=!0}if(i>0){let x=Math.sqrt(g.a*g.a+g.b*g.b),b=Math.sqrt(o*o+l*l);x>1e-5&&(x=(x+(b-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.b*=x,x=Math.sqrt(g.c*g.c+g.d*g.d),b=Math.sqrt(h*h+c*c),x>1e-5&&(x=(x+(b-x+this.data.offsetScaleY)*i)/x),g.c*=x,g.d*=x,v=!0}if(r>0){const x=g.c,b=g.d,w=Math.atan2(b,x);let T=Math.atan2(c,h)-Math.atan2(l,o)-(w-Math.atan2(g.b,g.a));T>k.PI?T-=k.PI2:T<-k.PI&&(T+=k.PI2),T=w+(T+f)*r;const E=Math.sqrt(x*x+b*b);g.c=Math.cos(T)*E,g.d=Math.sin(T)*E,v=!0}v&&(y.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,d=o*c-h*l>0?k.degRad:-k.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,_=p.length;m<_;m++){const y=p[m];let v=!1;const g=y.matrix;if(t!=0){const x=g.a,b=g.c,w=g.b,T=g.d;let E=Math.atan2(l,o)+u;E>k.PI?E-=k.PI2:E<-k.PI&&(E+=k.PI2),E*=t;const A=Math.cos(E),P=Math.sin(E);g.a=A*x-P*w,g.c=A*b-P*T,g.b=P*x+A*w,g.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.tx+=x.x*e,g.ty+=x.y*e,v=!0}if(i>0){let x=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.b*=x,x=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleY)*i+1,g.c*=x,g.d*=x,v=!0}if(r>0){let x=Math.atan2(c,h)-Math.atan2(l,o);x>k.PI?x-=k.PI2:x<-k.PI&&(x+=k.PI2);const b=g.c,w=g.d;x=Math.atan2(w,b)+(x-k.PI/2+f)*r;const T=Math.sqrt(b*b+w*w);g.c=Math.cos(x)*T,g.d=Math.sin(x)*T,v=!0}v&&(y.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const l=a[o];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;if(t!=0){let _=n.arotation-c+this.data.offsetRotation;_-=(16384-(16384.499999999996-_/360|0))*360,c+=_*t}let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax-d+this.data.offsetX)*e,u+=(n.ay-u+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;i>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*i)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*i)/p));const m=l.ashearY;if(r>0){let _=n.ashearY-m+this.data.offsetShearY;_-=(16384-(16384.499999999996-_/360|0))*360,l.shearY+=_*r}l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const l=a[o];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;t!=0&&(c+=(n.arotation+this.data.offsetRotation)*t);let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax+this.data.offsetX)*e,u+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;i>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*i+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*i+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}}const Cn=class{constructor(s){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,s==null)throw new Error("data cannot be null.");this.data=s,this.bones=new Array;for(let t=0;t<s.bones.length;t++){const e=s.bones[t];let i;if(e.parent==null)i=new a_(e,this,null);else{const r=this.bones[e.parent.index];i=new a_(e,this,r),r.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<s.slots.length;t++){const e=s.slots[t],i=this.bones[e.boneData.index],r=new s_(e,i);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<s.ikConstraints.length;t++){const e=s.ikConstraints[t];this.ikConstraints.push(new oE(e,this))}this.transformConstraints=new Array;for(let t=0;t<s.transformConstraints.length;t++){const e=s.transformConstraints[t];this.transformConstraints.push(new hE(e,this))}this.pathConstraints=new Array;for(let t=0;t<s.pathConstraints.length;t++){const e=s.pathConstraints[t];this.pathConstraints.push(new Sn(e,this))}this.color=new we(1,1,1,1),this.updateCache()}updateCache(){const s=this._updateCache;s.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,c=t.length;l<c;l++){const d=t[l];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin!=null){const l=this.skin.bones;for(let c=0,d=this.skin.bones.length;c<d;c++){let u=this.bones[l[c].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u!=null)}}const e=this.ikConstraints,i=this.transformConstraints,r=this.pathConstraints,n=e.length,a=i.length,o=r.length,h=n+a+o;t:for(let l=0;l<h;l++){for(let c=0;c<n;c++){const d=e[c];if(d.data.order==l){this.sortIkConstraint(d);continue t}}for(let c=0;c<a;c++){const d=i[c];if(d.data.order==l){this.sortTransformConstraint(d);continue t}}for(let c=0;c<o;c++){const d=r[c];if(d.data.order==l){this.sortPathConstraint(d);continue t}}}for(let l=0,c=t.length;l<c;l++)this.sortBone(t[l])}sortIkConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target;this.sortBone(t);const e=s.bones,i=e[0];if(this.sortBone(i),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(s),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(s){if(s.active=s.target.bone.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target,e=t.data.index,i=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,i),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,i);for(let o=0,h=this.data.skins.length;o<h;o++)this.sortPathConstraintAttachment(this.data.skins[o],e,i);const r=t.getAttachment();r instanceof An&&this.sortPathConstraintAttachmentWith(r,i);const n=s.bones,a=n.length;for(let o=0;o<a;o++)this.sortBone(n[o]);this._updateCache.push(s);for(let o=0;o<a;o++)this.sortReset(n[o].children);for(let o=0;o<a;o++)n[o].sorted=!0}sortTransformConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;this.sortBone(s.target);const t=s.bones,e=t.length;if(s.data.local)for(let i=0;i<e;i++){const r=t[i];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let i=0;i<e;i++)this.sortBone(t[i]);this._updateCache.push(s);for(let i=0;i<e;i++)this.sortReset(t[i].children);for(let i=0;i<e;i++)t[i].sorted=!0}sortPathConstraintAttachment(s,t,e){const i=s.attachments[t];if(i)for(const r in i)this.sortPathConstraintAttachmentWith(i[r],e)}sortPathConstraintAttachmentWith(s,t){if(!(s instanceof An))return;const e=s.bones;if(e==null)this.sortBone(t);else{const i=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const o=e[r];this.sortBone(i[o])}}}}sortBone(s){if(s.sorted)return;const t=s.parent;t!=null&&this.sortBone(t),s.sorted=!0,this._updateCache.push(s)}sortReset(s){for(let t=0,e=s.length;t<e;t++){const i=s[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(){const s=this.updateCacheReset;for(let e=0,i=s.length;e<i;e++){const r=s[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,i=t.length;e<i;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const s=this.bones;for(let r=0,n=s.length;r<n;r++)s[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],o=a.data;a.rotateMix=o.rotateMix,a.translateMix=o.translateMix,a.scaleMix=o.scaleMix,a.shearMix=o.shearMix}const i=this.pathConstraints;for(let r=0,n=i.length;r<n;r++){const a=i[r],o=a.data;a.position=o.position,a.spacing=o.spacing,a.rotateMix=o.rotateMix,a.translateMix=o.translateMix}}setSlotsToSetupPose(){const s=this.slots;Q.arrayCopy(s,0,this.drawOrder,0,s.length);for(let t=0,e=s.length;t<e;t++)s[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findBoneIndex(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}findSlot(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findSlotIndex(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}setSkinByName(s){const t=this.data.findSkin(s);if(t==null)throw new Error(`Skin not found: ${s}`);this.setSkin(t)}setSkin(s){if(s!=this.skin){if(s!=null)if(this.skin!=null)s.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=s.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=s,this.updateCache()}}getAttachmentByName(s,t){return this.getAttachment(this.data.findSlotIndex(s),t)}getAttachment(s,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(s,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(s,t):null}setAttachment(s,t){if(s==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let i=0,r=e.length;i<r;i++){const n=e[i];if(n.data.name==s){let a=null;if(t!=null&&(a=this.getAttachment(i,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${s}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${s}`)}findIkConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findTransformConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findPathConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}getBounds(s,t,e=new Array(2)){if(s==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const i=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let h=0,l=i.length;h<l;h++){const c=i[h];if(!c.bone.active)continue;let d=0,u=null;const f=c.getAttachment();if(f instanceof et)d=8,u=Q.setArraySize(e,d,0),f.computeWorldVertices(c.bone,u,0,2);else if(f instanceof fo){const p=f;d=p.worldVerticesLength,u=Q.setArraySize(e,d,0),p.computeWorldVertices(c,0,d,u,0,2)}if(u!=null)for(let p=0,m=u.length;p<m;p+=2){const _=u[p],y=u[p+1];r=Math.min(r,_),n=Math.min(n,y),a=Math.max(a,_),o=Math.max(o,y)}}s.set(r,n),t.set(a-r,o-n)}update(s){this.time+=s}get flipX(){return this.scaleX==-1}set flipX(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=s?1:-1}get flipY(){return this.scaleY==-1}set flipY(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=s?1:-1}};let o_=Cn;o_.deprecatedWarning1=!1,se.Normal,se.OnlyTranslation,se.NoRotationOrReflection,se.NoScale,se.NoScaleOrReflection,uo.Fixed,uo.Percent,Rr.Length,Rr.Fixed,Rr.Percent,Gs.Tangent,Gs.Chain,Gs.ChainScale,K.NORMAL,K.ADD,K.MULTIPLY,K.SCREEN;class lE extends Lc{createSkeleton(t){this.skeleton=new o_(t),this.skeleton.updateWorldTransform(),this.stateData=new n_(t),this.state=new Ne(this.stateData)}}class cE extends lE{constructor(t,e){const{followPointList:i,visible:r=!1}=e||{};let n;typeof t=="string"?n=qi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,i!=null&&i.length&&(i==null||i.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),ft.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(i=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{i()}}})}addAnimation(t="animation",e=!1,i=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,i).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){ft.system.remove(this._loopFn),this.destroy()}_loop(){this.update(ft.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:i}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:i,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,i+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{ct.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Ws=(s,t,e,i=!1)=>{s.cursor="pointer",s.eventMode="static";const r=n=>{n.button!==2&&e(n)};i?s.once(t,r):s.on(t,r)};class uE extends bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:i,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=i,this._tintColor=r,this._disabledColor=a,this._btn=new _e(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Ws(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Ws(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 dE extends Tn{constructor(t){const{sprite:e,onClick:i}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Ws(this,"pointerenter",()=>{ct.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Ws(this,"pointerleave",()=>{e.alpha=1,ct.to(e,{duration:.25,rotation:0})}),Ws(this,"pointerdown",()=>{e.alpha=.5}),Ws(this,"pointerup",()=>{i()})}}class fE extends bt{constructor(t){super(),this._maskUI=new lc({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,ct.to(this._maskUI,{duration:.25,alpha:.5}),ct.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){ct.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await ct.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class pE 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 i=new Fc({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=i,i.x=0,i.y=i.height*e,this.addChild(i),i.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++},ft.shared.add(()=>{const t=ft.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},zi.UTILITY)}_setTxtInfo(t,e){const i=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=[()=>(i(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class mE extends bt{constructor(t){super();const{bgWidth:e,bgHeight:i,barWidth:r,barHeight:n,bgTexture:a,barTexture:o}=t,h=new _e(a);this.addChild(h),this._progressBar=new _e(o),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(i-n)/2;const l=new li;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 _E extends Tn{constructor(t){const{width:e,height:i,scrollContent:r,bottomMargin:n=50}=t;if(super(e,i),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 _e;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new li,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,i),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(){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,ct.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const i=t.data.getLocalPosition(this).y-this._startY;this._content.y=i}}_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)),ct.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){ct.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)ct.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);ct.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else ct.to(this._content,{duration:.25,y:0})}}class gE extends Tn{constructor(t){const{width:e,height:i,content:r,slideCallback:n,scrollCallback:a,pageNum:o,pageHeight:h}=t;super(e,i),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 li;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=i,this._slideHeight=h,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=o-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 i;t<0?(ct.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?(ct.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,ct.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)}})),(i=this._slideCallback)==null||i.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,ct.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var i;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(i=this._scrollCallback)==null||i.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,i=this._startY-t.pageY,r=Math.abs(i)/e,n=.275,a=this._slideHeight/2,o=Math.round(i/this._slideHeight);(Math.abs(i)>a||r>n)&&(this._currentIndex+=o),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const h_=s=>{const t=new li;return t.beginFill(16777215),t.drawRect(0,0,s.width,s.height),t.endFill(),s.addChild(t),s.mask=t,t};class yE extends Tn{constructor(t,e,i,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,h_(this),this._slideWidth=t,this._slideArea=i,this.slideCallback=r,this._pageNum=Math.floor(i.width/this._slideWidth)-1,this.addChild(i),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?(ct.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(ct.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,ct.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,ct.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,i=this._startX-t.pageX,r=Math.abs(i)/e,n=this._slideWidth/2,a=.275;(Math.abs(i)>n||r>a)&&(i>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class xE{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 vE{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:i,onAmountIndex:r,onDisabled:n}=t;this.onAmountIndex=r,this.onDisabled=n,this._betAmountListLength=i,this._baseNumSteper=new xE(i,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 l_=(s,t,e)=>{const i=t/s.width*s.scale.x,r=e?e/s.height*s.scale.y:i,n=Math.min(i,r);s.scale.set(n>1?1:n)};class bE extends bt{constructor(t){super();const{data:e,cellWidth:i=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:o=3,lineColor:h="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=i,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=o,this._lineColor=h,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,i=new li;i.lineStyle(this._lineWidth,this._lineColor),i.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)i.moveTo(0,r*this._cellHeight),i.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)i.moveTo(r*this._cellWidth,0),i.lineTo(r*this._cellWidth,e);this.addChild(i)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const i=this._data[t][e];this._createNumberText(i,e,t)}}_createNumberText(t,e,i){const r=new Va(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=i*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),l_(r,this._cellWidth*.9)}}let c_;function TE(s){return c_=s,s}function Pn(){return c_}let wE=0;const Vc=class extends Je{constructor(s){super(),this.id=wE++,this.init(s)}set(s,t){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const t=this._source=s.source.cloneNode(!1);t.src=s.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=s.volume*(s.muted?0:1),i=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*i,this._source.playbackRate=this._speed*s.speed*t.speed}refreshPaused(){const s=this._media.context,t=this._media.parent,e=this._paused||t.paused||s.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(s){const{start:t,end:e,speed:i,loop:r,volume:n,muted:a}=s;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!r,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Vc.PADDING),this._end=Math.min(this._end+Vc.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),ft.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){ft.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){ft.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let u_=Vc;u_.PADDING=.1;class EE extends Je{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new u_(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h)},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;const r=()=>{o(),i.isLoaded=!0;const h=i.autoPlayStart();t&&t(null,i,h)},n=()=>{o(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{o();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},o=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class AE{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const _o=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],SE=["audio/mpeg","audio/ogg"],go={};function CE(s){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...s||{}},e=document.createElement("audio"),i={},r=/^no$/;_o.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),o=t[n]?e.canPlayType(t[n]).replace(r,""):"";i[n]=!!a||!!o}),Object.assign(go,i)}CE();class Wc{static setParamValue(t,e){if(t.setValueAtTime){const i=Pn().context;t.setValueAtTime(e,i.audioContext.currentTime)}else t.value=e;return e}}let PE=0;class RE extends Je{constructor(t){super(),this.id=PE++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(i=>i).forEach(i=>i.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const i=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);Wc.setParamValue(this._gain.gain,n*r*i),Wc.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(i=>{e.connect(i.destination),e=i}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i))}play(t){const{start:e,end:i,speed:r,loop:n,volume:a,muted:o,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=r,this._volume=a,this._loop=!!n,this._muted=o,this._filters=h,this.refresh();const d=this._source.buffer.duration;this._duration=d,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){ft.shared.remove(this._updateListener,this),t&&ft.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),i=e-this._lastUpdate;if(i>0||t){const r=this._source.playbackRate.value;this._elapsed+=i*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const o=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%o)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class d_{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const f_=class extends d_{constructor(s){const t=s.audioContext,e=t.createBufferSource(),i=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(i),i.connect(s.destination),super(r,i),this.context=s,this.bufferSource=e,this.gain=i,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(f_.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const s=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=s.buffer,Wc.setParamValue(t.playbackRate,s.playbackRate.value),t.loop=s.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let p_=f_;p_.BUFFER_SIZE=0;class IE{init(t){this.parent=t,this._nodes=new p_(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new RE(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,i=await H.ADAPTER.fetch(e);this._decode(await i.arrayBuffer(),t)}_decode(t,e){const i=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i)}}const Ir=class{static from(s){let t={};typeof s=="string"?t.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?t.source=s:Array.isArray(s)?t.url=s:t=s,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=Pn().useLegacy?new EE:new IE;return new Ir(e,t)}constructor(s,t){this.media=s,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(s){const[t]=s.map(e=>({url:e,ext:Ft.extname(e).slice(1)})).filter(({ext:e})=>go[e]).sort((e,i)=>_o.indexOf(e.ext)-_o.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Pn().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,t){if(typeof s=="object"){const i={};for(const r in s)i[r]=this.addSprites(r,s[r]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const e=new AE(this,t);return this._sprites[s]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const t=this._sprites[s];t!==void 0&&(t.destroy(),delete this._sprites[s])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,t){let e;if(typeof s=="string"?e={sprite:s,loop:this.loop,complete:t}:typeof s=="function"?(e={},e.complete=s):e=s,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,o,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,o,h),r(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(e),i}refresh(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refresh()}refreshPaused(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const t=this._instances.indexOf(s);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(Ir._pool.length>0){const s=Ir._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),Ir._pool.indexOf(s)<0&&Ir._pool.push(s)}};let yo=Ir;yo._pool=[];class ME extends Je{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Rn extends d_{constructor(){const t=window,e=new Rn.AudioContext,i=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(i),i.connect(e.destination),super(r,i),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Rn.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=r,this.events=new Je,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const i=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},i);r&&r.catch(i)}}class DE{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Rn),this._htmlAudioContext=new ME,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Rn.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const o=this._getOptions(t[a],e);n[a]=this.add(a,o)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof yo)return this._sounds[t]=e,e;const i=this._getOptions(e),r=yo.from(i);return this._sounds[t]=r,r}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){const i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const m_=s=>{var e;const t=s.src;return((e=s==null?void 0:s.alias)==null?void 0:e[0])??Ft.basename(t,Ft.extname(t))},BE={extension:G.Asset,detection:{test:async()=>!0,add:async s=>[...s,..._o.filter(t=>go[t])],remove:async s=>s.filter(t=>s.includes(t))},loader:{extension:{type:[G.LoadParser],priority:Re.High},test(s){const t=Ft.extname(s).slice(1);return!!go[t]||SE.some(e=>s.startsWith(`data:${e}`))},async load(s,t){const e=await new Promise((i,r)=>yo.from({...t.data,url:s,preload:!0,loaded(n,a){var o,h;n?r(n):i(a),(h=(o=t.data)==null?void 0:o.loaded)==null||h.call(o,n,a)}}));return Pn().add(m_(t),e),e},async unload(s,t){Pn().remove(m_(t))}}};z.add(BE),TE(new DE);class OE{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,i;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(i=this._musicPlayer)==null||i.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},this._musicPlayer=new Audio,document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(i=>{const r=new Date().getTime(),n=qi.get(t).url,a=new Audio(n);a.muted=this._isBackground||!this.effectEnabled,a.addEventListener("ended",()=>{this._playingList=this._playingList.filter(o=>o.id!==r),i()}),a.play().then(()=>{if(e){const h=a.duration-e;a.currentTime=Math.max(h,0)}this._playingList.push({id:r,audio:a,url:n})}).catch(()=>{})})}async playMusic(t){var r;this._musicPlayer&&(ct.killTweensOf(this._musicPlayer),await ct.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),(r=this._musicPlayer)==null||r.pause());const e=qi.get(t).url;this._musicPlayer.src=e,this._musicPlayer.loop=!0,this._musicPlayer.volume=0;const i=()=>{this._musicPlayer.play().then(()=>{this._isMusicPaused=!1,ct.killTweensOf(this._musicPlayer),ct.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}).catch(()=>{requestAnimationFrame(i.bind(this))})};i()}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t;this._isMusicPaused=!1,(t=this._musicPlayer)==null||t.play()}stopEffect(t){const e=qi.get(t).url;this._playingList.forEach(i=>{i.url===e&&i.audio.pause()}),this._playingList=this._playingList.filter(i=>i.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){this._musicPlayer.muted=t||!this.musicEnabled}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.muted=t||!this.effectEnabled})}}const FE=s=>{const{texture:t,dotWidth:e,width:i,height:r}=s;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new zb(t,n[0],n[1],n[2],n[3]);return a.width=i,a.height=r,a},LE=(s,t,e)=>{let i=!1;return s.cursor="pointer",s.eventMode="static",s.on(t,r=>{i||r.button!==2&&e(r)}),()=>{i=!0}},kE=(s,t,e=0)=>parseFloat((Math.random()*(t-s)+s).toFixed(e)),NE=(s,t)=>{let e=0;const i=new ft,r=n=>{e+=n*i.deltaMS;let a=0;Array.isArray(t)?a=kE(t[0],t[1],2):a=t,e>=a&&(s(),e=0)};return i.add(r),i.start(),()=>{i.remove(r),i.stop()}},UE=(s,t,e)=>{const i=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=s.getBounds().contains(r.clientX,r.clientY);!n&&!a&&s.visible&&(e(),window.removeEventListener("pointerdown",i))};return window.addEventListener("pointerdown",i),()=>{window.removeEventListener("pointerdown",i)}},GE=(s=1,t)=>new Promise(e=>{let i=0;const r=new ft,n=()=>{i+=r.deltaMS,i>=s&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),HE=(s,t)=>{let e;if(s==="brightness")e=new ar,e.brightness(t,!1);else if(s==="blur")e=new Hf;else if(s==="desaturate")e=new ar,e.desaturate();else if(s==="contrast")e=new ar,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var VE=`attribute vec2 aVertexPosition;
1169
+ */class _i{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,i?this.ease=typeof i=="function"?i:Km(i):this.ease=null}static createList(t){if("list"in t){const i=t.list;let r;const{value:n,time:a}=i[0],o=r=new _i(typeof n=="string"?lo(n):n,a,t.ease);if(i.length>2||i.length===2&&i[1].value!==n)for(let h=1;h<i.length;++h){const{value:l,time:c}=i[h];r.next=new _i(typeof l=="string"?lo(l):l,c),r=r.next}return o.isStepped=!!t.isStepped,o}const e=new _i(typeof t.start=="string"?lo(t.start):t.start,0);return t.end!==t.start&&(e.next=new _i(typeof t.end=="string"?lo(t.end):t.end,1)),e}}let wn=X.from;const gi=Math.PI/180;function Li(s,t){if(!s)return;const e=Math.sin(s),i=Math.cos(s),r=t.x*i-t.y*e,n=t.x*e+t.y*i;t.x=r,t.y=n}function ho(s,t,e){return s<<16|t<<8|e}function jm(s){return Math.sqrt(s.x*s.x+s.y*s.y)}function Gw(s){const t=1/jm(s);s.x*=t,s.y*=t}function qm(s,t){s.x*=t,s.y*=t}function lo(s,t){t||(t={}),s.charAt(0)==="#"?s=s.substr(1):s.indexOf("0x")===0&&(s=s.substr(2));let e;return s.length===8&&(e=s.substr(0,2),s=s.substr(2)),t.r=parseInt(s.substr(0,2),16),t.g=parseInt(s.substr(2,2),16),t.b=parseInt(s.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function Km(s){const t=s.length,e=1/t;return function(i){const r=t*i|0,n=(i-r*e)*t,a=s[r]||s[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function Hw(s){return s?(s=s.toUpperCase().replace(/ /g,"_"),K[s]||K.NORMAL):K.NORMAL}class cc extends _e{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 xt;(function(s){s[s.Spawn=0]="Spawn",s[s.Normal=2]="Normal",s[s.Late=5]="Late"})(xt||(xt={}));const uc=ft.shared,Us=Symbol("Position particle per emitter position");class ut{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 tt,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new tt,this._prevEmitterPos=new tt,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){ut.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:Km(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(i=>{const r=ut.knownBehaviors[i.type];return r?new r(i.config):(console.error(`Unknown behavior: ${i.type}`),null)}).filter(i=>!!i);e.push(Us),e.sort((i,r)=>i===Us?r.order===xt.Spawn?1:-1:r===Us?i.order===xt.Spawn?-1:1:i.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(i=>i!==Us&&i.updateParticle),this.recycleBehaviors=e.filter(i=>i!==Us&&i.recycleParticle)}getBehavior(t){return ut.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof ut.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new cc(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let i=0;i<this.recycleBehaviors.length;++i)this.recycleBehaviors[i].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,Li(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?uc.remove(this.update,this):!this._autoUpdate&&t&&uc.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=uc.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,o;a;a=o)if(o=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let h=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?h=this.customEase(h,0,1,1):h=this.customEase(h)),a.agePercent=h;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,i;this._prevPosIsValid&&(e=this._prevEmitterPos.x,i=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,o;if(this._prevPosIsValid&&this._posChanged){const c=1+this._spawnTimer/t;a=(r-e)*c+e,o=(n-i)*c+i}else a=r,o=n;let h=null,l=null;for(let c=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),d=0;d<c;++d){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let u;if(this.minLifetime===this.maxLifetime?u=this.minLifetime:u=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=u)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new cc(this),f.init(u),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),h?(l.next=f,f.prev=l,l=f):l=h=f,++this.particleCount}if(h){this._activeParticlesLast?(this._activeParticlesLast.next=h,h.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=h,this._activeParticlesLast=l);for(let c=0;c<this.initBehaviors.length;++c){const d=this.initBehaviors[c];if(d===Us)for(let u=h,f;u;u=f){f=u.next,this.rotation!==0&&(Li(this.rotation,u.position),u.rotation+=this.rotation),u.position.x+=a,u.position.y+=o,u.age+=-this._spawnTimer;let p=u.age*u.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),u.agePercent=p}else d.initParticles(h)}for(let c=h,d;c;c=d){d=c.next;for(let u=0;u<this.updateBehaviors.length;++u)if(this.updateBehaviors[u].updateParticle(c,-this._spawnTimer)){this.recycle(c);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 i=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 o;this._poolFirst?(o=this._poolFirst,this._poolFirst=this._poolFirst.next,o.next=null):o=new cc(this);let h;this.minLifetime===this.maxLifetime?h=this.minLifetime:h=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,o.init(h),this.addAtBack?this._parent.addChildAt(o,0):this._parent.addChild(o),i?(r.next=o,o.prev=r,r=o):r=i=o,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=i,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Us)for(let o=i,h;o;o=h)h=o.next,this.rotation!==0&&(Li(this.rotation,o.position),o.rotation+=this.rotation),o.position.x+=t,o.position.y+=e;else a.initParticles(i)}}}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}}ut.knownBehaviors={};class dc{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}}dc.type="rect",dc.editorConfig=null;class co{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),Li(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}co.type="torus",co.editorConfig=null;class fc{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 i=t[e];let r=i[0];for(let n=1;n<i.length;++n){const a=i[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let i=1;i<t.length;++i){const r=t[i];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:i,p2:r}=this.segments[e],n=Math.sqrt((r.x-i.x)*(r.x-i.x)+(r.y-i.y)*(r.y-i.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let i,r;if(this.segments.length===1)i=this.segments[0],r=e;else for(let o=0;o<this.countingLengths.length;++o)if(e<this.countingLengths[o]){i=this.segments[o],r=o===0?e:e-this.countingLengths[o-1];break}r/=i.l||1;const{p1:n,p2:a}=i;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}fc.type="polygonalChain",fc.editorConfig=null;class pc{constructor(t){var e;this.order=xt.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 i=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,r=i.x,n=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const a=jm(i);a>this.maxSpeed&&qm(i,this.maxSpeed/a)}t.x+=(r+i.x)/2*e,t.y+=(n+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}pc.type="moveAcceleration",pc.editorConfig=null;function Vw(s){return this.ease&&(s=this.ease(s)),(this.first.next.value-this.first.value)*s+this.first.value}function Ww(s){this.ease&&(s=this.ease(s));const t=this.first.value,e=this.first.next.value,i=(e.r-t.r)*s+t.r,r=(e.g-t.g)*s+t.g,n=(e.b-t.b)*s+t.b;return ho(i,r,n)}function Xw(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;return s=(s-t.time)/(e.time-t.time),(e.value-t.value)*s+t.value}function $w(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;s=(s-t.time)/(e.time-t.time);const i=t.value,r=e.value,n=(r.r-i.r)*s+i.r,a=(r.g-i.g)*s+i.g,o=(r.b-i.b)*s+i.b;return ho(n,a,o)}function zw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;return t.value}function Yw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;const e=t.value;return ho(e.r,e.g,e.b)}class En{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?Ww:Vw:t.isStepped?this.interpolate=this.isColor?Yw:zw:this.interpolate=this.isColor?$w:Xw,this.ease=this.first.ease}}class mc{constructor(t){this.order=xt.Normal,this.list=new En(!1),this.list.reset(_i.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)}}mc.type="alpha",mc.editorConfig=null;class _c{constructor(t){this.order=xt.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}_c.type="alphaStatic",_c.editorConfig=null;function Zm(s){const t=[];for(let e=0;e<s.length;++e){let i=s[e];if(typeof i=="string")t.push(wn(i));else if(i instanceof X)t.push(i);else{let r=i.count||1;for(typeof i.texture=="string"?i=wn(i.texture):i=i.texture;r>0;--r)t.push(i)}}return t}class gc{constructor(t){this.order=xt.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],r=Zm(i.textures),n=i.framerate<0?-1:i.framerate>0?i.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!i.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[i];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 i=t.config,r=i.anim;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(i.anim.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||X.EMPTY}}gc.type="animatedRandom",gc.editorConfig=null;class yc{constructor(t){this.order=xt.Normal;const e=t.anim,i=Zm(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:r>0?i.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const i=this.anim;for(;e;)e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}updateParticle(t,e){const i=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(i.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=i.textures[n]||i.textures[i.textures.length-1]||X.EMPTY}}yc.type="animatedSingle",yc.editorConfig=null;class xc{constructor(t){this.order=xt.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=Hw(this.value),e=e.next}}xc.type="blendMode",xc.editorConfig=null;class vc{constructor(t){this.order=xt.Spawn,this.spacing=t.spacing*gi,this.start=t.start*gi,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,i.rotation=r,this.distance&&(i.position.x=this.distance,Li(r,i.position)),i=i.next,++e}}}vc.type="spawnBurst",vc.editorConfig=null;class bc{constructor(t){this.order=xt.Normal,this.list=new En(!0),this.list.reset(_i.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,r=ho(i.r,i.g,i.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}bc.type="color",bc.editorConfig=null;class Tc{constructor(t){this.order=xt.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}}Tc.type="colorStatic",Tc.editorConfig=null;class wc{constructor(t){this.order=xt.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?wn(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}}wc.type="textureOrdered",wc.editorConfig=null;const Ar=new tt,Qm=["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"],jw=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(Qm).join("|"),"g");function qw(s){const t=s.match(jw);for(let e=t.length-1;e>=0;--e)Qm.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return s=t.join(""),new Function("x",`return ${s};`)}class Ec{constructor(t){var e;if(this.order=xt.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=qw(t.path)}catch{this.path=null}else this.path=i=>i;this.list=new En(!1),this.list.reset(_i.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 tt(e.x,e.y),e.config.movement=0;const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=i*e,Ar.x=t.config.movement,Ar.y=this.path(Ar.x),Li(t.config.initRotation,Ar),t.position.x=t.config.initPosition.x+Ar.x,t.position.y=t.config.initPosition.y+Ar.y}}Ec.type="movePath",Ec.editorConfig=null;class Ac{constructor(){this.order=xt.Spawn}initParticles(t){}}Ac.type="spawnPoint",Ac.editorConfig=null;class Sc{constructor(t){this.order=xt.Normal,this.textures=t.textures.map(e=>typeof e=="string"?wn(e):e)}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[i],e=e.next}}}Sc.type="textureRandom",Sc.editorConfig=null;class Cc{constructor(t){this.order=xt.Normal,this.minStart=t.minStart*gi,this.maxStart=t.maxStart*gi,this.minSpeed=t.minSpeed*gi,this.maxSpeed=t.maxSpeed*gi,this.accel=t.accel*gi}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 i=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+i)/2*e}else t.rotation+=t.config.rotSpeed*e}}Cc.type="rotation",Cc.editorConfig=null;class Pc{constructor(t){this.order=xt.Normal,this.min=t.min*gi,this.max=t.max*gi}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}}Pc.type="rotationStatic",Pc.editorConfig=null;class Rc{constructor(t){this.order=xt.Late+1,this.rotation=(t.rotation||0)*gi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Rc.type="noRotation",Rc.editorConfig=null;class Ic{constructor(t){var e;this.order=xt.Normal,this.list=new En(!1),this.list.reset(_i.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=i,e.scale.x=e.scale.y=this.list.first.value*i,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ic.type="scale",Ic.editorConfig=null;class Mc{constructor(t){this.order=xt.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=i,e=e.next}}}Mc.type="scaleStatic",Mc.editorConfig=null;class ze{constructor(t){this.order=xt.Spawn;const e=ze.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){ze.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}ze.type="spawnShape",ze.editorConfig=null,ze.shapes={},ze.registerShape(fc),ze.registerShape(dc),ze.registerShape(co),ze.registerShape(co,"circle");class Dc{constructor(t){this.order=xt.Normal,this.texture=typeof t.texture=="string"?wn(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Dc.type="textureSingle",Dc.editorConfig=null;class Bc{constructor(t){var e;this.order=xt.Late,this.list=new En(!1),this.list.reset(_i.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e.config.velocity?e.config.velocity.set(this.list.first.value*i,0):e.config.velocity=new tt(this.list.first.value*i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;Gw(r),qm(r,i),t.x+=r.x*e,t.y+=r.y*e}}Bc.type="moveSpeed",Bc.editorConfig=null;class Oc{constructor(t){this.order=xt.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity;t.x+=i.x*e,t.y+=i.y*e}}Oc.type="moveSpeedStatic",Oc.editorConfig=null,ut.registerBehavior(pc),ut.registerBehavior(mc),ut.registerBehavior(_c),ut.registerBehavior(gc),ut.registerBehavior(yc),ut.registerBehavior(xc),ut.registerBehavior(vc),ut.registerBehavior(bc),ut.registerBehavior(Tc),ut.registerBehavior(wc),ut.registerBehavior(Ec),ut.registerBehavior(Ac),ut.registerBehavior(Sc),ut.registerBehavior(Cc),ut.registerBehavior(Pc),ut.registerBehavior(Rc),ut.registerBehavior(Ic),ut.registerBehavior(Mc),ut.registerBehavior(ze),ut.registerBehavior(Dc),ut.registerBehavior(Bc),ut.registerBehavior(Oc);class Fc extends Va{constructor(t){const{text:e,fontSize:i=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:o,fontFamily:h="MicrosoftYaHei",fontWeight:l="normal",wordWrap:c=!1,wordWrapWidth:d=100,lineHeight:u=1.25,align:f="left",indent:p=0,shadow:m}=t,_=new Mi({fontSize:i,wordWrap:c,wordWrapWidth:d,fontWeight:l,lineHeight:u*i,breakWords:c,fill:r,align:f,fontFamily:h,stroke:n?a:"transparent",strokeThickness:n?o:0,lineJoin:"round"});m&&(_.dropShadow=!0,_.dropShadowColor=m[0],_.dropShadowAngle=m[1]*(Math.PI/180),_.dropShadowBlur=m[2],_.dropShadowDistance=m[3]),super(e,_),this.position.x=p*i}}class Kw extends bt{constructor(t){super();const{start:e,control:i,end:r,json:n,duration:a,ease:o="power1.out",showControl:h=!1,loop:l=!1}=t;this._particleContainer=new jb,this.addChild(this._particleContainer);const c=new ut(this._particleContainer,n),d=this._createBezierPoints([e,...i,r],100,h),u={pathThrough:0};ct.to(u,{duration:a,pathThrough:d.length-1,repeat:l?-1:0,ease:o,onStart:()=>{c.emit=!0},onUpdate:()=>{const p=Math.floor(u.pathThrough),m=d[p];c.updateOwnerPos(m.x,m.y)},onComplete:()=>{ct.to(this,{alpha:0,duration:.5,onComplete:()=>{c.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new ft;f.add(()=>{c.update(1/75)}),f.start()}_createBezierPoints(t,e,i){const r=[];i&&t.forEach((n,a)=>{const o=new Fc({text:a+1,fontSize:16});o.position.set(n.x,n.y),this.addChild(o)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const i=t.length;let r=0,n=0;const a=[];for(let o=0;o<i;o++)a[o]=this._binomial(i-1,o);for(let o=0;o<i;o++){const h=t[o],l=a[o],c=Math.pow(e,o),d=Math.pow(1-e,i-1-o);r+=h.x*d*c*l,n+=h.y*d*c*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let i=1;for(let r=1;r<=e;r++)i=i*(t-r+1)/r;return i}}var yi=(s=>(s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping",s))(yi||{}),j=(s=>(s[s.setup=0]="setup",s[s.first=1]="first",s[s.replace=2]="replace",s[s.add=3]="add",s))(j||{}),Te=(s=>(s[s.mixIn=0]="mixIn",s[s.mixOut=1]="mixOut",s))(Te||{}),uo=(s=>(s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent",s))(uo||{}),Gs=(s=>(s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale",s))(Gs||{}),se=(s=>(s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",s))(se||{});class Jm{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 Zw{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}}const Hs=class{constructor(s=0,t=0,e=0,i=0){this.r=s,this.g=t,this.b=e,this.a=i}set(s,t,e,i){return this.r=s,this.g=t,this.b=e,this.a=i,this.clamp()}setFromColor(s){return this.r=s.r,this.g=s.g,this.b=s.b,this.a=s.a,this}setFromString(s){return s=s.charAt(0)=="#"?s.substr(1):s,this.r=parseInt(s.substr(0,2),16)/255,this.g=parseInt(s.substr(2,2),16)/255,this.b=parseInt(s.substr(4,2),16)/255,this.a=s.length!=8?1:parseInt(s.substr(6,2),16)/255,this}add(s,t,e,i){return this.r+=s,this.g+=t,this.b+=e,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(s,t){s.r=((t&4278190080)>>>24)/255,s.g=((t&16711680)>>>16)/255,s.b=((t&65280)>>>8)/255,s.a=(t&255)/255}static rgb888ToColor(s,t){s.r=((t&16711680)>>>16)/255,s.g=((t&65280)>>>8)/255,s.b=(t&255)/255}static fromString(s){return new Hs().setFromString(s)}};let we=Hs;we.WHITE=new Hs(1,1,1,1),we.RED=new Hs(1,0,0,1),we.GREEN=new Hs(0,1,0,1),we.BLUE=new Hs(0,0,1,1),we.MAGENTA=new Hs(1,0,1,1);const ki=class{static clamp(s,t,e){return s<t?t:s>e?e:s}static cosDeg(s){return Math.cos(s*ki.degRad)}static sinDeg(s){return Math.sin(s*ki.degRad)}static signum(s){return Math.sign(s)}static toInt(s){return s>0?Math.floor(s):Math.ceil(s)}static cbrt(s){const t=Math.pow(Math.abs(s),.3333333333333333);return s<0?-t:t}static randomTriangular(s,t){return ki.randomTriangularWith(s,t,(s+t)*.5)}static randomTriangularWith(s,t,e){const i=Math.random(),r=t-s;return i<=(e-s)/r?s+Math.sqrt(i*r*(e-s)):t-Math.sqrt((1-i)*r*(t-e))}static isPowerOfTwo(s){return s&&(s&s-1)===0}};let k=ki;k.PI=3.1415927,k.PI2=ki.PI*2,k.radiansToDegrees=180/ki.PI,k.radDeg=ki.radiansToDegrees,k.degreesToRadians=ki.PI/180,k.degRad=ki.degreesToRadians;class Qw{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}}class Jw extends Qw{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 tE extends Jw{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Sr=class{static arrayCopy(s,t,e,i,r){for(let n=t,a=i;n<t+r;n++,a++)e[a]=s[n]}static arrayFill(s,t,e,i){for(let r=t;r<e;r++)s[r]=i}static setArraySize(s,t,e=0){const i=s.length;if(i==t)return s;if(s.length=t,i<t)for(let r=i;r<t;r++)s[r]=e;return s}static ensureArrayCapacity(s,t,e=0){return s.length>=t?s:Sr.setArraySize(s,t,e)}static newArray(s,t){const e=new Array(s);for(let i=0;i<s;i++)e[i]=t;return e}static newFloatArray(s){if(Sr.SUPPORTS_TYPED_ARRAYS)return new Float32Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(s){if(Sr.SUPPORTS_TYPED_ARRAYS)return new Int16Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(s){return Sr.SUPPORTS_TYPED_ARRAYS?new Float32Array(s):s}static toSinglePrecision(s){return Sr.SUPPORTS_TYPED_ARRAYS?Math.fround(s):s}static webkit602BugfixHelper(s,t){}static contains(s,t,e=!0){for(let i=0;i<s.length;i++)if(s[i]==t)return!0;return!1}static enumValue(s,t){return s[t[0].toUpperCase()+t.slice(1)]}};let Q=Sr;Q.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class eE{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 iE{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 sE={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},hs=[0,0,0];class rE extends _e{constructor(){super(...arguments),this.region=null,this.attachment=null}}class nE extends Yb{constructor(t,e,i,r,n){super(t,e,i,r,n),this.region=null,this.attachment=null}}const t_=class extends bt{constructor(s){if(super(),!s)throw new Error("The spineData param is required.");if(typeof s=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=s,this.createSkeleton(s),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t],r=i.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===yi.Region){const a=r.name,o=this.createSprite(i,r,a);i.currentSprite=o,i.currentSpriteName=a,n.addChild(o)}else if(r.type===yi.Mesh){const a=this.createMesh(i,r);i.currentMesh=a,i.currentMeshId=r.id,i.currentMeshName=r.name,n.addChild(a)}else r.type===yi.Clipping&&(this.createGraphics(i,r),n.addChild(i.clippingContainer),n.addChild(i.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(s){var t;s!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),s==null||s.registerSpine(this),this._debug=s)}get autoUpdate(){return this._autoUpdate}set autoUpdate(s){s!==this._autoUpdate&&(this._autoUpdate=s,this.updateTransform=s?t_.prototype.autoUpdateTransform:bt.prototype.updateTransform)}get tint(){return Qr(this.tintRgb)}set tint(s){this.tintRgb=Md(s,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:sE.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(s){var l;const t=this.delayLimit;if(s>t&&(s=t),this.state.update(s),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,i=this.color;let r=null,n=null;i?(r=i.light,n=i.dark):r=this.tintRgb;for(let c=0,d=e.length;c<d;c++){const u=e[c],f=u.getAttachment(),p=this.slotContainers[c];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(u,f);let _=f.region;const y=f.color;switch(f!=null&&f.type){case yi.Region:if(p.transform.setFromMatrix(u.bone.matrix),_=f.region,u.currentMesh&&(u.currentMesh.visible=!1,u.currentMesh=null,u.currentMeshId=void 0,u.currentMeshName=void 0),!_){u.currentSprite&&(u.currentSprite.renderable=!1);break}if(!u.currentSpriteName||u.currentSpriteName!==f.name){const x=f.name;if(u.currentSprite&&(u.currentSprite.visible=!1),u.sprites=u.sprites||{},u.sprites[x]!==void 0)u.sprites[x].visible=!0;else{const b=this.createSprite(u,f,x);p.addChild(b)}u.currentSprite=u.sprites[x],u.currentSpriteName=x}u.currentSprite.renderable=!0,u.hackRegion||this.setSpriteRegion(f,u.currentSprite,_),u.currentSprite.color?m=u.currentSprite.color:(hs[0]=r[0]*u.color.r*y.r,hs[1]=r[1]*u.color.g*y.g,hs[2]=r[2]*u.color.b*y.b,u.currentSprite.tint=Qr(hs)),u.currentSprite.blendMode=u.blendMode;break;case yi.Mesh:if(u.currentSprite){u.currentSprite.visible=!1,u.currentSprite=null,u.currentSpriteName=void 0;const x=new ca;x._parentID=-1,x._worldID=p.transform._worldID,p.transform=x}if(!_){u.currentMesh&&(u.currentMesh.renderable=!1);break}const g=f.id;if(u.currentMeshId===void 0||u.currentMeshId!==g){const x=g;if(u.currentMesh&&(u.currentMesh.visible=!1),u.meshes=u.meshes||{},u.meshes[x]!==void 0)u.meshes[x].visible=!0;else{const b=this.createMesh(u,f);p.addChild(b)}u.currentMesh=u.meshes[x],u.currentMeshName=f.name,u.currentMeshId=x}u.currentMesh.renderable=!0,f.computeWorldVerticesOld(u,u.currentMesh.vertices),u.currentMesh.color?m=u.currentMesh.color:(hs[0]=r[0]*u.color.r*y.r,hs[1]=r[1]*u.color.g*y.g,hs[2]=r[2]*u.color.b*y.b,u.currentMesh.tint=Qr(hs)),u.currentMesh.blendMode=u.blendMode,u.hackRegion||this.setMeshRegion(f,u.currentMesh,_);break;case yi.Clipping:u.currentGraphics||(this.createGraphics(u,f),p.addChild(u.clippingContainer),p.addChild(u.currentGraphics)),this.updateGraphics(u,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let v=u.color.r*y.r,g=u.color.g*y.g,x=u.color.b*y.b;m.setLight(r[0]*v+n[0]*(1-v),r[1]*g+n[1]*(1-g),r[2]*x+n[2]*(1-x)),u.darkColor?(v=u.darkColor.r,g=u.darkColor.g,x=u.darkColor.b):(v=0,g=0,x=0),m.setDark(r[0]*v+n[0]*(1-v),r[1]*g+n[1]*(1-g),r[2]*x+n[2]*(1-x))}p.alpha=u.color.a}const a=this.skeleton.drawOrder;let o=null,h=null;for(let c=0,d=a.length;c<d;c++){const u=e[a[c].data.index],f=this.slotContainers[a[c].data.index];if(h||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),u.currentGraphics&&u.getAttachment())h=u.clippingContainer,o=u.getAttachment(),h.children.length=0,this.children[c]=f,o.endSlot===u.data&&(o.endSlot=null);else if(h){let p=this.tempClipContainers[c];p||(p=this.tempClipContainers[c]=this.newContainer(),p.visible=!1),this.children[c]=p,f.parent=null,h.addChild(f),o.endSlot==u.data&&(h.renderable=!0,h=null,o=null)}else this.children[c]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,t.rotation=s.rotation*k.degRad,t.position.x=s.x,t.position.y=s.y,t.alpha=s.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=s.scaleX*s.width/e.originalWidth,t.scale.y=-s.scaleY*s.height/e.originalHeight))}setMeshRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(s.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const s=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(s)}bt.prototype.updateTransform.call(this)}createSprite(s,t,e){let i=t.region;s.hackAttachment===t&&(i=s.hackRegion);const r=i?i.texture:null,n=this.newSprite(r);return n.anchor.set(.5),i&&this.setSpriteRegion(t,n,t.region),s.sprites=s.sprites||{},s.sprites[e]=n,n}createMesh(s,t){let e=t.region;s.hackAttachment===t&&(e=s.hackRegion,s.hackAttachment=null,s.hackRegion=null);const i=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),Ue.TRIANGLES);return typeof i._canvasPadding<"u"&&(i._canvasPadding=1.5),i.alpha=t.color.a,i.region=t.region,e&&this.setMeshRegion(t,i,e),s.meshes=s.meshes||{},s.meshes[t.id]=i,i}createGraphics(s,t){const e=this.newGraphics(),i=new $i([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(i),e.renderable=!1,s.currentGraphics=e,s.clippingContainer=this.newContainer(),s.clippingContainer.mask=s.currentGraphics,e}updateGraphics(s,t){const e=s.currentGraphics.geometry,i=e.graphicsData[0].shape.points,r=t.worldVerticesLength;i.length=r,t.computeWorldVertices(s,0,r,i,0,2),e.invalidate()}hackTextureBySlotIndex(s,t=null,e=null){const i=this.skeleton.slots[s];if(!i)return!1;const r=i.getAttachment();let n=r.region;return t?(n=new Jm,n.texture=t,n.size=e,i.hackRegion=n,i.hackAttachment=r):(i.hackRegion=null,i.hackAttachment=null),i.currentSprite?this.setSpriteRegion(r,i.currentSprite,n):i.currentMesh&&this.setMeshRegion(r,i.currentMesh,n),!0}hackTextureBySlotName(s,t=null,e=null){const i=this.skeleton.findSlotIndex(s);return i==-1?!1:this.hackTextureBySlotIndex(i,t,e)}hackTextureAttachment(s,t,e,i=null){const r=this.skeleton.findSlotIndex(s),n=this.skeleton.getAttachmentByName(s,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const o=a.getAttachment();if(t===o.name){let h=n.region;return e?(h=new Jm,h.texture=e,h.size=i,a.hackRegion=h,a.hackAttachment=o):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=h?(this.setSpriteRegion(o,a.currentSprite,h),a.currentSprite.region=h):a.currentMesh&&a.currentMesh.region!=h&&this.setMeshRegion(o,a.currentMesh,h),!0}return!1}newContainer(){return new bt}newSprite(s){return new rE(s)}newGraphics(){return new li}newMesh(s,t,e,i,r){return new nE(s,t,e,i,r)}transformHack(){return 1}hackAttachmentGroups(s,t,e){if(!s)return;const i=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const o=this.skeleton.slots[n],h=o.currentSpriteName||o.currentMeshName||"",l=o.currentSprite||o.currentMesh;h.endsWith(s)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,i.push(l))}return[i,r]}destroy(s){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t];for(const r in i.meshes)i.meshes[r].destroy(s);i.meshes=null;for(const r in i.sprites)i.sprites[r].destroy(s);i.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(s);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(s)}};let Lc=t_;Lc.clippingPolygon=[],Object.defineProperty(Lc.prototype,"visible",{get(){return this._visible},set(s){s!==this._visible&&(this._visible=s,s&&(this.lastTime=0))}});class e_{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}}const i_=class extends e_{constructor(s){super(s),this.id=(i_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(s,t){this.computeWorldVertices(s,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(s,t,e,i,r,n){e=r+(e>>1)*n;const a=s.bone.skeleton,o=s.deform;let h=this.vertices;const l=this.bones;if(l==null){o.length>0&&(h=o);const f=s.bone.matrix,p=f.tx,m=f.ty,_=f.a,y=f.c,v=f.b,g=f.d;for(let x=t,b=r;b<e;x+=2,b+=n){const w=h[x],T=h[x+1];i[b]=w*_+T*y+p,i[b+1]=w*v+T*g+m}return}let c=0,d=0;for(let f=0;f<t;f+=2){const p=l[c];c+=p+1,d+=p}const u=a.bones;if(o.length==0)for(let f=r,p=d*3;f<e;f+=n){let m=0,_=0,y=l[c++];for(y+=c;c<y;c++,p+=3){const v=u[l[c]].matrix,g=h[p],x=h[p+1],b=h[p+2];m+=(g*v.a+x*v.c+v.tx)*b,_+=(g*v.b+x*v.d+v.ty)*b}i[f]=m,i[f+1]=_}else{const f=o;for(let p=r,m=d*3,_=d<<1;p<e;p+=n){let y=0,v=0,g=l[c++];for(g+=c;c<g;c++,m+=3,_+=2){const x=u[l[c]].matrix,b=h[m]+f[_],w=h[m+1]+f[_+1],T=h[m+2];y+=(b*x.a+w*x.c+x.tx)*T,v+=(b*x.b+w*x.d+x.ty)*T}i[p]=y,i[p+1]=v}}}copyTo(s){this.bones!=null?(s.bones=new Array(this.bones.length),Q.arrayCopy(this.bones,0,s.bones,0,this.bones.length)):s.bones=null,this.vertices!=null?(s.vertices=Q.newFloatArray(this.vertices.length),Q.arrayCopy(this.vertices,0,s.vertices,0,this.vertices.length)):s.vertices=null,s.worldVerticesLength=this.worldVerticesLength,s.deformAttachment=this.deformAttachment}};let kc=i_;kc.nextID=0;class fo extends kc{constructor(t){super(t),this.type=yi.Mesh,this.color=new we(1,1,1,1),this.tempColor=new we(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 fo(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),Q.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),Q.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),Q.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new fo(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}}class An extends kc{constructor(t){super(t),this.type=yi.Path,this.closed=!1,this.constantSpeed=!1,this.color=new we(1,1,1,1)}copy(){const t=new An(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Q.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class s_{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 we,this.darkColor=t.darkColor==null?null:new we,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 Kt=class extends e_{constructor(s){super(s),this.type=yi.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 we(1,1,1,1),this.offset=Q.newFloatArray(8),this.uvs=Q.newFloatArray(8),this.tempColor=new we(1,1,1,1)}updateOffset(){const s=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,e=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*t,r=e+this.region.width*s,n=i+this.region.height*t,a=this.rotation*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=e*o+this.x,c=e*h,d=i*o+this.y,u=i*h,f=r*o+this.x,p=r*h,m=n*o+this.y,_=n*h,y=this.offset;y[Kt.OX1]=l-u,y[Kt.OY1]=d+c,y[Kt.OX2]=l-_,y[Kt.OY2]=m+c,y[Kt.OX3]=f-_,y[Kt.OY3]=m+p,y[Kt.OX4]=f-u,y[Kt.OY4]=d+p}setRegion(s){this.region=s;const t=this.uvs;s.rotate?(t[2]=s.u,t[3]=s.v2,t[4]=s.u,t[5]=s.v,t[6]=s.u2,t[7]=s.v,t[0]=s.u2,t[1]=s.v2):(t[0]=s.u,t[1]=s.v2,t[2]=s.u,t[3]=s.v,t[4]=s.u2,t[5]=s.v,t[6]=s.u2,t[7]=s.v2)}computeWorldVertices(s,t,e,i){const r=this.offset,n=s instanceof s_?s.bone.matrix:s.matrix,a=n.tx,o=n.ty,h=n.a,l=n.c,c=n.b,d=n.d;let u=0,f=0;u=r[Kt.OX1],f=r[Kt.OY1],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX2],f=r[Kt.OY2],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX3],f=r[Kt.OY3],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX4],f=r[Kt.OY4],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o}copy(){const s=new Kt(this.name);return s.region=this.region,s.rendererObject=this.rendererObject,s.path=this.path,s.x=this.x,s.y=this.y,s.scaleX=this.scaleX,s.scaleY=this.scaleY,s.rotation=this.rotation,s.width=this.width,s.height=this.height,Q.arrayCopy(this.uvs,0,s.uvs,0,8),Q.arrayCopy(this.offset,0,s.offset,0,8),s.color.setFromColor(this.color),s}};let et=Kt;et.OX1=0,et.OY1=1,et.OX2=2,et.OY2=3,et.OX3=4,et.OY3=5,et.OX4=6,et.OY4=7,et.X1=0,et.Y1=1,et.C1R=2,et.C1G=3,et.C1B=4,et.C1A=5,et.U1=6,et.V1=7,et.X2=8,et.Y2=9,et.C2R=10,et.C2G=11,et.C2B=12,et.C2A=13,et.U2=14,et.V2=15,et.X3=16,et.Y3=17,et.C3R=18,et.C3G=19,et.C3B=20,et.C3A=21,et.U3=22,et.V3=23,et.X4=24,et.Y4=25,et.C4R=26,et.C4G=27,et.C4B=28,et.C4A=29,et.U4=30,et.V4=31,new tE(2);class pe{constructor(t,e,i){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=i}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,i,r,n,a,o,h){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let c=0,d=l.length;c<d;c++)l[c].apply(t,e,i,n,a,o,h)}static binarySearch(t,e,i=1){let r=0,n=t.length/i-2;if(n==0)return i;let a=n>>>1;for(;;){if(t[(a+1)*i]<=e?r=a+1:n=a,r==n)return(r+1)*i;a=r+n>>>1}}static linearSearch(t,e,i){for(let r=0,n=t.length-i;r<=n;r+=i)if(t[r]>e)return r;return-1}}const Gt=class{constructor(s){if(s<=0)throw new Error(`frameCount must be > 0: ${s}`);this.curves=Q.newFloatArray((s-1)*Gt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/Gt.BEZIER_SIZE+1}setLinear(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.LINEAR}setStepped(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.STEPPED}getCurveType(s){const t=s*Gt.BEZIER_SIZE;if(t==this.curves.length)return Gt.LINEAR;const e=this.curves[t];return e==Gt.LINEAR?Gt.LINEAR:e==Gt.STEPPED?Gt.STEPPED:Gt.BEZIER}setCurve(s,t,e,i,r){const n=(-t*2+i)*.03,a=(-e*2+r)*.03,o=((t-i)*3+1)*.006,h=((e-r)*3+1)*.006;let l=n*2+o,c=a*2+h,d=t*.3+n+o*.16666667,u=e*.3+a+h*.16666667,f=s*Gt.BEZIER_SIZE;const p=this.curves;p[f++]=Gt.BEZIER;let m=d,_=u;for(let y=f+Gt.BEZIER_SIZE-1;f<y;f+=2)p[f]=m,p[f+1]=_,d+=l,u+=c,l+=o,c+=h,m+=d,_+=u}getCurvePercent(s,t){t=k.clamp(t,0,1);const e=this.curves;let i=s*Gt.BEZIER_SIZE;const r=e[i];if(r==Gt.LINEAR)return t;if(r==Gt.STEPPED)return 0;i++;let n=0;for(let o=i,h=i+Gt.BEZIER_SIZE-1;i<h;i+=2)if(n=e[i],n>=t){let l,c;return i==o?(l=0,c=0):(l=e[i-2],c=e[i-1]),c+(e[i+1]-c)*(t-l)/(n-l)}const a=e[i-1];return a+(1-a)*(t-n)/(1-n)}};let Fe=Gt;Fe.LINEAR=0,Fe.STEPPED=1,Fe.BEZIER=2,Fe.BEZIER_SIZE=10*2-1;const ls=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(s,t,e){s<<=1,this.frames[s]=t,this.frames[s+ls.ROTATION]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotation=h.data.rotation;return;case j.first:const p=h.data.rotation-h.rotation;h.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=o[o.length-ls.ENTRIES]){let p=o[o.length+ls.PREV_ROTATION];switch(n){case j.setup:h.rotation=h.data.rotation+p*r;break;case j.first:case j.replace:p+=h.data.rotation-h.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case j.add:h.rotation+=p*r}return}const l=pe.binarySearch(o,e,ls.ENTRIES),c=o[l+ls.PREV_ROTATION],d=o[l],u=this.getCurvePercent((l>>1)-1,1-(e-d)/(o[l+ls.PREV_TIME]-d));let f=o[l+ls.ROTATION]-c;switch(f=c+(f-(16384-(16384.499999999996-f/360|0))*360)*u,n){case j.setup:h.rotation=h.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case j.first:case j.replace:f+=h.data.rotation-h.rotation;case j.add:h.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Le=ls;Le.ENTRIES=2,Le.PREV_TIME=-2,Le.PREV_ROTATION=-1,Le.ROTATION=1;const ae=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ae.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(s,t,e,i){s*=ae.ENTRIES,this.frames[s]=t,this.frames[s+ae.X]=e,this.frames[s+ae.Y]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.x=h.data.x,h.y=h.data.y;return;case j.first:h.x+=(h.data.x-h.x)*r,h.y+=(h.data.y-h.y)*r}return}let l=0,c=0;if(e>=o[o.length-ae.ENTRIES])l=o[o.length+ae.PREV_X],c=o[o.length+ae.PREV_Y];else{const d=pe.binarySearch(o,e,ae.ENTRIES);l=o[d+ae.PREV_X],c=o[d+ae.PREV_Y];const u=o[d],f=this.getCurvePercent(d/ae.ENTRIES-1,1-(e-u)/(o[d+ae.PREV_TIME]-u));l+=(o[d+ae.X]-l)*f,c+=(o[d+ae.Y]-c)*f}switch(n){case j.setup:h.x=h.data.x+l*r,h.y=h.data.y+c*r;break;case j.first:case j.replace:h.x+=(h.data.x+l-h.x)*r,h.y+=(h.data.y+c-h.y)*r;break;case j.add:h.x+=l*r,h.y+=c*r}}};let Cr=ae;Cr.ENTRIES=3,Cr.PREV_TIME=-3,Cr.PREV_X=-2,Cr.PREV_Y=-1,Cr.X=1,Cr.Y=2;const Rt=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Rt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(s,t,e,i,r,n){s*=Rt.ENTRIES,this.frames[s]=t,this.frames[s+Rt.R]=e,this.frames[s+Rt.G]=i,this.frames[s+Rt.B]=r,this.frames[s+Rt.A]=n}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color);return;case j.first:const f=o.color,p=o.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,c=0,d=0,u=0;if(e>=h[h.length-Rt.ENTRIES]){const f=h.length;l=h[f+Rt.PREV_R],c=h[f+Rt.PREV_G],d=h[f+Rt.PREV_B],u=h[f+Rt.PREV_A]}else{const f=pe.binarySearch(h,e,Rt.ENTRIES);l=h[f+Rt.PREV_R],c=h[f+Rt.PREV_G],d=h[f+Rt.PREV_B],u=h[f+Rt.PREV_A];const p=h[f],m=this.getCurvePercent(f/Rt.ENTRIES-1,1-(e-p)/(h[f+Rt.PREV_TIME]-p));l+=(h[f+Rt.R]-l)*m,c+=(h[f+Rt.G]-c)*m,d+=(h[f+Rt.B]-d)*m,u+=(h[f+Rt.A]-u)*m}if(r==1)o.color.set(l,c,d,u);else{const f=o.color;n==j.setup&&f.setFromColor(o.data.color),f.add((l-f.r)*r,(c-f.g)*r,(d-f.b)*r,(u-f.a)*r)}}};let xi=Rt;xi.ENTRIES=5,xi.PREV_TIME=-5,xi.PREV_R=-4,xi.PREV_G=-3,xi.PREV_B=-2,xi.PREV_A=-1,xi.R=1,xi.G=2,xi.B=3,xi.A=4;const ot=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ot.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(s,t,e,i,r,n,a,o,h){s*=ot.ENTRIES,this.frames[s]=t,this.frames[s+ot.R]=e,this.frames[s+ot.G]=i,this.frames[s+ot.B]=r,this.frames[s+ot.A]=n,this.frames[s+ot.R2]=a,this.frames[s+ot.G2]=o,this.frames[s+ot.B2]=h}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case j.first:const _=o.color,y=o.darkColor,v=o.data.color,g=o.data.darkColor;_.add((v.r-_.r)*r,(v.g-_.g)*r,(v.b-_.b)*r,(v.a-_.a)*r),y.add((g.r-y.r)*r,(g.g-y.g)*r,(g.b-y.b)*r,0)}return}let l=0,c=0,d=0,u=0,f=0,p=0,m=0;if(e>=h[h.length-ot.ENTRIES]){const _=h.length;l=h[_+ot.PREV_R],c=h[_+ot.PREV_G],d=h[_+ot.PREV_B],u=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2]}else{const _=pe.binarySearch(h,e,ot.ENTRIES);l=h[_+ot.PREV_R],c=h[_+ot.PREV_G],d=h[_+ot.PREV_B],u=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2];const y=h[_],v=this.getCurvePercent(_/ot.ENTRIES-1,1-(e-y)/(h[_+ot.PREV_TIME]-y));l+=(h[_+ot.R]-l)*v,c+=(h[_+ot.G]-c)*v,d+=(h[_+ot.B]-d)*v,u+=(h[_+ot.A]-u)*v,f+=(h[_+ot.R2]-f)*v,p+=(h[_+ot.G2]-p)*v,m+=(h[_+ot.B2]-m)*v}if(r==1)o.color.set(l,c,d,u),o.darkColor.set(f,p,m,1);else{const _=o.color,y=o.darkColor;n==j.setup&&(_.setFromColor(o.data.color),y.setFromColor(o.data.darkColor)),_.add((l-_.r)*r,(c-_.g)*r,(d-_.b)*r,(u-_.a)*r),y.add((f-y.r)*r,(p-y.g)*r,(m-y.b)*r,0)}}};let re=ot;re.ENTRIES=8,re.PREV_TIME=-8,re.PREV_R=-7,re.PREV_G=-6,re.PREV_B=-5,re.PREV_A=-4,re.PREV_R2=-3,re.PREV_G2=-2,re.PREV_B2=-1,re.R=1,re.G=2,re.B=3,re.A=4,re.R2=5,re.G2=6,re.B2=7;class po{constructor(t){this.frames=Q.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i}apply(t,e,i,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;if(o==Te.mixOut){a==j.setup&&this.setAttachment(t,h,h.data.attachmentName);return}const l=this.frames;if(i<l[0]){(a==j.setup||a==j.first)&&this.setAttachment(t,h,h.data.attachmentName);return}let c=0;i>=l[l.length-1]?c=l.length-1:c=pe.binarySearch(l,i,1)-1;const d=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}setAttachment(t,e,i){e.setAttachment(i==null?null:t.getAttachment(this.slotIndex,i))}}class aE{constructor(t){this.frames=Q.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,i,r,n,a,o){if(r==null)return;const h=this.frames,l=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,r,n,a,o),e=-1;else if(e>=h[l-1])return;if(i<h[0])return;let c=0;if(e<h[0])c=0;else{c=pe.binarySearch(h,e);const d=h[c];for(;c>0&&h[c-1]==d;)c--}for(;c<l&&i>=h[c];c++)r.push(this.events[c])}}class Nc{constructor(t){this.frames=Q.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.drawOrders[t]=i}apply(t,e,i,r,n,a,o){const h=t.drawOrder,l=t.slots;if(o==Te.mixOut&&a==j.setup){Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const c=this.frames;if(i<c[0]){(a==j.setup||a==j.first)&&Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let d=0;i>=c[c.length-1]?d=c.length-1:d=pe.binarySearch(c,i)-1;const u=this.drawOrders[d];if(u==null)Q.arrayCopy(l,0,h,0,l.length);else for(let f=0,p=u.length;f<p;f++)h[f]=l[u[f]]}}const ht=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ht.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(s,t,e,i,r,n,a){s*=ht.ENTRIES,this.frames[s]=t,this.frames[s+ht.MIX]=e,this.frames[s+ht.SOFTNESS]=i,this.frames[s+ht.BEND_DIRECTION]=r,this.frames[s+ht.COMPRESS]=n?1:0,this.frames[s+ht.STRETCH]=a?1:0}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.ikConstraints[this.ikConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch;return;case j.first:h.mix+=(h.data.mix-h.mix)*r,h.softness+=(h.data.softness-h.softness)*r,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}return}if(e>=o[o.length-ht.ENTRIES]){n==j.setup?(h.mix=h.data.mix+(o[o.length+ht.PREV_MIX]-h.data.mix)*r,h.softness=h.data.softness+(o[o.length+ht.PREV_SOFTNESS]-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0)):(h.mix+=(o[o.length+ht.PREV_MIX]-h.mix)*r,h.softness+=(o[o.length+ht.PREV_SOFTNESS]-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0));return}const l=pe.binarySearch(o,e,ht.ENTRIES),c=o[l+ht.PREV_MIX],d=o[l+ht.PREV_SOFTNESS],u=o[l],f=this.getCurvePercent(l/ht.ENTRIES-1,1-(e-u)/(o[l+ht.PREV_TIME]-u));n==j.setup?(h.mix=h.data.mix+(c+(o[l+ht.MIX]-c)*f-h.data.mix)*r,h.softness=h.data.softness+(d+(o[l+ht.SOFTNESS]-d)*f-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[l+ht.PREV_BEND_DIRECTION],h.compress=o[l+ht.PREV_COMPRESS]!=0,h.stretch=o[l+ht.PREV_STRETCH]!=0)):(h.mix+=(c+(o[l+ht.MIX]-c)*f-h.mix)*r,h.softness+=(d+(o[l+ht.SOFTNESS]-d)*f-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[l+ht.PREV_BEND_DIRECTION],h.compress=o[l+ht.PREV_COMPRESS]!=0,h.stretch=o[l+ht.PREV_STRETCH]!=0))}};let ke=ht;ke.ENTRIES=6,ke.PREV_TIME=-6,ke.PREV_MIX=-5,ke.PREV_SOFTNESS=-4,ke.PREV_BEND_DIRECTION=-3,ke.PREV_COMPRESS=-2,ke.PREV_STRETCH=-1,ke.MIX=1,ke.SOFTNESS=2,ke.BEND_DIRECTION=3,ke.COMPRESS=4,ke.STRETCH=5;const It=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*It.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(s,t,e,i,r,n){s*=It.ENTRIES,this.frames[s]=t,this.frames[s+It.ROTATE]=e,this.frames[s+It.TRANSLATE]=i,this.frames[s+It.SCALE]=r,this.frames[s+It.SHEAR]=n}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.transformConstraints[this.transformConstraintIndex];if(!h.active)return;if(e<o[0]){const f=h.data;switch(n){case j.setup:h.rotateMix=f.rotateMix,h.translateMix=f.translateMix,h.scaleMix=f.scaleMix,h.shearMix=f.shearMix;return;case j.first:h.rotateMix+=(f.rotateMix-h.rotateMix)*r,h.translateMix+=(f.translateMix-h.translateMix)*r,h.scaleMix+=(f.scaleMix-h.scaleMix)*r,h.shearMix+=(f.shearMix-h.shearMix)*r}return}let l=0,c=0,d=0,u=0;if(e>=o[o.length-It.ENTRIES]){const f=o.length;l=o[f+It.PREV_ROTATE],c=o[f+It.PREV_TRANSLATE],d=o[f+It.PREV_SCALE],u=o[f+It.PREV_SHEAR]}else{const f=pe.binarySearch(o,e,It.ENTRIES);l=o[f+It.PREV_ROTATE],c=o[f+It.PREV_TRANSLATE],d=o[f+It.PREV_SCALE],u=o[f+It.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/It.ENTRIES-1,1-(e-p)/(o[f+It.PREV_TIME]-p));l+=(o[f+It.ROTATE]-l)*m,c+=(o[f+It.TRANSLATE]-c)*m,d+=(o[f+It.SCALE]-d)*m,u+=(o[f+It.SHEAR]-u)*m}if(n==j.setup){const f=h.data;h.rotateMix=f.rotateMix+(l-f.rotateMix)*r,h.translateMix=f.translateMix+(c-f.translateMix)*r,h.scaleMix=f.scaleMix+(d-f.scaleMix)*r,h.shearMix=f.shearMix+(u-f.shearMix)*r}else h.rotateMix+=(l-h.rotateMix)*r,h.translateMix+=(c-h.translateMix)*r,h.scaleMix+=(d-h.scaleMix)*r,h.shearMix+=(u-h.shearMix)*r}};let vi=It;vi.ENTRIES=5,vi.PREV_TIME=-5,vi.PREV_ROTATE=-4,vi.PREV_TRANSLATE=-3,vi.PREV_SCALE=-2,vi.PREV_SHEAR=-1,vi.ROTATE=1,vi.TRANSLATE=2,vi.SCALE=3,vi.SHEAR=4;const Ye=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Ye.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(s,t,e){s*=Ye.ENTRIES,this.frames[s]=t,this.frames[s+Ye.VALUE]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.position=h.data.position;return;case j.first:h.position+=(h.data.position-h.position)*r}return}let l=0;if(e>=o[o.length-Ye.ENTRIES])l=o[o.length+Ye.PREV_VALUE];else{const c=pe.binarySearch(o,e,Ye.ENTRIES);l=o[c+Ye.PREV_VALUE];const d=o[c],u=this.getCurvePercent(c/Ye.ENTRIES-1,1-(e-d)/(o[c+Ye.PREV_TIME]-d));l+=(o[c+Ye.VALUE]-l)*u}n==j.setup?h.position=h.data.position+(l-h.data.position)*r:h.position+=(l-h.position)*r}};let mo=Ye;mo.ENTRIES=2,mo.PREV_TIME=-2,mo.PREV_VALUE=-1,mo.VALUE=1;const oe=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(s,t,e,i){s*=oe.ENTRIES,this.frames[s]=t,this.frames[s+oe.ROTATE]=e,this.frames[s+oe.TRANSLATE]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotateMix=h.data.rotateMix,h.translateMix=h.data.translateMix;return;case j.first:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*r,h.translateMix+=(h.data.translateMix-h.translateMix)*r}return}let l=0,c=0;if(e>=o[o.length-oe.ENTRIES])l=o[o.length+oe.PREV_ROTATE],c=o[o.length+oe.PREV_TRANSLATE];else{const d=pe.binarySearch(o,e,oe.ENTRIES);l=o[d+oe.PREV_ROTATE],c=o[d+oe.PREV_TRANSLATE];const u=o[d],f=this.getCurvePercent(d/oe.ENTRIES-1,1-(e-u)/(o[d+oe.PREV_TIME]-u));l+=(o[d+oe.ROTATE]-l)*f,c+=(o[d+oe.TRANSLATE]-c)*f}n==j.setup?(h.rotateMix=h.data.rotateMix+(l-h.data.rotateMix)*r,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*r):(h.rotateMix+=(l-h.rotateMix)*r,h.translateMix+=(c-h.translateMix)*r)}};let Pr=oe;Pr.ENTRIES=3,Pr.PREV_TIME=-3,Pr.PREV_ROTATE=-2,Pr.PREV_TRANSLATE=-1,Pr.ROTATE=1,Pr.TRANSLATE=2;const Mt=class{constructor(s){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new r_(this),this.propertyIDs=new Zw,this.animationsChanged=!1,this.trackEntryPool=new eE(()=>new Uc),this.data=s}update(s){s*=this.timeScale;const t=this.tracks;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=s*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 o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(o/r.timeScale+s)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=s,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,s)){let o=r.mixingFrom;for(r.mixingFrom=null,o!=null&&(o.mixingTo=null);o!=null;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(s,t){const e=s.mixingFrom;if(e==null)return!0;const i=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,s.mixTime>0&&s.mixTime>=s.mixDuration?((e.totalAlpha==0||s.mixDuration==0)&&(s.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=s),s.interruptAlpha=e.interruptAlpha,this.queue.end(e)),i):(e.trackTime+=t*e.timeScale,s.mixTime+=t,!1)}apply(s){if(s==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let i=!1;for(let a=0,o=e.length;a<o;a++){const h=e[a];if(h==null||h.delay>0)continue;i=!0;const l=a==0?j.first:h.mixBlend;let c=h.alpha;h.mixingFrom!=null?c*=this.applyMixingFrom(h,s,l):h.trackTime>=h.trackEnd&&h.next==null&&(c=0);const d=h.animationLast,u=h.getAnimationTime(),f=h.animation.timelines.length,p=h.animation.timelines;if(a==0&&c==1||l==j.add)for(let m=0;m<f;m++){const _=p[m];_ instanceof po?this.applyAttachmentTimeline(_,s,u,l,!0):_.apply(s,d,u,t,c,l,Te.mixIn)}else{const m=h.timelineMode,_=h.timelinesRotation.length==0;_&&Q.setArraySize(h.timelinesRotation,f<<1,null);const y=h.timelinesRotation;for(let v=0;v<f;v++){const g=p[v],x=m[v]==Mt.SUBSEQUENT?l:j.setup;g instanceof Le?this.applyRotateTimeline(g,s,u,c,x,y,v<<1,_):g instanceof po?this.applyAttachmentTimeline(g,s,u,l,!0):g.apply(s,d,u,t,c,x,Te.mixIn)}}this.queueEvents(h,u),t.length=0,h.nextAnimationLast=u,h.nextTrackLast=h.trackTime}const r=this.unkeyedState+Mt.SETUP,n=s.slots;for(let a=0,o=s.slots.length;a<o;a++){const h=n[a];if(h.attachmentState==r){const l=h.data.attachmentName;h.setAttachment(l==null?null:s.getAttachment(h.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(s,t,e){const i=s.mixingFrom;i.mixingFrom!=null&&this.applyMixingFrom(i,t,e);let r=0;s.mixDuration==0?(r=1,e==j.first&&(e=j.setup)):(r=s.mixTime/s.mixDuration,r>1&&(r=1),e!=j.first&&(e=i.mixBlend));const n=r<i.eventThreshold?this.events:null,a=r<i.attachmentThreshold,o=r<i.drawOrderThreshold,h=i.animationLast,l=i.getAnimationTime(),c=i.animation.timelines.length,d=i.animation.timelines,u=i.alpha*s.interruptAlpha,f=u*(1-r);if(e==j.add)for(let p=0;p<c;p++)d[p].apply(t,h,l,n,f,e,Te.mixOut);else{const p=i.timelineMode,m=i.timelineHoldMix,_=i.timelinesRotation.length==0;_&&Q.setArraySize(i.timelinesRotation,c<<1,null);const y=i.timelinesRotation;i.totalAlpha=0;for(let v=0;v<c;v++){const g=d[v];let x=Te.mixOut,b,w=0;switch(p[v]){case Mt.SUBSEQUENT:if(!o&&g instanceof Nc)continue;b=e,w=f;break;case Mt.FIRST:b=j.setup,w=f;break;case Mt.HOLD_SUBSEQUENT:b=e,w=u;break;case Mt.HOLD_FIRST:b=j.setup,w=u;break;default:b=j.setup;const T=m[v];w=u*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=w,g instanceof Le?this.applyRotateTimeline(g,t,l,w,b,y,v<<1,_):g instanceof po?this.applyAttachmentTimeline(g,t,l,b,a):(o&&g instanceof Nc&&b==j.setup&&(x=Te.mixIn),g.apply(t,h,l,n,w,b,x))}}return s.mixDuration>0&&this.queueEvents(i,l),this.events.length=0,i.nextAnimationLast=l,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(s,t,e,i,r){const n=t.slots[s.slotIndex];if(!n.bone.active)return;const a=s.frames;if(e<a[0])(i==j.setup||i==j.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let o;e>=a[a.length-1]?o=a.length-1:o=pe.binarySearch(a,e)-1,this.setAttachment(t,n,s.attachmentNames[o],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Mt.SETUP)}setAttachment(s,t,e,i){t.setAttachment(e==null?null:s.getAttachment(t.data.index,e)),i&&(t.attachmentState=this.unkeyedState+Mt.CURRENT)}applyRotateTimeline(s,t,e,i,r,n,a,o){if(o&&(n[a]=0),i==1){s.apply(t,0,e,null,1,r,Te.mixIn);return}const h=s,l=h.frames,c=t.bones[h.boneIndex];if(!c.active)return;let d=0,u=0;if(e<l[0])switch(r){case j.setup:c.rotation=c.data.rotation;default:return;case j.first:d=c.rotation,u=c.data.rotation}else if(d=r==j.setup?c.data.rotation:c.rotation,e>=l[l.length-Le.ENTRIES])u=c.data.rotation+l[l.length+Le.PREV_ROTATION];else{const m=pe.binarySearch(l,e,Le.ENTRIES),_=l[m+Le.PREV_ROTATION],y=l[m],v=h.getCurvePercent((m>>1)-1,1-(e-y)/(l[m+Le.PREV_TIME]-y));u=l[m+Le.ROTATION]-_,u-=(16384-(16384.499999999996-u/360|0))*360,u=_+u*v+c.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let f=0,p=u-d;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,_=0;o?(m=0,_=p):(m=n[a],_=n[a+1]);const y=p>0;let v=m>=0;k.signum(_)!=k.signum(p)&&Math.abs(_)<=90&&(Math.abs(m)>180&&(m+=360*k.signum(m)),v=y),f=p+m-m%360,v!=y&&(f+=360*k.signum(m)),n[a]=f}n[a+1]=p,d+=f*i,c.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(s,t){const e=s.animationStart,i=s.animationEnd,r=i-e,n=s.trackLast%r,a=this.events;let o=0;const h=a.length;for(;o<h;o++){const c=a[o];if(c.time<n)break;c.time>i||this.queue.event(s,c)}let l=!1;for(s.loop?l=r==0||n>s.trackTime%r:l=t>=i&&s.animationLast<i,l&&this.queue.complete(s);o<h;o++)a[o].time<e||this.queue.event(s,a[o])}clearTracks(){const s=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=s,this.queue.drain()}clearTrack(s){if(s>=this.tracks.length)return;const t=this.tracks[s];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const i=e.mixingFrom;if(i==null)break;this.queue.end(i),e.mixingFrom=null,e.mixingTo=null,e=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(s,t,e){const i=this.expandToIndex(s);this.tracks[s]=t,i!=null&&(e&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom!=null&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(s,t,e){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(s,i,e)}setAnimationWith(s,t,e){if(t==null)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(s);r!=null&&(r.nextTrackLast==-1?(this.tracks[s]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,i=!1):this.disposeNext(r));const n=this.trackEntry(s,t,e,r);return this.setCurrent(s,n,i),this.queue.drain(),n}addAnimation(s,t,e,i){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(s,r,e,i)}addAnimationWith(s,t,e,i){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(s);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(s,t,e,r);if(r==null)this.setCurrent(s,n,!0),this.queue.drain();else if(r.next=n,i<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?i+=a*(1+(r.trackTime/a|0)):i+=Math.max(a,r.trackTime),i-=this.data.getMix(r.animation,t)):i=r.trackTime}return n.delay=i,n}setEmptyAnimation(s,t){const e=this.setAnimationWith(s,Mt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(s,t,e){e<=0&&(e-=t);const i=this.addAnimationWith(s,Mt.emptyAnimation,!1,e);return i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(s){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,s)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(s){return s<this.tracks.length?this.tracks[s]:(Q.ensureArrayCapacity(this.tracks,s+1,null),this.tracks.length=s+1,null)}trackEntry(s,t,e,i){const r=this.trackEntryPool.obtain();return r.trackIndex=s,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=i==null?0:this.data.getMix(i.animation,t),r.mixBlend=j.replace,r}disposeNext(s){let t=s.next;for(;t!=null;)this.queue.dispose(t),t=t.next;s.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let s=0,t=this.tracks.length;s<t;s++){let e=this.tracks[s];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=j.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(s){const t=s.mixingTo,e=s.animation.timelines,i=s.animation.timelines.length,r=Q.setArraySize(s.timelineMode,i);s.timelineHoldMix.length=0;const n=Q.setArraySize(s.timelineHoldMix,i),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let o=0;o<i;o++)r[o]=a.add(e[o].getPropertyId())?Mt.HOLD_FIRST:Mt.HOLD_SUBSEQUENT;return}t:for(let o=0;o<i;o++){const h=e[o],l=h.getPropertyId();if(!a.add(l))r[o]=Mt.SUBSEQUENT;else if(t==null||h instanceof po||h instanceof Nc||h instanceof aE||!t.animation.hasTimeline(l))r[o]=Mt.FIRST;else{for(let c=t.mixingTo;c!=null;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(s.mixDuration>0){r[o]=Mt.HOLD_MIX,n[o]=c;continue t}break}r[o]=Mt.HOLD_FIRST}}}getCurrent(s){return s>=this.tracks.length?null:this.tracks[s]}addListener(s){if(s==null)throw new Error("listener cannot be null.");this.listeners.push(s)}removeListener(s){const t=this.listeners.indexOf(s);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(s,t,e){Mt.deprecatedWarning1||(Mt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(s,t,e)}addAnimationByName(s,t,e,i){Mt.deprecatedWarning2||(Mt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(s,t,e,i)}hasAnimation(s){return this.data.skeletonData.findAnimation(s)!==null}hasAnimationByName(s){return Mt.deprecatedWarning3||(Mt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(s)}};let Ne=Mt;Ne.emptyAnimation=new pe("<empty>",[],0),Ne.SUBSEQUENT=0,Ne.FIRST=1,Ne.HOLD_SUBSEQUENT=2,Ne.HOLD_FIRST=3,Ne.HOLD_MIX=4,Ne.SETUP=1,Ne.CURRENT=2,Ne.deprecatedWarning1=!1,Ne.deprecatedWarning2=!1,Ne.deprecatedWarning3=!1;const Ni=class{constructor(){this.mixBlend=j.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 s=this.animationEnd-this.animationStart;return s==0?this.animationStart:this.trackTime%s+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(s){this.animationLast=s,this.nextAnimationLast=s}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ni.deprecatedWarning1||(Ni.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(s){Ni.deprecatedWarning1||(Ni.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=s}get endTime(){return Ni.deprecatedWarning2||(Ni.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(s){Ni.deprecatedWarning2||(Ni.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=s}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Uc=Ni;Uc.deprecatedWarning1=!1,Uc.deprecatedWarning2=!1;const Gc=class{constructor(s){this.objects=[],this.drainDisabled=!1,this.animState=s}start(s){this.objects.push(Ee.start),this.objects.push(s),this.animState.animationsChanged=!0}interrupt(s){this.objects.push(Ee.interrupt),this.objects.push(s)}end(s){this.objects.push(Ee.end),this.objects.push(s),this.animState.animationsChanged=!0}dispose(s){this.objects.push(Ee.dispose),this.objects.push(s)}complete(s){this.objects.push(Ee.complete),this.objects.push(s)}event(s,t){this.objects.push(Ee.event),this.objects.push(s),this.objects.push(t)}deprecateStuff(){return Gc.deprecatedWarning1||(Gc.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 s=this.objects,t=this.animState.listeners;for(let e=0;e<s.length;e+=2){const i=s[e],r=s[e+1];switch(i){case Ee.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++)t[o].start&&t[o].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case Ee.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++)t[o].interrupt&&t[o].interrupt(r);break;case Ee.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++)t[o].end&&t[o].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case Ee.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++)t[o].dispose&&t[o].dispose(r);this.animState.trackEntryPool.free(r);break;case Ee.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++)t[o].complete&&t[o].complete(r);const n=k.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 Ee.event:const a=s[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let o=0;o<t.length;o++)t[o].event&&t[o].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 r_=Gc;r_.deprecatedWarning1=!1;var Ee=(s=>(s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event",s))(Ee||{});const Hc=class{constructor(s){if(this.animationToMixTime={},this.defaultMix=0,s==null)throw new Error("skeletonData cannot be null.");this.skeletonData=s}setMix(s,t,e){const i=this.skeletonData.findAnimation(s);if(i==null)throw new Error(`Animation not found: ${s}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(i,r,e)}setMixByName(s,t,e){Hc.deprecatedWarning1||(Hc.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(s,t,e)}setMixWith(s,t,e){if(s==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const i=`${s.name}.${t.name}`;this.animationToMixTime[i]=e}getMix(s,t){const e=`${s.name}.${t.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}};let n_=Hc;n_.deprecatedWarning1=!1;class a_{constructor(t,e,i){if(this.matrix=new gt,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=i,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,i,r,n,a,o){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;const h=this.parent,l=this.matrix,c=this.skeleton.scaleX,d=-this.skeleton.scaleY;if(h==null){const _=this.skeleton,y=i+90+o;l.a=k.cosDeg(i+a)*r*c,l.c=k.cosDeg(y)*n*c,l.b=k.sinDeg(i+a)*r*d,l.d=k.sinDeg(y)*n*d,l.tx=t*c+_.x,l.ty=e*d+_.y;return}let u=h.matrix.a,f=h.matrix.c,p=h.matrix.b,m=h.matrix.d;switch(l.tx=u*t+f*e+h.matrix.tx,l.ty=p*t+m*e+h.matrix.ty,this.data.transformMode){case se.Normal:{const _=i+90+o,y=k.cosDeg(i+a)*r,v=k.cosDeg(_)*n,g=k.sinDeg(i+a)*r,x=k.sinDeg(_)*n;l.a=u*y+f*g,l.c=u*v+f*x,l.b=p*y+m*g,l.d=p*v+m*x;return}case se.OnlyTranslation:{const _=i+90+o;l.a=k.cosDeg(i+a)*r,l.c=k.cosDeg(_)*n,l.b=k.sinDeg(i+a)*r,l.d=k.sinDeg(_)*n;break}case se.NoRotationOrReflection:{let _=u*u+p*p,y=0;_>1e-4?(_=Math.abs(u*m-f*p)/_,u/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*_,m=u*_,y=Math.atan2(p,u)*k.radDeg):(u=0,p=0,y=90-Math.atan2(m,f)*k.radDeg);const v=i+a-y,g=i+o-y+90,x=k.cosDeg(v)*r,b=k.cosDeg(g)*n,w=k.sinDeg(v)*r,T=k.sinDeg(g)*n;l.a=u*x-f*w,l.c=u*b-f*T,l.b=p*x+m*w,l.d=p*b+m*T;break}case se.NoScale:case se.NoScaleOrReflection:{const _=k.cosDeg(i),y=k.sinDeg(i);let v=(u*_+f*y)/c,g=(p*_+m*y)/d,x=Math.sqrt(v*v+g*g);x>1e-5&&(x=1/x),v*=x,g*=x,x=Math.sqrt(v*v+g*g),this.data.transformMode==se.NoScale&&u*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(x=-x);const b=Math.PI/2+Math.atan2(g,v),w=Math.cos(b)*x,T=Math.sin(b)*x,E=k.cosDeg(a)*r,A=k.cosDeg(90+o)*n,P=k.sinDeg(a)*r,L=k.sinDeg(90+o)*n;l.a=v*E+w*P,l.c=v*A+w*L,l.b=g*E+T*P,l.d=g*A+T*L;break}}l.a*=c,l.c*=c,l.b*=d,l.d*=d}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)*k.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*k.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)*k.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)*k.radDeg;return}const i=t.matrix,r=1/(i.a*i.d-i.b*i.c),n=e.tx-i.tx,a=e.ty-i.ty;this.ax=n*i.d*r-a*i.c*r,this.ay=a*i.a*r-n*i.b*r;const o=r*i.d,h=r*i.a,l=r*i.c,c=r*i.b,d=o*e.a-l*e.b,u=o*e.c-l*e.d,f=h*e.b-c*e.a,p=h*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){const m=d*p-u*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(d*u+f*p,m)*k.radDeg,this.arotation=Math.atan2(f,d)*k.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,u)*k.radDeg}worldToLocal(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=1/(i*a-r*n),h=t.x-e.tx,l=t.y-e.ty;return t.x=h*a*o-l*r*o,t.y=l*i*o-h*n*o,t}localToWorld(t){const e=this.matrix,i=t.x,r=t.y;return t.x=i*e.a+r*e.c+e.tx,t.y=i*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=k.sinDeg(t),i=k.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*i,r.d*i-r.c*e)*k.radDeg}localToWorldRotation(t){const e=k.sinDeg(t),i=k.cosDeg(t),r=this.matrix;return Math.atan2(i*r.b+e*r.d,i*r.a+e*r.c)*k.radDeg}rotateWorld(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=k.cosDeg(t),h=k.sinDeg(t);e.a=o*i-h*n,e.c=o*r-h*a,e.b=h*i+o*n,e.d=h*r+o*a,this.appliedValid=!1}}class oE{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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i,r,n,a,o){t.appliedValid||t.updateAppliedTransform();const h=t.parent.matrix,l=h.a;let c=h.c;const d=h.b;let u=h.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case se.OnlyTranslation:p=e-t.worldX,m=i-t.worldY;break;case se.NoRotationOrReflection:const v=Math.abs(l*u-c*d)/(l*l+d*d),g=l/t.skeleton.scaleX,x=d/t.skeleton.scaleY;c=-x*v*t.skeleton.scaleX,u=g*v*t.skeleton.scaleY,f+=Math.atan2(x,g)*k.radDeg;default:const b=e-h.tx,w=i-h.ty,T=l*u-c*d;p=(b*u-w*c)/T-t.ax,m=(w*l-b*d)/T-t.ay}f+=Math.atan2(m,p)*k.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let _=t.ascaleX,y=t.ascaleY;if(r||n){switch(t.data.transformMode){case se.NoScale:case se.NoScaleOrReflection:p=e-t.worldX,m=i-t.worldY}const v=t.data.length*_,g=Math.sqrt(p*p+m*m);if(r&&g<v||n&&g>v&&v>1e-4){const x=(g/v-1)*o+1;_*=x,a&&(y*=x)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,_,y,t.ashearX,t.ashearY)}apply2(t,e,i,r,n,a,o,h){if(h==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,c=t.ay;let d=t.ascaleX,u=d,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let _=0,y=0,v=0;d<0?(d=-d,_=180,v=-1):(_=0,v=1),f<0&&(f=-f,v=-v),p<0?(p=-p,y=180):y=0;const g=e.ax;let x=0,b=0,w=0,T=m.a,E=m.c,A=m.b,P=m.d;const L=Math.abs(d-f)<=1e-4;L?(x=e.ay,b=T*g+E*x+m.tx,w=A*g+P*x+m.ty):(x=0,b=T*g+m.tx,w=A*g+m.ty);const M=t.parent.matrix;T=M.a,E=M.c,A=M.b,P=M.d;const S=1/(T*P-E*A);let C=b-M.tx,R=w-M.ty;const N=(C*P-R*E)*S-l,F=(R*T-C*A)*S-c,B=Math.sqrt(N*N+F*F);let W=e.data.length*p,I,D;if(B<1e-4){this.apply1(t,i,r,!1,a,!1,h),e.updateWorldTransformWith(g,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}C=i-M.tx,R=r-M.ty;let $=(C*P-R*E)*S-l,Y=(R*T-C*A)*S-c,U=$*$+Y*Y;if(o!=0){o*=d*(p+1)/2;const lt=Math.sqrt(U),vt=lt-B-W*d+o;if(vt>0){let Dt=Math.min(1,vt/(o*2))-1;Dt=(vt-o*(1-Dt*Dt))/lt,$-=Dt*$,Y-=Dt*Y,U=$*$+Y*Y}}t:if(L){W*=d;let lt=(U-B*B-W*W)/(2*B*W);lt<-1?lt=-1:lt>1&&(lt=1,a&&(u*=(Math.sqrt(U)/(B+W)-1)*h+1)),D=Math.acos(lt)*n,T=B+W*lt,E=W*Math.sin(D),I=Math.atan2(Y*T-$*E,$*T+Y*E)}else{T=d*W,E=f*W;const lt=T*T,vt=E*E,Dt=Math.atan2(Y,$);A=vt*B*B+lt*U-lt*vt;const kt=-2*vt*B,_t=vt-lt;if(P=kt*kt-4*_t*A,P>=0){let Dr=Math.sqrt(P);kt<0&&(Dr=-Dr),Dr=-(kt+Dr)/2;const T_=Dr/_t,w_=A/Dr,Br=Math.abs(T_)<Math.abs(w_)?T_:w_;if(Br*Br<=U){R=Math.sqrt(U-Br*Br)*n,I=Dt-Math.atan2(R,Br),D=Math.atan2(R/f,(Br-B)/d);break t}}let Bt=k.PI,wt=B-T,me=wt*wt,Ae=0,cs=0,Mr=B+T,us=Mr*Mr,b_=0;A=-T*B/(lt-vt),A>=-1&&A<=1&&(A=Math.acos(A),C=T*Math.cos(A)+B,R=E*Math.sin(A),P=C*C+R*R,P<me&&(Bt=A,me=P,wt=C,Ae=R),P>us&&(cs=A,us=P,Mr=C,b_=R)),U<=(me+us)/2?(I=Dt-Math.atan2(Ae*n,wt),D=Bt*n):(I=Dt-Math.atan2(b_*n,Mr),D=cs*n)}const rt=Math.atan2(x,g)*v;let dt=t.arotation;I=(I-rt)*k.radDeg+_-dt,I>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,c,dt+I*h,u,t.ascaleY,0,0),dt=e.arotation,D=((D+rt)*k.radDeg-e.ashearX)*v+y-dt,D>180?D-=360:D<-180&&(D+=360),e.updateWorldTransformWith(g,x,dt+D*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}var Rr=(s=>(s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s))(Rr||{});const Vs=class{constructor(s,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,s==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=s,this.bones=new Array;for(let e=0,i=s.bones.length;e<i;e++)this.bones.push(t.findBone(s.bones[e].name));this.target=t.findSlot(s.target.name),this.position=s.position,this.spacing=s.spacing,this.rotateMix=s.rotateMix,this.translateMix=s.translateMix}isActive(){return this.active}apply(){this.update()}update(){const s=this.target.getAttachment();if(!(s instanceof An))return;const t=this.rotateMix,e=this.translateMix,i=e>0,r=t>0;if(!i&&!r)return;const n=this.data,a=n.spacingMode,o=a==Rr.Length,h=n.rotateMode,l=h==Gs.Tangent,c=h==Gs.ChainScale,d=this.bones.length,u=l?d:d+1,f=this.bones,p=Q.setArraySize(this.spaces,u);let m=null;const _=this.spacing;if(c||o){c&&(m=Q.setArraySize(this.lengths,d));for(let w=0,T=u-1;w<T;){const E=f[w],A=E.data.length;if(A<Vs.epsilon)c&&(m[w]=0),p[++w]=0;else{const P=A*E.matrix.a,L=A*E.matrix.b,M=Math.sqrt(P*P+L*L);c&&(m[w]=M),p[++w]=(o?A+_:_)*M/A}}}else for(let w=1;w<u;w++)p[w]=_;const y=this.computeWorldPositions(s,u,l,n.positionMode==uo.Percent,a==Rr.Percent);let v=y[0],g=y[1],x=n.offsetRotation,b=!1;if(x==0)b=h==Gs.Chain;else{b=!1;const w=this.target.bone.matrix;x*=w.a*w.d-w.b*w.c>0?k.degRad:-k.degRad}for(let w=0,T=3;w<d;w++,T+=3){const E=f[w],A=E.matrix;A.tx+=(v-A.tx)*e,A.ty+=(g-A.ty)*e;const P=y[T],L=y[T+1],M=P-v,S=L-g;if(c){const C=m[w];if(C!=0){const R=(Math.sqrt(M*M+S*S)/C-1)*t+1;A.a*=R,A.b*=R}}if(v=P,g=L,r){const C=A.a,R=A.c,N=A.b,F=A.d;let B=0,W=0,I=0;if(l&&(l?B=y[T-1]:p[w+1]==0?B=y[T+2]:B=Math.atan2(S,M)),B-=Math.atan2(N,C),b){W=Math.cos(B),I=Math.sin(B);const D=E.data.length;v+=(D*(W*C-I*N)-M)*t,g+=(D*(I*C+W*N)-S)*t}else B+=x;B>k.PI?B-=k.PI2:B<-k.PI&&(B+=k.PI2),B*=t,W=Math.cos(B),I=Math.sin(B),A.a=W*C-I*N,A.c=W*R-I*F,A.b=I*C+W*N,A.d=I*R+W*F}E.appliedValid=!1}}computeWorldPositions(s,t,e,i,r){const n=this.target;let a=this.position;const o=this.spaces,h=Q.setArraySize(this.positions,t*3+2);let l=null;const c=s.closed;let d=s.worldVerticesLength,u=d/6,f=Vs.NONE;if(!s.constantSpeed){const B=s.lengths;u-=c?1:2;const W=B[u];if(i&&(a*=W),r)for(let I=0;I<t;I++)o[I]*=W;l=Q.setArraySize(this.world,8);for(let I=0,D=0,$=0;I<t;I++,D+=3){const Y=o[I];a+=Y;let U=a;if(c)U%=W,U<0&&(U+=W),$=0;else if(U<0){f!=Vs.BEFORE&&(f=Vs.BEFORE,s.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(U,l,0,h,D);continue}else if(U>W){f!=Vs.AFTER&&(f=Vs.AFTER,s.computeWorldVertices(n,d-6,4,l,0,2)),this.addAfterPosition(U-W,l,0,h,D);continue}for(;;$++){const rt=B[$];if(!(U>rt)){if($==0)U/=rt;else{const dt=B[$-1];U=(U-dt)/(rt-dt)}break}}$!=f&&(f=$,c&&$==u?(s.computeWorldVertices(n,d-4,4,l,0,2),s.computeWorldVertices(n,0,4,l,4,2)):s.computeWorldVertices(n,$*6+2,8,l,0,2)),this.addCurvePosition(U,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],h,D,e||I>0&&Y==0)}return h}c?(d+=2,l=Q.setArraySize(this.world,d),s.computeWorldVertices(n,2,d-4,l,0,2),s.computeWorldVertices(n,0,2,l,d-4,2),l[d-2]=l[0],l[d-1]=l[1]):(u--,d-=4,l=Q.setArraySize(this.world,d),s.computeWorldVertices(n,2,d,l,0,2));const p=Q.setArraySize(this.curves,u);let m=0,_=l[0],y=l[1],v=0,g=0,x=0,b=0,w=0,T=0,E=0,A=0,P=0,L=0,M=0,S=0,C=0,R=0;for(let B=0,W=2;B<u;B++,W+=6)v=l[W],g=l[W+1],x=l[W+2],b=l[W+3],w=l[W+4],T=l[W+5],E=(_-v*2+x)*.1875,A=(y-g*2+b)*.1875,P=((v-x)*3-_+w)*.09375,L=((g-b)*3-y+T)*.09375,M=E*2+P,S=A*2+L,C=(v-_)*.75+E+P*.16666667,R=(g-y)*.75+A+L*.16666667,m+=Math.sqrt(C*C+R*R),C+=M,R+=S,M+=P,S+=L,m+=Math.sqrt(C*C+R*R),C+=M,R+=S,m+=Math.sqrt(C*C+R*R),C+=M+P,R+=S+L,m+=Math.sqrt(C*C+R*R),p[B]=m,_=w,y=T;if(i&&(a*=m),r)for(let B=0;B<t;B++)o[B]*=m;const N=this.segments;let F=0;for(let B=0,W=0,I=0,D=0;B<t;B++,W+=3){const $=o[B];a+=$;let Y=a;if(c)Y%=m,Y<0&&(Y+=m),I=0;else if(Y<0){this.addBeforePosition(Y,l,0,h,W);continue}else if(Y>m){this.addAfterPosition(Y-m,l,d-4,h,W);continue}for(;;I++){const U=p[I];if(!(Y>U)){if(I==0)Y/=U;else{const rt=p[I-1];Y=(Y-rt)/(U-rt)}break}}if(I!=f){f=I;let U=I*6;for(_=l[U],y=l[U+1],v=l[U+2],g=l[U+3],x=l[U+4],b=l[U+5],w=l[U+6],T=l[U+7],E=(_-v*2+x)*.03,A=(y-g*2+b)*.03,P=((v-x)*3-_+w)*.006,L=((g-b)*3-y+T)*.006,M=E*2+P,S=A*2+L,C=(v-_)*.3+E+P*.16666667,R=(g-y)*.3+A+L*.16666667,F=Math.sqrt(C*C+R*R),N[0]=F,U=1;U<8;U++)C+=M,R+=S,M+=P,S+=L,F+=Math.sqrt(C*C+R*R),N[U]=F;C+=M,R+=S,F+=Math.sqrt(C*C+R*R),N[8]=F,C+=M+P,R+=S+L,F+=Math.sqrt(C*C+R*R),N[9]=F,D=0}for(Y*=F;;D++){const U=N[D];if(!(Y>U)){if(D==0)Y/=U;else{const rt=N[D-1];Y=D+(Y-rt)/(U-rt)}break}}this.addCurvePosition(Y*.1,_,y,v,g,x,b,w,T,h,W,e||B>0&&$==0)}return h}addBeforePosition(s,t,e,i,r){const n=t[e],a=t[e+1],o=t[e+2]-n,h=t[e+3]-a,l=Math.atan2(h,o);i[r]=n+s*Math.cos(l),i[r+1]=a+s*Math.sin(l),i[r+2]=l}addAfterPosition(s,t,e,i,r){const n=t[e+2],a=t[e+3],o=n-t[e],h=a-t[e+1],l=Math.atan2(h,o);i[r]=n+s*Math.cos(l),i[r+1]=a+s*Math.sin(l),i[r+2]=l}addCurvePosition(s,t,e,i,r,n,a,o,h,l,c,d){(s==0||isNaN(s))&&(s=1e-4);const u=s*s,f=u*s,p=1-s,m=p*p,_=m*p,y=p*s,v=y*3,g=p*v,x=v*s,b=t*_+i*g+n*x+o*f,w=e*_+r*g+a*x+h*f;l[c]=b,l[c+1]=w,d&&(l[c+2]=Math.atan2(w-(e*m+r*y*2+a*u),b-(t*m+i*y*2+n*u)))}};let Sn=Vs;Sn.NONE=-1,Sn.BEFORE=-2,Sn.AFTER=-3,Sn.epsilon=1e-5;class hE{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new iE,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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,d=o*c-h*l>0?k.degRad:-k.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,_=p.length;m<_;m++){const y=p[m];let v=!1;const g=y.matrix;if(t!=0){const x=g.a,b=g.c,w=g.b,T=g.d;let E=Math.atan2(l,o)-Math.atan2(w,x)+u;E>k.PI?E-=k.PI2:E<-k.PI&&(E+=k.PI2),E*=t;const A=Math.cos(E),P=Math.sin(E);g.a=A*x-P*w,g.c=A*b-P*T,g.b=P*x+A*w,g.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.tx+=(x.x-g.tx)*e,g.ty+=(x.y-g.ty)*e,v=!0}if(i>0){let x=Math.sqrt(g.a*g.a+g.b*g.b),b=Math.sqrt(o*o+l*l);x>1e-5&&(x=(x+(b-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.b*=x,x=Math.sqrt(g.c*g.c+g.d*g.d),b=Math.sqrt(h*h+c*c),x>1e-5&&(x=(x+(b-x+this.data.offsetScaleY)*i)/x),g.c*=x,g.d*=x,v=!0}if(r>0){const x=g.c,b=g.d,w=Math.atan2(b,x);let T=Math.atan2(c,h)-Math.atan2(l,o)-(w-Math.atan2(g.b,g.a));T>k.PI?T-=k.PI2:T<-k.PI&&(T+=k.PI2),T=w+(T+f)*r;const E=Math.sqrt(x*x+b*b);g.c=Math.cos(T)*E,g.d=Math.sin(T)*E,v=!0}v&&(y.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,d=o*c-h*l>0?k.degRad:-k.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,_=p.length;m<_;m++){const y=p[m];let v=!1;const g=y.matrix;if(t!=0){const x=g.a,b=g.c,w=g.b,T=g.d;let E=Math.atan2(l,o)+u;E>k.PI?E-=k.PI2:E<-k.PI&&(E+=k.PI2),E*=t;const A=Math.cos(E),P=Math.sin(E);g.a=A*x-P*w,g.c=A*b-P*T,g.b=P*x+A*w,g.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.tx+=x.x*e,g.ty+=x.y*e,v=!0}if(i>0){let x=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.b*=x,x=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleY)*i+1,g.c*=x,g.d*=x,v=!0}if(r>0){let x=Math.atan2(c,h)-Math.atan2(l,o);x>k.PI?x-=k.PI2:x<-k.PI&&(x+=k.PI2);const b=g.c,w=g.d;x=Math.atan2(w,b)+(x-k.PI/2+f)*r;const T=Math.sqrt(b*b+w*w);g.c=Math.cos(x)*T,g.d=Math.sin(x)*T,v=!0}v&&(y.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const l=a[o];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;if(t!=0){let _=n.arotation-c+this.data.offsetRotation;_-=(16384-(16384.499999999996-_/360|0))*360,c+=_*t}let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax-d+this.data.offsetX)*e,u+=(n.ay-u+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;i>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*i)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*i)/p));const m=l.ashearY;if(r>0){let _=n.ashearY-m+this.data.offsetShearY;_-=(16384-(16384.499999999996-_/360|0))*360,l.shearY+=_*r}l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const l=a[o];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;t!=0&&(c+=(n.arotation+this.data.offsetRotation)*t);let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax+this.data.offsetX)*e,u+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;i>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*i+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*i+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}}const Cn=class{constructor(s){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,s==null)throw new Error("data cannot be null.");this.data=s,this.bones=new Array;for(let t=0;t<s.bones.length;t++){const e=s.bones[t];let i;if(e.parent==null)i=new a_(e,this,null);else{const r=this.bones[e.parent.index];i=new a_(e,this,r),r.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<s.slots.length;t++){const e=s.slots[t],i=this.bones[e.boneData.index],r=new s_(e,i);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<s.ikConstraints.length;t++){const e=s.ikConstraints[t];this.ikConstraints.push(new oE(e,this))}this.transformConstraints=new Array;for(let t=0;t<s.transformConstraints.length;t++){const e=s.transformConstraints[t];this.transformConstraints.push(new hE(e,this))}this.pathConstraints=new Array;for(let t=0;t<s.pathConstraints.length;t++){const e=s.pathConstraints[t];this.pathConstraints.push(new Sn(e,this))}this.color=new we(1,1,1,1),this.updateCache()}updateCache(){const s=this._updateCache;s.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,c=t.length;l<c;l++){const d=t[l];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin!=null){const l=this.skin.bones;for(let c=0,d=this.skin.bones.length;c<d;c++){let u=this.bones[l[c].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u!=null)}}const e=this.ikConstraints,i=this.transformConstraints,r=this.pathConstraints,n=e.length,a=i.length,o=r.length,h=n+a+o;t:for(let l=0;l<h;l++){for(let c=0;c<n;c++){const d=e[c];if(d.data.order==l){this.sortIkConstraint(d);continue t}}for(let c=0;c<a;c++){const d=i[c];if(d.data.order==l){this.sortTransformConstraint(d);continue t}}for(let c=0;c<o;c++){const d=r[c];if(d.data.order==l){this.sortPathConstraint(d);continue t}}}for(let l=0,c=t.length;l<c;l++)this.sortBone(t[l])}sortIkConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target;this.sortBone(t);const e=s.bones,i=e[0];if(this.sortBone(i),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(s),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(s){if(s.active=s.target.bone.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target,e=t.data.index,i=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,i),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,i);for(let o=0,h=this.data.skins.length;o<h;o++)this.sortPathConstraintAttachment(this.data.skins[o],e,i);const r=t.getAttachment();r instanceof An&&this.sortPathConstraintAttachmentWith(r,i);const n=s.bones,a=n.length;for(let o=0;o<a;o++)this.sortBone(n[o]);this._updateCache.push(s);for(let o=0;o<a;o++)this.sortReset(n[o].children);for(let o=0;o<a;o++)n[o].sorted=!0}sortTransformConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;this.sortBone(s.target);const t=s.bones,e=t.length;if(s.data.local)for(let i=0;i<e;i++){const r=t[i];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let i=0;i<e;i++)this.sortBone(t[i]);this._updateCache.push(s);for(let i=0;i<e;i++)this.sortReset(t[i].children);for(let i=0;i<e;i++)t[i].sorted=!0}sortPathConstraintAttachment(s,t,e){const i=s.attachments[t];if(i)for(const r in i)this.sortPathConstraintAttachmentWith(i[r],e)}sortPathConstraintAttachmentWith(s,t){if(!(s instanceof An))return;const e=s.bones;if(e==null)this.sortBone(t);else{const i=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const o=e[r];this.sortBone(i[o])}}}}sortBone(s){if(s.sorted)return;const t=s.parent;t!=null&&this.sortBone(t),s.sorted=!0,this._updateCache.push(s)}sortReset(s){for(let t=0,e=s.length;t<e;t++){const i=s[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(){const s=this.updateCacheReset;for(let e=0,i=s.length;e<i;e++){const r=s[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,i=t.length;e<i;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const s=this.bones;for(let r=0,n=s.length;r<n;r++)s[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],o=a.data;a.rotateMix=o.rotateMix,a.translateMix=o.translateMix,a.scaleMix=o.scaleMix,a.shearMix=o.shearMix}const i=this.pathConstraints;for(let r=0,n=i.length;r<n;r++){const a=i[r],o=a.data;a.position=o.position,a.spacing=o.spacing,a.rotateMix=o.rotateMix,a.translateMix=o.translateMix}}setSlotsToSetupPose(){const s=this.slots;Q.arrayCopy(s,0,this.drawOrder,0,s.length);for(let t=0,e=s.length;t<e;t++)s[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findBoneIndex(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}findSlot(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findSlotIndex(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}setSkinByName(s){const t=this.data.findSkin(s);if(t==null)throw new Error(`Skin not found: ${s}`);this.setSkin(t)}setSkin(s){if(s!=this.skin){if(s!=null)if(this.skin!=null)s.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=s.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=s,this.updateCache()}}getAttachmentByName(s,t){return this.getAttachment(this.data.findSlotIndex(s),t)}getAttachment(s,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(s,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(s,t):null}setAttachment(s,t){if(s==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let i=0,r=e.length;i<r;i++){const n=e[i];if(n.data.name==s){let a=null;if(t!=null&&(a=this.getAttachment(i,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${s}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${s}`)}findIkConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findTransformConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findPathConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}getBounds(s,t,e=new Array(2)){if(s==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const i=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let h=0,l=i.length;h<l;h++){const c=i[h];if(!c.bone.active)continue;let d=0,u=null;const f=c.getAttachment();if(f instanceof et)d=8,u=Q.setArraySize(e,d,0),f.computeWorldVertices(c.bone,u,0,2);else if(f instanceof fo){const p=f;d=p.worldVerticesLength,u=Q.setArraySize(e,d,0),p.computeWorldVertices(c,0,d,u,0,2)}if(u!=null)for(let p=0,m=u.length;p<m;p+=2){const _=u[p],y=u[p+1];r=Math.min(r,_),n=Math.min(n,y),a=Math.max(a,_),o=Math.max(o,y)}}s.set(r,n),t.set(a-r,o-n)}update(s){this.time+=s}get flipX(){return this.scaleX==-1}set flipX(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=s?1:-1}get flipY(){return this.scaleY==-1}set flipY(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=s?1:-1}};let o_=Cn;o_.deprecatedWarning1=!1,se.Normal,se.OnlyTranslation,se.NoRotationOrReflection,se.NoScale,se.NoScaleOrReflection,uo.Fixed,uo.Percent,Rr.Length,Rr.Fixed,Rr.Percent,Gs.Tangent,Gs.Chain,Gs.ChainScale,K.NORMAL,K.ADD,K.MULTIPLY,K.SCREEN;class lE extends Lc{createSkeleton(t){this.skeleton=new o_(t),this.skeleton.updateWorldTransform(),this.stateData=new n_(t),this.state=new Ne(this.stateData)}}class cE extends lE{constructor(t,e){const{followPointList:i,visible:r=!1}=e||{};let n;typeof t=="string"?n=qi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,i!=null&&i.length&&(i==null||i.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),ft.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(i=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{i()}}})}addAnimation(t="animation",e=!1,i=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,i).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){ft.system.remove(this._loopFn),this.destroy()}_loop(){this.update(ft.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:i}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:i,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,i+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{ct.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Ws=(s,t,e,i=!1)=>{s.cursor="pointer",s.eventMode="static";const r=n=>{n.button!==2&&e(n)};i?s.once(t,r):s.on(t,r)};class uE extends bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:i,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=i,this._tintColor=r,this._disabledColor=a,this._btn=new _e(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Ws(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Ws(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 dE extends Tn{constructor(t){const{sprite:e,onClick:i}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Ws(this,"pointerenter",()=>{ct.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Ws(this,"pointerleave",()=>{e.alpha=1,ct.to(e,{duration:.25,rotation:0})}),Ws(this,"pointerdown",()=>{e.alpha=.5}),Ws(this,"pointerup",()=>{i()})}}class fE extends bt{constructor(t){super(),this._maskUI=new lc({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,ct.to(this._maskUI,{duration:.25,alpha:.5}),ct.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){ct.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await ct.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class pE 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 i=new Fc({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=i,i.x=0,i.y=i.height*e,this.addChild(i),i.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++},ft.shared.add(()=>{const t=ft.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},zi.UTILITY)}_setTxtInfo(t,e){const i=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=[()=>(i(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class mE extends bt{constructor(t){super();const{bgWidth:e,bgHeight:i,barWidth:r,barHeight:n,bgTexture:a,barTexture:o}=t,h=new _e(a);this.addChild(h),this._progressBar=new _e(o),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(i-n)/2;const l=new li;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 _E extends Tn{constructor(t){const{width:e,height:i,scrollContent:r,bottomMargin:n=50}=t;if(super(e,i),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 _e;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new li,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,i),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(){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,ct.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const i=t.data.getLocalPosition(this).y-this._startY;this._content.y=i}}_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)),ct.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){ct.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)ct.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);ct.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else ct.to(this._content,{duration:.25,y:0})}}class gE extends Tn{constructor(t){const{width:e,height:i,content:r,slideCallback:n,scrollCallback:a,pageNum:o,pageHeight:h}=t;super(e,i),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 li;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=i,this._slideHeight=h,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=o-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 i;t<0?(ct.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?(ct.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,ct.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)}})),(i=this._slideCallback)==null||i.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,ct.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var i;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(i=this._scrollCallback)==null||i.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,i=this._startY-t.pageY,r=Math.abs(i)/e,n=.275,a=this._slideHeight/2,o=Math.round(i/this._slideHeight);(Math.abs(i)>a||r>n)&&(this._currentIndex+=o),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const h_=s=>{const t=new li;return t.beginFill(16777215),t.drawRect(0,0,s.width,s.height),t.endFill(),s.addChild(t),s.mask=t,t};class yE extends Tn{constructor(t,e,i,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,h_(this),this._slideWidth=t,this._slideArea=i,this.slideCallback=r,this._pageNum=Math.floor(i.width/this._slideWidth)-1,this.addChild(i),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?(ct.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(ct.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,ct.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,ct.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,i=this._startX-t.pageX,r=Math.abs(i)/e,n=this._slideWidth/2,a=.275;(Math.abs(i)>n||r>a)&&(i>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class xE{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 vE{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:i,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=i,this._baseNumSteper=new xE(i,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 l_=(s,t,e)=>{const i=t/s.width*s.scale.x,r=e?e/s.height*s.scale.y:i,n=Math.min(i,r);s.scale.set(n>1?1:n)};class bE extends bt{constructor(t){super();const{data:e,cellWidth:i=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:o=3,lineColor:h="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=i,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=o,this._lineColor=h,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,i=new li;i.lineStyle(this._lineWidth,this._lineColor),i.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)i.moveTo(0,r*this._cellHeight),i.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)i.moveTo(r*this._cellWidth,0),i.lineTo(r*this._cellWidth,e);this.addChild(i)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const i=this._data[t][e];this._createNumberText(i,e,t)}}_createNumberText(t,e,i){const r=new Va(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=i*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),l_(r,this._cellWidth*.9)}}let c_;function TE(s){return c_=s,s}function Pn(){return c_}let wE=0;const Vc=class extends Je{constructor(s){super(),this.id=wE++,this.init(s)}set(s,t){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const t=this._source=s.source.cloneNode(!1);t.src=s.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=s.volume*(s.muted?0:1),i=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*i,this._source.playbackRate=this._speed*s.speed*t.speed}refreshPaused(){const s=this._media.context,t=this._media.parent,e=this._paused||t.paused||s.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(s){const{start:t,end:e,speed:i,loop:r,volume:n,muted:a}=s;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!r,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Vc.PADDING),this._end=Math.min(this._end+Vc.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),ft.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){ft.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){ft.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let u_=Vc;u_.PADDING=.1;class EE extends Je{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new u_(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h)},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;const r=()=>{o(),i.isLoaded=!0;const h=i.autoPlayStart();t&&t(null,i,h)},n=()=>{o(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{o();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},o=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class AE{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const _o=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],SE=["audio/mpeg","audio/ogg"],go={};function CE(s){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...s||{}},e=document.createElement("audio"),i={},r=/^no$/;_o.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),o=t[n]?e.canPlayType(t[n]).replace(r,""):"";i[n]=!!a||!!o}),Object.assign(go,i)}CE();class Wc{static setParamValue(t,e){if(t.setValueAtTime){const i=Pn().context;t.setValueAtTime(e,i.audioContext.currentTime)}else t.value=e;return e}}let PE=0;class RE extends Je{constructor(t){super(),this.id=PE++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(i=>i).forEach(i=>i.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const i=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);Wc.setParamValue(this._gain.gain,n*r*i),Wc.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(i=>{e.connect(i.destination),e=i}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i))}play(t){const{start:e,end:i,speed:r,loop:n,volume:a,muted:o,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=r,this._volume=a,this._loop=!!n,this._muted=o,this._filters=h,this.refresh();const d=this._source.buffer.duration;this._duration=d,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){ft.shared.remove(this._updateListener,this),t&&ft.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),i=e-this._lastUpdate;if(i>0||t){const r=this._source.playbackRate.value;this._elapsed+=i*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const o=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%o)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class d_{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const f_=class extends d_{constructor(s){const t=s.audioContext,e=t.createBufferSource(),i=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(i),i.connect(s.destination),super(r,i),this.context=s,this.bufferSource=e,this.gain=i,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(f_.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const s=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=s.buffer,Wc.setParamValue(t.playbackRate,s.playbackRate.value),t.loop=s.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let p_=f_;p_.BUFFER_SIZE=0;class IE{init(t){this.parent=t,this._nodes=new p_(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new RE(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,i=await H.ADAPTER.fetch(e);this._decode(await i.arrayBuffer(),t)}_decode(t,e){const i=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i)}}const Ir=class{static from(s){let t={};typeof s=="string"?t.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?t.source=s:Array.isArray(s)?t.url=s:t=s,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=Pn().useLegacy?new EE:new IE;return new Ir(e,t)}constructor(s,t){this.media=s,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(s){const[t]=s.map(e=>({url:e,ext:Ft.extname(e).slice(1)})).filter(({ext:e})=>go[e]).sort((e,i)=>_o.indexOf(e.ext)-_o.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Pn().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,t){if(typeof s=="object"){const i={};for(const r in s)i[r]=this.addSprites(r,s[r]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const e=new AE(this,t);return this._sprites[s]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const t=this._sprites[s];t!==void 0&&(t.destroy(),delete this._sprites[s])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,t){let e;if(typeof s=="string"?e={sprite:s,loop:this.loop,complete:t}:typeof s=="function"?(e={},e.complete=s):e=s,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,o,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,o,h),r(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(e),i}refresh(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refresh()}refreshPaused(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const t=this._instances.indexOf(s);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(Ir._pool.length>0){const s=Ir._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),Ir._pool.indexOf(s)<0&&Ir._pool.push(s)}};let yo=Ir;yo._pool=[];class ME extends Je{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Rn extends d_{constructor(){const t=window,e=new Rn.AudioContext,i=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(i),i.connect(e.destination),super(r,i),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Rn.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=r,this.events=new Je,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const i=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},i);r&&r.catch(i)}}class DE{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Rn),this._htmlAudioContext=new ME,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Rn.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const o=this._getOptions(t[a],e);n[a]=this.add(a,o)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof yo)return this._sounds[t]=e,e;const i=this._getOptions(e),r=yo.from(i);return this._sounds[t]=r,r}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){const i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const m_=s=>{var e;const t=s.src;return((e=s==null?void 0:s.alias)==null?void 0:e[0])??Ft.basename(t,Ft.extname(t))},BE={extension:G.Asset,detection:{test:async()=>!0,add:async s=>[...s,..._o.filter(t=>go[t])],remove:async s=>s.filter(t=>s.includes(t))},loader:{extension:{type:[G.LoadParser],priority:Re.High},test(s){const t=Ft.extname(s).slice(1);return!!go[t]||SE.some(e=>s.startsWith(`data:${e}`))},async load(s,t){const e=await new Promise((i,r)=>yo.from({...t.data,url:s,preload:!0,loaded(n,a){var o,h;n?r(n):i(a),(h=(o=t.data)==null?void 0:o.loaded)==null||h.call(o,n,a)}}));return Pn().add(m_(t),e),e},async unload(s,t){Pn().remove(m_(t))}}};z.add(BE),TE(new DE);class OE{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,i;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(i=this._musicPlayer)==null||i.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},this._musicPlayer=new Audio,document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(i=>{const r=new Date().getTime(),n=qi.get(t).url,a=new Audio(n);a.muted=this._isBackground||!this.effectEnabled,a.addEventListener("ended",()=>{this._playingList=this._playingList.filter(o=>o.id!==r),i()}),a.play().then(()=>{if(e){const h=a.duration-e;a.currentTime=Math.max(h,0)}this._playingList.push({id:r,audio:a,url:n})}).catch(()=>{})})}async playMusic(t){var r;this._musicPlayer&&(ct.killTweensOf(this._musicPlayer),await ct.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),(r=this._musicPlayer)==null||r.pause());const e=qi.get(t).url;this._musicPlayer.src=e,this._musicPlayer.loop=!0,this._musicPlayer.volume=0;const i=()=>{this._musicPlayer.play().then(()=>{this._isMusicPaused=!1,ct.killTweensOf(this._musicPlayer),ct.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}).catch(()=>{requestAnimationFrame(i.bind(this))})};i()}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t;this._isMusicPaused=!1,(t=this._musicPlayer)==null||t.play()}stopEffect(t){const e=qi.get(t).url;this._playingList.forEach(i=>{i.url===e&&i.audio.pause()}),this._playingList=this._playingList.filter(i=>i.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){this._musicPlayer.muted=t||!this.musicEnabled}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.muted=t||!this.effectEnabled})}}const FE=s=>{const{texture:t,dotWidth:e,width:i,height:r}=s;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new zb(t,n[0],n[1],n[2],n[3]);return a.width=i,a.height=r,a},LE=(s,t,e)=>{let i=!1;return s.cursor="pointer",s.eventMode="static",s.on(t,r=>{i||r.button!==2&&e(r)}),()=>{i=!0}},kE=(s,t,e=0)=>parseFloat((Math.random()*(t-s)+s).toFixed(e)),NE=(s,t)=>{let e=0;const i=new ft,r=n=>{e+=n*i.deltaMS;let a=0;Array.isArray(t)?a=kE(t[0],t[1],2):a=t,e>=a&&(s(),e=0)};return i.add(r),i.start(),()=>{i.remove(r),i.stop()}},UE=(s,t,e)=>{const i=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=s.getBounds().contains(r.clientX,r.clientY);!n&&!a&&s.visible&&(e(),window.removeEventListener("pointerdown",i))};return window.addEventListener("pointerdown",i),()=>{window.removeEventListener("pointerdown",i)}},GE=(s=1,t)=>new Promise(e=>{let i=0;const r=new ft,n=()=>{i+=r.deltaMS,i>=s&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),HE=(s,t)=>{let e;if(s==="brightness")e=new ar,e.brightness(t,!1);else if(s==="blur")e=new Hf;else if(s==="desaturate")e=new ar,e.desaturate();else if(s==="contrast")e=new ar,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var VE=`attribute vec2 aVertexPosition;
1170
1170
  attribute vec2 aTextureCoord;
1171
1171
 
1172
1172
  uniform mat3 projectionMatrix;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {